亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jcdctmgr.c

?? jpeg壓縮C代碼,包括庫的源代碼和一個測試程序的源代碼
?? C
字號:
/*
* jcdctmgr.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains the forward-DCT management logic.
* This code selects a particular DCT implementation to be used,
* and it performs related housekeeping chores including coefficient
* quantization.
*/

#include "jpeg.h"
extern const int jpeg_zigzag_order[DCTSIZE2];

/* Quantize/descale the coefficients, and store into coef_blocks[] */
void jpeg_quant(short * data, WORD *multipliers, WORD *rounds)
{
	short buffer[64];
	int temp;
	int i;
	
	for (i = 0; i < DCTSIZE2; i++) 
	{
		temp = data[i];

		/* Divide the coefficient value by qval, ensuring proper rounding.
		* Since C does not specify the direction of rounding for negative
		* quotients, we have to force the dividend positive for portability.
		*
		* In most files, at least half of the output values will be zero
		* (at default quantization settings, more like three-quarters...)
		* so we should ensure that this case is fast.  On many machines,
		* a comparison is enough cheaper than a divide to make a special test
		* a win.  Since both inputs will be nonnegative, we need only test
		* for a < b to discover whether a/b is 0.
		* If your machine's division is fast enough, define FAST_DIVIDE.
		*/
		#define DIVIDE_BY(a,b)  (a = (((a+rounds[i])*multipliers[i]) >> 16))

		if (temp < 0) {
			temp = -temp;
			DIVIDE_BY(temp, qval);
			temp = -temp;
		} else {
			DIVIDE_BY(temp, qval);
		}
		buffer[jpeg_zigzag_order[i]] = (short) temp;
	}
	memcpy(data, buffer, 128);
}

/*
* Perform forward DCT on one or more blocks of a component.
* This version is used for integer DCT implementations.
* The input samples are taken from the sample_data[] array starting at
* position start_row/start_col, and moving to the right for any additional
* blocks. The quantized coefficients are returned in coef_blocks[].
*/
void forward_DCT(PBYTE sample_data, short *data, 
				 WORD *multipliers, WORD *rounds, int width)			 
{
	int i;
	
	// 計算差分
	for (i = 0; i < 8; i ++) 
	{
		*data++ = sample_data[0] - CENTERJSAMPLE;
		*data++ = sample_data[1] - CENTERJSAMPLE;
		*data++ = sample_data[2] - CENTERJSAMPLE;
		*data++ = sample_data[3] - CENTERJSAMPLE;
		*data++ = sample_data[4] - CENTERJSAMPLE;
		*data++ = sample_data[5] - CENTERJSAMPLE;
		*data++ = sample_data[6] - CENTERJSAMPLE;
		*data++ = sample_data[7] - CENTERJSAMPLE;
		sample_data += width;
	}
	data -= 64;
	
	/* Perform the DCT */
	jpeg_fdct_islow_ti (data);

	jpeg_quant(data, multipliers, rounds);
}

/*
* Compression initialization.
* Before calling this, all parameters and a data destination must be set up.
*
* We require a write_all_tables parameter as a failsafe check when writing
* multiple datastreams from the same compression object.  Since prior runs
* will have left all the tables marked sent_table=TRUE, a subsequent run
* would emit an abbreviated stream (no tables) by default.  This may be what
* is wanted, but for safety's sake it should not be the default behavior:
* programmers should have to make a deliberate choice to emit abbreviated
* images.  Therefore the documentation and examples should encourage people
* to pass write_all_tables=TRUE; then it will take active thought to do the
* wrong thing.
*/
int jpeg_start_compress (j_compress_ptr cinfo, Bitstream *bs, int width, int height)
{
	bs->ptr = bs->buffer;
	
	/* Initialize bit buffer to empty */
	bs->byte_buf = 0;
	bs->cnt = 0;
	
	/* Write the datastream header (SOI) immediately.
	* Frame and scan headers are postponed till later.
	* This lets application insert special markers after the SOI.
	*/
	return write_file_header(cinfo, bs, width, height);
}


/*
* Finish JPEG compression.
*
* If a multipass operating mode was selected, this may do a great deal of
* work including most of the actual output.
*/
int jpeg_finish_compress (Bitstream *bs)
{
	/* The entropy coder always needs an end-of-pass call,
	* either to analyze statistics or to flush its output buffer.
	*/
	finish_pass_huff(bs);
	
	/* Write EOI, do final cleanup */
	// Write datastream trailer.
	write_file_trailer(bs);

	return (bs->ptr - bs->buffer);
}

