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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? text_code_mb.c

?? MPEG4編碼和解碼程序
?? C
字號:

/**************************************************************************
該文件包含了宏塊紋理編碼的函數(shù)代碼
***************************************************************************/

#include "text_code.h"
#include "text_dct.h"

#define BLOCK_SIZE 8

Void  	BlockPredict (SInt *curr, /*SInt *rec_curr,*/
	Int x_pos, Int y_pos, UInt width, Int fblock[][8]);
Void  	BlockRebuild (SInt *rec_curr, SInt *comp, Int pred_type, Int max,
	Int x_pos, Int y_pos, UInt width, UInt edge, Int fblock[][8]);
Void  	BlockQuantH263 (Int *coeff, Int QP, Int mode, Int type,
	Int *qcoeff, Int maxDC, Int image_type);
Void  	BlockDequantH263 (Int *qcoeff, Int QP, Int mode, Int type,
	Int *rcoeff, Int image_type, Int short_video_header, Int bits_per_pixel);


/***********************************************************CommentBegin******
 函數(shù)功能:
 編碼、解碼重建的視頻宏塊
 函數(shù)輸入:
 Int x_pos	宏塊的x軸方向坐標(biāo)
 Int y_pos	宏塊的y軸方向坐標(biāo)
 UInt width	Vop邊界會的寬度
 Int QP		量化參數(shù)
 Int Mode	宏塊編碼模式
 函數(shù)輸入/輸出:
 Vop *curr	當(dāng)前未編碼的視頻對象平面
 Vop *rec_curr	當(dāng)前解碼并重建的視頻對象平面
 Vop *comp      當(dāng)前已經(jīng)過運(yùn)動補(bǔ)償后的視頻對象平面
 Int *qcoeff 	系數(shù)塊(384 * sizeof(Int))
 *
 ***********************************************************CommentEnd********/

Void CodeMB(Vop *curr, Vop *rec_curr, Vop *comp, Int x_pos, Int y_pos, UInt width,
Int QP, Int Mode, Int *qcoeff)
{
	Int k;
	Int fblock[6][8][8];
	Int coeff[384];
	Int *coeff_ind;
	Int *qcoeff_ind;
	Int* rcoeff_ind;
	Int x, y;
	SInt *current, *recon, *compensated = NULL;
	UInt xwidth;
	Int iblock[6][8][8];
	Int rcoeff[6*64];
	Int i, j;
	Int type;									  /* luma = 1, chroma = 2 */
//	Int *qmat;
	SInt tmp[64];
	Int s;

	int operation = curr->prediction_type;
	/* This variable is for combined operation.
	If it is an I_VOP, then MB in curr is reconstruct into rec_curr,
	and comp is not used at all (i.e., it can be set to NULL).
	If it is a P_VOP, then MB in curr is reconstructed, and the result
	added with MB_comp is written into rec_curr. 
	- adamli 11/19/2000 */

	Int max = GetVopBrightWhite(curr);
	/* This variable is the max value for the clipping of the reconstructed image. */

	coeff_ind = coeff;
	qcoeff_ind = qcoeff;
	rcoeff_ind = rcoeff;

	for (k = 0; k < 6; k++)
	{
		switch (k)
		{
			case 0:
				x = x_pos;
				y = y_pos;
				xwidth = width;
				current = (SInt *) GetImageData (GetVopY (curr));
				break;
			case 1:
				x = x_pos + 8;
				y = y_pos;
				xwidth = width;
				current = (SInt *) GetImageData (GetVopY (curr));
				break;
			case 2:
				x = x_pos;
				y = y_pos + 8;
				xwidth = width;
				current = (SInt *) GetImageData (GetVopY (curr));
				break;
			case 3:
				x = x_pos + 8;
				y = y_pos + 8;
				xwidth = width;
				current = (SInt *) GetImageData (GetVopY (curr));
				break;
			case 4:
				x = x_pos / 2;
				y = y_pos / 2;
				xwidth = width / 2;
				current = (SInt *) GetImageData (GetVopU (curr));
				break;
			case 5:
				x = x_pos / 2;
				y = y_pos / 2;
				xwidth = width / 2;
				current = (SInt *) GetImageData (GetVopV (curr));
				break;
			default:
				break;
		}
		BlockPredict (current, x, y, xwidth, fblock[k]);
	}

	for (k = 0; k < 6; k++)
	{
		s = 0;
		for (i = 0; i < 8; i++)
			for (j = 0; j < 8; j++)
				tmp[s++] = (SInt) fblock[k][i][j];
#ifndef _MMX_
		fdct_enc(tmp);
#else
		fdct_mm32(tmp);
#endif
		for (s = 0; s < 64; s++)
			coeff_ind[s] = (Int) tmp[s];

		if (k < 4) type = 1;
		else type = 2;

		/* For this release, only H263 quantization is supported. - adamli */
		BlockQuantH263(coeff_ind,QP,Mode,type,qcoeff_ind,
			GetVopBrightWhite(curr),1);
		BlockDequantH263(qcoeff_ind,QP,Mode,type,rcoeff_ind,1, 0, GetVopBitsPerPixel(curr));

		for (s = 0; s < 64; s++)
			tmp[s] = (SInt) rcoeff_ind[s];
#ifndef _MMX_
		idct_enc(tmp);
#else
		Fast_IDCT(tmp);
#endif
		s = 0;
		for (i = 0; i < 8; i++)
			for (j = 0; j < 8; j++)
				iblock[k][i][j] = (Int)tmp[s++];

		coeff_ind += 64;
		qcoeff_ind += 64;
		rcoeff_ind += 64;

		if (Mode == MODE_INTRA||Mode==MODE_INTRA_Q)
			for (i = 0; i < 8; i++)
				for (j = 0; j < 8; j ++)
					iblock[k][i][j] = MIN (GetVopBrightWhite(curr), MAX (0, iblock[k][i][j]));

		switch (k)
		{
			case 0:
			case 1:
			case 2:
				continue;

			case 3:
				recon = (SInt *) GetImageData (GetVopY (rec_curr));
				if (operation == P_VOP) compensated = (SInt *) GetImageData (GetVopY (comp));
				BlockRebuild (recon, compensated, operation, max, x_pos,     y_pos,     width, 16, iblock[0]);
				BlockRebuild (recon, compensated, operation, max, x_pos + 8, y_pos,     width, 16, iblock[1]);
				BlockRebuild (recon, compensated, operation, max, x_pos,     y_pos + 8, width, 16, iblock[2]);
				BlockRebuild (recon, compensated, operation, max, x_pos + 8, y_pos + 8, width, 16, iblock[3]);
				continue;

			case 4:
				recon = (SInt *) GetImageData (GetVopU (rec_curr));
				if (operation == P_VOP) compensated = (SInt *) GetImageData (GetVopU (comp));
				BlockRebuild (recon, compensated, operation, max,
					x_pos/2, y_pos/2, width/2, 8, iblock[4]);
				continue;

			case 5:
				recon = (SInt *) GetImageData (GetVopV (rec_curr));
				if (operation == P_VOP) compensated = (SInt *) GetImageData (GetVopV (comp));
				BlockRebuild (recon, compensated, operation, max,
					x_pos/2, y_pos/2, width/2, 8, iblock[5]);
				continue;
		}
	}

	return;
}


/***********************************************************CommentBegin******
 函數(shù)功能:
對一個幀內(nèi)宏塊進(jìn)行預(yù)測,并得到它的預(yù)測結(jié)果。
函數(shù)輸入:
1)	nt x_pos:宏塊的x方向的空間位置;
2)	nt y_pos:宏塊的y方向的空間位置;
3)	Int width:宏塊所在視頻對象平面的邊界框的寬度。
函數(shù)輸出:
Int fblock[][8]:將要進(jìn)行編碼的預(yù)測宏塊,輸出到數(shù)據(jù)流中。
函數(shù)輸入/輸出:
1)SInt* curr	:當(dāng)前未編碼的視頻對象平面數(shù)據(jù);
2)SInt* rec_curr:重建視頻對象平面數(shù)據(jù)的區(qū)域

 *
 ***********************************************************CommentEnd********/
Void
BlockPredict (SInt *curr, /*SInt *rec_curr,*/ Int x_pos, Int y_pos,
UInt width, Int fblock[][8])
{
	Int i, j;

	for (i = 0; i < 8; i++)
	{
		for (j = 0; j < 8; j++)
		{
			fblock[i][j] = curr[(y_pos+i)*width + x_pos+j];
		}
	}
}


