Mercurial > libavcodec.hg
annotate mpeg12data.h @ 1178:09f1c2f62388 libavcodec
10l
author | michaelni |
---|---|
date | Thu, 10 Apr 2003 14:07:18 +0000 |
parents | fea03d2c4946 |
children | 4c2339f3863a |
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 | |
28 const unsigned char vlc_dc_table[256] = { | |
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 | |
1064 | 51 const uint16_t vlc_dc_lum_code[12] = { |
0 | 52 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, |
53 }; | |
54 const unsigned char vlc_dc_lum_bits[12] = { | |
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 | |
237
75123d30f862
optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents:
236
diff
changeset
|
65 /* simple include everything table for dc, first byte is bits number next 3 are code*/ |
1064 | 66 static uint32_t mpeg1_lum_dc_uni[512]; |
67 static uint32_t mpeg1_chr_dc_uni[512]; | |
237
75123d30f862
optimized encode_dc() (+2% speed on P3 for mpeg1 intra only encodings)
michaelni
parents:
236
diff
changeset
|
68 |
1064 | 69 static const uint16_t mpeg1_vlc[113][2] = { |
0 | 70 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, |
71 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, | |
72 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 }, | |
73 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 }, | |
74 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 }, | |
75 { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 }, | |
76 { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 }, | |
77 { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 }, | |
78 { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 }, | |
79 { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 }, | |
80 { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 }, | |
81 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 }, | |
82 { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 }, | |
83 { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 }, | |
84 { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 }, | |
85 { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 }, | |
86 { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 }, | |
87 { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 }, | |
88 { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 }, | |
89 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 }, | |
90 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 }, | |
91 { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 }, | |
92 { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 }, | |
93 { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 }, | |
94 { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 }, | |
95 { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 }, | |
96 { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 }, | |
97 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 }, | |
98 { 0x1, 6 }, /* escape */ | |
99 { 0x2, 2 }, /* EOB */ | |
100 }; | |
101 | |
1064 | 102 static const uint16_t mpeg2_vlc[113][2] = { |
0 | 103 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, |
104 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, | |
105 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, | |
106 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14}, | |
107 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14}, | |
108 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14}, | |
109 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14}, | |
110 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15}, | |
111 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15}, | |
112 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}, | |
113 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8}, | |
114 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15}, | |
115 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15}, | |
116 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16}, | |
117 {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7}, | |
118 {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5}, | |
119 {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6}, | |
120 {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9}, | |
121 {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16}, | |
122 {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12}, | |
123 {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13}, | |
124 {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16}, | |
125 {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16}, | |
126 {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16}, | |
127 {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12}, | |
128 {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13}, | |
129 {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16}, | |
130 {0x1d,16}, {0x1c,16}, {0x1b,16}, | |
131 {0x01,6}, /* escape */ | |
132 {0x06,4}, /* EOB */ | |
133 }; | |
134 | |
1064 | 135 static const int8_t mpeg1_level[111] = { |
0 | 136 1, 2, 3, 4, 5, 6, 7, 8, |
137 9, 10, 11, 12, 13, 14, 15, 16, | |
138 17, 18, 19, 20, 21, 22, 23, 24, | |
139 25, 26, 27, 28, 29, 30, 31, 32, | |
140 33, 34, 35, 36, 37, 38, 39, 40, | |
141 1, 2, 3, 4, 5, 6, 7, 8, | |
142 9, 10, 11, 12, 13, 14, 15, 16, | |
143 17, 18, 1, 2, 3, 4, 5, 1, | |
144 2, 3, 4, 1, 2, 3, 1, 2, | |
145 3, 1, 2, 3, 1, 2, 1, 2, | |
146 1, 2, 1, 2, 1, 2, 1, 2, | |
147 1, 2, 1, 2, 1, 2, 1, 2, | |
148 1, 1, 1, 1, 1, 1, 1, 1, | |
149 1, 1, 1, 1, 1, 1, 1, | |
150 }; | |
151 | |
1064 | 152 static const int8_t mpeg1_run[111] = { |
0 | 153 0, 0, 0, 0, 0, 0, 0, 0, |
154 0, 0, 0, 0, 0, 0, 0, 0, | |
155 0, 0, 0, 0, 0, 0, 0, 0, | |
156 0, 0, 0, 0, 0, 0, 0, 0, | |
157 0, 0, 0, 0, 0, 0, 0, 0, | |
158 1, 1, 1, 1, 1, 1, 1, 1, | |
159 1, 1, 1, 1, 1, 1, 1, 1, | |
160 1, 1, 2, 2, 2, 2, 2, 3, | |
161 3, 3, 3, 4, 4, 4, 5, 5, | |
162 5, 6, 6, 6, 7, 7, 8, 8, | |
163 9, 9, 10, 10, 11, 11, 12, 12, | |
164 13, 13, 14, 14, 15, 15, 16, 16, | |
165 17, 18, 19, 20, 21, 22, 23, 24, | |
166 25, 26, 27, 28, 29, 30, 31, | |
167 }; | |
168 | |
1064 | 169 static uint8_t mpeg1_index_run[2][64]; |
170 static int8_t mpeg1_max_level[2][64]; | |
236 | 171 |
0 | 172 static RLTable rl_mpeg1 = { |
173 111, | |
174 111, | |
175 mpeg1_vlc, | |
176 mpeg1_run, | |
177 mpeg1_level, | |
178 }; | |
179 | |
180 static RLTable rl_mpeg2 = { | |
181 111, | |
182 111, | |
183 mpeg2_vlc, | |
184 mpeg1_run, | |
185 mpeg1_level, | |
186 }; | |
187 | |
1064 | 188 static const uint8_t mbAddrIncrTable[35][2] = { |
0 | 189 {0x1, 1}, |
190 {0x3, 3}, | |
191 {0x2, 3}, | |
192 {0x3, 4}, | |
193 {0x2, 4}, | |
194 {0x3, 5}, | |
195 {0x2, 5}, | |
196 {0x7, 7}, | |
197 {0x6, 7}, | |
198 {0xb, 8}, | |
199 {0xa, 8}, | |
200 {0x9, 8}, | |
201 {0x8, 8}, | |
202 {0x7, 8}, | |
203 {0x6, 8}, | |
204 {0x17, 10}, | |
205 {0x16, 10}, | |
206 {0x15, 10}, | |
207 {0x14, 10}, | |
208 {0x13, 10}, | |
209 {0x12, 10}, | |
210 {0x23, 11}, | |
211 {0x22, 11}, | |
212 {0x21, 11}, | |
213 {0x20, 11}, | |
214 {0x1f, 11}, | |
215 {0x1e, 11}, | |
216 {0x1d, 11}, | |
217 {0x1c, 11}, | |
218 {0x1b, 11}, | |
219 {0x1a, 11}, | |
220 {0x19, 11}, | |
221 {0x18, 11}, | |
222 {0x8, 11}, /* escape */ | |
223 {0xf, 11}, /* stuffing */ | |
224 }; | |
225 | |
1064 | 226 static const uint8_t mbPatTable[63][2] = { |
0 | 227 {0xb, 5}, |
228 {0x9, 5}, | |
229 {0xd, 6}, | |
230 {0xd, 4}, | |
231 {0x17, 7}, | |
232 {0x13, 7}, | |
233 {0x1f, 8}, | |
234 {0xc, 4}, | |
235 {0x16, 7}, | |
236 {0x12, 7}, | |
237 {0x1e, 8}, | |
238 {0x13, 5}, | |
239 {0x1b, 8}, | |
240 {0x17, 8}, | |
241 {0x13, 8}, | |
242 {0xb, 4}, | |
243 {0x15, 7}, | |
244 {0x11, 7}, | |
245 {0x1d, 8}, | |
246 {0x11, 5}, | |
247 {0x19, 8}, | |
248 {0x15, 8}, | |
249 {0x11, 8}, | |
250 {0xf, 6}, | |
251 {0xf, 8}, | |
252 {0xd, 8}, | |
253 {0x3, 9}, | |
254 {0xf, 5}, | |
255 {0xb, 8}, | |
256 {0x7, 8}, | |
257 {0x7, 9}, | |
258 {0xa, 4}, | |
259 {0x14, 7}, | |
260 {0x10, 7}, | |
261 {0x1c, 8}, | |
262 {0xe, 6}, | |
263 {0xe, 8}, | |
264 {0xc, 8}, | |
265 {0x2, 9}, | |
266 {0x10, 5}, | |
267 {0x18, 8}, | |
268 {0x14, 8}, | |
269 {0x10, 8}, | |
270 {0xe, 5}, | |
271 {0xa, 8}, | |
272 {0x6, 8}, | |
273 {0x6, 9}, | |
274 {0x12, 5}, | |
275 {0x1a, 8}, | |
276 {0x16, 8}, | |
277 {0x12, 8}, | |
278 {0xd, 5}, | |
279 {0x9, 8}, | |
280 {0x5, 8}, | |
281 {0x5, 9}, | |
282 {0xc, 5}, | |
283 {0x8, 8}, | |
284 {0x4, 8}, | |
285 {0x4, 9}, | |
286 {0x7, 3}, | |
287 {0xa, 5}, | |
288 {0x8, 5}, | |
289 {0xc, 6} | |
290 }; | |
291 | |
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
|
292 #define MB_TYPE_PAT 0x40000000 |
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
|
293 #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
|
294 #define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV) |
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
|
295 #define IS_PAT(a) ((a)&MB_TYPE_PAT) |
0 | 296 |
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 static const uint8_t table_mb_ptype[7][2] = { |
64 | 298 { 3, 5 }, // 0x01 MB_INTRA |
299 { 1, 2 }, // 0x02 MB_PAT | |
300 { 1, 3 }, // 0x08 MB_FOR | |
301 { 1, 1 }, // 0x0A MB_FOR|MB_PAT | |
302 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA | |
303 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT | |
304 { 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
|
305 }; |
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
|
306 |
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
|
307 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
|
308 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
|
309 MB_TYPE_L0 | MB_TYPE_PAT | MB_TYPE_ZERO_MV | MB_TYPE_16x16, |
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
|
310 MB_TYPE_L0, |
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
|
311 MB_TYPE_L0 | MB_TYPE_PAT, |
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
|
312 MB_TYPE_QUANT | 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
|
313 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_PAT | MB_TYPE_ZERO_MV | MB_TYPE_16x16, |
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
|
314 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_PAT, |
0 | 315 }; |
316 | |
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
|
317 static const uint8_t table_mb_btype[11][2] = { |
64 | 318 { 3, 5 }, // 0x01 MB_INTRA |
319 { 2, 3 }, // 0x04 MB_BACK | |
320 { 3, 3 }, // 0x06 MB_BACK|MB_PAT | |
321 { 2, 4 }, // 0x08 MB_FOR | |
322 { 3, 4 }, // 0x0A MB_FOR|MB_PAT | |
323 { 2, 2 }, // 0x0C MB_FOR|MB_BACK | |
324 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT | |
325 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA | |
326 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT | |
327 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT | |
328 { 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
|
329 }; |
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
|
330 |
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 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
|
332 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
|
333 MB_TYPE_L1, |
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
|
334 MB_TYPE_L1 | MB_TYPE_PAT, |
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
|
335 MB_TYPE_L0, |
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
|
336 MB_TYPE_L0 | MB_TYPE_PAT, |
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
|
337 MB_TYPE_L0L1, |
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
|
338 MB_TYPE_L0L1 | MB_TYPE_PAT, |
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
|
339 MB_TYPE_QUANT | 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
|
340 MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_PAT, |
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
|
341 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_PAT, |
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
|
342 MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_PAT, |
0 | 343 }; |
344 | |
1064 | 345 static const uint8_t mbMotionVectorTable[17][2] = { |
0 | 346 { 0x1, 1 }, |
347 { 0x1, 2 }, | |
348 { 0x1, 3 }, | |
349 { 0x1, 4 }, | |
350 { 0x3, 6 }, | |
351 { 0x5, 7 }, | |
352 { 0x4, 7 }, | |
353 { 0x3, 7 }, | |
354 { 0xb, 9 }, | |
355 { 0xa, 9 }, | |
356 { 0x9, 9 }, | |
357 { 0x11, 10 }, | |
358 { 0x10, 10 }, | |
359 { 0xf, 10 }, | |
360 { 0xe, 10 }, | |
361 { 0xd, 10 }, | |
362 { 0xc, 10 }, | |
363 }; | |
364 | |
1126
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
365 #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
|
366 |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
367 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
|
368 0, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
369 24000, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
370 24024, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
371 25025, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
372 30000, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
373 30030, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
374 50050, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
375 60000, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
376 60060, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
377 // 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
|
378 15015, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
379 // 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
|
380 5005, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
381 10010, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
382 12012, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
383 15015, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
384 // 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
|
385 25025, |
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
386 25025, |
0 | 387 }; |
388 | |
1064 | 389 static const uint8_t non_linear_qscale[32] = { |
0 | 390 0, 1, 2, 3, 4, 5, 6, 7, |
391 8,10,12,14,16,18,20,22, | |
392 24,28,32,36,40,44,48,52, | |
393 56,64,72,80,88,96,104,112, | |
394 }; | |
498 | 395 |
1064 | 396 uint8_t ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales? |
498 | 397 // 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 |
398 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, | |
399 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, | |
400 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, | |
401 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, | |
402 }; | |
403 | |
917 | 404 static const float mpeg1_aspect[16]={ |
405 0.0000, | |
406 1.0000, | |
407 0.6735, | |
408 0.7031, | |
409 | |
410 0.7615, | |
411 0.8055, | |
412 0.8437, | |
413 0.8935, | |
498 | 414 |
917 | 415 0.9157, |
416 0.9815, | |
417 1.0255, | |
418 1.0695, | |
419 | |
420 1.0950, | |
421 1.1575, | |
422 1.2015, | |
423 }; | |
424 | |
425 static const float mpeg2_aspect[16]={ | |
426 0, | |
427 1.0, | |
428 -3.0/4.0, | |
429 -9.0/16.0, | |
430 -1.0/2.21, | |
431 }; | |
432 |