资源简介
用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编码程序代码
相关资源
- 可解码所有jpeg格式图片的开源JPEG解码
- 软件工程课程设计--自动排课排课系统
- C语言程序设计第四版谭浩强课后习题
- spiht算法小波图像编码算法
- 基于JPEG2000的图像编码与解码c++版
- 《算法珠玑》Java版本 一个最精简的题
- jpeg图片解码灰度二值化c语言实现
- mjpeg-streamer远程监控软件
- jpeg jpg解码 C++
- JPEG压缩的c语言实现
- 《计算机常用数值算法与程序C++版》
- vc++ 图像编码 视频编码
- Bmp2jpeg图片格式转换
- Virtual Machine Design and Implementation in C
- jpeg压缩纯C语言实现
- JPEG编码之DCT与量化C++
- 物流管理系统数据库+后台ssh
- C语言在线考试系统
-
C++ ATL控件与ja
vasc ript交互 -
C++与ja
vasc ript交互 - 源代码——MFC的WebBrowser控件 C++与ja
- C语言的png和jpeg图片格式转换为bmp格式
- Visual C++实现MPEG/JPEG编解码技术代码集
- 基于SSH框架的在线考试系统165944
- Visual C++开发GIS系统第2版
- JPEG图像压缩c语言算法
- Visual C++ 实现 MPEG-JPEG 编解码技术.pd
- JPEG分析器 1.1 源代码
- 嵌入式图像处理C语言源码
- 纯C语言+libjpeg实现最简单jpeg图片解码
评论
共有 条评论