annotate mpeg12data.h @ 357:ae179ec5fb47 libavcodec

correct quantizer bias
author michaelni
date Fri, 03 May 2002 21:38:02 +0000
parents 75123d30f862
children 0b4450c15067
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * MPEG1/2 tables
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
4
39
f6806d3e2d37 updated scans
glantau
parents: 25
diff changeset
5 INT16 default_intra_matrix[64] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 8, 16, 19, 22, 26, 27, 29, 34,
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 16, 16, 22, 24, 27, 29, 34, 37,
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 19, 22, 26, 27, 29, 34, 34, 38,
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 22, 22, 26, 27, 29, 34, 37, 40,
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 22, 26, 27, 29, 32, 35, 40, 48,
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 26, 27, 29, 32, 35, 40, 48, 58,
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 26, 27, 29, 34, 38, 46, 56, 69,
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 27, 29, 35, 38, 46, 56, 69, 83
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
15
39
f6806d3e2d37 updated scans
glantau
parents: 25
diff changeset
16 INT16 default_non_intra_matrix[64] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 16, 16, 16, 16, 16, 16, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
26
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 const unsigned char vlc_dc_table[256] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 0, 1, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 3, 3, 3, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 4, 4, 4, 4, 4, 4, 4, 4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
34
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
39
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
49
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 const UINT16 vlc_dc_lum_code[12] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 const unsigned char vlc_dc_lum_bits[12] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
56
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 const UINT16 vlc_dc_chroma_code[12] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
60 const unsigned char vlc_dc_chroma_bits[12] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
63
237
75123d30f862 optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents: 236
diff changeset
64 /* simple include everything table for dc, first byte is bits number next 3 are code*/
75123d30f862 optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents: 236
diff changeset
65 static UINT32 mpeg1_lum_dc_uni[512];
75123d30f862 optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents: 236
diff changeset
66 static UINT32 mpeg1_chr_dc_uni[512];
75123d30f862 optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents: 236
diff changeset
67
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 static const UINT16 mpeg1_vlc[113][2] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
93 { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 { 0x1, 6 }, /* escape */
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 { 0x2, 2 }, /* EOB */
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
100
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 static const UINT16 mpeg2_vlc[113][2] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
986e461dc072 Initial revision
glantau
parents:
diff changeset
106 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
121 {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 {0x1d,16}, {0x1c,16}, {0x1b,16},
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 {0x01,6}, /* escape */
986e461dc072 Initial revision
glantau
parents:
diff changeset
131 {0x06,4}, /* EOB */
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
133
25
2f603eb2f23d types fix
glantau
parents: 19
diff changeset
134 static const INT8 mpeg1_level[111] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 1, 2, 3, 4, 5, 6, 7, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 17, 18, 19, 20, 21, 22, 23, 24,
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 25, 26, 27, 28, 29, 30, 31, 32,
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 33, 34, 35, 36, 37, 38, 39, 40,
986e461dc072 Initial revision
glantau
parents:
diff changeset
140 1, 2, 3, 4, 5, 6, 7, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 9, 10, 11, 12, 13, 14, 15, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 17, 18, 1, 2, 3, 4, 5, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
143 2, 3, 4, 1, 2, 3, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
144 3, 1, 2, 3, 1, 2, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
145 1, 2, 1, 2, 1, 2, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 1, 2, 1, 2, 1, 2, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
147 1, 1, 1, 1, 1, 1, 1, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
148 1, 1, 1, 1, 1, 1, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
149 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
150
25
2f603eb2f23d types fix
glantau
parents: 19
diff changeset
151 static const INT8 mpeg1_run[111] = {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
153 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 1, 1, 1, 1, 1, 1, 1, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 1, 1, 1, 1, 1, 1, 1, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 1, 1, 2, 2, 2, 2, 2, 3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 3, 3, 3, 4, 4, 4, 5, 5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 5, 6, 6, 6, 7, 7, 8, 8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 9, 9, 10, 10, 11, 11, 12, 12,
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 13, 13, 14, 14, 15, 15, 16, 16,
986e461dc072 Initial revision
glantau
parents:
diff changeset
164 17, 18, 19, 20, 21, 22, 23, 24,
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 25, 26, 27, 28, 29, 30, 31,
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
167
236
4a090f1da60a optimize mpeg1_encode_block()
michaelni
parents: 64
diff changeset
168 static UINT8 mpeg1_index_run[2][64];
4a090f1da60a optimize mpeg1_encode_block()
michaelni
parents: 64
diff changeset
169 static INT8 mpeg1_max_level[2][64];
4a090f1da60a optimize mpeg1_encode_block()
michaelni
parents: 64
diff changeset
170
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 static RLTable rl_mpeg1 = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 111,
986e461dc072 Initial revision
glantau
parents:
diff changeset
173 111,
986e461dc072 Initial revision
glantau
parents:
diff changeset
174 mpeg1_vlc,
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 mpeg1_run,
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 mpeg1_level,
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
178
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 static RLTable rl_mpeg2 = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 111,
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 111,
986e461dc072 Initial revision
glantau
parents:
diff changeset
182 mpeg2_vlc,
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 mpeg1_run,
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 mpeg1_level,
986e461dc072 Initial revision
glantau
parents:
diff changeset
185 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
186
986e461dc072 Initial revision
glantau
parents:
diff changeset
187 static const UINT8 mbAddrIncrTable[35][2] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 {0x1, 1},
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 {0x3, 3},
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 {0x2, 3},
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 {0x3, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 {0x2, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
193 {0x3, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 {0x2, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 {0x7, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 {0x6, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
197 {0xb, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 {0xa, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 {0x9, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 {0x8, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 {0x7, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 {0x6, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
203 {0x17, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
204 {0x16, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
205 {0x15, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
206 {0x14, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
207 {0x13, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
208 {0x12, 10},
986e461dc072 Initial revision
glantau
parents:
diff changeset
209 {0x23, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
210 {0x22, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
211 {0x21, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
212 {0x20, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 {0x1f, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
214 {0x1e, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
215 {0x1d, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
216 {0x1c, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
217 {0x1b, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 {0x1a, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
219 {0x19, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 {0x18, 11},
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 {0x8, 11}, /* escape */
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 {0xf, 11}, /* stuffing */
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
224
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 static const UINT8 mbPatTable[63][2] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 {0xb, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 {0x9, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 {0xd, 6},
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 {0xd, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 {0x17, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
231 {0x13, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
232 {0x1f, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
233 {0xc, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 {0x16, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
235 {0x12, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 {0x1e, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 {0x13, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
238 {0x1b, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 {0x17, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 {0x13, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
241 {0xb, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 {0x15, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
243 {0x11, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 {0x1d, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
245 {0x11, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 {0x19, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 {0x15, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 {0x11, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
249 {0xf, 6},
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 {0xf, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 {0xd, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 {0x3, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 {0xf, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 {0xb, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
255 {0x7, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 {0x7, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
257 {0xa, 4},
986e461dc072 Initial revision
glantau
parents:
diff changeset
258 {0x14, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
259 {0x10, 7},
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 {0x1c, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
261 {0xe, 6},
986e461dc072 Initial revision
glantau
parents:
diff changeset
262 {0xe, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 {0xc, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
264 {0x2, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
265 {0x10, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 {0x18, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
267 {0x14, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
268 {0x10, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
269 {0xe, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 {0xa, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 {0x6, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 {0x6, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 {0x12, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 {0x1a, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 {0x16, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
276 {0x12, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
277 {0xd, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 {0x9, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
279 {0x5, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
280 {0x5, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
281 {0xc, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
282 {0x8, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
283 {0x4, 8},
986e461dc072 Initial revision
glantau
parents:
diff changeset
284 {0x4, 9},
986e461dc072 Initial revision
glantau
parents:
diff changeset
285 {0x7, 3},
986e461dc072 Initial revision
glantau
parents:
diff changeset
286 {0xa, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
287 {0x8, 5},
986e461dc072 Initial revision
glantau
parents:
diff changeset
288 {0xc, 6}
986e461dc072 Initial revision
glantau
parents:
diff changeset
289 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
290
986e461dc072 Initial revision
glantau
parents:
diff changeset
291 #define MB_INTRA 0x01
986e461dc072 Initial revision
glantau
parents:
diff changeset
292 #define MB_PAT 0x02
986e461dc072 Initial revision
glantau
parents:
diff changeset
293 #define MB_BACK 0x04
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 #define MB_FOR 0x08
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 #define MB_QUANT 0x10
986e461dc072 Initial revision
glantau
parents:
diff changeset
296
986e461dc072 Initial revision
glantau
parents:
diff changeset
297 static const UINT8 table_mb_ptype[32][2] = {
64
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
298 { 0, 0 }, // 0x00
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
299 { 3, 5 }, // 0x01 MB_INTRA
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
300 { 1, 2 }, // 0x02 MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
301 { 0, 0 }, // 0x03
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
302 { 0, 0 }, // 0x04
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
303 { 0, 0 }, // 0x05
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
304 { 0, 0 }, // 0x06
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
305 { 0, 0 }, // 0x07
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
306 { 1, 3 }, // 0x08 MB_FOR
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
307 { 0, 0 }, // 0x09
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
308 { 1, 1 }, // 0x0A MB_FOR|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
309 { 0, 0 }, // 0x0B
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
310 { 0, 0 }, // 0x0C
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
311 { 0, 0 }, // 0x0D
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
312 { 0, 0 }, // 0x0E
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
313 { 0, 0 }, // 0x0F
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
314 { 0, 0 }, // 0x10
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
315 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
316 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
317 { 0, 0 }, // 0x13
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
318 { 0, 0 }, // 0x14
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
319 { 0, 0 }, // 0x15
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
320 { 0, 0 }, // 0x16
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
321 { 0, 0 }, // 0x17
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
322 { 0, 0 }, // 0x18
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
323 { 0, 0 }, // 0x19
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
324 { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
325 { 0, 0 }, // 0x1B
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
326 { 0, 0 }, // 0x1C
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
327 { 0, 0 }, // 0x1D
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
328 { 0, 0 }, // 0x1E
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
329 { 0, 0 }, // 0x1F
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
331
986e461dc072 Initial revision
glantau
parents:
diff changeset
332 static const UINT8 table_mb_btype[32][2] = {
64
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
333 { 0, 0 }, // 0x00
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
334 { 3, 5 }, // 0x01 MB_INTRA
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
335 { 0, 0 }, // 0x02
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
336 { 0, 0 }, // 0x03
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
337 { 2, 3 }, // 0x04 MB_BACK
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
338 { 0, 0 }, // 0x05
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
339 { 3, 3 }, // 0x06 MB_BACK|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
340 { 0, 0 }, // 0x07
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
341 { 2, 4 }, // 0x08 MB_FOR
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
342 { 0, 0 }, // 0x09
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
343 { 3, 4 }, // 0x0A MB_FOR|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
344 { 0, 0 }, // 0x0B
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
345 { 2, 2 }, // 0x0C MB_FOR|MB_BACK
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
346 { 0, 0 }, // 0x0D
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
347 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
348 { 0, 0 }, // 0x0F
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
349 { 0, 0 }, // 0x10
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
350 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
351 { 0, 0 }, // 0x12
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
352 { 0, 0 }, // 0x13
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
353 { 0, 0 }, // 0x14
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
354 { 0, 0 }, // 0x15
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
355 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
356 { 0, 0 }, // 0x17
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
357 { 0, 0 }, // 0x18
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
358 { 0, 0 }, // 0x19
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
359 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
360 { 0, 0 }, // 0x1B
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
361 { 0, 0 }, // 0x1C
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
362 { 0, 0 }, // 0x1D
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
363 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
5aa6292a1660 win32 fixes
glantau
parents: 39
diff changeset
364 { 0, 0 }, // 0x1F
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
365 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
366
986e461dc072 Initial revision
glantau
parents:
diff changeset
367 static const UINT8 mbMotionVectorTable[17][2] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
368 { 0x1, 1 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
369 { 0x1, 2 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
370 { 0x1, 3 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
371 { 0x1, 4 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
372 { 0x3, 6 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
373 { 0x5, 7 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
374 { 0x4, 7 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
375 { 0x3, 7 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
376 { 0xb, 9 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
377 { 0xa, 9 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
378 { 0x9, 9 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
379 { 0x11, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
380 { 0x10, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
381 { 0xf, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
382 { 0xe, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
383 { 0xd, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
384 { 0xc, 10 },
986e461dc072 Initial revision
glantau
parents:
diff changeset
385 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
386
986e461dc072 Initial revision
glantau
parents:
diff changeset
387 static const int frame_rate_tab[9] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
388 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
389 (int)(23.976 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
390 (int)(24 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
391 (int)(25 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
392 (int)(29.97 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
393 (int)(30 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
394 (int)(50 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
395 (int)(59.94 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
396 (int)(60 * FRAME_RATE_BASE),
986e461dc072 Initial revision
glantau
parents:
diff changeset
397 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
398
986e461dc072 Initial revision
glantau
parents:
diff changeset
399 static const UINT8 non_linear_qscale[32] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
400 0, 1, 2, 3, 4, 5, 6, 7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
401 8,10,12,14,16,18,20,22,
986e461dc072 Initial revision
glantau
parents:
diff changeset
402 24,28,32,36,40,44,48,52,
986e461dc072 Initial revision
glantau
parents:
diff changeset
403 56,64,72,80,88,96,104,112,
986e461dc072 Initial revision
glantau
parents:
diff changeset
404 };