Commit 287229e5 authored by Michael Niedermayer's avatar Michael Niedermayer

msmpeg4v1 decoding

Originally committed as revision 643 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 7f2fe444
/* intra MCBPC, mb_type = (intra), then (intraq) */ /* intra MCBPC, mb_type = (intra), then (intraq) */
static const UINT8 intra_MCBPC_code[8] = { 1, 1, 2, 3, 1, 1, 2, 3 }; const UINT8 intra_MCBPC_code[8] = { 1, 1, 2, 3, 1, 1, 2, 3 };
static const UINT8 intra_MCBPC_bits[8] = { 1, 3, 3, 3, 4, 6, 6, 6 }; const UINT8 intra_MCBPC_bits[8] = { 1, 3, 3, 3, 4, 6, 6, 6 };
/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */ /* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */ /* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
static const UINT8 inter_MCBPC_code[25] = { const UINT8 inter_MCBPC_code[25] = {
1, 3, 2, 5, 1, 3, 2, 5,
3, 4, 3, 3, 3, 4, 3, 3,
3, 7, 6, 5, 3, 7, 6, 5,
...@@ -14,7 +14,7 @@ static const UINT8 inter_MCBPC_code[25] = { ...@@ -14,7 +14,7 @@ static const UINT8 inter_MCBPC_code[25] = {
1, /* Stuffing */ 1, /* Stuffing */
2, 12, 14, 15, 2, 12, 14, 15,
}; };
static const UINT8 inter_MCBPC_bits[25] = { const UINT8 inter_MCBPC_bits[25] = {
1, 4, 4, 6, 1, 4, 4, 6,
5, 8, 8, 7, 5, 8, 8, 7,
3, 7, 7, 9, 3, 7, 7, 9,
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
/* intra picture macro block coded block pattern */ /* intra picture macro block coded block pattern */
const UINT16 table_mb_intra[64][2] = { static const UINT16 table_mb_intra[64][2] = {
{ 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 }, { 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 },
{ 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 }, { 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 },
{ 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 }, { 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 },
...@@ -23,7 +23,7 @@ const UINT16 table_mb_intra[64][2] = { ...@@ -23,7 +23,7 @@ const UINT16 table_mb_intra[64][2] = {
}; };
/* non intra picture macro block coded block pattern + mb type */ /* non intra picture macro block coded block pattern + mb type */
const UINT32 table_mb_non_intra[128][2] = { static const UINT32 table_mb_non_intra[128][2] = {
{ 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 }, { 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 },
{ 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 }, { 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 },
{ 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 }, { 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 },
...@@ -128,7 +128,7 @@ static const UINT32 table0_dc_chroma[120][2] = { ...@@ -128,7 +128,7 @@ static const UINT32 table0_dc_chroma[120][2] = {
/* dc table 1 */ /* dc table 1 */
const UINT32 table1_dc_lum[120][2] = { static const UINT32 table1_dc_lum[120][2] = {
{ 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 }, { 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 },
{ 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 }, { 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 },
{ 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 }, { 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 },
...@@ -161,7 +161,7 @@ const UINT32 table1_dc_lum[120][2] = { ...@@ -161,7 +161,7 @@ const UINT32 table1_dc_lum[120][2] = {
{ 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 }, { 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 },
}; };
const UINT32 table1_dc_chroma[120][2] = { static const UINT32 table1_dc_chroma[120][2] = {
{ 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 }, { 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 },
{ 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 }, { 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 },
{ 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 }, { 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 },
...@@ -233,7 +233,7 @@ static const UINT16 table0_vlc[133][2] = { ...@@ -233,7 +233,7 @@ static const UINT16 table0_vlc[133][2] = {
{ 0x16, 7 }, { 0x16, 7 },
}; };
const INT8 table0_level[132] = { static const INT8 table0_level[132] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
...@@ -253,7 +253,7 @@ const INT8 table0_level[132] = { ...@@ -253,7 +253,7 @@ const INT8 table0_level[132] = {
1, 1, 1, 1, 1, 1, 1, 1,
}; };
const INT8 table0_run[132] = { static const INT8 table0_run[132] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
...@@ -275,7 +275,7 @@ const INT8 table0_run[132] = { ...@@ -275,7 +275,7 @@ const INT8 table0_run[132] = {
/* vlc table 1, for intra chroma and P macro blocks */ /* vlc table 1, for intra chroma and P macro blocks */
const UINT16 table1_vlc[149][2] = { static const UINT16 table1_vlc[149][2] = {
{ 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 }, { 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 },
{ 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 }, { 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 },
{ 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 }, { 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 },
...@@ -316,7 +316,7 @@ const UINT16 table1_vlc[149][2] = { ...@@ -316,7 +316,7 @@ const UINT16 table1_vlc[149][2] = {
{ 0xd, 9 }, { 0xd, 9 },
}; };
const INT8 table1_level[148] = { static const INT8 table1_level[148] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 1, 2, 9, 10, 11, 12, 13, 14, 1, 2,
3, 4, 5, 6, 7, 8, 9, 1, 3, 4, 5, 6, 7, 8, 9, 1,
...@@ -338,7 +338,7 @@ const INT8 table1_level[148] = { ...@@ -338,7 +338,7 @@ const INT8 table1_level[148] = {
1, 1, 1, 1, 1, 1, 1, 1,
}; };
const INT8 table1_run[148] = { static const INT8 table1_run[148] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2,
...@@ -362,7 +362,7 @@ const INT8 table1_run[148] = { ...@@ -362,7 +362,7 @@ const INT8 table1_run[148] = {
/* third vlc table */ /* third vlc table */
const UINT16 table2_vlc[186][2] = { static const UINT16 table2_vlc[186][2] = {
{ 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 }, { 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 },
{ 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 }, { 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 },
{ 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 }, { 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 },
...@@ -412,7 +412,7 @@ const UINT16 table2_vlc[186][2] = { ...@@ -412,7 +412,7 @@ const UINT16 table2_vlc[186][2] = {
{ 0x23dc, 14 },{ 0x4a, 9 }, { 0x23dc, 14 },{ 0x4a, 9 },
}; };
const INT8 table2_level[185] = { static const INT8 table2_level[185] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 1, 2, 3, 4, 5, 17, 18, 19, 1, 2, 3, 4, 5,
...@@ -439,7 +439,7 @@ const INT8 table2_level[185] = { ...@@ -439,7 +439,7 @@ const INT8 table2_level[185] = {
1, 1,
}; };
const INT8 table2_run[185] = { static const INT8 table2_run[185] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1,
...@@ -467,7 +467,7 @@ const INT8 table2_run[185] = { ...@@ -467,7 +467,7 @@ const INT8 table2_run[185] = {
}; };
/* second non intra vlc table */ /* second non intra vlc table */
const UINT16 table4_vlc[169][2] = { static const UINT16 table4_vlc[169][2] = {
{ 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 }, { 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 },
{ 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 }, { 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 },
{ 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 }, { 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 },
...@@ -513,7 +513,7 @@ const UINT16 table4_vlc[169][2] = { ...@@ -513,7 +513,7 @@ const UINT16 table4_vlc[169][2] = {
{ 0x169, 9 }, { 0x169, 9 },
}; };
const INT8 table4_level[168] = { static const INT8 table4_level[168] = {
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 1, 17, 18, 19, 20, 21, 22, 23, 1,
...@@ -537,7 +537,7 @@ const INT8 table4_level[168] = { ...@@ -537,7 +537,7 @@ const INT8 table4_level[168] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
}; };
const INT8 table4_run[168] = { static const INT8 table4_run[168] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
...@@ -575,6 +575,11 @@ extern const UINT8 DCtab_chrom[13][2]; ...@@ -575,6 +575,11 @@ extern const UINT8 DCtab_chrom[13][2];
extern const UINT8 cbpy_tab[16][2]; extern const UINT8 cbpy_tab[16][2];
extern const UINT8 mvtab[33][2]; extern const UINT8 mvtab[33][2];
extern const UINT8 intra_MCBPC_code[8];
extern const UINT8 intra_MCBPC_bits[8];
extern const UINT8 inter_MCBPC_code[8];
extern const UINT8 inter_MCBPC_bits[8];
#define NB_RL_TABLES 6 #define NB_RL_TABLES 6
...@@ -627,7 +632,7 @@ static RLTable rl_table[NB_RL_TABLES] = { ...@@ -627,7 +632,7 @@ static RLTable rl_table[NB_RL_TABLES] = {
/* motion vector table 0 */ /* motion vector table 0 */
const UINT16 table0_mv_code[1100] = { static const UINT16 table0_mv_code[1100] = {
0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001, 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001,
0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f, 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f,
0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b, 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b,
...@@ -768,7 +773,7 @@ const UINT16 table0_mv_code[1100] = { ...@@ -768,7 +773,7 @@ const UINT16 table0_mv_code[1100] = {
0x5f0d, 0x5f0e, 0x5f0f, 0x0000, 0x5f0d, 0x5f0e, 0x5f0f, 0x0000,
}; };
const UINT8 table0_mv_bits[1100] = { static const UINT8 table0_mv_bits[1100] = {
1, 4, 4, 4, 5, 5, 5, 6, 1, 4, 4, 4, 5, 5, 5, 6,
6, 6, 7, 7, 7, 8, 8, 8, 6, 6, 7, 7, 7, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
...@@ -909,7 +914,7 @@ const UINT8 table0_mv_bits[1100] = { ...@@ -909,7 +914,7 @@ const UINT8 table0_mv_bits[1100] = {
17, 17, 17, 8, 17, 17, 17, 8,
}; };
const UINT8 table0_mvx[1099] = { static const UINT8 table0_mvx[1099] = {
32, 32, 31, 32, 33, 31, 33, 31, 32, 32, 31, 32, 33, 31, 33, 31,
33, 32, 34, 32, 30, 32, 31, 34, 33, 32, 34, 32, 30, 32, 31, 34,
35, 32, 34, 33, 29, 33, 30, 30, 35, 32, 34, 33, 29, 33, 30, 30,
...@@ -1050,7 +1055,7 @@ const UINT8 table0_mvx[1099] = { ...@@ -1050,7 +1055,7 @@ const UINT8 table0_mvx[1099] = {
61, 19, 19, 61, 19, 19,
}; };
const UINT8 table0_mvy[1099] = { static const UINT8 table0_mvy[1099] = {
32, 31, 32, 33, 32, 31, 31, 33, 32, 31, 32, 33, 32, 31, 31, 33,
33, 34, 32, 30, 32, 35, 34, 31, 33, 34, 32, 30, 32, 35, 34, 31,
32, 29, 33, 30, 32, 34, 33, 31, 32, 29, 33, 30, 32, 34, 33, 31,
...@@ -1192,7 +1197,7 @@ const UINT8 table0_mvy[1099] = { ...@@ -1192,7 +1197,7 @@ const UINT8 table0_mvy[1099] = {
}; };
/* motion vector table 1 */ /* motion vector table 1 */
const UINT16 table1_mv_code[1100] = { static const UINT16 table1_mv_code[1100] = {
0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c, 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c,
0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041, 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041,
0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069, 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069,
...@@ -1333,7 +1338,7 @@ const UINT16 table1_mv_code[1100] = { ...@@ -1333,7 +1338,7 @@ const UINT16 table1_mv_code[1100] = {
0x2473, 0x26a2, 0x26a3, 0x000b, 0x2473, 0x26a2, 0x26a3, 0x000b,
}; };
const UINT8 table1_mv_bits[1100] = { static const UINT8 table1_mv_bits[1100] = {
2, 4, 4, 4, 5, 5, 5, 5, 2, 4, 4, 4, 5, 5, 5, 5,
6, 6, 7, 7, 7, 7, 7, 8, 6, 6, 7, 7, 7, 7, 7, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
...@@ -1474,7 +1479,7 @@ const UINT8 table1_mv_bits[1100] = { ...@@ -1474,7 +1479,7 @@ const UINT8 table1_mv_bits[1100] = {
15, 15, 15, 4, 15, 15, 15, 4,
}; };
const UINT8 table1_mvx[1099] = { static const UINT8 table1_mvx[1099] = {
32, 31, 32, 31, 33, 32, 33, 33, 32, 31, 32, 31, 33, 32, 33, 33,
31, 34, 30, 32, 32, 34, 35, 32, 31, 34, 30, 32, 32, 34, 35, 32,
34, 33, 29, 30, 30, 32, 31, 31, 34, 33, 29, 30, 30, 32, 31, 31,
...@@ -1615,7 +1620,7 @@ const UINT8 table1_mvx[1099] = { ...@@ -1615,7 +1620,7 @@ const UINT8 table1_mvx[1099] = {
0, 12, 27, 0, 12, 27,
}; };
const UINT8 table1_mvy[1099] = { static const UINT8 table1_mvy[1099] = {
32, 32, 31, 31, 32, 33, 31, 33, 32, 32, 31, 31, 32, 33, 31, 33,
33, 32, 32, 30, 34, 31, 32, 29, 33, 32, 32, 30, 34, 31, 32, 29,
33, 30, 32, 33, 31, 35, 34, 30, 33, 30, 32, 33, 31, 35, 34, 30,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment