Mercurial > libavcodec.hg
comparison mpeg4data.h @ 10803:4605bd2fdb7f libavcodec
Split the mpeg4 encoder and decoder off h263.c
author | michael |
---|---|
date | Thu, 07 Jan 2010 23:53:49 +0000 |
parents | e9d9d946f213 |
children | 9abebeca7d1b |
comparison
equal
deleted
inserted
replaced
10802:4f614b69b4e5 | 10803:4605bd2fdb7f |
---|---|
28 #ifndef AVCODEC_MPEG4DATA_H | 28 #ifndef AVCODEC_MPEG4DATA_H |
29 #define AVCODEC_MPEG4DATA_H | 29 #define AVCODEC_MPEG4DATA_H |
30 | 30 |
31 #include <stdint.h> | 31 #include <stdint.h> |
32 #include "mpegvideo.h" | 32 #include "mpegvideo.h" |
33 | |
34 // shapes | |
35 #define RECT_SHAPE 0 | |
36 #define BIN_SHAPE 1 | |
37 #define BIN_ONLY_SHAPE 2 | |
38 #define GRAY_SHAPE 3 | |
39 | |
40 #define SIMPLE_VO_TYPE 1 | |
41 #define CORE_VO_TYPE 3 | |
42 #define MAIN_VO_TYPE 4 | |
43 #define NBIT_VO_TYPE 5 | |
44 #define ARTS_VO_TYPE 10 | |
45 #define ACE_VO_TYPE 12 | |
46 #define ADV_SIMPLE_VO_TYPE 17 | |
47 | |
48 // aspect_ratio_info | |
49 #define EXTENDED_PAR 15 | |
50 | |
51 //vol_sprite_usage / sprite_enable | |
52 #define STATIC_SPRITE 1 | |
53 #define GMC_SPRITE 2 | |
54 | |
55 #define MOTION_MARKER 0x1F001 | |
56 #define DC_MARKER 0x6B001 | |
57 | |
58 static const int mb_type_b_map[4]= { | |
59 MB_TYPE_DIRECT2 | MB_TYPE_L0L1, | |
60 MB_TYPE_L0L1 | MB_TYPE_16x16, | |
61 MB_TYPE_L1 | MB_TYPE_16x16, | |
62 MB_TYPE_L0 | MB_TYPE_16x16, | |
63 }; | |
64 | |
65 #define VOS_STARTCODE 0x1B0 | |
66 #define USER_DATA_STARTCODE 0x1B2 | |
67 #define GOP_STARTCODE 0x1B3 | |
68 #define VISUAL_OBJ_STARTCODE 0x1B5 | |
69 #define VOP_STARTCODE 0x1B6 | |
70 | 33 |
71 /* dc encoding for mpeg4 */ | 34 /* dc encoding for mpeg4 */ |
72 const uint8_t DCtab_lum[13][2] = | 35 const uint8_t DCtab_lum[13][2] = |
73 { | 36 { |
74 {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, | 37 {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, |
141 3, 3, 4, 4, 5, 5, 6, 6, | 104 3, 3, 4, 4, 5, 5, 6, 6, |
142 7, 8, 9, 10, 11, 12, 13, 14, | 105 7, 8, 9, 10, 11, 12, 13, 14, |
143 15, 16, 17, 18, 19, 20, | 106 15, 16, 17, 18, 19, 20, |
144 }; | 107 }; |
145 | 108 |
146 static RLTable rl_intra = { | 109 RLTable rl_intra = { |
147 102, | 110 102, |
148 67, | 111 67, |
149 intra_vlc, | 112 intra_vlc, |
150 intra_run, | 113 intra_run, |
151 intra_level, | 114 intra_level, |
152 }; | 115 }; |
153 | 116 |
154 /* Note this is identical to the intra rvlc except that it is reordered. */ | 117 /* Note this is identical to the intra rvlc except that it is reordered. */ |
155 static const uint16_t inter_rvlc[170][2]={ | 118 const uint16_t inter_rvlc[170][2]={ |
156 {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7}, | 119 {0x0006, 3},{0x0001, 4},{0x0004, 5},{0x001C, 7}, |
157 {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10}, | 120 {0x003C, 8},{0x003D, 8},{0x007C, 9},{0x00FC, 10}, |
158 {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12}, | 121 {0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12}, |
159 {0x07FC, 13},{0x07FD, 13},{0x0BFC, 13},{0x0BFD, 13}, | 122 {0x07FC, 13},{0x07FD, 13},{0x0BFC, 13},{0x0BFD, 13}, |
160 {0x0FFC, 14},{0x0FFD, 14},{0x1FFC, 15},{0x0007, 3}, | 123 {0x0FFC, 14},{0x0FFD, 14},{0x1FFC, 15},{0x0007, 3}, |
196 {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14}, | 159 {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14}, |
197 {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15}, | 160 {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15}, |
198 {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} | 161 {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} |
199 }; | 162 }; |
200 | 163 |
201 static const int8_t inter_rvlc_run[169]={ | 164 const int8_t inter_rvlc_run[169]={ |
202 0, 0, 0, 0, 0, 0, 0, 0, | 165 0, 0, 0, 0, 0, 0, 0, 0, |
203 0, 0, 0, 0, 0, 0, 0, 0, | 166 0, 0, 0, 0, 0, 0, 0, 0, |
204 0, 0, 0, 1, 1, 1, 1, 1, | 167 0, 0, 0, 1, 1, 1, 1, 1, |
205 1, 1, 1, 1, 1, 2, 2, 2, | 168 1, 1, 1, 1, 1, 2, 2, 2, |
206 2, 2, 2, 2, 3, 3, 3, 3, | 169 2, 2, 2, 2, 3, 3, 3, 3, |
221 27, 28, 29, 30, 31, 32, 33, 34, | 184 27, 28, 29, 30, 31, 32, 33, 34, |
222 35, 36, 37, 38, 39, 40, 41, 42, | 185 35, 36, 37, 38, 39, 40, 41, 42, |
223 43, 44, | 186 43, 44, |
224 }; | 187 }; |
225 | 188 |
226 static const int8_t inter_rvlc_level[169]={ | 189 const int8_t inter_rvlc_level[169]={ |
227 1, 2, 3, 4, 5, 6, 7, 8, | 190 1, 2, 3, 4, 5, 6, 7, 8, |
228 9, 10, 11, 12, 13, 14, 15, 16, | 191 9, 10, 11, 12, 13, 14, 15, 16, |
229 17, 18, 19, 1, 2, 3, 4, 5, | 192 17, 18, 19, 1, 2, 3, 4, 5, |
230 6, 7, 8, 9, 10, 1, 2, 3, | 193 6, 7, 8, 9, 10, 1, 2, 3, |
231 4, 5, 6, 7, 1, 2, 3, 4, | 194 4, 5, 6, 7, 1, 2, 3, 4, |
246 1, 1, 1, 1, 1, 1, 1, 1, | 209 1, 1, 1, 1, 1, 1, 1, 1, |
247 1, 1, 1, 1, 1, 1, 1, 1, | 210 1, 1, 1, 1, 1, 1, 1, 1, |
248 1, 1, | 211 1, 1, |
249 }; | 212 }; |
250 | 213 |
251 static RLTable rvlc_rl_inter = { | 214 RLTable rvlc_rl_inter = { |
252 169, | 215 169, |
253 103, | 216 103, |
254 inter_rvlc, | 217 inter_rvlc, |
255 inter_rvlc_run, | 218 inter_rvlc_run, |
256 inter_rvlc_level, | 219 inter_rvlc_level, |
257 }; | 220 }; |
258 | 221 |
259 static const uint16_t intra_rvlc[170][2]={ | 222 const uint16_t intra_rvlc[170][2]={ |
260 {0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5}, | 223 {0x0006, 3},{0x0007, 3},{0x000A, 4},{0x0009, 5}, |
261 {0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8}, | 224 {0x0014, 6},{0x0015, 6},{0x0034, 7},{0x0074, 8}, |
262 {0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10}, | 225 {0x0075, 8},{0x00DD, 9},{0x00EC, 9},{0x01EC, 10}, |
263 {0x01ED, 10},{0x01F4, 10},{0x03EC, 11},{0x03ED, 11}, | 226 {0x01ED, 10},{0x01F4, 10},{0x03EC, 11},{0x03ED, 11}, |
264 {0x03F4, 11},{0x077D, 12},{0x07BC, 12},{0x0FBD, 13}, | 227 {0x03F4, 11},{0x077D, 12},{0x07BC, 12},{0x0FBD, 13}, |
300 {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14}, | 263 {0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14}, |
301 {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15}, | 264 {0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15}, |
302 {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} | 265 {0x3F7C, 15},{0x3F7D, 15},{0x0000, 4} |
303 }; | 266 }; |
304 | 267 |
305 static const int8_t intra_rvlc_run[169]={ | 268 const int8_t intra_rvlc_run[169]={ |
306 0, 0, 0, 0, 0, 0, 0, 0, | 269 0, 0, 0, 0, 0, 0, 0, 0, |
307 0, 0, 0, 0, 0, 0, 0, 0, | 270 0, 0, 0, 0, 0, 0, 0, 0, |
308 0, 0, 0, 0, 0, 0, 0, 0, | 271 0, 0, 0, 0, 0, 0, 0, 0, |
309 0, 0, 0, 1, 1, 1, 1, 1, | 272 0, 0, 0, 1, 1, 1, 1, 1, |
310 1, 1, 1, 1, 1, 1, 1, 1, | 273 1, 1, 1, 1, 1, 1, 1, 1, |
325 27, 28, 29, 30, 31, 32, 33, 34, | 288 27, 28, 29, 30, 31, 32, 33, 34, |
326 35, 36, 37, 38, 39, 40, 41, 42, | 289 35, 36, 37, 38, 39, 40, 41, 42, |
327 43, 44, | 290 43, 44, |
328 }; | 291 }; |
329 | 292 |
330 static const int8_t intra_rvlc_level[169]={ | 293 const int8_t intra_rvlc_level[169]={ |
331 1, 2, 3, 4, 5, 6, 7, 8, | 294 1, 2, 3, 4, 5, 6, 7, 8, |
332 9, 10, 11, 12, 13, 14, 15, 16, | 295 9, 10, 11, 12, 13, 14, 15, 16, |
333 17, 18, 19, 20, 21, 22, 23, 24, | 296 17, 18, 19, 20, 21, 22, 23, 24, |
334 25, 26, 27, 1, 2, 3, 4, 5, | 297 25, 26, 27, 1, 2, 3, 4, 5, |
335 6, 7, 8, 9, 10, 11, 12, 13, | 298 6, 7, 8, 9, 10, 11, 12, 13, |
350 1, 1, 1, 1, 1, 1, 1, 1, | 313 1, 1, 1, 1, 1, 1, 1, 1, |
351 1, 1, 1, 1, 1, 1, 1, 1, | 314 1, 1, 1, 1, 1, 1, 1, 1, |
352 1, 1, | 315 1, 1, |
353 }; | 316 }; |
354 | 317 |
355 static RLTable rvlc_rl_intra = { | 318 RLTable rvlc_rl_intra = { |
356 169, | 319 169, |
357 103, | 320 103, |
358 intra_rvlc, | 321 intra_rvlc, |
359 intra_rvlc_run, | 322 intra_rvlc_run, |
360 intra_rvlc_level, | 323 intra_rvlc_level, |
361 }; | 324 }; |
362 | 325 |
363 static const uint16_t sprite_trajectory_tab[15][2] = { | 326 const uint16_t sprite_trajectory_tab[15][2] = { |
364 {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, | 327 {0x00, 2}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, |
365 {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, | 328 {0x0E, 4}, {0x1E, 5}, {0x3E, 6}, {0x7E, 7}, {0xFE, 8}, |
366 {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12}, | 329 {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12}, |
367 }; | 330 }; |
368 | 331 |
369 static const uint8_t mb_type_b_tab[4][2] = { | 332 const uint8_t mb_type_b_tab[4][2] = { |
370 {1, 1}, {1, 2}, {1, 3}, {1, 4}, | 333 {1, 1}, {1, 2}, {1, 3}, {1, 4}, |
371 }; | |
372 | |
373 static const AVRational pixel_aspect[16]={ | |
374 {0, 1}, | |
375 {1, 1}, | |
376 {12, 11}, | |
377 {10, 11}, | |
378 {16, 11}, | |
379 {40, 33}, | |
380 {0, 1}, | |
381 {0, 1}, | |
382 {0, 1}, | |
383 {0, 1}, | |
384 {0, 1}, | |
385 {0, 1}, | |
386 {0, 1}, | |
387 {0, 1}, | |
388 {0, 1}, | |
389 {0, 1}, | |
390 }; | 334 }; |
391 | 335 |
392 /* these matrixes will be permuted for the idct */ | 336 /* these matrixes will be permuted for the idct */ |
393 const int16_t ff_mpeg4_default_intra_matrix[64] = { | 337 const int16_t ff_mpeg4_default_intra_matrix[64] = { |
394 8, 17, 18, 19, 21, 23, 25, 27, | 338 8, 17, 18, 19, 21, 23, 25, 27, |
423 | 367 |
424 const uint16_t ff_mpeg4_resync_prefix[8]={ | 368 const uint16_t ff_mpeg4_resync_prefix[8]={ |
425 0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000 | 369 0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000 |
426 }; | 370 }; |
427 | 371 |
428 static const uint8_t mpeg4_dc_threshold[8]={ | 372 const uint8_t mpeg4_dc_threshold[8]={ |
429 99, 13, 15, 17, 19, 21, 23, 0 | 373 99, 13, 15, 17, 19, 21, 23, 0 |
430 }; | 374 }; |
431 | 375 |
432 #endif /* AVCODEC_MPEG4DATA_H */ | 376 #endif /* AVCODEC_MPEG4DATA_H */ |