资源简介
用C++实现的压缩、解压缩算法,只有几个cpp、h文件,非常小巧,方便学习算法用。
代码片段和文件信息
// jpgd.cpp - C++ class for JPEG decompression.
// Public domain Rich Geldreich
// Last updated Apr. 16 2011
// Alex Evans: Linear memory allocator (taken from jpge.h).
//
// Supports progressive and baseline sequential JPEG image files and the most common chroma subsampling factors: Y H1V1 H2V1 H1V2 and H2V2.
//
// Chroma upsampling quality: H2V2 is upsampled in the frequency domain H2V1 and H1V2 are upsampled using point sampling.
// Chroma upsampling reference: “Fast Scheme for Image Size Change in the Compressed Domain“
// http://vision.ai.uiuc.edu/~dugad/research/dct/index.html
#include “jpgd.h“
#include
#include
#define JPGD_ASSERT(x) assert(x)
#ifdef _MSC_VER
#pragma warning (disable : 4611) // warning C4611: interaction between ‘_setjmp‘ and C++ object destruction is non-portable
#endif
// Set to 1 to enable freq. domain chroma upsampling on images using H2V2 subsampling (0=faster nearest neighbor sampling).
// This is slower but results in higher quality on images with highly saturated colors.
#define JPGD_SUPPORT_FREQ_DOMAIN_UPSAMPLING 1
#define JPGD_TRUE (1)
#define JPGD_FALSE (0)
#define JPGD_MAX(ab) (((a)>(b)) ? (a) : (b))
#define JPGD_MIN(ab) (((a)<(b)) ? (a) : (b))
namespace jpgd {
static inline void *jpgd_malloc(size_t nSize) { return malloc(nSize); }
static inline void jpgd_free(void *p) { free(p); }
// DCT coefficients are stored in this sequence.
static int g_ZAG[64] = { 0181692310172432251811451219263340484134272013671421283542495657504336292215233037445158595245383139465360615447556263 };
enum JPEG_MARKER
{
M_SOF0 = 0xC0 M_SOF1 = 0xC1 M_SOF2 = 0xC2 M_SOF3 = 0xC3 M_SOF5 = 0xC5 M_SOF6 = 0xC6 M_SOF7 = 0xC7 M_JPG = 0xC8
M_SOF9 = 0xC9 M_SOF10 = 0xCA M_SOF11 = 0xCB M_SOF13 = 0xCD M_SOF14 = 0xCE M_SOF15 = 0xCF M_DHT = 0xC4 M_DAC = 0xCC
M_RST0 = 0xD0 M_RST1 = 0xD1 M_RST2 = 0xD2 M_RST3 = 0xD3 M_RST4 = 0xD4 M_RST5 = 0xD5 M_RST6 = 0xD6 M_RST7 = 0xD7
M_SOI = 0xD8 M_EOI = 0xD9 M_SOS = 0xDA M_DQT = 0xDB M_DNL = 0xDC M_DRI = 0xDD M_DHP = 0xDE M_EXP = 0xDF
M_APP0 = 0xE0 M_APP15 = 0xEF M_JPG0 = 0xF0 M_JPG13 = 0xFD M_COM = 0xFE M_TEM = 0x01 M_ERROR = 0x100 RST0 = 0xD0
};
enum JPEG_SUBSAMPLING { JPGD_GRAYSCALE = 0 JPGD_YH1V1 JPGD_YH2V1 JPGD_YH1V2 JPGD_YH2V2 };
#define CONST_BITS 13
#define PASS1_BITS 2
#define SCALEDONE ((int32)1)
#define FIX_0_298631336 ((int32)2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((int32)3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((int32)4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((int32)6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((int32)7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((int32)9633) /* FIX(1.175875602) */
#define FIX_1_501321
- 上一篇:MFC 聊天功能源代码
- 下一篇:交叉25码ITF25编码程序代码
相关资源
- VC++解析并显示JPEG图片showjpeg.rar
- c语言jpeg压缩库
- C++从入门到精通第三版 清华大学出版
- JPEG编解码的c语言实现
- 校园导航c++实现
- 图像序列编码为MJPEG视频文件
- C++ jpeg图像编码与解码
-
C++中使用CWebPage调用ja
vasc ript - C++ 生成JPEG图片源代码
- JPEG图片EXIF信息提取及缩略图显示VC
- JPEG源码(C语言实现)
- jpg jpeg 解码 转 bmp RGB vs2013 c++
- 看病预约系统C++
- mjpeg解码源代码
- OpenCV 中文API官方帮助文档.rar
- 图像压缩算法JPEG源代码实现(C语言)
- jpeg软编码
- C++ MFC调用Javascrip函数
- 排序算法经典大合集C++(数据全部测
- jpeg压缩C语言实现
-
ja
vasc ript实现的CRC16源码非查表法 - 获取jpg文件宽和高
- CHTMLDome2
- linux C语言实现yuyv拍照保存并转为jp
- 分数的加减乘除及化简c++
- opencv中mat与jpeg相互转换及显示代码
- VC++6.0 打开位图文件源代码 BMP图像数
- bmp2jpeg图像压缩
- 数据压缩课设 jpeg编码 C++
- libjpeg静态库
评论
共有 条评论