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

📄 idctpart.c

📁 魔兽2Linux版
💻 C
📖 第 1 页 / 共 2 页
字号:
			op[7*8] = 0;			op[1*8] = 0;			op[2*8] = 0;			op[3*8] = 0;			op[4*8] = 0;			op[5*8] = 0;			op[6*8] = 0;		}		ip++;			// next column        op++;	}}/***************************************************************************** *   Routine:    dequant10**   Purpose:    The reverse of routine quantize, this routine takes a Q_LIST*               list of quantized values and multipies by the relevant value in*               quantization array. **   Parameters :  *       Input :*           quantized_list :: Q_LIST*                      -- The quantized values in zig-zag order*       Output :*           DCT_block      :: INT16 *              *                      -- The expanded values in a 2-D block**   Return value :*       None.** *****************************************************************************///extern unsigned dequant_index[64];void dequant_slow10( INT16 * dequant_coeffs, INT16 * quantized_list, INT32 * DCT_block){    	memset(DCT_block,0, 128);	// Loop fully expanded for maximum speed    DCT_block[dequant_index[0]] = quantized_list[0] * dequant_coeffs[0];    DCT_block[dequant_index[1]] = quantized_list[1] * dequant_coeffs[1];    DCT_block[dequant_index[2]] = quantized_list[2] * dequant_coeffs[2];    DCT_block[dequant_index[3]] = quantized_list[3] * dequant_coeffs[3];    DCT_block[dequant_index[4]] = quantized_list[4] * dequant_coeffs[4];    DCT_block[dequant_index[5]] = quantized_list[5] * dequant_coeffs[5];    DCT_block[dequant_index[6]] = quantized_list[6] * dequant_coeffs[6];    DCT_block[dequant_index[7]] = quantized_list[7] * dequant_coeffs[7];    DCT_block[dequant_index[8]] = quantized_list[8] * dequant_coeffs[8];    DCT_block[dequant_index[9]] = quantized_list[9] * dequant_coeffs[9];    DCT_block[dequant_index[10]] = quantized_list[10] * dequant_coeffs[10];}/************************************************//* Module Name:		IDct10						*//*												*//* Description:		IDCT for Blocks only have	*//*					less than 10 coefficents    *//************************************************/////////////////////////////// x  x  x  x  0  0  0  0 // x  x  x  0  0  0  0  0// x  x  0  0  0  0  0  0// x  0  0  0  0  0  0  0 // 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0//////////////////////////void IDct10( Q_LIST_ENTRY * InputData, int16 *QuantMatrix, int16 * OutputData ){	int32 IntermediateData[64];	int32 * ip = IntermediateData;	int16 * op = OutputData;	int32 _A, _B, _C, _D, _Ad, _Bd, _Cd, _Dd, _E, _F, _G, _H;	int32 _Ed, _Gd, _Add, _Bdd, _Fd, _Hd;	int32 t1, t2;	int loop;		// dequantize the input 	dequant_slow10( QuantMatrix, InputData, IntermediateData);	// Inverse DCT on the rows now	for ( loop = 0; loop < 4; loop++)	{		// Check for non-zero values		if ( ip[0] | ip[1] | ip[2] | ip[3] )		{			t1 = (int32)(xC1S7 * ip[1]);            t1 >>= 16;			_A = t1; 			t1 = (int32)(xC7S1 * ip[1]);            t1 >>= 16;			_B = t1 ;			t1 = (int32)(xC3S5 * ip[3]);            t1 >>= 16;			_C = t1; 			t2 = (int32)(xC5S3 * ip[3]);            t2 >>= 16;			_D = -t2; 			t1 = (int32)(xC4S4 * (_A - _C));            t1 >>= 16;			_Ad = t1;			t1 = (int32)(xC4S4 * (_B - _D));            t1 >>= 16;			_Bd = t1;						_Cd = _A + _C;			_Dd = _B + _D;			t1 = (int32)(xC4S4 * ip[0] );            t1 >>= 16;			_E = t1;			_F = t1;						t1 = (int32)(xC2S6 * ip[2]);            t1 >>= 16;			_G = t1; 			t1 = (int32)(xC6S2 * ip[2]);            t1 >>= 16;			_H = t1 ;						_Ed = _E - _G;			_Gd = _E + _G;			_Add = _F + _Ad;			_Bdd = _Bd - _H;						_Fd = _F - _Ad;			_Hd = _Bd + _H;				// Final sequence of operations over-write original inputs.			ip[0] = (int16)((_Gd + _Cd )   >> 0);			ip[7] = (int16)((_Gd - _Cd )   >> 0);			ip[1] = (int16)((_Add + _Hd )  >> 0);			ip[2] = (int16)((_Add - _Hd )  >> 0);			ip[3] = (int16)((_Ed + _Dd )   >> 0);			ip[4] = (int16)((_Ed - _Dd )   >> 0);			ip[5] = (int16)((_Fd + _Bdd )  >> 0);			ip[6] = (int16)((_Fd - _Bdd )  >> 0);		}		ip += 8;			/* next row */	}	ip = IntermediateData;	for ( loop = 0; loop < 8; loop++)	{			// Check for non-zero values (bitwise or faster than ||)		if ( ip[0 * 8] | ip[1 * 8] | ip[2 * 8] | ip[3 * 8] )		{			t1 = (int32)(xC1S7 * ip[1*8]);            t1 >>= 16;			_A = t1 ;			t1 = (int32)(xC7S1 * ip[1*8]);            t1 >>= 16;			_B = t1 ;			t1 = (int32)(xC3S5 * ip[3*8]);            t1 >>= 16;			_C = t1 ;			t2 = (int32)(xC5S3 * ip[3*8]);            t2 >>= 16;			_D = - t2;			t1 = (int32)(xC4S4 * (_A - _C));            t1 >>= 16;//            t1 += (_A - _C);			_Ad = t1;			t1 = (int32)(xC4S4 * (_B - _D));            t1 >>= 16;//            t1 += (_B - _D);			_Bd = t1;						_Cd = _A + _C;			_Dd = _B + _D;			t1 = (int32)(xC4S4 * ip[0*8]);            t1 >>= 16;			_E = t1;			_F = t1;						t1 = (int32)(xC2S6 * ip[2*8]);            t1 >>= 16;			_G = t1;			t1 = (int32)(xC6S2 * ip[2*8]);            t1 >>= 16;			_H = t1;						_Ed = _E - _G;			_Gd = _E + _G;			_Add = _F + _Ad;			_Bdd = _Bd - _H;						_Fd = _F - _Ad;			_Hd = _Bd + _H;				_Gd += IdctAdjustBeforeShift;			_Add += IdctAdjustBeforeShift;			_Ed += IdctAdjustBeforeShift;			_Fd += IdctAdjustBeforeShift;			// Final sequence of operations over-write original inputs.			op[0*8] = (int16)((_Gd + _Cd )   >> 4);			op[7*8] = (int16)((_Gd - _Cd )   >> 4);			op[1*8] = (int16)((_Add + _Hd )  >> 4);			op[2*8] = (int16)((_Add - _Hd )  >> 4);			op[3*8] = (int16)((_Ed + _Dd )   >> 4);			op[4*8] = (int16)((_Ed - _Dd )   >> 4);			op[5*8] = (int16)((_Fd + _Bdd )  >> 4);			op[6*8] = (int16)((_Fd - _Bdd )  >> 4);		}		else		{			op[0*8] = 0;			op[7*8] = 0;			op[1*8] = 0;			op[2*8] = 0;			op[3*8] = 0;			op[4*8] = 0;			op[5*8] = 0;			op[6*8] = 0;		}		ip++;			// next columnop++;	}}/************************************************//* Module Name:		IDct1						*//*												*//* Description:		IDCT for Blocks only have	*//*					less than 1 coefficents		*//************************************************/////////////////////////////// x   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	// 0   0   0  0  0  0  0  0	///////////////////////////void IDct1( Q_LIST_ENTRY * InputData, int16 *QuantMatrix, INT16 * OutputData ){    INT32 loop;		INT16  OutD;		OutD=(INT16) ((INT32)(InputData[0]*QuantMatrix[0]+15)>>5);	for(loop=0;loop<64;loop++)		OutputData[loop]=OutD;}/* Currently only used by experimenting post processor *//************************************************//* Module Name:		IDct4						*//*												*//* Description:		IDCT for Blocks only have	*//*					at most 4 coefficents		*//************************************************/////////////////////////////// x  x  0  0  0  0  0  0 // x  x  0  0  0  0  0  0// 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0 // 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0// 0  0  0  0  0  0  0  0//////////////////////////void IDct4 ( int16 * InputData, int16 * OutputData ){	int16 * ip = InputData;	int16 * op = OutputData;	int32 _A, _B, _Ad, _Bd, _Cd, _Dd, _E;	int32 _Add, _Fd;	int32 t1;	int loop;		// Unzigzag the coefficents	ip[8]=ip[2];	ip[9]=ip[4];	ip[2]=0;	ip[5]=0;	// Inverse DCT on the rows now	for ( loop = 0; loop < 2; loop++)	{		// Check for non-zero values		if ( ip[0] | ip[1] )		{			t1 = (int32)(xC1S7 * ip[1]);            t1 >>= 16;			_A = t1; 			t1 = (int32)(xC7S1 * ip[1]);            t1 >>= 16;			_B = t1 ;			//_C = 0; 			//_D = 0; 			t1 = (int32)(xC4S4 * _A );            t1 >>= 16;			_Ad = t1;			t1 = (int32)(xC4S4 * _B );            t1 >>= 16;			_Bd = t1;						_Cd = _A ;			_Dd = _B ;			t1 = (int32)(xC4S4 * ip[0] );            t1 >>= 16;			_E = t1;//			_F = t1;						//_G = 0; 			//_H = 0 ;						//_Ed = _E ;			//_Gd = _E ;			_Add = _E + _Ad;//			_Bdd = _Bd ;						_Fd = _E - _Ad;//			_Hd = _Bd ;				// Final sequence of operations over-write original inputs.			ip[0] = (int16)((_E + _Cd )   >> 0);			ip[7] = (int16)((_E - _Cd )   >> 0);			ip[1] = (int16)((_Add + _Bd )  >> 0);			ip[2] = (int16)((_Add - _Bd )  >> 0);			ip[3] = (int16)((_E + _Dd )   >> 0);			ip[4] = (int16)((_E - _Dd )   >> 0);			ip[5] = (int16)((_Fd + _Bd )  >> 0);			ip[6] = (int16)((_Fd - _Bd )  >> 0);		}		ip += 8;			/* next row */	}	ip = InputData;	for ( loop = 0; loop < 8; loop++)	{			// Check for non-zero values (bitwise or faster than ||)		if ( ip[0 * 8] | ip[1 * 8] )		{			t1 = (int32)(xC1S7 * ip[1*8]);            t1 >>= 16;			_A = t1 ;			t1 = (int32)(xC7S1 * ip[1*8]);            t1 >>= 16;			_B = t1 ;			//_C = 0 ;			//_D = 0;			t1 = (int32)(xC4S4 * _A );            t1 >>= 16;//            t1 += (_A - _C);			_Ad = t1;			t1 = (int32)(xC4S4 * _B );            t1 >>= 16;//            t1 += (_B - _D);			_Bd = t1;						_Cd = _A ;			_Dd = _B ;			t1 = (int32)(xC4S4 * ip[0*8]);            t1 >>= 16;			_E = t1;//			_F = t1;			//			_G = 0 ;//			_H = 0 ;			//			_Ed = _E ;//			_Gd = _E ;			_Add = _E + _Ad;//			_Bdd = _Bd ;						_Fd = _E - _Ad;//			_Hd = _Bd ;							_Add += IdctAdjustBeforeShift;			_E += IdctAdjustBeforeShift;			_Fd += IdctAdjustBeforeShift;			// Final sequence of operations over-write original inputs.			op[0*8] = (int16)((_E + _Cd )   >> 4);			op[7*8] = (int16)((_E - _Cd )   >> 4);			op[1*8] = (int16)((_Add + _Bd )  >> 4);			op[2*8] = (int16)((_Add - _Bd )  >> 4);			op[3*8] = (int16)((_E + _Dd )   >> 4);			op[4*8] = (int16)((_E - _Dd )   >> 4);			op[5*8] = (int16)((_Fd + _Bd )  >> 4);			op[6*8] = (int16)((_Fd - _Bd )  >> 4);		}		else		{			op[0*8] = 0;			op[7*8] = 0;			op[1*8] = 0;			op[2*8] = 0;			op[3*8] = 0;			op[4*8] = 0;			op[5*8] = 0;			op[6*8] = 0;		}		ip++;			// next columnop++;	}}

⌨️ 快捷键说明

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