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

📄 global.hpp

📁 MPEG-4编解码的实现(包括MPEG4视音频编解码)
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************

This software module was originally developed by 

	Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation
	Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation
	Bruce Lin (blin@microsoft.com), Microsoft Corporation
	Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation
	(date: March, 1996)

and edited by
	Yoshihiro Kikuchi (TOSHIBA CORPORATION)
	Takeshi Nagai (TOSHIBA CORPORATION)
	Toshiaki Watanabe (TOSHIBA CORPORATION)
	Noboru Yamaguchi (TOSHIBA CORPORATION)

in the course of development of the MPEG-4 Video (ISO/IEC 14496-2). 
This software module is an implementation of a part of one or more MPEG-4 Video tools 
as specified by the MPEG-4 Video. 
ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications 
thereof for use in hardware or software products claiming conformance to the MPEG-4 Video. 
Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents. 
The original developer of this software module and his/her company, 
the subsequent editors and their companies, 
and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. 
Copyright is not released for non MPEG-4 Video conforming products. 
Microsoft retains full right to use the code for his/her own purpose, 
assign or donate the code to a third party and to inhibit third parties from using the code for non <MPEG standard> conforming products. 
This copyright notice must be included in all copies or derivative works. 

Copyright (c) 1996, 1997.

Revision History:

*************************************************************************/


#ifndef __GLOBAL_HPP_
#define __GLOBAL_HPP_



// global tables for overlap motion comp.
// central block

#ifdef __GLOBAL_VAR_

UInt gWghtC[8][8] = {
	{4,5,5,5,5,5,5,4},
	{5,5,5,5,5,5,5,5},
	{5,5,6,6,6,6,5,5},
	{5,5,6,6,6,6,5,5},
	{5,5,6,6,6,6,5,5},
	{5,5,6,6,6,6,5,5},
	{5,5,5,5,5,5,5,5},
	{4,5,5,5,5,5,5,4},
};
// top block
UInt gWghtT[8][8] = {
	{2,2,2,2,2,2,2,2},
	{1,1,2,2,2,2,1,1},
	{1,1,1,1,1,1,1,1},
	{1,1,1,1,1,1,1,1},
	{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},
};
// bottom block
UInt gWghtB[8][8] = {
	{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},
	{1,1,1,1,1,1,1,1},
	{1,1,1,1,1,1,1,1},
	{1,1,2,2,2,2,1,1},
	{2,2,2,2,2,2,2,2},
};
// right block
UInt gWghtR[8][8] = {
	{0,0,0,0,1,1,1,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,2,2},
	{0,0,0,0,1,1,1,2},
};
// left block
UInt gWghtL[8][8] = {
	{2,1,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,2,1,1,0,0,0,0},
	{2,1,1,1,0,0,0,0},
};

// rounding table for Chrominace mv; see VM1.1/Table ?
Int grgiMvRound16 [16] = {
	0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
};
Int grgiMvRound12 [12] = {
	0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2,
};
Int grgiMvRound8 [8] = {
	0, 0, 1, 1, 1, 1, 1, 2,
};
Int grgiMvRound4 [4] ={
	0, 1, 1, 1,
};


//index of candidate blocks for diffrential mv coding
BlockNum gIndexOfCandBlk[5][3] = {
					{Y_BLOCK2, Y_BLOCK3, Y_BLOCK3}, 	
					{Y_BLOCK2, Y_BLOCK3, Y_BLOCK3}, 
					{Y_BLOCK1, Y_BLOCK4, Y_BLOCK3},
					{Y_BLOCK4, Y_BLOCK1, Y_BLOCK2},
					{Y_BLOCK3, Y_BLOCK1, Y_BLOCK2}};