/***********************************************************CommentBegin******
函數(shù)功能:
在視頻對象平面數(shù)據(jù)區(qū)域中重建一個宏塊。
函數(shù)輸入:
1)	nt x_pos:宏塊的x方向的空間位置;
2)	Int y_pos:宏塊的y方向的空間位置;
3)UInt width:宏塊所在視頻對象平面的邊界框的寬度。
函數(shù)輸出:
SInt* rec_curr:當(dāng)前將要重建的視頻對象平面數(shù)據(jù)區(qū)域。
函數(shù)描述:
對幀內(nèi)的預(yù)測塊也進(jìn)行重建。

 ***********************************************************CommentEnd********/

Void BlockRebuild (SInt *rec_curr, SInt *comp, Int pred_type, Int max,
Int x_pos, Int y_pos, UInt width, UInt edge, Int fblock[][8])
{
	/* 本函數(shù)將同時(shí)重建塊和產(chǎn)生新的誤差*/
	Int i, j;
	SInt *rec;
	Int padded_width;
	
	padded_width = width + 2 * edge;
	rec = rec_curr + edge * padded_width + edge;

	if (pred_type == I_VOP)
	{
		SInt *p;
		p  = rec + y_pos * padded_width + x_pos;

		for (i = 0; i < 8; i++) 
		{
			for (j = 0; j < 8; j++)
			{
				SInt temp = fblock[i][j];
				*(p++) = CLIP(temp, 0, max);
			}

			p += padded_width - 8;
		}
	}
	else if (pred_type == P_VOP)
	{
		SInt *p, *pc; 
		p  = rec + y_pos * padded_width + x_pos;
		pc = comp     + y_pos * width + x_pos;

		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 8; j++)
			{
				SInt temp = *(pc++) + fblock[i][j];
				*(p++) = CLIP(temp, 0, max);
			}
			p += padded_width - 8;
			pc += width - 8;
		}
	}
}




/***********************************************************CommentBegin******
 函數(shù)功能:
 *	8x8宏塊量化
 函數(shù)輸入:
 Int *coeff	未量化系數(shù)
 Int QP		量化參數(shù)
 Int Mode	宏塊編碼模式
 函數(shù)輸出:
 Int *qcoeff	已量化系數(shù)
***********************************************************CommentEnd********/
Void
BlockQuantH263 (Int *coeff, Int QP, Int mode, Int type, Int *qcoeff, Int maxDC, Int image_type)
{
	Int i;
	Int level, result;
	Int step, offset;
	Int dc_scaler;

	if (!(QP > 0 && (QP < 32*image_type))) return;
	if (!(type == 1 || type == 2)) return;

	if (mode == MODE_INTRA || mode == MODE_INTRA_Q)
	{										  /* Intra */
		dc_scaler = cal_dc_scaler(QP,type);
		qcoeff[0] = MAX(1,MIN(maxDC-1, (coeff[0] + dc_scaler/2)/dc_scaler));

		step = 2 * QP;
		for (i = 1; i < 64; i++)
		{
			level = (abs(coeff[i]))  / step;
			result = (coeff[i] >= 0) ? level : -level;
			qcoeff[i] =  MIN(2047, MAX(-2048, result));
		}
	}
	else
	{										  /* non Intra */
		step = 2 * QP;
		offset = QP / 2;
		for (i = 0; i < 64; i++)
		{
			level = (abs(coeff[i]) - offset)  / step;
			result = (coeff[i] >= 0) ? level : -level;
			qcoeff[i] =  MIN(2047, MAX(-2048, result));
		}
	}

	return;
}


/***********************************************************CommentBegin******
 *
 * -- BlockDequantH263 -- 8x8 block dequantization
 *
 * Purpose :
 *	8x8 block dequantization
 *
 * Arguments in :
 *	Int *qcoeff	        quantized coefficients
 *	Int QP		        quantization parameter
 *	Int mode	        Macroblock coding mode
 *      Int short_video_header  Flag to signal short video header bitstreams (H.263)
 *
 * Arguments out :
 *	Int *rcoeff	reconstructed (dequantized) coefficients
 *
 ***********************************************************CommentEnd********/
