Mercurial > libavcodec.hg
annotate vp6data.h @ 11363:a4596f842e18 libavcodec
Fixed buffer overread in flashsv decoder.
author | fenrir |
---|---|
date | Thu, 04 Mar 2010 19:10:44 +0000 |
parents | e9d9d946f213 |
children | 7dd2a45249a9 |
rev | line source |
---|---|
3695 | 1 /** |
8718
e9d9d946f213
Use full internal pathname in doxygen @file directives.
diego
parents:
8299
diff
changeset
|
2 * @file libavcodec/vp6data.h |
3695 | 3 * VP6 compatible video decoder |
4 * | |
5 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> | |
6 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3695
diff
changeset
|
7 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3695
diff
changeset
|
8 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3695
diff
changeset
|
9 * FFmpeg is free software; you can redistribute it and/or |
3695 | 10 * modify it under the terms of the GNU Lesser General Public |
11 * License as published by the Free Software Foundation; either | |
12 * version 2.1 of the License, or (at your option) any later version. | |
13 * | |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3695
diff
changeset
|
14 * FFmpeg is distributed in the hope that it will be useful, |
3695 | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * Lesser General Public License for more details. | |
18 * | |
19 * 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:
3695
diff
changeset
|
20 * License along with FFmpeg; if not, write to the Free Software |
5215 | 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3695 | 22 */ |
23 | |
7760 | 24 #ifndef AVCODEC_VP6DATA_H |
25 #define AVCODEC_VP6DATA_H | |
3695 | 26 |
27 #include "vp56data.h" | |
28 | |
29 static const uint8_t vp6_def_fdv_vector_model[2][8] = { | |
30 { 247, 210, 135, 68, 138, 220, 239, 246 }, | |
31 { 244, 184, 201, 44, 173, 221, 239, 253 }, | |
32 }; | |
33 | |
34 static const uint8_t vp6_def_pdv_vector_model[2][7] = { | |
35 { 225, 146, 172, 147, 214, 39, 156 }, | |
36 { 204, 170, 119, 235, 140, 230, 228 }, | |
37 }; | |
38 | |
39 static const uint8_t vp6_def_coeff_reorder[] = { | |
40 0, 0, 1, 1, 1, 2, 2, 2, | |
41 2, 2, 2, 3, 3, 4, 4, 4, | |
42 5, 5, 5, 5, 6, 6, 7, 7, | |
43 7, 7, 7, 8, 8, 9, 9, 9, | |
44 9, 9, 9, 10, 10, 11, 11, 11, | |
45 11, 11, 11, 12, 12, 12, 12, 12, | |
46 12, 13, 13, 13, 13, 13, 14, 14, | |
47 14, 14, 15, 15, 15, 15, 15, 15, | |
48 }; | |
49 | |
50 static const uint8_t vp6_def_runv_coeff_model[2][14] = { | |
51 { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 }, | |
52 { 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 }, | |
53 }; | |
54 | |
55 static const uint8_t vp6_sig_dct_pct[2][2] = { | |
56 { 237, 246 }, | |
57 { 231, 243 }, | |
58 }; | |
59 | |
60 static const uint8_t vp6_pdv_pct[2][7] = { | |
61 { 253, 253, 254, 254, 254, 254, 254 }, | |
62 { 245, 253, 254, 254, 254, 254, 254 }, | |
63 }; | |
64 | |
65 static const uint8_t vp6_fdv_pct[2][8] = { | |
66 { 254, 254, 254, 254, 254, 250, 250, 252 }, | |
67 { 254, 254, 254, 254, 254, 251, 251, 254 }, | |
68 }; | |
69 | |
70 static const uint8_t vp6_dccv_pct[2][11] = { | |
71 { 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 }, | |
72 { 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 }, | |
73 }; | |
74 | |
75 static const uint8_t vp6_coeff_reorder_pct[] = { | |
76 255, 132, 132, 159, 153, 151, 161, 170, | |
77 164, 162, 136, 110, 103, 114, 129, 118, | |
78 124, 125, 132, 136, 114, 110, 142, 135, | |
79 134, 123, 143, 126, 153, 183, 166, 161, | |
80 171, 180, 179, 164, 203, 218, 225, 217, | |
81 215, 206, 203, 217, 229, 241, 248, 243, | |
82 253, 255, 253, 255, 255, 255, 255, 255, | |
83 255, 255, 255, 255, 255, 255, 255, 255, | |
84 }; | |
85 | |
86 static const uint8_t vp6_runv_pct[2][14] = { | |
87 { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 }, | |
88 { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 }, | |
89 }; | |
90 | |
91 static const uint8_t vp6_ract_pct[3][2][6][11] = { | |
92 { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 }, | |
93 { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 }, | |
94 { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 }, | |
95 { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 }, | |
96 { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
97 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, | |
98 { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
99 { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 }, | |
100 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
101 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
102 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
103 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }, | |
104 { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 }, | |
105 { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 }, | |
106 { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 }, | |
107 { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 }, | |
108 { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
109 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, | |
110 { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
111 { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
112 { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
113 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
114 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
115 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }, | |
116 { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 }, | |
117 { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 }, | |
118 { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 }, | |
119 { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 }, | |
120 { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
121 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } }, | |
122 { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 }, | |
123 { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 }, | |
124 { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
125 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
126 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }, | |
127 { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } } | |
128 }; | |
129 | |
130 static const int vp6_dccv_lc[3][5][2] = { | |
131 { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } }, | |
132 { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } }, | |
133 { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } }, | |
134 }; | |
135 | |
136 static const uint8_t vp6_coeff_groups[] = { | |
137 0, 0, 1, 1, 1, 2, 2, 2, | |
138 2, 2, 2, 3, 3, 3, 3, 3, | |
139 3, 3, 3, 3, 3, 3, 4, 4, | |
140 4, 4, 4, 4, 4, 4, 4, 4, | |
141 4, 4, 4, 4, 4, 5, 5, 5, | |
142 5, 5, 5, 5, 5, 5, 5, 5, | |
143 5, 5, 5, 5, 5, 5, 5, 5, | |
144 5, 5, 5, 5, 5, 5, 5, 5, | |
145 }; | |
146 | |
4308 | 147 static const int16_t vp6_block_copy_filter[17][8][4] = { |
3695 | 148 { { 0, 128, 0, 0 }, /* 0 */ |
149 { -3, 122, 9, 0 }, | |
150 { -4, 109, 24, -1 }, | |
151 { -5, 91, 45, -3 }, | |
152 { -4, 68, 68, -4 }, | |
153 { -3, 45, 91, -5 }, | |
154 { -1, 24, 109, -4 }, | |
155 { 0, 9, 122, -3 } }, | |
156 { { 0, 128, 0, 0 }, /* 1 */ | |
157 { -4, 124, 9, -1 }, | |
158 { -5, 110, 25, -2 }, | |
159 { -6, 91, 46, -3 }, | |
160 { -5, 69, 69, -5 }, | |
161 { -3, 46, 91, -6 }, | |
162 { -2, 25, 110, -5 }, | |
163 { -1, 9, 124, -4 } }, | |
164 { { 0, 128, 0, 0 }, /* 2 */ | |
165 { -4, 123, 10, -1 }, | |
166 { -6, 110, 26, -2 }, | |
167 { -7, 92, 47, -4 }, | |
168 { -6, 70, 70, -6 }, | |
169 { -4, 47, 92, -7 }, | |
170 { -2, 26, 110, -6 }, | |
171 { -1, 10, 123, -4 } }, | |
172 { { 0, 128, 0, 0 }, /* 3 */ | |
173 { -5, 124, 10, -1 }, | |
174 { -7, 110, 27, -2 }, | |
175 { -7, 91, 48, -4 }, | |
176 { -6, 70, 70, -6 }, | |
177 { -4, 48, 92, -8 }, | |
178 { -2, 27, 110, -7 }, | |
179 { -1, 10, 124, -5 } }, | |
180 { { 0, 128, 0, 0 }, /* 4 */ | |
181 { -6, 124, 11, -1 }, | |
182 { -8, 111, 28, -3 }, | |
183 { -8, 92, 49, -5 }, | |
184 { -7, 71, 71, -7 }, | |
185 { -5, 49, 92, -8 }, | |
186 { -3, 28, 111, -8 }, | |
187 { -1, 11, 124, -6 } }, | |
188 { { 0, 128, 0, 0 }, /* 5 */ | |
189 { -6, 123, 12, -1 }, | |
190 { -9, 111, 29, -3 }, | |
191 { -9, 93, 50, -6 }, | |
192 { -8, 72, 72, -8 }, | |
193 { -6, 50, 93, -9 }, | |
194 { -3, 29, 111, -9 }, | |
195 { -1, 12, 123, -6 } }, | |
196 { { 0, 128, 0, 0 }, /* 6 */ | |
197 { -7, 124, 12, -1 }, | |
198 { -10, 111, 30, -3 }, | |
199 { -10, 93, 51, -6 }, | |
200 { -9, 73, 73, -9 }, | |
201 { -6, 51, 93, -10 }, | |
202 { -3, 30, 111, -10 }, | |
203 { -1, 12, 124, -7 } }, | |
204 { { 0, 128, 0, 0 }, /* 7 */ | |
205 { -7, 123, 13, -1 }, | |
206 { -11, 112, 31, -4 }, | |
207 { -11, 94, 52, -7 }, | |
208 { -10, 74, 74, -10 }, | |
209 { -7, 52, 94, -11 }, | |
210 { -4, 31, 112, -11 }, | |
211 { -1, 13, 123, -7 } }, | |
212 { { 0, 128, 0, 0 }, /* 8 */ | |
213 { -8, 124, 13, -1 }, | |
214 { -12, 112, 32, -4 }, | |
215 { -12, 94, 53, -7 }, | |
216 { -10, 74, 74, -10 }, | |
217 { -7, 53, 94, -12 }, | |
218 { -4, 32, 112, -12 }, | |
219 { -1, 13, 124, -8 } }, | |
220 { { 0, 128, 0, 0 }, /* 9 */ | |
221 { -9, 124, 14, -1 }, | |
222 { -13, 112, 33, -4 }, | |
223 { -13, 95, 54, -8 }, | |
224 { -11, 75, 75, -11 }, | |
225 { -8, 54, 95, -13 }, | |
226 { -4, 33, 112, -13 }, | |
227 { -1, 14, 124, -9 } }, | |
228 { { 0, 128, 0, 0 }, /* 10 */ | |
229 { -9, 123, 15, -1 }, | |
230 { -14, 113, 34, -5 }, | |
231 { -14, 95, 55, -8 }, | |
232 { -12, 76, 76, -12 }, | |
233 { -8, 55, 95, -14 }, | |
234 { -5, 34, 112, -13 }, | |
235 { -1, 15, 123, -9 } }, | |
236 { { 0, 128, 0, 0 }, /* 11 */ | |
237 { -10, 124, 15, -1 }, | |
238 { -14, 113, 34, -5 }, | |
239 { -15, 96, 56, -9 }, | |
240 { -13, 77, 77, -13 }, | |
241 { -9, 56, 96, -15 }, | |
242 { -5, 34, 113, -14 }, | |
243 { -1, 15, 124, -10 } }, | |
244 { { 0, 128, 0, 0 }, /* 12 */ | |
245 { -10, 123, 16, -1 }, | |
246 { -15, 113, 35, -5 }, | |
247 { -16, 98, 56, -10 }, | |
248 { -14, 78, 78, -14 }, | |
249 { -10, 56, 98, -16 }, | |
250 { -5, 35, 113, -15 }, | |
251 { -1, 16, 123, -10 } }, | |
252 { { 0, 128, 0, 0 }, /* 13 */ | |
253 { -11, 124, 17, -2 }, | |
254 { -16, 113, 36, -5 }, | |
255 { -17, 98, 57, -10 }, | |
256 { -14, 78, 78, -14 }, | |
257 { -10, 57, 98, -17 }, | |
258 { -5, 36, 113, -16 }, | |
259 { -2, 17, 124, -11 } }, | |
260 { { 0, 128, 0, 0 }, /* 14 */ | |
261 { -12, 125, 17, -2 }, | |
262 { -17, 114, 37, -6 }, | |
263 { -18, 99, 58, -11 }, | |
264 { -15, 79, 79, -15 }, | |
265 { -11, 58, 99, -18 }, | |
266 { -6, 37, 114, -17 }, | |
267 { -2, 17, 125, -12 } }, | |
268 { { 0, 128, 0, 0 }, /* 15 */ | |
269 { -12, 124, 18, -2 }, | |
270 { -18, 114, 38, -6 }, | |
271 { -19, 99, 59, -11 }, | |
272 { -16, 80, 80, -16 }, | |
273 { -11, 59, 99, -19 }, | |
274 { -6, 38, 114, -18 }, | |
275 { -2, 18, 124, -12 } }, | |
4308 | 276 { { 0, 128, 0, 0 }, /* 16 */ |
277 { -4, 118, 16, -2 }, | |
278 { -7, 106, 34, -5 }, | |
279 { -8, 90, 53, -7 }, | |
280 { -8, 72, 72, -8 }, | |
281 { -7, 53, 90, -8 }, | |
282 { -5, 34, 106, -7 }, | |
283 { -2, 16, 118, -4 } }, | |
3695 | 284 }; |
285 | |
8299 | 286 static const VP56Tree vp6_pcr_tree[] = { |
3695 | 287 { 8, 0}, |
288 { 4, 1}, | |
289 { 2, 2}, {-1}, {-2}, | |
290 { 2, 3}, {-3}, {-4}, | |
291 { 8, 4}, | |
292 { 4, 5}, | |
293 { 2, 6}, {-5}, {-6}, | |
294 { 2, 7}, {-7}, {-8}, | |
295 {-0}, | |
296 }; | |
297 | |
298 static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 }; | |
299 | |
5821 | 300 static const uint8_t vp6_huff_coeff_map[] = { |
301 13, 14, 11, 0, 1, 15, 16, 18, 2, 17, 3, 4, 19, 20, 5, 6, 21, 22, 7, 8, 9, 10 | |
302 }; | |
303 | |
304 static const uint8_t vp6_huff_run_map[] = { | |
305 10, 13, 11, 12, 0, 1, 2, 3, 14, 8, 15, 16, 4, 5, 6, 7 | |
306 }; | |
307 | |
7760 | 308 #endif /* AVCODEC_VP6DATA_H */ |