//MPEG quantizer matrix
Int rgiDefaultIntraQMatrix [BLOCK_SQUARE_SIZE] = {
	8,	17,	18,	19,	21,	23,	25,	27,
	17,	18,	19,	21,	23,	25,	27,	28,
	20,	21,	22,	23,	24,	26,	28,	30,
	21,	22,	23,	24,	26,	28,	30,	32,
	22,	23,	24,	26,	28,	30,	32,	35,
	23,	24,	26,	28,	30,	32,	35,	38,
	25,	26,	28,	30,	32,	35,	38,	41,
	27,	28,	30,	32,	35,	38,	41,	45
};

Int rgiDefaultInterQMatrix [BLOCK_SQUARE_SIZE] = {
	16,	17,	18, 19, 20,	21,	22,	23,
	17,	18,	19,	20,	21,	22,	23,	24,
	18,	19,	20,	21,	22,	23,	24,	25,
	19,	20,	21,	22,	23,	24,	26,	27,
	20,	21,	22,	23,	25,	26,	27,	28,
	21,	22,	23,	24,	26,	27,	28,	30,
	22,	23,	24,	26,	27,	28,	30,	31,
	23,	24,	25,	27,	28,	30,	31,	33
};
/*
Int rgiDefaultIntraQMatrix [BLOCK_SQUARE_SIZE] = {
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16
};

Int rgiDefaultInterQMatrix [BLOCK_SQUARE_SIZE] = {
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16,
	16,	16,	16,	16,	16,	16,	16, 16
};
*/
Int grgiStandardZigzag [BLOCK_SQUARE_SIZE] = {
	0, 1, 8, 16, 9, 2, 3, 10, 
	17, 24, 32, 25, 18, 11, 4, 5, 
	12, 19, 26, 33, 40, 48, 41, 34, 
	27, 20, 13, 6, 7, 14, 21, 28, 
	35, 42, 49, 56, 57, 50, 43, 36, 
	29, 22, 15, 23, 30, 37, 44, 51, 
	58, 59, 52, 45, 38, 31, 39, 46, 
	53, 60, 61, 54, 47, 55, 62, 63
};

Int grgiHorizontalZigzag [BLOCK_SQUARE_SIZE] = {
	0, 1, 2, 3, 8, 9, 16, 17, 
	10, 11, 4, 5, 6, 7, 15, 14, 
	13, 12, 19, 18, 24, 25, 32, 33, 
	26, 27, 20, 21, 22, 23, 28, 29, 
	30, 31, 34, 35, 40, 41, 48, 49, 
	42, 43, 36, 37, 38, 39, 44, 45, 
	46, 47, 50, 51, 56, 57, 58, 59, 
	52, 53, 54, 55, 60, 61, 62, 63
};

Int grgiVerticalZigzag [BLOCK_SQUARE_SIZE] = {
	0, 8, 16, 24, 1, 9, 2, 10, 
	17, 25, 32, 40, 48, 56, 57, 49, 
	41, 33, 26, 18, 3, 11, 4, 12, 
	19, 27, 34, 42, 50, 58, 35, 43, 
	51, 59, 20, 28, 5, 13, 6, 14, 
	21, 29, 36, 44, 52, 60, 37, 45, 
	53, 61, 22, 30, 7, 15, 23, 31, 
	38, 46, 54, 62, 39, 47, 55, 63
};

UInt grgIfNotLastNumOfLevelAtRun [27] = {
	12, 6, 4, 3, 3, 3, 3, 2, 2, 2, 2, 
	 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	 1, 1, 1, 1, 1
};

UInt grgIfLastNumOfLevelAtRun [41] = {
	 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	 1, 1, 1, 1, 1, 1, 1, 1
};

UInt grgiIntraYAVCLHashingTable [102] = {
1, 3, 6, 9, 10, 13, 14, 17, 18, 21,
22, 23, 2, 34, 11, 19, 24, 25, 33, 12,
20, 26, 4, 15, 39, 5, 130, 27, 65, 68,
41, 7, 100, 195, 8, 131, 97, 258, 129,
163, 35, 42, 66, 225, 36, 98, 16, 37,
38, 67, 99, 162, 194, 226, 40, 290, 69,
227, 1025, 353, 1030, 1057, 1031, 1089, 161, 
1026, 1185, 193, 1121, 1153, 1313, 257, 289,
321, 1027, 1217, 1249, 1281, 385, 1028, 1058,
1345, 1377, 1409, 1441, 1473, 417, 1029, 1059,
1090, 1122, 1154, 1505, 1537, 449, 1032, 1186,
1218, 1569, 1601, 1633, 1665};

