⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bindct_revisions.doc

📁 JPEG Image compression using IJG standards followed
💻 DOC
字号:
1: cjpeg.c	parse_switches, added options for bindct.2: jpeglib.h	Add bindct enum options in J_DCT_METHOD.3: jmorecfg.h	Define DCT_BIN_A1_SUPPORTED	etc.4: jcdctmgr.c:	jinit_forward_dct:	added options for bindct.5: Added new files:	jfdct_bin_a1.c	jfdct_bin_b1.c : not completed. Check minus sign!	jfdct_bin_c1.c : not completed. Check minus sign !	jfdct_bin_l1.c6. jdct.h	Declare functions jfdct_bin_a1,	jfdct_bin_b1, jfdct_bin_c1,	jfdct_bin_l1.	and jpeg_idct_bin_a1 etc.	Note in jdct.h:	 * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE).	 * The DCT outputs are returned scaled up by a factor of 8; they therefore	 * have a range of +-8K for 8-bit data, +-128K for 12-bit data.  This	 * convention improves accuracy in integer implementations and saves some	 * work in floating-point ones.	 * Quantization of the output coefficients is done by jcdctmgr.c.	 */Is this scaling by 8 related to the scaling of Q table by 8 in jcdctmgr.c (for JDCT_ISLOW)?Then the scaling in DCT coef and Q tabel cancel out with each other.In jddctmgr.c, the dequantization table is the original one, without scling by 8. This justifies the above conclusion.7.  Files involved in forward transform:	1. cjpeg.c calls jpeg_write_scanlines(), which is defined in jcapistd.c;		2. In jcapistd.c, jpeg_wtite_scanlines() call	(*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);	which points to the process_data_simple_main() in jcmainct.c;	3. The jcmainct.c is the main buffer controller for compression.	In  process_data_simple_main(), it call	   (*cinfo->prep->pre_process_data), defined in jcprepct.c,		which handles color conversion, downsamplign etc.	It then check whether 8 rows have been copied to the buffer, 	if no, it returns to the cjpeg.c to call write_scanlines again.	If yes,  it calls 	(*cinfo->coef->compress_data) (cinfo, main->buffer),	this points to the function compress_data() in jccoefct.c.	4. In the compress_data() of  jccoefct.c, 	 (*cinfo->fdct->forward_DCT)	is called, which is defined in jcdctmgr.c.	5. In jcdctmgr.c, the function forward_DCT() does the followings:		- subtract each pixel by 128.		- call do (*do_dct) (workspace), which points to the actual 			forward DCT code.		- Quantize the DCT coefficients./************************************************ * * 		Decoder * ************************************************ */jddctmgr.c :/* The current scaled-IDCT routines require ISLOW-style multiplier tables, * so be sure to compile that code if either ISLOW or SCALING is requested. */#ifdef DCT_ISLOW_SUPPORTED#define PROVIDE_ISLOW_TABLES#else#ifdef IDCT_SCALING_SUPPORTED#define PROVIDE_ISLOW_TABLES#endif#endifWhat does this mean?for JDCT_ISLOW:Define the q table as type ISLOW_MULT_TYPE:	ISLOW_MULT_TYPE * ismtbl = (ISLOW_MULT_TYPE *) compptr->dct_table;The reason is discussed in jidctint.c.Check this, do we need new type for binDCT?1. djpeg.c call  (void) jpeg_start_decompress(&cinfo);			start_input_pass in jdinput.c calls latech_quant_tables.			latch_quant_tables in jdinput.c is called to get Q table.			but where to scale it according to the Quality factor?			and	jpeg_read_scanlines,			both are defined in jdapistd.c.2. In jdapistd.c, the jpeg_read_scanlines calls		 (*cinfo->main->process_data),	which points to the process_data_simple_main in jdmainct.c,3: The jdmainct.c is the main buffer controller for decompression.	In the process_data_simple_main, it calls		(*cinfo->coef->decompress_data),	which points to 		decompress_onepass,	which is defined in jdcoefct.c.4. In jdcoefct.c, the (*cinfo->entropy->decode_mcu) is called,	which		***************************************************************07/08/00:Modification for lossless binDCT:***************************************************************Key problem:	To obtain the lossless binDCT, the scaling factor should be	avoided. Thus the resulted binDCT coefficients are scaled by	up to 8 times from the true DCT coefficients.	As  a result, the original Huffman table is no longer valid for	the binDCT coefficients, as the original DCT coefficents range	from  -1024 ~ 1023. But the binDCT coef are: -8196 - 8195.		The old Huffman table only support data category 00 to 0A.Solution:	Provide a new Huffman table, which support CAtegory 0B to 0F.Files modified:	jcparam.c:		Define the new 2D statistical models.	jchuff.c:		Modify the range of the DCT coef. (error message)				jcparam.c only specifies the number of codewords with different length.		jchuff.c will generate the code themselves according to the method		defined in JPEG book.	cjpeg.c:		Old program call setup default configuration before parse the switches.		Now we need to know hether -lossless option is presented before setup 		the Huffman table.				So a new small function check_bindct_lossless_switch() is provided 		to check for any "-dct bin_xx" and "-lossless" options.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -