comparison mpeg12data.h @ 1064:b32afefe7d33 libavcodec

* UINTX -> uintx_t INTX -> intx_t
author kabi
date Tue, 11 Feb 2003 16:35:48 +0000
parents d3aa313dc373
children 03df246fb06b
comparison
equal deleted inserted replaced
1063:fdeac9642346 1064:b32afefe7d33
1 /* 1 /*
2 * MPEG1/2 tables 2 * MPEG1/2 tables
3 */ 3 */
4 4
5 const INT16 ff_mpeg1_default_intra_matrix[64] = { 5 const int16_t ff_mpeg1_default_intra_matrix[64] = {
6 8, 16, 19, 22, 26, 27, 29, 34, 6 8, 16, 19, 22, 26, 27, 29, 34,
7 16, 16, 22, 24, 27, 29, 34, 37, 7 16, 16, 22, 24, 27, 29, 34, 37,
8 19, 22, 26, 27, 29, 34, 34, 38, 8 19, 22, 26, 27, 29, 34, 34, 38,
9 22, 22, 26, 27, 29, 34, 37, 40, 9 22, 22, 26, 27, 29, 34, 37, 40,
10 22, 26, 27, 29, 32, 35, 40, 48, 10 22, 26, 27, 29, 32, 35, 40, 48,
11 26, 27, 29, 32, 35, 40, 48, 58, 11 26, 27, 29, 32, 35, 40, 48, 58,
12 26, 27, 29, 34, 38, 46, 56, 69, 12 26, 27, 29, 34, 38, 46, 56, 69,
13 27, 29, 35, 38, 46, 56, 69, 83 13 27, 29, 35, 38, 46, 56, 69, 83
14 }; 14 };
15 15
16 const INT16 ff_mpeg1_default_non_intra_matrix[64] = { 16 const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
17 16, 16, 16, 16, 16, 16, 16, 16, 17 16, 16, 16, 16, 16, 16, 16, 16,
18 16, 16, 16, 16, 16, 16, 16, 16, 18 16, 16, 16, 16, 16, 16, 16, 16,
19 16, 16, 16, 16, 16, 16, 16, 16, 19 16, 16, 16, 16, 16, 16, 16, 16,
20 16, 16, 16, 16, 16, 16, 16, 16, 20 16, 16, 16, 16, 16, 16, 16, 16,
21 16, 16, 16, 16, 16, 16, 16, 16, 21 16, 16, 16, 16, 16, 16, 16, 16,
45 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 45 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
46 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 46 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
47 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 47 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
48 }; 48 };
49 49
50 const UINT16 vlc_dc_lum_code[12] = { 50 const uint16_t vlc_dc_lum_code[12] = {
51 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, 51 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
52 }; 52 };
53 const unsigned char vlc_dc_lum_bits[12] = { 53 const unsigned char vlc_dc_lum_bits[12] = {
54 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, 54 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
55 }; 55 };
56 56
57 const UINT16 vlc_dc_chroma_code[12] = { 57 const uint16_t vlc_dc_chroma_code[12] = {
58 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, 58 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
59 }; 59 };
60 const unsigned char vlc_dc_chroma_bits[12] = { 60 const unsigned char vlc_dc_chroma_bits[12] = {
61 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 61 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
62 }; 62 };
63 63
64 /* simple include everything table for dc, first byte is bits number next 3 are code*/ 64 /* simple include everything table for dc, first byte is bits number next 3 are code*/
65 static UINT32 mpeg1_lum_dc_uni[512]; 65 static uint32_t mpeg1_lum_dc_uni[512];
66 static UINT32 mpeg1_chr_dc_uni[512]; 66 static uint32_t mpeg1_chr_dc_uni[512];
67 67
68 static const UINT16 mpeg1_vlc[113][2] = { 68 static const uint16_t mpeg1_vlc[113][2] = {
69 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, 69 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
70 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, 70 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
71 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 }, 71 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
72 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 }, 72 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
73 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 }, 73 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
96 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 }, 96 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
97 { 0x1, 6 }, /* escape */ 97 { 0x1, 6 }, /* escape */
98 { 0x2, 2 }, /* EOB */ 98 { 0x2, 2 }, /* EOB */
99 }; 99 };
100 100
101 static const UINT16 mpeg2_vlc[113][2] = { 101 static const uint16_t mpeg2_vlc[113][2] = {
102 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, 102 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
103 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, 103 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
104 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, 104 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
105 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14}, 105 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
106 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14}, 106 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
129 {0x1d,16}, {0x1c,16}, {0x1b,16}, 129 {0x1d,16}, {0x1c,16}, {0x1b,16},
130 {0x01,6}, /* escape */ 130 {0x01,6}, /* escape */
131 {0x06,4}, /* EOB */ 131 {0x06,4}, /* EOB */
132 }; 132 };
133 133
134 static const INT8 mpeg1_level[111] = { 134 static const int8_t mpeg1_level[111] = {
135 1, 2, 3, 4, 5, 6, 7, 8, 135 1, 2, 3, 4, 5, 6, 7, 8,
136 9, 10, 11, 12, 13, 14, 15, 16, 136 9, 10, 11, 12, 13, 14, 15, 16,
137 17, 18, 19, 20, 21, 22, 23, 24, 137 17, 18, 19, 20, 21, 22, 23, 24,
138 25, 26, 27, 28, 29, 30, 31, 32, 138 25, 26, 27, 28, 29, 30, 31, 32,
139 33, 34, 35, 36, 37, 38, 39, 40, 139 33, 34, 35, 36, 37, 38, 39, 40,
146 1, 2, 1, 2, 1, 2, 1, 2, 146 1, 2, 1, 2, 1, 2, 1, 2,
147 1, 1, 1, 1, 1, 1, 1, 1, 147 1, 1, 1, 1, 1, 1, 1, 1,
148 1, 1, 1, 1, 1, 1, 1, 148 1, 1, 1, 1, 1, 1, 1,
149 }; 149 };
150 150
151 static const INT8 mpeg1_run[111] = { 151 static const int8_t mpeg1_run[111] = {
152 0, 0, 0, 0, 0, 0, 0, 0, 152 0, 0, 0, 0, 0, 0, 0, 0,
153 0, 0, 0, 0, 0, 0, 0, 0, 153 0, 0, 0, 0, 0, 0, 0, 0,
154 0, 0, 0, 0, 0, 0, 0, 0, 154 0, 0, 0, 0, 0, 0, 0, 0,
155 0, 0, 0, 0, 0, 0, 0, 0, 155 0, 0, 0, 0, 0, 0, 0, 0,
156 0, 0, 0, 0, 0, 0, 0, 0, 156 0, 0, 0, 0, 0, 0, 0, 0,
163 13, 13, 14, 14, 15, 15, 16, 16, 163 13, 13, 14, 14, 15, 15, 16, 16,
164 17, 18, 19, 20, 21, 22, 23, 24, 164 17, 18, 19, 20, 21, 22, 23, 24,
165 25, 26, 27, 28, 29, 30, 31, 165 25, 26, 27, 28, 29, 30, 31,
166 }; 166 };
167 167
168 static UINT8 mpeg1_index_run[2][64]; 168 static uint8_t mpeg1_index_run[2][64];
169 static INT8 mpeg1_max_level[2][64]; 169 static int8_t mpeg1_max_level[2][64];
170 170
171 static RLTable rl_mpeg1 = { 171 static RLTable rl_mpeg1 = {
172 111, 172 111,
173 111, 173 111,
174 mpeg1_vlc, 174 mpeg1_vlc,
182 mpeg2_vlc, 182 mpeg2_vlc,
183 mpeg1_run, 183 mpeg1_run,
184 mpeg1_level, 184 mpeg1_level,
185 }; 185 };
186 186
187 static const UINT8 mbAddrIncrTable[35][2] = { 187 static const uint8_t mbAddrIncrTable[35][2] = {
188 {0x1, 1}, 188 {0x1, 1},
189 {0x3, 3}, 189 {0x3, 3},
190 {0x2, 3}, 190 {0x2, 3},
191 {0x3, 4}, 191 {0x3, 4},
192 {0x2, 4}, 192 {0x2, 4},
220 {0x18, 11}, 220 {0x18, 11},
221 {0x8, 11}, /* escape */ 221 {0x8, 11}, /* escape */
222 {0xf, 11}, /* stuffing */ 222 {0xf, 11}, /* stuffing */
223 }; 223 };
224 224
225 static const UINT8 mbPatTable[63][2] = { 225 static const uint8_t mbPatTable[63][2] = {
226 {0xb, 5}, 226 {0xb, 5},
227 {0x9, 5}, 227 {0x9, 5},
228 {0xd, 6}, 228 {0xd, 6},
229 {0xd, 4}, 229 {0xd, 4},
230 {0x17, 7}, 230 {0x17, 7},
292 #define MB_PAT 0x02 292 #define MB_PAT 0x02
293 #define MB_BACK 0x04 293 #define MB_BACK 0x04
294 #define MB_FOR 0x08 294 #define MB_FOR 0x08
295 #define MB_QUANT 0x10 295 #define MB_QUANT 0x10
296 296
297 static const UINT8 table_mb_ptype[32][2] = { 297 static const uint8_t table_mb_ptype[32][2] = {
298 { 0, 0 }, // 0x00 298 { 0, 0 }, // 0x00
299 { 3, 5 }, // 0x01 MB_INTRA 299 { 3, 5 }, // 0x01 MB_INTRA
300 { 1, 2 }, // 0x02 MB_PAT 300 { 1, 2 }, // 0x02 MB_PAT
301 { 0, 0 }, // 0x03 301 { 0, 0 }, // 0x03
302 { 0, 0 }, // 0x04 302 { 0, 0 }, // 0x04
327 { 0, 0 }, // 0x1D 327 { 0, 0 }, // 0x1D
328 { 0, 0 }, // 0x1E 328 { 0, 0 }, // 0x1E
329 { 0, 0 }, // 0x1F 329 { 0, 0 }, // 0x1F
330 }; 330 };
331 331
332 static const UINT8 table_mb_btype[32][2] = { 332 static const uint8_t table_mb_btype[32][2] = {
333 { 0, 0 }, // 0x00 333 { 0, 0 }, // 0x00
334 { 3, 5 }, // 0x01 MB_INTRA 334 { 3, 5 }, // 0x01 MB_INTRA
335 { 0, 0 }, // 0x02 335 { 0, 0 }, // 0x02
336 { 0, 0 }, // 0x03 336 { 0, 0 }, // 0x03
337 { 2, 3 }, // 0x04 MB_BACK 337 { 2, 3 }, // 0x04 MB_BACK
362 { 0, 0 }, // 0x1D 362 { 0, 0 }, // 0x1D
363 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT 363 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
364 { 0, 0 }, // 0x1F 364 { 0, 0 }, // 0x1F
365 }; 365 };
366 366
367 static const UINT8 mbMotionVectorTable[17][2] = { 367 static const uint8_t mbMotionVectorTable[17][2] = {
368 { 0x1, 1 }, 368 { 0x1, 1 },
369 { 0x1, 2 }, 369 { 0x1, 2 },
370 { 0x1, 3 }, 370 { 0x1, 3 },
371 { 0x1, 4 }, 371 { 0x1, 4 },
372 { 0x3, 6 }, 372 { 0x3, 6 },
394 (int)(50 * FRAME_RATE_BASE), 394 (int)(50 * FRAME_RATE_BASE),
395 (int)(59.94 * FRAME_RATE_BASE), 395 (int)(59.94 * FRAME_RATE_BASE),
396 (int)(60 * FRAME_RATE_BASE), 396 (int)(60 * FRAME_RATE_BASE),
397 }; 397 };
398 398
399 static const UINT8 non_linear_qscale[32] = { 399 static const uint8_t non_linear_qscale[32] = {
400 0, 1, 2, 3, 4, 5, 6, 7, 400 0, 1, 2, 3, 4, 5, 6, 7,
401 8,10,12,14,16,18,20,22, 401 8,10,12,14,16,18,20,22,
402 24,28,32,36,40,44,48,52, 402 24,28,32,36,40,44,48,52,
403 56,64,72,80,88,96,104,112, 403 56,64,72,80,88,96,104,112,
404 }; 404 };
405 405
406 UINT8 ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales? 406 uint8_t ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales?
407 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 407 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
408 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 408 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
409 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 409 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
410 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 410 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
411 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 411 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,