/* NBIT: change to a bigger number
Int grgiDCSwitchingThreshold [8] = {32, 13, 15, 17, 19, 21, 23, 0};
*/
Int grgiDCSwitchingThreshold [8] = {512, 13, 15, 17, 19, 21, 23, 0};

Int g_rgiLMAXintra [128] ={27, 10, 5, 4, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 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,
							8,  3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
							1,  1, 1, 1, 1, 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};

Int g_rgiRMAXintra [64]  = {0, 15,10, 8, 4, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 
						    1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
						    0, 21, 7, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
						    0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

Int g_rgiLMAXinter [128] = {12, 6, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 
							 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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,
							 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
							 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
							 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
							 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

Int g_rgiRMAXinter [64]  = {0, 27, 11, 7, 3, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0,
							0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
						    0, 41,  2, 1, 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,};

U16 gCAEintraProb [1024] = {
65267,16468,65003,17912,64573,8556,64252,5653,
40174,3932,29789,277,45152,1140,32768,2043,
4499,80,6554,1144,21065,465,32768,799,
5482,183,7282,264,5336,99,6554,563,
54784,30201,58254,9879,54613,3069,32768,58495,
32768,32768,32768,2849,58982,54613,32768,12892,
31006,1332,49152,3287,60075,350,32768,712,
39322,760,32768,354,52659,432,61854,150,
64999,28362,65323,42521,63572,32768,63677,18319,
4910,32768,64238,434,53248,32768,61865,13590,
16384,32768,13107,333,32768,32768,32768,32768,
32768,32768,1074,780,25058,5461,6697,233,
62949,30247,63702,24638,59578,32768,32768,42257,
32768,32768,49152,546,62557,32768,54613,19258,
62405,32569,64600,865,60495,10923,32768,898,
34193,24576,64111,341,47492,5231,55474,591,
65114,60075,64080,5334,65448,61882,64543,13209,
54906,16384,35289,4933,48645,9614,55351,7318,
49807,54613,32768,32768,50972,32768,32768,32768,
15159,1928,2048,171,3093,8,6096,74,
32768,60855,32768,32768,32768,32768,32768,32768,
32768,32768,32768,32768,32768,55454,32768,57672,
32768,16384,32768,21845,32768,32768,32768,32768,
32768,32768,32768,5041,28440,91,32768,45,
65124,10923,64874,5041,65429,57344,63435,48060,
61440,32768,63488,24887,59688,3277,63918,14021,
32768,32768,32768,32768,32768,32768,32768,32768,
690,32768,32768,1456,32768,32768,8192,728,
32768,32768,58982,17944,65237,54613,32768,2242,
32768,32768,32768,42130,49152,57344,58254,16740,
32768,10923,54613,182,32768,32768,32768,7282,
49152,32768,32768,5041,63295,1394,55188,77,
63672,6554,54613,49152,64558,32768,32768,5461,
64142,32768,32768,32768,62415,32768,32768,16384,
1481,438,19661,840,33654,3121,64425,6554,
4178,2048,32768,2260,5226,1680,32768,565,
60075,32768,32768,32768,32768,32768,32768,32768,
32768,32768,32768,32768,32768,32768,32768,32768,
16384,261,32768,412,16384,636,32768,4369,
23406,4328,32768,524,15604,560,32768,676,
49152,32768,49152,32768,32768,32768,64572,32768,
32768,32768,54613,32768,32768,32768,32768,32768,
4681,32768,5617,851,32768,32768,59578,32768,
32768,32768,3121,3121,49152,32768,6554,10923,

⌨️ 快捷键说明

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