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