comparison vc1data.c @ 4949:845386be542c libavcodec

Add ff_ prefix to (externally) visible variables
author kostya
date Wed, 09 May 2007 16:59:46 +0000
parents 67975429cb40
children 4c47bb2a0c8b
comparison
equal deleted inserted replaced
4948:74caff45a271 4949:845386be542c
28 #include "avcodec.h" 28 #include "avcodec.h"
29 #include "vc1.h" 29 #include "vc1.h"
30 #include "vc1data.h" 30 #include "vc1data.h"
31 31
32 /** Table for conversion between TTBLK and TTMB */ 32 /** Table for conversion between TTBLK and TTMB */
33 const int vc1_ttblk_to_tt[3][8] = { 33 const int ff_vc1_ttblk_to_tt[3][8] = {
34 { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT }, 34 { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT },
35 { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP }, 35 { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP },
36 { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP } 36 { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP }
37 }; 37 };
38 38
39 const int vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 }; 39 const int ff_vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 };
40 40
41 /** MV P mode - the 5th element is only used for mode 1 */ 41 /** MV P mode - the 5th element is only used for mode 1 */
42 const uint8_t vc1_mv_pmode_table[2][5] = { 42 const uint8_t ff_vc1_mv_pmode_table[2][5] = {
43 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV }, 43 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV },
44 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN } 44 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN }
45 }; 45 };
46 const uint8_t vc1_mv_pmode_table2[2][4] = { 46 const uint8_t ff_vc1_mv_pmode_table2[2][4] = {
47 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV }, 47 { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV },
48 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN } 48 { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN }
49 }; 49 };
50 50
51 const int vc1_fps_nr[5] = { 24, 25, 30, 50, 60 }, 51 const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
52 vc1_fps_dr[2] = { 1000, 1001 }; 52 ff_vc1_fps_dr[2] = { 1000, 1001 };
53 const uint8_t vc1_pquant_table[3][32] = { 53 const uint8_t ff_vc1_pquant_table[3][32] = {
54 { /* Implicit quantizer */ 54 { /* Implicit quantizer */
55 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12, 55 0, 1, 2, 3, 4, 5, 6, 7, 8, 6, 7, 8, 9, 10, 11, 12,
56 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31 56 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31
57 }, 57 },
58 { /* Explicit quantizer, pquantizer uniform */ 58 { /* Explicit quantizer, pquantizer uniform */
68 /** @name VC-1 VLC tables and defines 68 /** @name VC-1 VLC tables and defines
69 * @todo TODO move this into the context 69 * @todo TODO move this into the context
70 */ 70 */
71 //@{ 71 //@{
72 #define VC1_BFRACTION_VLC_BITS 7 72 #define VC1_BFRACTION_VLC_BITS 7
73 VLC vc1_bfraction_vlc; 73 VLC ff_vc1_bfraction_vlc;
74 #define VC1_IMODE_VLC_BITS 4 74 #define VC1_IMODE_VLC_BITS 4
75 VLC vc1_imode_vlc; 75 VLC ff_vc1_imode_vlc;
76 #define VC1_NORM2_VLC_BITS 3 76 #define VC1_NORM2_VLC_BITS 3
77 VLC vc1_norm2_vlc; 77 VLC ff_vc1_norm2_vlc;
78 #define VC1_NORM6_VLC_BITS 9 78 #define VC1_NORM6_VLC_BITS 9
79 VLC vc1_norm6_vlc; 79 VLC ff_vc1_norm6_vlc;
80 /* Could be optimized, one table only needs 8 bits */ 80 /* Could be optimized, one table only needs 8 bits */
81 #define VC1_TTMB_VLC_BITS 9 //12 81 #define VC1_TTMB_VLC_BITS 9 //12
82 VLC vc1_ttmb_vlc[3]; 82 VLC ff_vc1_ttmb_vlc[3];
83 #define VC1_MV_DIFF_VLC_BITS 9 //15 83 #define VC1_MV_DIFF_VLC_BITS 9 //15
84 VLC vc1_mv_diff_vlc[4]; 84 VLC ff_vc1_mv_diff_vlc[4];
85 #define VC1_CBPCY_P_VLC_BITS 9 //14 85 #define VC1_CBPCY_P_VLC_BITS 9 //14
86 VLC vc1_cbpcy_p_vlc[4]; 86 VLC ff_vc1_cbpcy_p_vlc[4];
87 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6 87 #define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
88 VLC vc1_4mv_block_pattern_vlc[4]; 88 VLC ff_vc1_4mv_block_pattern_vlc[4];
89 #define VC1_TTBLK_VLC_BITS 5 89 #define VC1_TTBLK_VLC_BITS 5
90 VLC vc1_ttblk_vlc[3]; 90 VLC ff_vc1_ttblk_vlc[3];
91 #define VC1_SUBBLKPAT_VLC_BITS 6 91 #define VC1_SUBBLKPAT_VLC_BITS 6
92 VLC vc1_subblkpat_vlc[3]; 92 VLC ff_vc1_subblkpat_vlc[3];
93 93
94 VLC vc1_ac_coeff_table[8]; 94 VLC ff_vc1_ac_coeff_table[8];
95 //@} 95 //@}
96 96
97 97
98 #if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard 98 #if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard
99 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */ 99 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
100 const int16_t vc1_bfraction_lut[23] = { 100 const int16_t ff_vc1_bfraction_lut[23] = {
101 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/, 101 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
102 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/, 102 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
103 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/, 103 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
104 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/, 104 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
105 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/, 105 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
106 525 /*5/8*/, 735 /*7/8*/, 106 525 /*5/8*/, 735 /*7/8*/,
107 -1 /*inv.*/, 0 /*BI fm*/ 107 -1 /*inv.*/, 0 /*BI fm*/
108 }; 108 };
109 #else 109 #else
110 /* pre-computed scales for all bfractions and base=256 */ 110 /* pre-computed scales for all bfractions and base=256 */
111 const int16_t vc1_bfraction_lut[23] = { 111 const int16_t ff_vc1_bfraction_lut[23] = {
112 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/, 112 128 /*1/2*/, 85 /*1/3*/, 170 /*2/3*/, 64 /*1/4*/,
113 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/, 113 192 /*3/4*/, 51 /*1/5*/, 102 /*2/5*/,
114 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/, 114 153 /*3/5*/, 204 /*4/5*/, 43 /*1/6*/, 215 /*5/6*/,
115 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/, 115 37 /*1/7*/, 74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/,
116 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/, 116 185 /*5/7*/, 222 /*6/7*/, 32 /*1/8*/, 96 /*3/8*/,
117 160 /*5/8*/, 224 /*7/8*/, 117 160 /*5/8*/, 224 /*7/8*/,
118 -1 /*inv.*/, 0 /*BI fm*/ 118 -1 /*inv.*/, 0 /*BI fm*/
119 }; 119 };
120 #endif 120 #endif
121 121
122 const uint8_t vc1_bfraction_bits[23] = { 122 const uint8_t ff_vc1_bfraction_bits[23] = {
123 3, 3, 3, 3, 123 3, 3, 3, 3,
124 3, 3, 3, 124 3, 3, 3,
125 7, 7, 7, 7, 125 7, 7, 7, 7,
126 7, 7, 7, 7, 126 7, 7, 7, 7,
127 7, 7, 7, 7, 127 7, 7, 7, 7,
128 7, 7, 128 7, 7,
129 7, 7 129 7, 7
130 }; 130 };
131 const uint8_t vc1_bfraction_codes[23] = { 131 const uint8_t ff_vc1_bfraction_codes[23] = {
132 0, 1, 2, 3, 132 0, 1, 2, 3,
133 4, 5, 6, 133 4, 5, 6,
134 112, 113, 114, 115, 134 112, 113, 114, 115,
135 116, 117, 118, 119, 135 116, 117, 118, 119,
136 120, 121, 122, 123, 136 120, 121, 122, 123,
137 124, 125, 137 124, 125,
138 126, 127 138 126, 127
139 }; 139 };
140 140
141 //Same as H.264 141 //Same as H.264
142 const AVRational vc1_pixel_aspect[16]={ 142 const AVRational ff_vc1_pixel_aspect[16]={
143 {0, 1}, 143 {0, 1},
144 {1, 1}, 144 {1, 1},
145 {12, 11}, 145 {12, 11},
146 {10, 11}, 146 {10, 11},
147 {16, 11}, 147 {16, 11},
157 {0, 1}, 157 {0, 1},
158 {0, 1} 158 {0, 1}
159 }; 159 };
160 160
161 /* BitPlane IMODE - such a small table... */ 161 /* BitPlane IMODE - such a small table... */
162 const uint8_t vc1_imode_codes[7] = { 162 const uint8_t ff_vc1_imode_codes[7] = {
163 0, 2, 1, 3, 1, 2, 3 163 0, 2, 1, 3, 1, 2, 3
164 }; 164 };
165 const uint8_t vc1_imode_bits[7] = { 165 const uint8_t ff_vc1_imode_bits[7] = {
166 4, 2, 3, 2, 4, 3, 3 166 4, 2, 3, 2, 4, 3, 3
167 }; 167 };
168 168
169 /* Normal-2 imode */ 169 /* Normal-2 imode */
170 const uint8_t vc1_norm2_codes[4] = { 170 const uint8_t ff_vc1_norm2_codes[4] = {
171 0, 4, 5, 3 171 0, 4, 5, 3
172 }; 172 };
173 const uint8_t vc1_norm2_bits[4] = { 173 const uint8_t ff_vc1_norm2_bits[4] = {
174 1, 3, 3, 2 174 1, 3, 3, 2
175 }; 175 };
176 176
177 const uint16_t vc1_norm6_codes[64] = { 177 const uint16_t ff_vc1_norm6_codes[64] = {
178 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E, 178 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
179 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037, 179 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
180 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036, 180 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
181 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007, 181 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
182 }; 182 };
183 183
184 const uint8_t vc1_norm6_bits[64] = { 184 const uint8_t ff_vc1_norm6_bits[64] = {
185 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13, 185 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
186 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, 186 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
187 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9, 187 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
188 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6, 188 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
189 }; 189 };
190 /* Normal-6 imode */ 190 /* Normal-6 imode */
191 const uint8_t vc1_norm6_spec[64][5] = { 191 const uint8_t ff_vc1_norm6_spec[64][5] = {
192 { 0, 1, 1 }, 192 { 0, 1, 1 },
193 { 1, 2, 4 }, 193 { 1, 2, 4 },
194 { 2, 3, 4 }, 194 { 2, 3, 4 },
195 { 3, 0, 8 }, 195 { 3, 0, 8 },
196 { 4, 4, 4 }, 196 { 4, 4, 4 },
254 {62, 3, 5, 2, 4 }, 254 {62, 3, 5, 2, 4 },
255 {63, 3, 5, 1, 1 }, 255 {63, 3, 5, 1, 1 },
256 }; 256 };
257 257
258 /* 4MV Block pattern VLC tables */ 258 /* 4MV Block pattern VLC tables */
259 const uint8_t vc1_4mv_block_pattern_codes[4][16] = { 259 const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
260 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2}, 260 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
261 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0}, 261 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
262 { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0}, 262 { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
263 { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10} 263 { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 10}
264 }; 264 };
265 const uint8_t vc1_4mv_block_pattern_bits[4][16] = { 265 const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] = {
266 { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2}, 266 { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
267 { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2}, 267 { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
268 { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3}, 268 { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
269 { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4} 269 { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
270 }; 270 };
273 0, 2, 4, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21 273 0, 2, 4, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
274 }; 274 };
275 275
276 /* P-Picture CBPCY VLC tables */ 276 /* P-Picture CBPCY VLC tables */
277 #if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV? 277 #if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
278 const uint16_t vc1_cbpcy_p_codes[4][64] = { 278 const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
279 { 279 {
280 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119, 280 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
281 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63, 281 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63,
282 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62, 282 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62,
283 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3 283 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3
300 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29, 300 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29,
301 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31 301 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31
302 } 302 }
303 }; 303 };
304 304
305 const uint8_t vc1_cbpcy_p_bits[4][64] = { 305 const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
306 { 306 {
307 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8, 307 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8,
308 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7, 308 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7,
309 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7, 309 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7,
310 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2 310 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2
327 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 327 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
328 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8 328 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
329 } 329 }
330 }; 330 };
331 #else 331 #else
332 const uint16_t vc1_cbpcy_p_codes[4][64] = { 332 const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
333 { 333 {
334 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2, 334 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
335 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4, 335 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
336 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5, 336 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
337 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3 337 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
353 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 353 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
354 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 354 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
355 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31 355 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
356 } 356 }
357 }; 357 };
358 const uint8_t vc1_cbpcy_p_bits[4][64] = { 358 const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
359 { 359 {
360 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3, 360 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
361 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3, 361 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
362 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3, 362 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
363 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2 363 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
389 * 4x8:B:right 4x8:B:left 4x8:B:both 389 * 4x8:B:right 4x8:B:left 4x8:B:both
390 * 4x4:B 8x8:MB 390 * 4x4:B 8x8:MB
391 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both 391 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both
392 * 4x8,MB,right 4x8,MB,left 392 * 4x8,MB,right 4x8,MB,left
393 * 4x4,MB */ 393 * 4x4,MB */
394 const uint16_t vc1_ttmb_codes[3][16] = { 394 const uint16_t ff_vc1_ttmb_codes[3][16] = {
395 { 395 {
396 0x0003, 396 0x0003,
397 0x002E, 0x005F, 0x0000, 397 0x002E, 0x005F, 0x0000,
398 0x0016, 0x0015, 0x0001, 398 0x0016, 0x0015, 0x0001,
399 0x0004, 0x0014, 399 0x0004, 0x0014,
419 0x0101, 0x0041, 0x0011, 419 0x0101, 0x0041, 0x0011,
420 0x0100 420 0x0100
421 } 421 }
422 }; 422 };
423 423
424 const uint8_t vc1_ttmb_bits[3][16] = { 424 const uint8_t ff_vc1_ttmb_bits[3][16] = {
425 { 425 {
426 2, 426 2,
427 6, 7, 2, 427 6, 7, 2,
428 5, 5, 2, 428 5, 5, 2,
429 3, 5, 429 3, 5,
450 11 450 11
451 } 451 }
452 }; 452 };
453 453
454 /* TTBLK (Transform Type per Block) tables */ 454 /* TTBLK (Transform Type per Block) tables */
455 const uint8_t vc1_ttblk_codes[3][8] = { 455 const uint8_t ff_vc1_ttblk_codes[3][8] = {
456 { 0, 1, 3, 5, 16, 17, 18, 19}, 456 { 0, 1, 3, 5, 16, 17, 18, 19},
457 { 3, 0, 1, 2, 3, 5, 8, 9}, 457 { 3, 0, 1, 2, 3, 5, 8, 9},
458 { 1, 0, 1, 4, 6, 7, 10, 11} 458 { 1, 0, 1, 4, 6, 7, 10, 11}
459 }; 459 };
460 const uint8_t vc1_ttblk_bits[3][8] = { 460 const uint8_t ff_vc1_ttblk_bits[3][8] = {
461 { 2, 2, 2, 3, 5, 5, 5, 5}, 461 { 2, 2, 2, 3, 5, 5, 5, 5},
462 { 2, 3, 3, 3, 3, 3, 4, 4}, 462 { 2, 3, 3, 3, 3, 3, 4, 4},
463 { 2, 3, 3, 3, 3, 3, 4, 4} 463 { 2, 3, 3, 3, 3, 3, 4, 4}
464 }; 464 };
465 465
466 /* SUBBLKPAT tables, p93-94, reordered */ 466 /* SUBBLKPAT tables, p93-94, reordered */
467 const uint8_t vc1_subblkpat_codes[3][15] = { 467 const uint8_t ff_vc1_subblkpat_codes[3][15] = {
468 { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1}, 468 { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
469 { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1}, 469 { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
470 { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15} 470 { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
471 }; 471 };
472 const uint8_t vc1_subblkpat_bits[3][15] = { 472 const uint8_t ff_vc1_subblkpat_bits[3][15] = {
473 { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1}, 473 { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
474 { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2}, 474 { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
475 { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4} 475 { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
476 }; 476 };
477 477
478 /* MV differential tables, p265 */ 478 /* MV differential tables, p265 */
479 const uint16_t vc1_mv_diff_codes[4][73] = { 479 const uint16_t ff_vc1_mv_diff_codes[4][73] = {
480 { 480 {
481 0, 2, 3, 8, 576, 3, 2, 6, 481 0, 2, 3, 8, 576, 3, 2, 6,
482 5, 577, 578, 7, 8, 9, 40, 19, 482 5, 577, 578, 7, 8, 9, 40, 19,
483 37, 82, 21, 22, 23, 579, 580, 166, 483 37, 82, 21, 22, 23, 579, 580, 166,
484 96, 167, 49, 194, 195, 581, 582, 583, 484 96, 167, 49, 194, 195, 581, 582, 583,
524 25, 26, 39, 108, 13, 109, 55, 56, 524 25, 26, 39, 108, 13, 109, 55, 56,
525 57, 116, 11, 153, 234, 235, 118, 119, 525 57, 116, 11, 153, 234, 235, 118, 119,
526 15 /* 73 elements */ 526 15 /* 73 elements */
527 } 527 }
528 }; 528 };
529 const uint8_t vc1_mv_diff_bits[4][73] = { 529 const uint8_t ff_vc1_mv_diff_bits[4][73] = {
530 { 530 {
531 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9, 531 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
532 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14, 532 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
533 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9, 533 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9,
534 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7, 534 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7,
559 }; 559 };
560 560
561 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */ 561 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
562 562
563 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */ 563 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
564 const int8_t vc1_normal_zz[64] = { 564 const int8_t ff_vc1_normal_zz[64] = {
565 0, 8, 1, 2, 9, 16, 24, 17, 565 0, 8, 1, 2, 9, 16, 24, 17,
566 10, 3, 4, 11, 18, 25, 32, 40, 566 10, 3, 4, 11, 18, 25, 32, 40,
567 33, 48, 26, 19, 12, 5, 6, 13, 567 33, 48, 26, 19, 12, 5, 6, 13,
568 20, 27, 34, 41, 56, 49, 57, 42, 568 20, 27, 34, 41, 56, 49, 57, 42,
569 35, 28, 21, 14, 7, 15, 22, 29, 569 35, 28, 21, 14, 7, 15, 22, 29,
570 36, 43, 50, 58, 51, 59, 44, 37, 570 36, 43, 50, 58, 51, 59, 44, 37,
571 30, 23, 31, 38, 45, 52, 60, 53, 571 30, 23, 31, 38, 45, 52, 60, 53,
572 61, 46, 39, 47, 54, 62, 55, 63 572 61, 46, 39, 47, 54, 62, 55, 63
573 }; 573 };
574 574
575 const int8_t vc1_horizontal_zz [64] = /* Table 227 */ 575 const int8_t ff_vc1_horizontal_zz [64] = /* Table 227 */
576 { 576 {
577 0, 1, 8, 2, 3, 9, 16, 24, 577 0, 1, 8, 2, 3, 9, 16, 24,
578 17, 10, 4, 5, 11, 18, 25, 32, 578 17, 10, 4, 5, 11, 18, 25, 32,
579 40, 48, 33, 26, 19, 12, 6, 7, 579 40, 48, 33, 26, 19, 12, 6, 7,
580 13, 20, 27, 34, 41, 56, 49, 57, 580 13, 20, 27, 34, 41, 56, 49, 57,
582 36, 43, 50, 58, 51, 44, 37, 30, 582 36, 43, 50, 58, 51, 44, 37, 30,
583 23, 31, 38, 45, 52, 59, 60, 53, 583 23, 31, 38, 45, 52, 59, 60, 53,
584 46, 39, 47, 54, 61, 62, 55, 63 584 46, 39, 47, 54, 61, 62, 55, 63
585 }; 585 };
586 586
587 const int8_t vc1_vertical_zz [64] = /* Table 228 */ 587 const int8_t ff_vc1_vertical_zz [64] = /* Table 228 */
588 { 588 {
589 0, 8, 16, 1, 24, 32, 40, 9, 589 0, 8, 16, 1, 24, 32, 40, 9,
590 2, 3, 10, 17, 25, 48, 56, 41, 590 2, 3, 10, 17, 25, 48, 56, 41,
591 33, 26, 18, 11, 4, 5, 12, 19, 591 33, 26, 18, 11, 4, 5, 12, 19,
592 27, 34, 49, 57, 50, 42, 35, 28, 592 27, 34, 49, 57, 50, 42, 35, 28,
594 43, 51, 58, 59, 52, 44, 37, 30, 594 43, 51, 58, 59, 52, 44, 37, 30,
595 22, 15, 23, 31, 38, 45, 60, 53, 595 22, 15, 23, 31, 38, 45, 60, 53,
596 46, 39, 47, 54, 61, 62, 55, 63 596 46, 39, 47, 54, 61, 62, 55, 63
597 }; 597 };
598 598
599 const int8_t vc1_simple_progressive_8x8_zz [64] = 599 const int8_t ff_vc1_simple_progressive_8x8_zz [64] =
600 /* Table 229 */ 600 /* Table 229 */
601 { 601 {
602 0, 8, 1, 2, 9, 16, 24, 17, 602 0, 8, 1, 2, 9, 16, 24, 17,
603 10, 3, 4, 11, 18, 25, 32, 40, 603 10, 3, 4, 11, 18, 25, 32, 40,
604 48, 56, 41, 33, 26, 19, 12, 5, 604 48, 56, 41, 33, 26, 19, 12, 5,
607 22, 29, 36, 43, 51, 59, 60, 52, 607 22, 29, 36, 43, 51, 59, 60, 52,
608 44, 37, 30, 23, 31, 38, 45, 53, 608 44, 37, 30, 23, 31, 38, 45, 53,
609 61, 62, 54, 46, 39, 47, 55, 63 609 61, 62, 54, 46, 39, 47, 55, 63
610 }; 610 };
611 611
612 const int8_t vc1_simple_progressive_8x4_zz [32] = /* Table 230 */ 612 const int8_t ff_vc1_simple_progressive_8x4_zz [32] = /* Table 230 */
613 { 613 {
614 0, 1, 2, 8, 3, 9, 10, 16, 614 0, 1, 2, 8, 3, 9, 10, 16,
615 4, 11, 17, 24, 18, 12, 5, 19, 615 4, 11, 17, 24, 18, 12, 5, 19,
616 25, 13, 20, 26, 27, 6, 21, 28, 616 25, 13, 20, 26, 27, 6, 21, 28,
617 14, 22, 29, 7, 30, 15, 23, 31 617 14, 22, 29, 7, 30, 15, 23, 31
618 }; 618 };
619 619
620 const int8_t vc1_simple_progressive_4x8_zz [32] = /* Table 231 */ 620 const int8_t ff_vc1_simple_progressive_4x8_zz [32] = /* Table 231 */
621 { 621 {
622 0, 8, 1, 16, 622 0, 8, 1, 16,
623 9, 24, 17, 2, 623 9, 24, 17, 2,
624 32, 10, 25, 40, 624 32, 10, 25, 40,
625 18, 48, 33, 26, 625 18, 48, 33, 26,
628 19, 50, 27, 58, 628 19, 50, 27, 58,
629 35, 43, 51, 59 629 35, 43, 51, 59
630 }; 630 };
631 631
632 /* Table 232 */ 632 /* Table 232 */
633 const int8_t vc1_simple_progressive_4x4_zz [16] = 633 const int8_t ff_vc1_simple_progressive_4x4_zz [16] =
634 { 634 {
635 0, 8, 16, 1, 635 0, 8, 16, 1,
636 9, 24, 17, 2, 636 9, 24, 17, 2,
637 10, 18, 25, 3, 637 10, 18, 25, 3,
638 11, 26, 19, 27 638 11, 26, 19, 27
639 }; 639 };
640 640
641 const int8_t vc1_adv_progressive_8x4_zz [32] = /* Table 233 */ 641 const int8_t ff_vc1_adv_progressive_8x4_zz [32] = /* Table 233 */
642 { 642 {
643 0, 8, 1, 16, 2, 9, 10, 3, 643 0, 8, 1, 16, 2, 9, 10, 3,
644 24, 17, 4, 11, 18, 12, 5, 19, 644 24, 17, 4, 11, 18, 12, 5, 19,
645 25, 13, 20, 26, 27, 6, 21, 28, 645 25, 13, 20, 26, 27, 6, 21, 28,
646 14, 22, 29, 7, 30, 15, 23, 31 646 14, 22, 29, 7, 30, 15, 23, 31
647 }; 647 };
648 648
649 const int8_t vc1_adv_progressive_4x8_zz [32] = /* Table 234 */ 649 const int8_t ff_vc1_adv_progressive_4x8_zz [32] = /* Table 234 */
650 { 650 {
651 0, 1, 8, 2, 651 0, 1, 8, 2,
652 9, 16, 17, 24, 652 9, 16, 17, 24,
653 10, 32, 25, 18, 653 10, 32, 25, 18,
654 40, 3, 33, 26, 654 40, 3, 33, 26,
656 34, 49, 57, 42, 656 34, 49, 57, 42,
657 19, 50, 27, 58, 657 19, 50, 27, 58,
658 35, 43, 51, 59 658 35, 43, 51, 59
659 }; 659 };
660 660
661 const int8_t vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */ 661 const int8_t ff_vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */
662 { 662 {
663 0, 8, 1, 16, 24, 9, 2, 32, 663 0, 8, 1, 16, 24, 9, 2, 32,
664 40, 48, 56, 17, 10, 3, 25, 18, 664 40, 48, 56, 17, 10, 3, 25, 18,
665 11, 4, 33, 41, 49, 57, 26, 34, 665 11, 4, 33, 41, 49, 57, 26, 34,
666 42, 50, 58, 19, 12, 5, 27, 20, 666 42, 50, 58, 19, 12, 5, 27, 20,
668 22, 29, 36, 43, 51, 59, 60, 52, 668 22, 29, 36, 43, 51, 59, 60, 52,
669 44, 37, 30, 23, 31, 38, 45, 53, 669 44, 37, 30, 23, 31, 38, 45, 53,
670 61, 62, 54, 46, 39, 47, 55, 63 670 61, 62, 54, 46, 39, 47, 55, 63
671 }; 671 };
672 672
673 const int8_t vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */ 673 const int8_t ff_vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */
674 { 674 {
675 0, 8, 16, 24, 1, 9, 2, 17, 675 0, 8, 16, 24, 1, 9, 2, 17,
676 25, 10, 3, 18, 26, 4, 11, 19, 676 25, 10, 3, 18, 26, 4, 11, 19,
677 12, 5, 13, 20, 27, 6, 21, 28, 677 12, 5, 13, 20, 27, 6, 21, 28,
678 14, 22, 29, 7, 30, 15, 23, 31 678 14, 22, 29, 7, 30, 15, 23, 31
679 }; 679 };
680 680
681 const int8_t vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */ 681 const int8_t ff_vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */
682 { 682 {
683 0, 1, 2, 8, 683 0, 1, 2, 8,
684 16, 9, 24, 17, 684 16, 9, 24, 17,
685 10, 3, 32, 40, 685 10, 3, 32, 40,
686 48, 56, 25, 18, 686 48, 56, 25, 18,
688 49, 57, 11, 42, 688 49, 57, 11, 42,
689 19, 50, 27, 58, 689 19, 50, 27, 58,
690 35, 43, 51, 59 690 35, 43, 51, 59
691 }; 691 };
692 692
693 const int8_t vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */ 693 const int8_t ff_vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */
694 { 694 {
695 0, 8, 16, 24, 695 0, 8, 16, 24,
696 1, 9, 17, 2, 696 1, 9, 17, 2,
697 25, 10, 18, 3, 697 25, 10, 18, 3,
698 26, 11, 19, 27 698 26, 11, 19, 27
699 }; 699 };
700 700
701 701
702 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */ 702 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
703 const int32_t vc1_dqscale[63] = { 703 const int32_t ff_vc1_dqscale[63] = {
704 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000, 704 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
705 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000, 705 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
706 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB, 706 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
707 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000, 707 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
708 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A, 708 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A,