📄 jpeglib.h
字号:
/*
***********************************************************************
*
* 版权信息:Copyright (c) 2005, 杭州海康威视数字技术有限公司
*
* 文件名称:jpeglib.h
* 文件标识:HIKVISION_JPEG_ENCODER_LIB
* 摘 要:海康威视 x86 JPEG 编码库的接口函数执行文件
*
* 当前版本:1.0
* 作 者:贾永华
* 完成日期:2005年07月04号
*
************************************************************************
*/
#ifndef _HIKVISION_JPEG_ENCODER_LIB
#define _HIKVISION_JPEG_ENCODER_LIB
#ifdef __cplusplus
extern "C" {
#endif
// Huffman coding tables.
typedef struct
{
unsigned char bits[32]; // bits[k] = # of symbols with codes of length k bits; bits[0] is unused
unsigned char huffval[256]; // The symbols, in order of incr code length
} JHUFF_TBL;
// Master record for a compression instance
typedef struct _JPEG_COMPRESS_PARAM_
{
JHUFF_TBL dc_huff_tbl_ptrs[2]; // dc huffman coding tables
JHUFF_TBL ac_huff_tbl_ptrs[2]; // ac huffman coding tables
unsigned short dc_derived_tbls[2*2*256]; // dc derived tables
unsigned short ac_derived_tbls[2*2*256]; // ac derived tables
/* This array gives the coefficient quantizers in natural array order
* (not the zigzag order in which they are stored in a JPEG DQT marker).
* CAUTION: IJG versions prior to v6a kept this array in zigzag order.
*/
unsigned short quantval [64*2];
unsigned short multipliers[64*2];
unsigned short rounds [64*2];
}JPEG_COMPRESS_PARAM, *PJPEG_COMPRESS_PARAM;
// 帧数据指针(YUV 420格式)
typedef struct _YUV_FRAME_
{
unsigned char *y;
unsigned char *u;
unsigned char *v;
}YUV_FRAME;
/* 帧编码参数 */
typedef struct _JPEG_IMAGE_PARAM_
{
YUV_FRAME * frame; // 帧数据指针(编码器中没有使用DMA,为了保证速度,应该分配在可被CACHE的内存中)
unsigned int width; // 图像宽度
unsigned int height; // 图像高度
unsigned char* bitstream; // 码流输出缓冲区首指针
unsigned int size; // 码流输出缓冲区的大小
unsigned int length; // 输出码流长度(以字节为单位)
} JPEG_IMAGE_PARAM;
/*++
功能:设置压缩后的图像质量
参数:param - 编码器参数指针
quality - 图像质量(范围:差 0 - 100 好),推荐默认值为75或80
注意:当编码开始前和图像质量参数变化时,需要设置图像质量
注:JPEG_COMPRESS_PARAM 中的参数,在JPEG_SetQuality中被初始化
--*/
void JPEG_SetQuality (JPEG_COMPRESS_PARAM *param, int quality);
/*++
功能:编码一帧图像
参数:param - 编码器参数指针
image - 当前帧参数指针
返回值:如果成功返回非零, 否则返回0
--*/
int JPEG_Compress (JPEG_COMPRESS_PARAM *param, JPEG_IMAGE_PARAM *image);
void fdct_xmm_skal(short block[64]);
#ifdef __cplusplus
}
#endif
#endif //_HIKVISION_JPEG_ENCODER_LIB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -