VirtualBox

source: vbox/trunk/src/libs/ffmpeg-20060710/libavcodec/mpeg12data.h@ 9441

Last change on this file since 9441 was 5776, checked in by vboxsync, 17 years ago

ffmpeg: exported to OSE

File size: 12.3 KB
Line 
1/**
2 * @file mpeg12data.h
3 * MPEG1/2 tables.
4 */
5
6const int16_t ff_mpeg1_default_intra_matrix[64] = {
7 8, 16, 19, 22, 26, 27, 29, 34,
8 16, 16, 22, 24, 27, 29, 34, 37,
9 19, 22, 26, 27, 29, 34, 34, 38,
10 22, 22, 26, 27, 29, 34, 37, 40,
11 22, 26, 27, 29, 32, 35, 40, 48,
12 26, 27, 29, 32, 35, 40, 48, 58,
13 26, 27, 29, 34, 38, 46, 56, 69,
14 27, 29, 35, 38, 46, 56, 69, 83
15};
16
17const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
18 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,
21 16, 16, 16, 16, 16, 16, 16, 16,
22 16, 16, 16, 16, 16, 16, 16, 16,
23 16, 16, 16, 16, 16, 16, 16, 16,
24 16, 16, 16, 16, 16, 16, 16, 16,
25 16, 16, 16, 16, 16, 16, 16, 16,
26};
27
28static const uint16_t vlc_dc_lum_code[12] = {
29 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
30};
31static const unsigned char vlc_dc_lum_bits[12] = {
32 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
33};
34
35const uint16_t vlc_dc_chroma_code[12] = {
36 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
37};
38const unsigned char vlc_dc_chroma_bits[12] = {
39 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
40};
41
42static const uint16_t mpeg1_vlc[113][2] = {
43 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
44 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
45 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
46 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
47 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
48 { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
49 { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
50 { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
51 { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
52 { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
53 { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
54 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
55 { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
56 { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
57 { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
58 { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
59 { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
60 { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
61 { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
62 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
63 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
64 { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
65 { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
66 { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
67 { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
68 { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
69 { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
70 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
71 { 0x1, 6 }, /* escape */
72 { 0x2, 2 }, /* EOB */
73};
74
75static const uint16_t mpeg2_vlc[113][2] = {
76 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
77 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
78 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
79 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
80 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
81 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
82 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
83 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
84 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
85 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
86 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
87 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
88 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
89 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
90 {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
91 {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
92 {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
93 {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
94 {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
95 {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
96 {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
97 {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
98 {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
99 {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
100 {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
101 {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
102 {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
103 {0x1d,16}, {0x1c,16}, {0x1b,16},
104 {0x01,6}, /* escape */
105 {0x06,4}, /* EOB */
106};
107
108static const int8_t mpeg1_level[111] = {
109 1, 2, 3, 4, 5, 6, 7, 8,
110 9, 10, 11, 12, 13, 14, 15, 16,
111 17, 18, 19, 20, 21, 22, 23, 24,
112 25, 26, 27, 28, 29, 30, 31, 32,
113 33, 34, 35, 36, 37, 38, 39, 40,
114 1, 2, 3, 4, 5, 6, 7, 8,
115 9, 10, 11, 12, 13, 14, 15, 16,
116 17, 18, 1, 2, 3, 4, 5, 1,
117 2, 3, 4, 1, 2, 3, 1, 2,
118 3, 1, 2, 3, 1, 2, 1, 2,
119 1, 2, 1, 2, 1, 2, 1, 2,
120 1, 2, 1, 2, 1, 2, 1, 2,
121 1, 1, 1, 1, 1, 1, 1, 1,
122 1, 1, 1, 1, 1, 1, 1,
123};
124
125static const int8_t mpeg1_run[111] = {
126 0, 0, 0, 0, 0, 0, 0, 0,
127 0, 0, 0, 0, 0, 0, 0, 0,
128 0, 0, 0, 0, 0, 0, 0, 0,
129 0, 0, 0, 0, 0, 0, 0, 0,
130 0, 0, 0, 0, 0, 0, 0, 0,
131 1, 1, 1, 1, 1, 1, 1, 1,
132 1, 1, 1, 1, 1, 1, 1, 1,
133 1, 1, 2, 2, 2, 2, 2, 3,
134 3, 3, 3, 4, 4, 4, 5, 5,
135 5, 6, 6, 6, 7, 7, 8, 8,
136 9, 9, 10, 10, 11, 11, 12, 12,
137 13, 13, 14, 14, 15, 15, 16, 16,
138 17, 18, 19, 20, 21, 22, 23, 24,
139 25, 26, 27, 28, 29, 30, 31,
140};
141
142static RLTable rl_mpeg1 = {
143 111,
144 111,
145 mpeg1_vlc,
146 mpeg1_run,
147 mpeg1_level,
148};
149
150static RLTable rl_mpeg2 = {
151 111,
152 111,
153 mpeg2_vlc,
154 mpeg1_run,
155 mpeg1_level,
156};
157
158static const uint8_t mbAddrIncrTable[36][2] = {
159 {0x1, 1},
160 {0x3, 3},
161 {0x2, 3},
162 {0x3, 4},
163 {0x2, 4},
164 {0x3, 5},
165 {0x2, 5},
166 {0x7, 7},
167 {0x6, 7},
168 {0xb, 8},
169 {0xa, 8},
170 {0x9, 8},
171 {0x8, 8},
172 {0x7, 8},
173 {0x6, 8},
174 {0x17, 10},
175 {0x16, 10},
176 {0x15, 10},
177 {0x14, 10},
178 {0x13, 10},
179 {0x12, 10},
180 {0x23, 11},
181 {0x22, 11},
182 {0x21, 11},
183 {0x20, 11},
184 {0x1f, 11},
185 {0x1e, 11},
186 {0x1d, 11},
187 {0x1c, 11},
188 {0x1b, 11},
189 {0x1a, 11},
190 {0x19, 11},
191 {0x18, 11},
192 {0x8, 11}, /* escape */
193 {0xf, 11}, /* stuffing */
194 {0x0, 8}, /* end (and 15 more 0 bits should follow) */
195};
196
197static const uint8_t mbPatTable[64][2] = {
198 {0x1, 9},
199 {0xb, 5},
200 {0x9, 5},
201 {0xd, 6},
202 {0xd, 4},
203 {0x17, 7},
204 {0x13, 7},
205 {0x1f, 8},
206 {0xc, 4},
207 {0x16, 7},
208 {0x12, 7},
209 {0x1e, 8},
210 {0x13, 5},
211 {0x1b, 8},
212 {0x17, 8},
213 {0x13, 8},
214 {0xb, 4},
215 {0x15, 7},
216 {0x11, 7},
217 {0x1d, 8},
218 {0x11, 5},
219 {0x19, 8},
220 {0x15, 8},
221 {0x11, 8},
222 {0xf, 6},
223 {0xf, 8},
224 {0xd, 8},
225 {0x3, 9},
226 {0xf, 5},
227 {0xb, 8},
228 {0x7, 8},
229 {0x7, 9},
230 {0xa, 4},
231 {0x14, 7},
232 {0x10, 7},
233 {0x1c, 8},
234 {0xe, 6},
235 {0xe, 8},
236 {0xc, 8},
237 {0x2, 9},
238 {0x10, 5},
239 {0x18, 8},
240 {0x14, 8},
241 {0x10, 8},
242 {0xe, 5},
243 {0xa, 8},
244 {0x6, 8},
245 {0x6, 9},
246 {0x12, 5},
247 {0x1a, 8},
248 {0x16, 8},
249 {0x12, 8},
250 {0xd, 5},
251 {0x9, 8},
252 {0x5, 8},
253 {0x5, 9},
254 {0xc, 5},
255 {0x8, 8},
256 {0x4, 8},
257 {0x4, 9},
258 {0x7, 3},
259 {0xa, 5},
260 {0x8, 5},
261 {0xc, 6}
262};
263
264#define MB_TYPE_ZERO_MV 0x20000000
265#define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV)
266
267static const uint8_t table_mb_ptype[7][2] = {
268 { 3, 5 }, // 0x01 MB_INTRA
269 { 1, 2 }, // 0x02 MB_PAT
270 { 1, 3 }, // 0x08 MB_FOR
271 { 1, 1 }, // 0x0A MB_FOR|MB_PAT
272 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
273 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
274 { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
275};
276
277static const uint32_t ptype2mb_type[7] = {
278 MB_TYPE_INTRA,
279 MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
280 MB_TYPE_L0,
281 MB_TYPE_L0 | MB_TYPE_CBP,
282 MB_TYPE_QUANT | MB_TYPE_INTRA,
283 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
284 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
285};
286
287static const uint8_t table_mb_btype[11][2] = {
288 { 3, 5 }, // 0x01 MB_INTRA
289 { 2, 3 }, // 0x04 MB_BACK
290 { 3, 3 }, // 0x06 MB_BACK|MB_PAT
291 { 2, 4 }, // 0x08 MB_FOR
292 { 3, 4 }, // 0x0A MB_FOR|MB_PAT
293 { 2, 2 }, // 0x0C MB_FOR|MB_BACK
294 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
295 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
296 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
297 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
298 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
299};
300
301static const uint32_t btype2mb_type[11] = {
302 MB_TYPE_INTRA,
303 MB_TYPE_L1,
304 MB_TYPE_L1 | MB_TYPE_CBP,
305 MB_TYPE_L0,
306 MB_TYPE_L0 | MB_TYPE_CBP,
307 MB_TYPE_L0L1,
308 MB_TYPE_L0L1 | MB_TYPE_CBP,
309 MB_TYPE_QUANT | MB_TYPE_INTRA,
310 MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
311 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
312 MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
313};
314
315static const uint8_t mbMotionVectorTable[17][2] = {
316{ 0x1, 1 },
317{ 0x1, 2 },
318{ 0x1, 3 },
319{ 0x1, 4 },
320{ 0x3, 6 },
321{ 0x5, 7 },
322{ 0x4, 7 },
323{ 0x3, 7 },
324{ 0xb, 9 },
325{ 0xa, 9 },
326{ 0x9, 9 },
327{ 0x11, 10 },
328{ 0x10, 10 },
329{ 0xf, 10 },
330{ 0xe, 10 },
331{ 0xd, 10 },
332{ 0xc, 10 },
333};
334
335const AVRational ff_frame_rate_tab[] = {
336 { 0, 0},
337 {24000, 1001},
338 { 24, 1},
339 { 25, 1},
340 {30000, 1001},
341 { 30, 1},
342 { 50, 1},
343 {60000, 1001},
344 { 60, 1},
345 // Xing's 15fps: (9)
346 { 15, 1},
347 // libmpeg3's "Unofficial economy rates": (10-13)
348 { 5, 1},
349 { 10, 1},
350 { 12, 1},
351 { 15, 1},
352 { 0, 0},
353};
354
355static const uint8_t non_linear_qscale[32] = {
356 0, 1, 2, 3, 4, 5, 6, 7,
357 8,10,12,14,16,18,20,22,
358 24,28,32,36,40,44,48,52,
359 56,64,72,80,88,96,104,112,
360};
361
362const uint8_t ff_mpeg1_dc_scale_table[128]={
363// 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
364 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,
365 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,
366 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,
367 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,
368};
369
370const static uint8_t mpeg2_dc_scale_table1[128]={
371// 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
372 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
373 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
374 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
375 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
376};
377
378static const uint8_t mpeg2_dc_scale_table2[128]={
379// 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
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384};
385
386static const uint8_t mpeg2_dc_scale_table3[128]={
387// 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
388 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,
389 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,
390 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,
391 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,
392};
393
394static const uint8_t *mpeg2_dc_scale_table[4]={
395 ff_mpeg1_dc_scale_table,
396 mpeg2_dc_scale_table1,
397 mpeg2_dc_scale_table2,
398 mpeg2_dc_scale_table3,
399};
400
401static const float mpeg1_aspect[16]={
402 0.0000,
403 1.0000,
404 0.6735,
405 0.7031,
406
407 0.7615,
408 0.8055,
409 0.8437,
410 0.8935,
411
412 0.9157,
413 0.9815,
414 1.0255,
415 1.0695,
416
417 1.0950,
418 1.1575,
419 1.2015,
420};
421
422static const AVRational mpeg2_aspect[16]={
423 {0,1},
424 {1,1},
425 {4,3},
426 {16,9},
427 {221,100},
428 {0,1},
429 {0,1},
430 {0,1},
431 {0,1},
432 {0,1},
433 {0,1},
434 {0,1},
435 {0,1},
436 {0,1},
437 {0,1},
438 {0,1},
439};
440
441static const uint8_t svcd_scan_offset_placeholder[14]={
442 0x10, 0x0E,
443 0x00, 0x80, 0x81,
444 0x00, 0x80, 0x81,
445 0xff, 0xff, 0xff,
446 0xff, 0xff, 0xff,
447};
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette