Mercurial > libavcodec.hg
comparison vc9data.h @ 2497:69adfbbdcdeb libavcodec
- samples from mplayer ftp in the "adv" profile seem to have profile=2,
which isn't the advanced one; and indeed, using adv. profile parser fails.
Using normal parser works, and that's what is done
- attempt at taking care of stride for NORM2 bitplane decoding
- duplication of much code from msmpeg4.c; this code isn't yet used, but
goes down as far as the block layer (mainly Transform Type stuff, the
remains are wild editing without checking). Unusable yet, and lacks the AC
decoding (but a step further in bitstream parsing)
patch by anonymous
author | michael |
---|---|
date | Fri, 04 Feb 2005 02:20:38 +0000 |
parents | 5d28ea40fd98 |
children | ef2149182f1c |
comparison
equal
deleted
inserted
replaced
2496:74d7fd7b49c5 | 2497:69adfbbdcdeb |
---|---|
3 * VC9 tables. | 3 * VC9 tables. |
4 */ | 4 */ |
5 | 5 |
6 #ifndef VC9DATA_H | 6 #ifndef VC9DATA_H |
7 #define VC9DATA_H | 7 #define VC9DATA_H |
8 | |
9 /* Set a method for reading VLC in NORM6 bitplane decoding */ | |
10 #define VLC_NORM6_METH0D 1 | |
11 | 8 |
12 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */ | 9 /* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */ |
13 const int16_t vc9_bfraction_lut[23] = { | 10 const int16_t vc9_bfraction_lut[23] = { |
14 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/, | 11 420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/, |
15 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/, | 12 630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/, |
72 }; | 69 }; |
73 static const uint8_t vc9_norm2_bits[4] = { | 70 static const uint8_t vc9_norm2_bits[4] = { |
74 1, 3, 3, 2 | 71 1, 3, 3, 2 |
75 }; | 72 }; |
76 | 73 |
77 #if VLC_NORM6_METH0D == 1 | |
78 static const uint16_t vc9_norm6_codes[64] = { | 74 static const uint16_t vc9_norm6_codes[64] = { |
79 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E, | 75 0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E, |
80 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037, | 76 0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037, |
81 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036, | 77 0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036, |
82 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007, | 78 0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007, |
153 {60, 3, 5, 0, 8 }, | 149 {60, 3, 5, 0, 8 }, |
154 {61, 3, 5, 3, 4 }, | 150 {61, 3, 5, 3, 4 }, |
155 {62, 3, 5, 2, 4 }, | 151 {62, 3, 5, 2, 4 }, |
156 {63, 3, 5, 1, 1 }, | 152 {63, 3, 5, 1, 1 }, |
157 }; | 153 }; |
158 #endif | |
159 | |
160 //Mechanical way, handling sparse/incomplete tables | |
161 #if VLC_NORM6_METH0D == 2 | |
162 //(2,5) is VLC+FLC, (3,5) double VLC | |
163 static const uint8_t vc9_norm6_first[24][2] = { | |
164 { 1, 1}, { 2, 4}, { 3, 4}, { 0, 8}, | |
165 { 4, 4}, { 1, 8}, { 2, 8}, { 5, 4}, | |
166 { 3, 8}, { 4, 8}, { 5, 8}, { 6, 4}, | |
167 { 6, 8}, { 7, 8}, { 8, 8}, { 9, 8}, | |
168 { 7, 4}, { 10, 8}, { 11, 8}, { 12, 8}, | |
169 { 13, 8}, { 14, 8}, { 2, 5}, { 3, 5} | |
170 }; | |
171 | |
172 static const uint8_t vc9_norm6_second[22][2] = { | |
173 { 14, 8}, { 13, 8}, { 12, 8}, { 11, 8}, | |
174 { 10, 8}, { 7, 4}, { 9, 8}, { 8, 8}, | |
175 { 7, 8}, { 6, 8}, { 6, 4}, { 5, 8}, | |
176 { 4, 8}, { 3, 8}, { 5, 4}, { 2, 8}, | |
177 { 1, 8}, { 4, 4}, { 0, 8}, { 3, 4}, | |
178 { 2, 4}, { 1, 1} | |
179 }; | |
180 static const uint8_t vc9_norm6_flc_val[20] = { | |
181 7, 11, 13, 14, 19, 21, 22, 25, | |
182 26, 28, 35, 37, 38, 41, 42, 44, | |
183 49, 50, 52, 56 | |
184 }; | |
185 static const uint8_t vc9_norm6_second_val[22] = { | |
186 15, 23, 27, 29, 30, 31, 39, 43, | |
187 45, 46, 47, 51, 53, 54, 55, 57, | |
188 58, 59, 60, 61, 62, 63 | |
189 }; | |
190 #endif | |
191 | 154 |
192 /* 4MV Block pattern VLC tables */ | 155 /* 4MV Block pattern VLC tables */ |
193 static const uint8_t vc9_4mv_block_pattern_codes[4][16] = { | 156 static const uint8_t vc9_4mv_block_pattern_codes[4][16] = { |
194 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2}, | 157 { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27, 0, 28, 1, 2, 2}, |
195 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0}, | 158 { 8, 18, 19, 4, 20, 5, 30, 11, 21, 31, 6, 12, 7, 13, 14, 0}, |
327 11, 9, 7, | 290 11, 9, 7, |
328 11 | 291 11 |
329 } | 292 } |
330 }; | 293 }; |
331 | 294 |
295 /* TTBLK (Transform Type per Block) tables */ | |
296 static const uint8_t vc9_ttblk_codes[3][8] = { | |
297 { 0, 1, 3, 5, 16, 17, 18, 19}, | |
298 { 3, 0, 1, 2, 3, 5, 8, 9}, | |
299 { 1, 0, 1, 4, 6, 7, 10, 11} | |
300 }; | |
301 static const uint8_t vc9_ttblk_bits[3][8] = { | |
302 { 2, 2, 2, 3, 5, 5, 5, 5}, | |
303 { 2, 3, 3, 3, 3, 3, 4, 4}, | |
304 { 2, 3, 3, 3, 3, 3, 4, 4} | |
305 }; | |
306 | |
307 /* SUBBLKPAT tables, p93-94, reordered */ | |
308 static const uint8_t vc9_subblkpat_codes[3][15] = { | |
309 { 14, 12, 7, 11, 9, 26, 2, 10, 27, 8, 0, 6, 1, 15, 1}, | |
310 { 14, 0, 8, 15, 10, 4, 23, 13, 5, 9, 25, 3, 24, 22, 1}, | |
311 { 5, 6, 2, 2, 8, 0, 28, 3, 1, 3, 29, 1, 19, 18, 15} | |
312 }; | |
313 static const uint8_t vc9_subblkpat_bits[3][15] = { | |
314 { 5, 5, 5, 5, 5, 6, 4, 5, 6, 5, 4, 5, 4, 5, 1}, | |
315 { 4, 3, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 2}, | |
316 { 3, 3, 4, 3, 4, 5, 5, 3, 5, 4, 5, 4, 5, 5, 4} | |
317 }; | |
332 | 318 |
333 /* MV differential tables, p265 */ | 319 /* MV differential tables, p265 */ |
334 static const uint16_t vc9_mv_diff_codes[4][73] = { | 320 static const uint16_t vc9_mv_diff_codes[4][73] = { |
335 { | 321 { |
336 0, 2, 3, 8, 576, 3, 2, 6, | 322 0, 2, 3, 8, 576, 3, 2, 6, |