VC-1 decoder with I-frames support and partial P-frames decoding
[libav.git] / libavcodec / vc1data.h
1 /**
2 * @file vc1data.h
3 * VC-1 tables.
4 */
5
6 #ifndef VC1DATA_H
7 #define VC1DATA_H
8
9 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
10 const int16_t vc1_bfraction_lut[23] = {
11 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
12 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
13 504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
14 120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
15 600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
16 525 /*5/8*/, 735 /*7/8*/,
17 -1 /*inv.*/, 0 /*BI fm*/
18 };
19 const uint8_t vc1_bfraction_bits[23] = {
20 3, 3, 3, 3,
21 3, 3, 3,
22 7, 7, 7, 7,
23 7, 7, 7, 7,
24 7, 7, 7, 7,
25 7, 7,
26 7, 7
27 };
28 const uint8_t vc1_bfraction_codes[23] = {
29 0, 1, 2, 3,
30 4, 5, 6,
31 112, 113, 114, 115,
32 116, 117, 118, 119,
33 120, 121, 122, 123,
34 124, 125,
35 126, 127
36 };
37
38 //Same as H.264
39 static const AVRational vc1_pixel_aspect[16]={
40 {0, 1},
41 {1, 1},
42 {12, 11},
43 {10, 11},
44 {16, 11},
45 {40, 33},
46 {24, 11},
47 {20, 11},
48 {32, 11},
49 {80, 33},
50 {18, 11},
51 {15, 11},
52 {64, 33},
53 {160, 99},
54 {0, 1},
55 {0, 1}
56 };
57
58 /* BitPlane IMODE - such a small table... */
59 static const uint8_t vc1_imode_codes[7] = {
60 0, 2, 1, 3, 1, 2, 3
61 };
62 static const uint8_t vc1_imode_bits[7] = {
63 4, 2, 3, 2, 4, 3, 3
64 };
65
66 /* Normal-2 imode */
67 static const uint8_t vc1_norm2_codes[4] = {
68 0, 4, 5, 3
69 };
70 static const uint8_t vc1_norm2_bits[4] = {
71 1, 3, 3, 2
72 };
73
74 static const uint16_t vc1_norm6_codes[64] = {
75 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
76 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
77 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
78 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
79 };
80
81 static const uint8_t vc1_norm6_bits[64] = {
82 1, 4, 4, 8, 4, 8, 8, 10, 4, 8, 8, 10, 8, 10, 10, 13,
83 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
84 4, 8, 8, 10, 8, 10, 10, 13, 8, 10, 10, 13, 10, 13, 13, 9,
85 8, 10, 10, 13, 10, 13, 13, 9, 10, 13, 13, 9, 13, 9, 9, 6,
86 };
87 /* Normal-6 imode */
88 static const uint8_t vc1_norm6_spec[64][5] = {
89 { 0, 1, 1 },
90 { 1, 2, 4 },
91 { 2, 3, 4 },
92 { 3, 0, 8 },
93 { 4, 4, 4 },
94 { 5, 1, 8 },
95 { 6, 2, 8 },
96 { 7, 2, 5, 7, 5 },
97 { 8, 5, 4 },
98 { 9, 3, 8 },
99 {10, 4, 8 },
100 {11, 2, 5, 11, 5 },
101 {12, 5, 8 },
102 {13, 2, 5, 13, 5 },
103 {14, 2, 5, 14, 5 },
104 {15, 3, 5, 14, 8 },
105 {16, 6, 4 },
106 {17, 6, 8 },
107 {18, 7, 8 },
108 {19, 2, 5, 19, 5 },
109 {20, 8, 8 },
110 {21, 2, 5, 21, 5 },
111 {22, 2, 5, 22, 5 },
112 {23, 3, 5, 13, 8 },
113 {24, 9, 8 },
114 {25, 2, 5, 25, 5 },
115 {26, 2, 5, 26, 5 },
116 {27, 3, 5, 12, 8 },
117 {28, 2, 5, 28, 5 },
118 {29, 3, 5, 11, 8 },
119 {30, 3, 5, 10, 8 },
120 {31, 3, 5, 7, 4 },
121 {32, 7, 4 },
122 {33, 10, 8 },
123 {34, 11, 8 },
124 {35, 2, 5, 3, 5 },
125 {36, 12, 8 },
126 {37, 2, 5, 5, 5 },
127 {38, 2, 5, 6, 5 },
128 {39, 3, 5, 9, 8 },
129 {40, 13, 8 },
130 {41, 2, 5, 9, 5 },
131 {42, 2, 5, 10, 5 },
132 {43, 3, 5, 8, 8 },
133 {44, 2, 5, 12, 5 },
134 {45, 3, 5, 7, 8 },
135 {46, 3, 5, 6, 8 },
136 {47, 3, 5, 6, 4 },
137 {48, 14, 8 },
138 {49, 2, 5, 17, 5 },
139 {50, 2, 5, 18, 5 },
140 {51, 3, 5, 5, 8 },
141 {52, 2, 5, 20, 5 },
142 {53, 3, 5, 4, 8 },
143 {54, 3, 5, 3, 8 },
144 {55, 3, 5, 5, 4 },
145 {56, 2, 5, 24, 5 },
146 {57, 3, 5, 2, 8 },
147 {58, 3, 5, 1, 8 },
148 {59, 3, 5, 4, 4 },
149 {60, 3, 5, 0, 8 },
150 {61, 3, 5, 3, 4 },
151 {62, 3, 5, 2, 4 },
152 {63, 3, 5, 1, 1 },
153 };
154
155 /* 4MV Block pattern VLC tables */
156 static const uint8_t vc1_4mv_block_pattern_codes[4][16] = {
157 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2},
158 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0},
159 { 15, 6, 7, 2, 8, 3, 28, 9, 10, 29, 4, 11, 5, 12, 13, 0},
160 { 0, 11, 12, 4, 13, 5, 30, 16, 14, 31, 6, 17, 7, 18, 19, 19}
161 };
162 static const uint8_t vc1_4mv_block_pattern_bits[4][16] = {
163 { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
164 { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
165 { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
166 { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
167 };
168
169 const uint8_t wmv3_dc_scale_table[32]={
170 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
171 };
172
173 /* P-Picture CBPCY VLC tables */
174 #if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
175 static const uint16_t vc1_cbpcy_p_codes[4][64] = {
176 {
177 0, 6, 15, 13, 13, 11, 3, 13, 5, 8, 49, 10, 12, 114, 102, 119,
178 1, 54, 96, 8, 10, 111, 5, 15, 12, 10, 2, 12, 13, 115, 53, 63,
179 1, 7, 1, 7, 14, 12, 4, 14, 1, 9, 97, 11, 7, 58, 52, 62,
180 4, 103, 1, 9, 11, 56, 101, 118, 4, 110, 100, 30, 2, 5, 4, 3
181 },
182 {
183 0, 9, 1, 18, 5, 14, 237, 26, 3, 121, 3, 22, 13, 16, 6, 30,
184 2, 10, 1, 20, 12, 241, 5, 28, 16, 12, 3, 24, 28, 124, 239, 247,
185 1, 240, 1, 19, 18, 15, 4, 27, 1, 122, 2, 23, 1, 17, 7, 31,
186 1, 11, 2, 21, 19, 246, 238, 29, 17, 13, 236, 25, 58, 63, 8, 125
187 },
188 {
189 0, 201, 25, 231, 5, 221, 1, 3, 2, 414, 2, 241, 16, 225, 195, 492,
190 2, 412, 1, 240, 7, 224, 98, 245, 1, 220, 96, 5, 9, 230, 101, 247,
191 1, 102, 1, 415, 24, 3, 2, 244, 3, 54, 3, 484, 17, 114, 200, 493,
192 3, 413, 1, 4, 13, 113, 99, 485, 4, 111, 194, 243, 5, 29, 26, 31
193 },
194 {
195 0, 28, 12, 44, 3, 36, 20, 52, 2, 32, 16, 48, 8, 40, 24, 28,
196 1, 30, 14, 46, 6, 38, 22, 54, 3, 34, 18, 50, 10, 42, 26, 30,
197 1, 29, 13, 45, 5, 37, 21, 53, 2, 33, 17, 49, 9, 41, 25, 29,
198 1, 31, 15, 47, 7, 39, 23, 55, 4, 35, 19, 51, 11, 43, 27, 31
199 }
200 };
201
202 static const uint8_t vc1_cbpcy_p_bits[4][64] = {
203 {
204 13, 13, 7, 13, 7, 13, 13, 12, 6, 13, 7, 12, 6, 8, 8, 8,
205 5, 7, 8, 12, 6, 8, 13, 12, 7, 13, 13, 12, 6, 8, 7, 7,
206 6, 13, 8, 12, 7, 13, 13, 12, 7, 13, 8, 12, 5, 7, 7, 7,
207 6, 8, 13, 12, 6, 7, 8, 8, 5, 8, 8, 6, 3, 3, 3, 2
208 },
209 {
210 14, 13, 8, 13, 3, 13, 8, 13, 3, 7, 8, 13, 4, 13, 13, 13,
211 3, 13, 13, 13, 4, 8, 13, 13, 5, 13, 13, 13, 5, 7, 8, 8,
212 3, 8, 14, 13, 5, 13, 13, 13, 4, 7, 13, 13, 6, 13, 13, 13,
213 5, 13, 8, 13, 5, 8, 8, 13, 5, 13, 8, 13, 6, 6, 13, 7
214 },
215 {
216 13, 8, 6, 8, 4, 8, 13, 12, 4, 9, 8, 8, 5, 8, 8, 9,
217 5, 9, 10, 8, 4, 8, 7, 8, 6, 8, 7, 13, 4, 8, 7, 8,
218 5, 7, 8, 9, 6, 13, 13, 8, 4, 6, 8, 9, 5, 7, 8, 9,
219 5, 9, 9, 13, 5, 7, 7, 9, 4, 7, 8, 8, 3, 5, 5, 5
220 },
221 {
222 9, 9, 9, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 8,
223 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
224 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
225 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8
226 }
227 };
228 #else
229 static const uint16_t vc1_cbpcy_p_codes[4][64] = {
230 {
231 0, 1, 1, 4, 5, 1, 12, 4, 13, 14, 10, 11, 12, 7, 13, 2,
232 15, 1, 96, 1, 49, 97, 2, 100, 3, 4, 5, 101, 102, 52, 53, 4,
233 6, 7, 54, 103, 8, 9, 10, 110, 11, 12, 111, 56, 114, 58, 115, 5,
234 13, 7, 8, 9, 10, 11, 12, 30, 13, 14, 15, 118, 119, 62, 63, 3
235 },
236 {
237 0, 1, 2, 1, 3, 1, 16, 17, 5, 18, 12, 19, 13, 1, 28, 58,
238 1, 1, 1, 2, 3, 2, 3, 236, 237, 4, 5, 238, 6, 7, 239, 8,
239 9, 240, 10, 11, 121, 122, 12, 13, 14, 15, 241, 246, 16, 17, 124, 63,
240 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 247, 125
241 },
242 {
243 0, 1, 2, 3, 2, 3, 1, 4, 5, 24, 7, 13, 16, 17, 9, 5,
244 25, 1, 1, 1, 2, 3, 96, 194, 1, 2, 98, 99, 195, 200, 101, 26,
245 201, 102, 412, 413, 414, 54, 220, 111, 221, 3, 224, 113, 225, 114, 230, 29,
246 231, 415, 240, 4, 241, 484, 5, 243, 3, 244, 245, 485, 492, 493, 247, 31
247 },
248 {
249 0, 1, 1, 1, 2, 2, 3, 4, 3, 5, 6, 7, 8, 9, 10, 11,
250 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
251 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
252 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 28, 29, 30, 31
253 }
254 };
255 static const uint8_t vc1_cbpcy_p_bits[4][64] = {
256 {
257 13, 6, 5, 6, 6, 7, 7, 5, 7, 7, 6, 6, 6, 5, 6, 3,
258 7, 8, 8, 13, 7, 8, 13, 8, 13, 13, 13, 8, 8, 7, 7, 3,
259 13, 13, 7, 8, 13, 13, 13, 8, 13, 13, 8, 7, 8, 7, 8, 3,
260 13, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 8, 8, 7, 7, 2
261 },
262 {
263 14, 3, 3, 5, 3, 4, 5, 5, 3, 5, 4, 5, 4, 6, 5, 6,
264 8, 14, 13, 8, 8, 13, 13, 8, 8, 13, 13, 8, 13, 13, 8, 13,
265 13, 8, 13, 13, 7, 7, 13, 13, 13, 13, 8, 8, 13, 13, 7, 6,
266 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 7
267 },
268 {
269 13, 5, 5, 5, 4, 4, 6, 4, 4, 6, 4, 5, 5, 5, 4, 3,
270 6, 8, 10, 9, 8, 8, 7, 8, 13, 13, 7, 7, 8, 8, 7, 5,
271 8, 7, 9, 9, 9, 6, 8, 7, 8, 13, 8, 7, 8, 7, 8, 5,
272 8, 9, 8, 13, 8, 9, 13, 8, 12, 8, 8, 9, 9, 9, 8, 5
273 },
274 {
275 9, 2, 3, 9, 2, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 9,
276 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
277 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
278 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8
279 }
280 };
281 #endif
282
283 /* MacroBlock Transform Type: 7.1.3.11, p89
284 * 8x8:B
285 * 8x4:B:btm 8x4:B:top 8x4:B:both,
286 * 4x8:B:right 4x8:B:left 4x8:B:both
287 * 4x4:B 8x8:MB
288 * 8x4:MB:btm 8x4:MB:top 8x4,MB,both
289 * 4x8,MB,right 4x8,MB,left
290 * 4x4,MB */
291 static const uint16_t vc1_ttmb_codes[3][16] = {
292 {
293 0x0003,
294 0x002E, 0x005F, 0x0000,
295 0x0016, 0x0015, 0x0001,
296 0x0004, 0x0014,
297 0x02F1, 0x0179, 0x017B,
298 0x0BC0, 0x0BC1, 0x05E1,
299 0x017A
300 },
301 {
302 0x0006,
303 0x0006, 0x0003, 0x0007,
304 0x000F, 0x000E, 0x0000,
305 0x0002, 0x0002,
306 0x0014, 0x0011, 0x000B,
307 0x0009, 0x0021, 0x0015,
308 0x0020
309 },
310 {
311 0x0006,
312 0x0000, 0x000E, 0x0005,
313 0x0002, 0x0003, 0x0003,
314 0x000F, 0x0002,
315 0x0081, 0x0021, 0x0009,
316 0x0101, 0x0041, 0x0011,
317 0x0100
318 }
319 };
320
321 static const uint8_t vc1_ttmb_bits[3][16] = {
322 {
323 2,
324 6, 7, 2,
325 5, 5, 2,
326 3, 5,
327 10, 9, 9,
328 12, 12, 11,
329 9
330 },
331 {
332 3,
333 4, 4, 4,
334 4, 4, 3,
335 3, 2,
336 7, 7, 6,
337 6, 8, 7,
338 8
339 },
340 {
341 3,
342 3, 4, 5,
343 3, 3, 4,
344 4, 2,
345 10, 8, 6,
346 11, 9, 7,
347 11
348 }
349 };
350
351 /* TTBLK (Transform Type per Block) tables */
352 static const uint8_t vc1_ttblk_codes[3][8] = {
353 { 0, 1, 3, 5, 16, 17, 18, 19},
354 { 3, 0, 1, 2, 3, 5, 8, 9},
355 { 1, 0, 1, 4, 6, 7, 10, 11}
356 };
357 static const uint8_t vc1_ttblk_bits[3][8] = {
358 { 2, 2, 2, 3, 5, 5, 5, 5},
359 { 2, 3, 3, 3, 3, 3, 4, 4},
360 { 2, 3, 3, 3, 3, 3, 4, 4}
361 };
362
363 /* SUBBLKPAT tables, p93-94, reordered */
364 static const uint8_t vc1_subblkpat_codes[3][15] = {
365 { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1},
366 { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1},
367 { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15}
368 };
369 static const uint8_t vc1_subblkpat_bits[3][15] = {
370 { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1},
371 { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2},
372 { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4}
373 };
374
375 /* MV differential tables, p265 */
376 static const uint16_t vc1_mv_diff_codes[4][73] = {
377 {
378 0, 2, 3, 8, 576, 3, 2, 6,
379 5, 577, 578, 7, 8, 9, 40, 19,
380 37, 82, 21, 22, 23, 579, 580, 166,
381 96, 167, 49, 194, 195, 581, 582, 583,
382 292, 293, 294, 13, 2, 7, 24, 50,
383 102, 295, 13, 7, 8, 18, 50, 103,
384 38, 20, 21, 22, 39, 204, 103, 23,
385 24, 25, 104, 410, 105, 106, 107, 108,
386 109, 220, 411, 442, 222, 443, 446, 447,
387 7 /* 73 elements */
388 },
389 {
390 0, 4, 5, 3, 4, 3, 4, 5,
391 20, 6, 21, 44, 45, 46, 3008, 95,
392 112, 113, 57, 3009, 3010, 116, 117, 3011,
393 118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
394 3019, 3020, 3021, 3022, 1, 4, 15, 160,
395 161, 41, 6, 11, 42, 162, 43, 119,
396 56, 57, 58, 163, 236, 237, 3023, 119,
397 120, 242, 122, 486, 1512, 487, 246, 494,
398 1513, 495, 1514, 1515, 1516, 1517, 1518, 1519,
399 31 /* 73 elements */
400 },
401 {
402 0, 512, 513, 514, 515, 2, 3, 258,
403 259, 260, 261, 262, 263, 264, 265, 266,
404 267, 268, 269, 270, 271, 272, 273, 274,
405 275, 276, 277, 278, 279, 280, 281, 282,
406 283, 284, 285, 286, 1, 5, 287, 288,
407 289, 290, 6, 7, 291, 292, 293, 294,
408 295, 296, 297, 298, 299, 300, 301, 302,
409 303, 304, 305, 306, 307, 308, 309, 310,
410 311, 312, 313, 314, 315, 316, 317, 318,
411 319 /* 73 elements */
412 },
413 {
414 0, 1, 1, 2, 3, 4, 1, 5,
415 4, 3, 5, 8, 6, 9, 10, 11,
416 12, 7, 104, 14, 105, 4, 10, 15,
417 11, 6, 14, 8, 106, 107, 108, 15,
418 109, 9, 55, 10, 1, 2, 1, 2,
419 3, 12, 6, 2, 6, 7, 28, 7,
420 15, 8, 5, 18, 29, 152, 77, 24,
421 25, 26, 39, 108, 13, 109, 55, 56,
422 57, 116, 11, 153, 234, 235, 118, 119,
423 15 /* 73 elements */
424 }
425 };
426 static const uint8_t vc1_mv_diff_bits[4][73] = {
427 {
428 6, 7, 7, 8, 14, 6, 5, 6, 7, 14, 14, 6, 6, 6, 8, 9,
429 10, 9, 7, 7, 7, 14, 14, 10, 9, 10, 8, 10, 10, 14, 14, 14,
430 13, 13, 13, 6, 3, 5, 6, 8, 9, 13, 5, 4, 4, 5, 7, 9,
431 6, 5, 5, 5, 6, 9, 8, 5, 5, 5, 7, 10, 7, 7, 7, 7,
432 7, 8, 10, 9, 8, 9, 9, 9, 3 /* 73 elements */
433 },
434 {
435 5, 7, 7, 6, 6, 5, 5, 6, 7, 5, 7, 8, 8, 8, 14, 9,
436 9, 9, 8, 14, 14, 9, 9, 14, 9, 14, 14, 14, 14, 14, 14, 14,
437 14, 14, 14, 14, 2, 3, 6, 8, 8, 6, 3, 4, 6, 8, 6, 9,
438 6, 6, 6, 8, 8, 8, 14, 7, 7, 8, 7, 9, 13, 9, 8, 9,
439 13, 9, 13, 13, 13, 13, 13, 13, 5 /* 73 elements */
440
441 },
442 {
443 3, 12, 12, 12, 12, 3, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
444 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
445 11, 11, 11, 11, 1, 5, 11, 11, 11, 11, 4, 4, 11, 11, 11, 11,
446 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
447 11, 11, 11, 11, 11, 11, 11, 11, 11 /* 73 elements */
448 },
449 {
450 15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
451 12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
452 15, 10, 14, 10, 4, 4, 5, 7, 8, 9, 5, 3, 4, 5, 6, 8,
453 5, 4, 3, 5, 6, 8, 7, 5, 5, 5, 6, 7, 9, 7, 6, 6,
454 6, 7, 10, 8, 8, 8, 7, 7, 4 /* 73 elements */
455 }
456 };
457
458 /* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
459
460 /* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
461 static const int8_t vc1_normal_zz[64] = {
462 0, 8, 1, 2, 9, 16, 24, 17,
463 10, 3, 4, 11, 18, 25, 32, 40,
464 33, 48, 26, 19, 12, 5, 6, 13,
465 20, 27, 34, 41, 56, 49, 57, 42,
466 35, 28, 21, 14, 7, 15, 22, 29,
467 36, 43, 50, 58, 51, 59, 44, 37,
468 30, 23, 31, 38, 45, 52, 60, 53,
469 61, 46, 39, 47, 54, 62, 55, 63
470 };
471
472 static const int8_t vc1_horizontal_zz [64] = /* Table 227 */
473 {
474 0, 1, 8, 2, 3, 9, 16, 24,
475 17, 10, 4, 5, 11, 18, 25, 32,
476 40, 48, 33, 26, 19, 12, 6, 7,
477 13, 20, 27, 34, 41, 56, 49, 57,
478 42, 35, 28, 21, 14, 15, 22, 29,
479 36, 43, 50, 58, 51, 44, 37, 30,
480 23, 31, 38, 45, 52, 59, 60, 53,
481 46, 39, 47, 54, 61, 62, 55, 63
482 };
483
484 static const int8_t vc1_vertical_zz [64] = /* Table 228 */
485 {
486 0, 8, 16, 1, 24, 32, 40, 9,
487 2, 3, 10, 17, 25, 48, 56, 41,
488 33, 26, 18, 11, 4, 5, 12, 19,
489 27, 34, 49, 57, 50, 42, 35, 28,
490 20, 13, 6, 7, 14, 21, 29, 36,
491 43, 51, 58, 59, 52, 44, 37, 30,
492 22, 15, 23, 31, 38, 45, 60, 53,
493 46, 39, 47, 54, 61, 62, 55, 63
494 };
495
496 static const int8_t vc1_simple_progressive_8x8_zz [64] =
497 /* Table 229 */
498 {
499 0, 8, 1, 2, 9, 16, 24, 17,
500 10, 3, 4, 11, 18, 25, 32, 40,
501 48, 56, 41, 33, 26, 19, 12, 5,
502 6, 13, 20, 27, 34, 49, 57, 58,
503 50, 42, 35, 28, 21, 14, 7, 15,
504 22, 29, 36, 43, 51, 59, 60, 52,
505 44, 37, 30, 23, 31, 38, 45, 53,
506 61, 62, 54, 46, 39, 47, 55, 63
507 };
508
509 static const int8_t vc1_simple_progressive_8x4_zz [32] = /* Table 230 */
510 {
511 0, 1, 2, 8, 3, 9, 10, 16,
512 4, 11, 17, 24, 18, 12, 5, 19,
513 25, 13, 20, 26, 27, 6, 21, 28,
514 14, 22, 29, 7, 30, 15, 23, 31
515 };
516
517 static const int8_t vc1_simple_progressive_4x8_zz [32] = /* Table 231 */
518 {
519 0, 8, 1, 16,
520 9, 24, 17, 2,
521 32, 10, 25, 40,
522 18, 48, 33, 26,
523 56, 41, 34, 3,
524 49, 57, 11, 42,
525 19, 50, 27, 58,
526 35, 43, 51, 59
527 };
528
529 /* Table 232 */
530 static const int8_t vc1_simple_progressive_4x4_zz [16] =
531 {
532 0, 8, 16, 1,
533 9, 24, 17, 2,
534 10, 18, 25, 3,
535 11, 26, 19, 27
536 };
537
538 static const int8_t vc1_adv_progressive_8x4_zz [32] = /* Table 233 */
539 {
540 0, 8, 1, 16, 2, 9, 10, 3,
541 24, 17, 4, 11, 18, 12, 5, 19,
542 25, 13, 20, 26, 27, 6, 21, 28,
543 14, 22, 29, 7, 30, 15, 23, 31
544 };
545
546 static const int8_t vc1_adv_progressive_4x8_zz [32] = /* Table 234 */
547 {
548 0, 1, 8, 2,
549 9, 16, 17, 24,
550 10, 32, 25, 18,
551 40, 3, 33, 26,
552 48, 11, 56, 41,
553 34, 49, 57, 42,
554 19, 50, 27, 58,
555 35, 43, 51, 59
556 };
557
558 static const int8_t vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */
559 {
560 0, 8, 1, 16, 24, 9, 2, 32,
561 40, 48, 56, 17, 10, 3, 25, 18,
562 11, 4, 33, 41, 49, 57, 26, 34,
563 42, 50, 58, 19, 12, 5, 27, 20,
564 13, 6, 35, 28, 21, 14, 7, 15,
565 22, 29, 36, 43, 51, 59, 60, 52,
566 44, 37, 30, 23, 31, 38, 45, 53,
567 61, 62, 54, 46, 39, 47, 55, 63
568 };
569
570 static const int8_t vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */
571 {
572 0, 8, 16, 24, 1, 9, 2, 17,
573 25, 10, 3, 18, 26, 4, 11, 19,
574 12, 5, 13, 20, 27, 6, 21, 28,
575 14, 22, 29, 7, 30, 15, 23, 31
576 };
577
578 static const int8_t vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */
579 {
580 0, 1, 2, 8,
581 16, 9, 24, 17,
582 10, 3, 32, 40,
583 48, 56, 25, 18,
584 33, 26, 41, 34,
585 49, 57, 11, 42,
586 19, 50, 27, 58,
587 35, 43, 51, 59
588 };
589
590 static const int8_t vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */
591 {
592 0, 8, 16, 24,
593 1, 9, 17, 2,
594 25, 10, 18, 3,
595 26, 11, 19, 27
596 };
597
598
599 /* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
600 static const int32_t vc1_dqscale[63] = {
601 0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
602 0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
603 0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
604 0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
605 0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A,
606 0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555,
607 0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249,
608 0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000
609 };
610 #endif /* VC1DATA_H */