Mercurial > libavcodec.hg
annotate mpeg12data.h @ 4704:0cb02a723a62 libavcodec
utilize multi-stage AC-3 bit allocation. speeds up encoding by 25-30%
author | jbr |
---|---|
date | Thu, 22 Mar 2007 05:34:26 +0000 |
parents | 5464e5021a67 |
children | 4394344397d8 |
rev | line source |
---|---|
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
1 /* |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
2 * MPEG1 codec / MPEG2 decoder |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
3 * copyright (c) 2000,2001 Fabrice Bellard |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
4 * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
5 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
6 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
7 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
12 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
16 * Lesser General Public License for more details. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
17 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3776
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
21 */ |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3556
diff
changeset
|
22 |
1106 | 23 /** |
24 * @file mpeg12data.h | |
25 * MPEG1/2 tables. | |
0 | 26 */ |
27 | |
3776 | 28 const uint16_t ff_mpeg1_default_intra_matrix[64] = { |
2979 | 29 8, 16, 19, 22, 26, 27, 29, 34, |
30 16, 16, 22, 24, 27, 29, 34, 37, | |
31 19, 22, 26, 27, 29, 34, 34, 38, | |
32 22, 22, 26, 27, 29, 34, 37, 40, | |
33 22, 26, 27, 29, 32, 35, 40, 48, | |
34 26, 27, 29, 32, 35, 40, 48, 58, | |
35 26, 27, 29, 34, 38, 46, 56, 69, | |
36 27, 29, 35, 38, 46, 56, 69, 83 | |
0 | 37 }; |
38 | |
3776 | 39 const uint16_t ff_mpeg1_default_non_intra_matrix[64] = { |
0 | 40 16, 16, 16, 16, 16, 16, 16, 16, |
41 16, 16, 16, 16, 16, 16, 16, 16, | |
42 16, 16, 16, 16, 16, 16, 16, 16, | |
43 16, 16, 16, 16, 16, 16, 16, 16, | |
44 16, 16, 16, 16, 16, 16, 16, 16, | |
45 16, 16, 16, 16, 16, 16, 16, 16, | |
46 16, 16, 16, 16, 16, 16, 16, 16, | |
47 16, 16, 16, 16, 16, 16, 16, 16, | |
48 }; | |
49 | |
1325 | 50 static const uint16_t vlc_dc_lum_code[12] = { |
0 | 51 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, |
52 }; | |
1325 | 53 static const unsigned char vlc_dc_lum_bits[12] = { |
0 | 54 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, |
55 }; | |
56 | |
4180 | 57 static const uint16_t vlc_dc_chroma_code[12] = { |
0 | 58 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, |
59 }; | |
4180 | 60 static const unsigned char vlc_dc_chroma_bits[12] = { |
0 | 61 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, |
62 }; | |
63 | |
1064 | 64 static const uint16_t mpeg1_vlc[113][2] = { |
0 | 65 { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, |
66 { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, | |
67 { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 }, | |
68 { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 }, | |
69 { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 }, | |
70 { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 }, | |
71 { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 }, | |
72 { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 }, | |
73 { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 }, | |
74 { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 }, | |
75 { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 }, | |
76 { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 }, | |
77 { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 }, | |
78 { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 }, | |
79 { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 }, | |
80 { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 }, | |
81 { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 }, | |
82 { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 }, | |
83 { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 }, | |
84 { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 }, | |
85 { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 }, | |
86 { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 }, | |
87 { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 }, | |
88 { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 }, | |
89 { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 }, | |
90 { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 }, | |
91 { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 }, | |
92 { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 }, | |
93 { 0x1, 6 }, /* escape */ | |
94 { 0x2, 2 }, /* EOB */ | |
95 }; | |
96 | |
1064 | 97 static const uint16_t mpeg2_vlc[113][2] = { |
0 | 98 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, |
99 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, | |
100 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, | |
101 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14}, | |
102 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14}, | |
103 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14}, | |
104 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14}, | |
105 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15}, | |
106 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15}, | |
107 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}, | |
108 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8}, | |
109 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15}, | |
110 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15}, | |
111 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16}, | |
2967 | 112 {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7}, |
113 {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5}, | |
114 {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6}, | |
115 {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9}, | |
116 {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16}, | |
117 {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12}, | |
118 {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13}, | |
119 {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16}, | |
120 {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16}, | |
121 {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16}, | |
122 {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12}, | |
123 {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13}, | |
124 {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16}, | |
125 {0x1d,16}, {0x1c,16}, {0x1b,16}, | |
0 | 126 {0x01,6}, /* escape */ |
127 {0x06,4}, /* EOB */ | |
128 }; | |
129 | |
1064 | 130 static const int8_t mpeg1_level[111] = { |
0 | 131 1, 2, 3, 4, 5, 6, 7, 8, |
132 9, 10, 11, 12, 13, 14, 15, 16, | |
133 17, 18, 19, 20, 21, 22, 23, 24, | |
134 25, 26, 27, 28, 29, 30, 31, 32, | |
135 33, 34, 35, 36, 37, 38, 39, 40, | |
136 1, 2, 3, 4, 5, 6, 7, 8, | |
137 9, 10, 11, 12, 13, 14, 15, 16, | |
138 17, 18, 1, 2, 3, 4, 5, 1, | |
139 2, 3, 4, 1, 2, 3, 1, 2, | |
140 3, 1, 2, 3, 1, 2, 1, 2, | |
141 1, 2, 1, 2, 1, 2, 1, 2, | |
142 1, 2, 1, 2, 1, 2, 1, 2, | |
143 1, 1, 1, 1, 1, 1, 1, 1, | |
144 1, 1, 1, 1, 1, 1, 1, | |
145 }; | |
146 | |
1064 | 147 static const int8_t mpeg1_run[111] = { |
0 | 148 0, 0, 0, 0, 0, 0, 0, 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 1, 1, 1, 1, 1, 1, 1, 1, | |
154 1, 1, 1, 1, 1, 1, 1, 1, | |
155 1, 1, 2, 2, 2, 2, 2, 3, | |
156 3, 3, 3, 4, 4, 4, 5, 5, | |
157 5, 6, 6, 6, 7, 7, 8, 8, | |
158 9, 9, 10, 10, 11, 11, 12, 12, | |
159 13, 13, 14, 14, 15, 15, 16, 16, | |
160 17, 18, 19, 20, 21, 22, 23, 24, | |
161 25, 26, 27, 28, 29, 30, 31, | |
162 }; | |
163 | |
164 static RLTable rl_mpeg1 = { | |
165 111, | |
166 111, | |
167 mpeg1_vlc, | |
168 mpeg1_run, | |
169 mpeg1_level, | |
170 }; | |
171 | |
172 static RLTable rl_mpeg2 = { | |
173 111, | |
174 111, | |
175 mpeg2_vlc, | |
176 mpeg1_run, | |
177 mpeg1_level, | |
178 }; | |
179 | |
1181 | 180 static const uint8_t mbAddrIncrTable[36][2] = { |
0 | 181 {0x1, 1}, |
182 {0x3, 3}, | |
183 {0x2, 3}, | |
184 {0x3, 4}, | |
185 {0x2, 4}, | |
186 {0x3, 5}, | |
187 {0x2, 5}, | |
188 {0x7, 7}, | |
189 {0x6, 7}, | |
190 {0xb, 8}, | |
191 {0xa, 8}, | |
192 {0x9, 8}, | |
193 {0x8, 8}, | |
194 {0x7, 8}, | |
195 {0x6, 8}, | |
196 {0x17, 10}, | |
197 {0x16, 10}, | |
198 {0x15, 10}, | |
199 {0x14, 10}, | |
200 {0x13, 10}, | |
201 {0x12, 10}, | |
202 {0x23, 11}, | |
203 {0x22, 11}, | |
204 {0x21, 11}, | |
205 {0x20, 11}, | |
206 {0x1f, 11}, | |
207 {0x1e, 11}, | |
208 {0x1d, 11}, | |
209 {0x1c, 11}, | |
210 {0x1b, 11}, | |
211 {0x1a, 11}, | |
212 {0x19, 11}, | |
213 {0x18, 11}, | |
214 {0x8, 11}, /* escape */ | |
215 {0xf, 11}, /* stuffing */ | |
1181 | 216 {0x0, 8}, /* end (and 15 more 0 bits should follow) */ |
0 | 217 }; |
218 | |
1853 | 219 static const uint8_t mbPatTable[64][2] = { |
220 {0x1, 9}, | |
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 | |
3391
d60dc0a7dee6
staric frame_rate_tab -> non static ff_frame_rate_tab part of the cavs patch by (Stefan Gehrer stefan.gehrer gmx de)
michael
parents:
2979
diff
changeset
|
357 const AVRational ff_frame_rate_tab[] = { |
1837 | 358 { 0, 0}, |
359 {24000, 1001}, | |
360 { 24, 1}, | |
361 { 25, 1}, | |
362 {30000, 1001}, | |
363 { 30, 1}, | |
364 { 50, 1}, | |
365 {60000, 1001}, | |
366 { 60, 1}, | |
1126
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
367 // Xing's 15fps: (9) |
1837 | 368 { 15, 1}, |
1126
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1106
diff
changeset
|
369 // libmpeg3's "Unofficial economy rates": (10-13) |
1837 | 370 { 5, 1}, |
371 { 10, 1}, | |
372 { 12, 1}, | |
373 { 15, 1}, | |
374 { 0, 0}, | |
0 | 375 }; |
376 | |
1064 | 377 static const uint8_t non_linear_qscale[32] = { |
0 | 378 0, 1, 2, 3, 4, 5, 6, 7, |
379 8,10,12,14,16,18,20,22, | |
380 24,28,32,36,40,44,48,52, | |
381 56,64,72,80,88,96,104,112, | |
382 }; | |
498 | 383 |
4621 | 384 static const uint8_t inv_non_linear_qscale[13] = { |
385 0, 2, 4, 6, 8, | |
386 9,10,11,12,13,14,15,16, | |
387 }; | |
388 | |
2753 | 389 const uint8_t ff_mpeg1_dc_scale_table[128]={ |
498 | 390 // 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 |
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 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, | |
395 }; | |
396 | |
3556
6805c1e5507e
Fix some "'static' is not at beginning of declaration" warnings.
diego
parents:
3391
diff
changeset
|
397 static const uint8_t mpeg2_dc_scale_table1[128]={ |
1993 | 398 // 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 |
399 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
400 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
401 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
402 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
403 }; | |
404 | |
2967 | 405 static const uint8_t mpeg2_dc_scale_table2[128]={ |
1993 | 406 // 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 |
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
411 }; | |
412 | |
2967 | 413 static const uint8_t mpeg2_dc_scale_table3[128]={ |
1993 | 414 // 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 |
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
419 }; | |
420 | |
2753 | 421 static const uint8_t *mpeg2_dc_scale_table[4]={ |
1993 | 422 ff_mpeg1_dc_scale_table, |
423 mpeg2_dc_scale_table1, | |
424 mpeg2_dc_scale_table2, | |
2967 | 425 mpeg2_dc_scale_table3, |
1993 | 426 }; |
427 | |
917 | 428 static const float mpeg1_aspect[16]={ |
429 0.0000, | |
430 1.0000, | |
431 0.6735, | |
432 0.7031, | |
2967 | 433 |
917 | 434 0.7615, |
435 0.8055, | |
436 0.8437, | |
437 0.8935, | |
498 | 438 |
917 | 439 0.9157, |
440 0.9815, | |
441 1.0255, | |
442 1.0695, | |
443 | |
444 1.0950, | |
445 1.1575, | |
446 1.2015, | |
447 }; | |
448 | |
1548 | 449 static const AVRational mpeg2_aspect[16]={ |
450 {0,1}, | |
451 {1,1}, | |
452 {4,3}, | |
453 {16,9}, | |
454 {221,100}, | |
455 {0,1}, | |
456 {0,1}, | |
457 {0,1}, | |
458 {0,1}, | |
459 {0,1}, | |
460 {0,1}, | |
461 {0,1}, | |
462 {0,1}, | |
463 {0,1}, | |
464 {0,1}, | |
465 {0,1}, | |
917 | 466 }; |
467 | |
1721 | 468 static const uint8_t svcd_scan_offset_placeholder[14]={ |
469 0x10, 0x0E, | |
470 0x00, 0x80, 0x81, | |
471 0x00, 0x80, 0x81, | |
472 0xff, 0xff, 0xff, | |
473 0xff, 0xff, 0xff, | |
474 }; |