Void
BlockDequantH263 (Int *qcoeff, Int QP, Int mode, Int type, Int *rcoeff,
Int image_type, Int short_video_header, Int bits_per_pixel)
{
	Int i;
	Int dc_scaler;
	Int lim;

	lim = (1 << (bits_per_pixel + 3));

	if (QP)
	{
		for (i = 0; i < 64; i++)
		{
			if (qcoeff[i])
			{
				/* 16.11.98 Sven Brandau: "correct saturation" due to N2470, Clause 2.1.6 */
				qcoeff[i] =  MIN(2047, MAX(-2048, qcoeff[i] ));
				if ((QP % 2) == 1)
					rcoeff[i] = QP * (2*ABS(qcoeff[i]) + 1);
				else
					rcoeff[i] = QP * (2*ABS(qcoeff[i]) + 1) - 1;
				rcoeff[i] = SIGN(qcoeff[i]) * rcoeff[i];
			}
			else
				rcoeff[i] = 0;
		}
		if (mode == MODE_INTRA || mode == MODE_INTRA_Q)
		{										  /* Intra */

			MOMCHECK(QP > 0 && (QP < 32*image_type));
			MOMCHECK(type == 1 || type == 2);

			if (short_video_header)
				dc_scaler = 8;
			else
				dc_scaler = cal_dc_scaler(QP,type);

			rcoeff[0] = qcoeff[0] * dc_scaler;
		}
	}
	else
	{
		/* No quantizing at all */
		for (i = 0; i < 64; i++)
		{
			rcoeff[i] = qcoeff[i];
		}

		if (mode == MODE_INTRA || mode == MODE_INTRA_Q)
		{										  /* Intra */
			rcoeff[0] = qcoeff[0]*8;
		}
	}
	for (i=0;i<64;i++)
		if (rcoeff[i]>(lim-1)) rcoeff[i]=(lim-1);
		else if (rcoeff[i]<(-lim)) rcoeff[i]=(-lim);

	return;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产激情精品久久久第一区二区| 日韩不卡在线观看日韩不卡视频| 欧美撒尿777hd撒尿| 精品一区二区三区在线观看| 亚洲视频在线一区| 精品久久免费看| 欧美日韩一级二级三级| 成人黄色小视频在线观看| 天堂久久久久va久久久久| 自拍偷拍亚洲综合| 久久久久国产一区二区三区四区 | 99re热视频精品| 美女国产一区二区| 亚洲福利视频一区二区| 国产精品久久久久影院| 欧美电影免费观看完整版| caoporen国产精品视频| 精品无码三级在线观看视频| 亚洲6080在线| 夜夜揉揉日日人人青青一国产精品| 久久精品欧美一区二区三区麻豆| 欧美精三区欧美精三区| 在线观看日韩国产| eeuss鲁片一区二区三区在线看| 免费成人在线影院| 午夜精品视频在线观看| 亚洲最大成人综合| 亚洲日本成人在线观看| 国产欧美日韩三级| 久久日韩粉嫩一区二区三区 | 日韩欧美中文一区二区| 欧美日本在线播放| 精品视频资源站| 在线日韩av片| 在线观看亚洲专区| 色伊人久久综合中文字幕| av午夜精品一区二区三区| 成人福利视频网站| 北岛玲一区二区三区四区| 丁香桃色午夜亚洲一区二区三区| 国产精品小仙女| 国产成人精品aa毛片| 国产麻豆精品95视频| 国产精品一卡二| 成人动漫一区二区在线| 99re热视频这里只精品| 日本精品裸体写真集在线观看| 在线观看亚洲a| 欧美精品在线观看播放| 欧美顶级少妇做爰| 精品久久人人做人人爱| 国产情人综合久久777777| 中文字幕+乱码+中文字幕一区| 国产精品美女一区二区| 最新日韩在线视频| 一区二区久久久| 亚洲成a人片在线观看中文| 丝瓜av网站精品一区二区| 麻豆91精品视频| 国产盗摄女厕一区二区三区| 成人av在线一区二区| 在线观看91视频| 91精品国产综合久久福利软件 | 乱一区二区av| 国产成人精品影院| 91啪亚洲精品| 777xxx欧美| 国产亚洲综合av| 亚洲免费观看在线观看| 午夜激情久久久| 国产乱码精品一区二区三区忘忧草 | 亚洲高清中文字幕| 理论电影国产精品| 成人动漫一区二区三区| 欧美日韩高清一区二区三区| 亚洲精品在线电影| 亚洲欧美综合另类在线卡通| 亚洲第一主播视频| 国产一区不卡在线| 欧洲一区在线观看| 久久久亚洲欧洲日产国码αv| 中文字幕一区二区三区乱码在线| 午夜私人影院久久久久| 国产精品亚洲一区二区三区在线| 色素色在线综合| 精品久久久三级丝袜| 亚洲免费在线观看| 激情丁香综合五月| 色8久久精品久久久久久蜜| 日韩免费看的电影| 一片黄亚洲嫩模| 国产成a人亚洲| 9191成人精品久久| 国产精品传媒入口麻豆| 毛片av一区二区| 色婷婷久久99综合精品jk白丝| 日韩欧美一区二区三区在线| 亚洲天堂成人在线观看| 久久电影网电视剧免费观看| 在线一区二区三区四区五区| 久久久亚洲高清| 天天亚洲美女在线视频| av激情综合网| 国产午夜精品久久久久久久| 视频一区在线视频| 91官网在线观看| 中文av一区特黄| 精品一区二区三区在线视频| 欧美日韩免费电影| 有坂深雪av一区二区精品| 国产呦萝稀缺另类资源| 91精品国产欧美一区二区18| 亚洲综合视频在线| jiyouzz国产精品久久| 久久亚洲一区二区三区四区| 日本女优在线视频一区二区| 在线观看成人免费视频| 亚洲情趣在线观看| 成人av手机在线观看| 国产亚洲欧美日韩在线一区| 久久激情综合网| 日韩免费观看2025年上映的电影 | 国产精品99久久久久久似苏梦涵 | 青娱乐精品在线视频| 欧美日韩情趣电影| 亚洲综合av网| 在线亚洲免费视频| 亚洲精品国产a久久久久久| 成人爱爱电影网址| 国产欧美精品一区二区三区四区 | 国产91色综合久久免费分享| 久久伊人中文字幕| 久久精品国产一区二区三区免费看| 欧美日韩国产经典色站一区二区三区 | 精品剧情在线观看| 九九精品一区二区| 久久综合久久综合九色| 精品亚洲porn| 精品噜噜噜噜久久久久久久久试看| 奇米精品一区二区三区在线观看 | 91.麻豆视频| 全国精品久久少妇| 精品日韩在线一区| 国产一区二区三区四区五区入口| 精品精品欲导航| 国产精品456| 国产精品美女一区二区| 91丝袜美女网| 亚洲福利一区二区三区| 欧美一区二区视频在线观看2022 | 日韩视频123| 久久99国产精品免费网站| 精品久久久久av影院| 国产福利91精品| √…a在线天堂一区| 91黄视频在线| 舔着乳尖日韩一区| 亚洲精品一区二区在线观看| 国产成人免费9x9x人网站视频| 国产精品高清亚洲| 欧美日韩精品欧美日韩精品 | 日韩高清不卡一区二区三区| 精品久久久久久久久久久久包黑料 | 亚洲高清一区二区三区| 精品欧美一区二区三区精品久久| 国产精品18久久久久久vr| 亚洲欧洲中文日韩久久av乱码| 欧美日韩情趣电影| 国产精品538一区二区在线| 亚洲欧美日韩国产一区二区三区| 欧美久久一二区| 国产成人在线视频网址| 亚洲午夜一区二区| 精品国产一区二区三区av性色| 成人av网址在线| 日韩高清一级片| 国产精品久久久久四虎| 在线不卡中文字幕| youjizz国产精品| 日韩高清在线电影| 亚洲欧洲成人av每日更新| 日韩一区二区三区电影在线观看 | 粉嫩在线一区二区三区视频| 亚洲无人区一区| 久久午夜国产精品| 日本高清视频一区二区| 国产伦精品一区二区三区视频青涩| 18成人在线观看| 欧美精品一区二区三区高清aⅴ| 成人aaaa免费全部观看| 蜜桃视频免费观看一区| ㊣最新国产の精品bt伙计久久| 日韩免费性生活视频播放| 色香蕉成人二区免费| 狠狠色丁香婷婷综合| 亚洲一区av在线| 中文字幕亚洲成人| 欧美刺激午夜性久久久久久久| 在线视频综合导航| 波多野结衣中文字幕一区|