/*
* Process some data in the single-pass case.
* We process the equivalent of one fully interleaved MCU row ("iMCU" row)
* per call, ie, v_samp_factor block rows for each component in the image.
* Returns TRUE if the iMCU row is completed, FALSE if suspended.
*
* NB: input_buf contains a plane for each component in image,
* which we index according to the component's SOF position.
*/
int JPEG_Compress(JPEG_COMPRESS_PARAM *cinfo, JPEG_IMAGE_PARAM *image)
{
	short data[6][64];
	int last_dc_val[3];			// last DC coef for each component
	int pix_x, pix_y;
	Bitstream bitstream;

	unsigned short *rounds, *multipliers;
	PBYTE imgY, imgU, imgV;
	int width, height;

	// check parameters
	if(cinfo == NULL) return 0;
	if(image == NULL) return 0;
	if(image->bitstream == 0) return 0;
	if(image->frame == 0) return 0;
	if((image->width % 16) || (image->height % 16)) return 0;

	// init
	rounds = cinfo->rounds;
	multipliers = cinfo->multipliers;

	width = image->width;
	height = image->height;

	imgY = image->frame->y;
	imgU = image->frame->u;
	imgV = image->frame->v;

	bitstream.buffer = image->bitstream;
	bitstream.size   = image->size;

	// Start compressor
	if(!jpeg_start_compress(cinfo, &bitstream, width, height))
	{
		return 0;
	}

	last_dc_val[0] = 0;
	last_dc_val[1] = 0;
	last_dc_val[2] = 0;

	for(pix_y = 0; pix_y < height; pix_y += 16)
	{
		for(pix_x = 0; pix_x < width; pix_x += 16)
		{
			forward_DCT(imgY          , data[0], multipliers, rounds, width);
			forward_DCT(imgY+8        , data[1], multipliers, rounds, width);
			forward_DCT(imgY+width*8  , data[2], multipliers, rounds, width);
			forward_DCT(imgY+width*8+8, data[3], multipliers, rounds, width);
			forward_DCT(imgU          , data[4], multipliers+64, rounds+64, width/2);
			forward_DCT(imgV          , data[5], multipliers+64, rounds+64, width/2);

			// Try to write the MCU.  In event of a suspension failure, we will
			// re-DCT the MCU on restart (a bit inefficient, could be fixed...)
			encode_mcu_huff(cinfo, &bitstream, data, last_dc_val); 

			if(bitstream.ptr > bitstream.buffer + bitstream.size - 512)
			{
				//DebugPrint("\nERROR! bitstream over!\n");
				return 0;
			}

			imgY += 16;
			imgU += 8;
			imgV += 8;
		}
		imgY += width*15;
		imgU += width/2*7;
		imgV += width/2*7;
	}

	image->length = jpeg_finish_compress(&bitstream);

	return image->length;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区免费观看| 91久久国产最好的精华液| 国产盗摄精品一区二区三区在线 | 91豆麻精品91久久久久久| 91精品国产全国免费观看 | 日韩三级精品电影久久久| 中文字幕一区二区三区在线观看| 午夜影院久久久| 波多野结衣一区二区三区| 日韩欧美激情一区| 一区二区三区av电影| 成人午夜视频在线| 久久综合久久综合九色| 日本中文一区二区三区| 在线观看日韩电影| 亚洲天堂久久久久久久| 国产91精品精华液一区二区三区| 欧美zozozo| 麻豆国产一区二区| 欧美精品丝袜中出| 亚洲成人免费在线| 欧美写真视频网站| 亚洲精品国产精华液| 91片在线免费观看| 国产精品女上位| 国产·精品毛片| 亚洲国产精品v| 国产一区二区三区美女| 久久久久国产一区二区三区四区| 久久av资源网| 精品免费国产二区三区| 国产一区视频在线看| 久久久久久久综合狠狠综合| 国产一区二区成人久久免费影院 | 蜜桃在线一区二区三区| 欧美一个色资源| 免费观看30秒视频久久| 日韩视频在线观看一区二区| 蜜桃视频一区二区三区| 久久理论电影网| 国产成人免费在线| 亚洲欧洲国产日韩| 欧美少妇一区二区| 日日骚欧美日韩| 欧美成人a视频| 国产成人一区在线| 亚洲精品国产精品乱码不99| 欧美日韩一级片网站| 男人的天堂亚洲一区| 欧美精品一区二区三区视频| 国产jizzjizz一区二区| 亚洲精品免费在线播放| 91精品婷婷国产综合久久性色| 免费成人在线网站| 国产日韩精品一区| 91久久久免费一区二区| 蜜臀久久99精品久久久久久9| 久久久久高清精品| 在线观看成人小视频| 蜜臀av性久久久久蜜臀aⅴ四虎| 久久蜜桃av一区二区天堂| 一本大道久久a久久综合| 欧美aaa在线| 中文字幕精品—区二区四季| 在线免费av一区| 韩国毛片一区二区三区| 亚洲精品视频免费观看| 欧美一区二区三区四区在线观看| 国产精品一卡二| 偷拍一区二区三区| 欧美激情一区二区在线| 欧美日韩成人激情| 粉嫩在线一区二区三区视频| 午夜欧美视频在线观看| 国产精品午夜春色av| 欧美一区二区三区四区高清| 91在线云播放| 紧缚奴在线一区二区三区| 亚洲免费伊人电影| 久久无码av三级| 亚洲国产精品激情在线观看| 日韩一区二区免费在线观看| 国产伦精品一区二区三区在线观看| 国产精品久久久久久久久快鸭 | 久久99久久精品| 亚洲素人一区二区| 久久日一线二线三线suv| 在线亚洲免费视频| 成人性色生活片免费看爆迷你毛片| 日韩主播视频在线| 亚洲精品你懂的| 国产精品私人自拍| 日韩欧美不卡在线观看视频| 在线观看亚洲一区| 一本久久综合亚洲鲁鲁五月天 | 国产高清精品久久久久| 日韩av在线播放中文字幕| 亚洲欧美偷拍另类a∨色屁股| 国产欧美精品一区二区色综合 | 乱一区二区av| 亚洲一区成人在线| 亚洲人成亚洲人成在线观看图片| 久久天天做天天爱综合色| 欧美成人bangbros| 日韩一级欧美一级| 欧美一级一级性生活免费录像| 欧美午夜不卡在线观看免费| 99久久精品国产精品久久| 风间由美一区二区三区在线观看| 国产在线精品免费| 国产成人午夜精品影院观看视频| 黄页网站大全一区二区| 精一区二区三区| 国产自产视频一区二区三区| 久久精品国产精品亚洲精品| 美女视频一区二区| 狠狠色伊人亚洲综合成人| 久久99蜜桃精品| 国产乱人伦精品一区二区在线观看| 麻豆成人av在线| 国产综合久久久久久久久久久久| 国产做a爰片久久毛片| 国产精品一区二区免费不卡 | 国产日产欧美一区| 亚洲国产成人自拍| 中文字幕一区二区不卡| 日韩一区中文字幕| 亚洲第一会所有码转帖| 日本色综合中文字幕| 久久国产精品第一页| 国产河南妇女毛片精品久久久| 成人精品亚洲人成在线| 在线亚洲人成电影网站色www| 欧美日本在线看| 日韩精品一区二区三区在线| 久久精品视频在线看| 亚洲欧美国产三级| 性做久久久久久免费观看欧美| 久久激情五月婷婷| 成人黄色777网| 欧美日韩精品系列| 精品国产欧美一区二区| 亚洲同性同志一二三专区| 五月婷婷综合在线| 国产黄色精品视频| 欧美视频一二三区| 国产午夜久久久久| 亚洲1区2区3区4区| 国产高清不卡一区| 欧美日韩一区在线观看| 精品国产污污免费网站入口 | 成人免费视频视频在线观看免费 | 日韩午夜av电影| 国产精品天天看| 日韩中文欧美在线| 成人av网站免费观看| 欧美美女一区二区三区| 久久亚洲私人国产精品va媚药| 亚洲免费在线播放| 国产一区二区主播在线| 欧美性极品少妇| 国产精品毛片久久久久久| 日韩电影一区二区三区| 91在线国产福利| 久久久久青草大香线综合精品| 亚洲电影一区二区三区| hitomi一区二区三区精品| 日韩视频永久免费| 亚洲一区二区欧美| 99re热视频精品| 国产午夜精品一区二区| 奇米精品一区二区三区四区| 91成人免费网站| 国产精品人成在线观看免费| 激情文学综合网| 制服视频三区第一页精品| 夜夜嗨av一区二区三区网页| 高清不卡一二三区| 久久久99精品久久| 久久国产乱子精品免费女| 91超碰这里只有精品国产| 自拍偷拍国产亚洲| 国产白丝网站精品污在线入口| 欧美一级二级三级蜜桃| 性做久久久久久免费观看欧美| 色先锋久久av资源部| 国产精品福利电影一区二区三区四区| 精品制服美女久久| 欧美刺激午夜性久久久久久久| 三级一区在线视频先锋| 欧美日韩国产另类一区| 亚洲一区二区成人在线观看| 色欧美乱欧美15图片| 亚洲欧美一区二区三区国产精品| 粉嫩av亚洲一区二区图片| 国产欧美日韩综合精品一区二区| 国产一区美女在线| 国产欧美日韩亚州综合| 成人综合婷婷国产精品久久| 国产精品视频观看|