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