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_il_coeff_reorder[] = {
55  0, 1, 0, 1, 1, 2, 5, 3,
56  2, 2, 2, 2, 4, 7, 8, 10,
57  9, 7, 5, 4, 2, 3, 5, 6,
58  8, 9, 11, 12, 13, 12, 11, 10,
59  9, 7, 5, 4, 6, 7, 9, 11,
60  12, 12, 13, 13, 14, 12, 11, 9,
61  7, 9, 11, 12, 14, 14, 14, 15,
62  13, 11, 13, 15, 15, 15, 15, 15,
63 };
64 
65 static const uint8_t vp6_def_runv_coeff_model[2][14] = {
66  { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 },
67  { 135, 201, 181, 154, 98, 117, 132, 126, 146, 169, 184, 240, 246, 254 },
68 };
69 
70 static const uint8_t vp6_sig_dct_pct[2][2] = {
71  { 237, 246 },
72  { 231, 243 },
73 };
74 
75 static const uint8_t vp6_pdv_pct[2][7] = {
76  { 253, 253, 254, 254, 254, 254, 254 },
77  { 245, 253, 254, 254, 254, 254, 254 },
78 };
79 
80 static const uint8_t vp6_fdv_pct[2][8] = {
81  { 254, 254, 254, 254, 254, 250, 250, 252 },
82  { 254, 254, 254, 254, 254, 251, 251, 254 },
83 };
84 
85 static const uint8_t vp6_dccv_pct[2][11] = {
86  { 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
87  { 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 },
88 };
89 
90 static const uint8_t vp6_coeff_reorder_pct[] = {
91  255, 132, 132, 159, 153, 151, 161, 170,
92  164, 162, 136, 110, 103, 114, 129, 118,
93  124, 125, 132, 136, 114, 110, 142, 135,
94  134, 123, 143, 126, 153, 183, 166, 161,
95  171, 180, 179, 164, 203, 218, 225, 217,
96  215, 206, 203, 217, 229, 241, 248, 243,
97  253, 255, 253, 255, 255, 255, 255, 255,
98  255, 255, 255, 255, 255, 255, 255, 255,
99 };
100 
101 static const uint8_t vp6_runv_pct[2][14] = {
102  { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 },
103  { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 },
104 };
105 
106 static const uint8_t vp6_ract_pct[3][2][6][11] = {
107  { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 },
108  { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 },
109  { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 },
110  { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 },
111  { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
112  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
113  { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
114  { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 },
115  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
116  { 255, 255, 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  { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 },
120  { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 },
121  { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 },
122  { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 },
123  { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
124  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
125  { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
126  { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
127  { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
128  { 255, 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  { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 },
132  { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 },
133  { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 },
134  { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 },
135  { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
136  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
137  { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 },
138  { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 },
139  { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
140  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
141  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
142  { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }
143 };
144 
145 static const int vp6_dccv_lc[3][5][2] = {
146  { { 122, 133 }, { 0, 1 }, { 78, 171 }, { 139, 117 }, { 168, 79 } },
147  { { 133, 51 }, { 0, 1 }, { 169, 71 }, { 214, 44 }, { 210, 38 } },
148  { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246, -3 }, { 203, 17 } },
149 };
150 
151 static const uint8_t vp6_coeff_groups[] = {
152  0, 0, 1, 1, 1, 2, 2, 2,
153  2, 2, 2, 3, 3, 3, 3, 3,
154  3, 3, 3, 3, 3, 3, 4, 4,
155  4, 4, 4, 4, 4, 4, 4, 4,
156  4, 4, 4, 4, 4, 5, 5, 5,
157  5, 5, 5, 5, 5, 5, 5, 5,
158  5, 5, 5, 5, 5, 5, 5, 5,
159  5, 5, 5, 5, 5, 5, 5, 5,
160 };
161 
162 static const int16_t vp6_block_copy_filter[17][8][4] = {
163  { { 0, 128, 0, 0 }, /* 0 */
164  { -3, 122, 9, 0 },
165  { -4, 109, 24, -1 },
166  { -5, 91, 45, -3 },
167  { -4, 68, 68, -4 },
168  { -3, 45, 91, -5 },
169  { -1, 24, 109, -4 },
170  { 0, 9, 122, -3 } },
171  { { 0, 128, 0, 0 }, /* 1 */
172  { -4, 124, 9, -1 },
173  { -5, 110, 25, -2 },
174  { -6, 91, 46, -3 },
175  { -5, 69, 69, -5 },
176  { -3, 46, 91, -6 },
177  { -2, 25, 110, -5 },
178  { -1, 9, 124, -4 } },
179  { { 0, 128, 0, 0 }, /* 2 */
180  { -4, 123, 10, -1 },
181  { -6, 110, 26, -2 },
182  { -7, 92, 47, -4 },
183  { -6, 70, 70, -6 },
184  { -4, 47, 92, -7 },
185  { -2, 26, 110, -6 },
186  { -1, 10, 123, -4 } },
187  { { 0, 128, 0, 0 }, /* 3 */
188  { -5, 124, 10, -1 },
189  { -7, 110, 27, -2 },
190  { -7, 91, 48, -4 },
191  { -6, 70, 70, -6 },
192  { -4, 48, 92, -8 },
193  { -2, 27, 110, -7 },
194  { -1, 10, 124, -5 } },
195  { { 0, 128, 0, 0 }, /* 4 */
196  { -6, 124, 11, -1 },
197  { -8, 111, 28, -3 },
198  { -8, 92, 49, -5 },
199  { -7, 71, 71, -7 },
200  { -5, 49, 92, -8 },
201  { -3, 28, 111, -8 },
202  { -1, 11, 124, -6 } },
203  { { 0, 128, 0, 0 }, /* 5 */
204  { -6, 123, 12, -1 },
205  { -9, 111, 29, -3 },
206  { -9, 93, 50, -6 },
207  { -8, 72, 72, -8 },
208  { -6, 50, 93, -9 },
209  { -3, 29, 111, -9 },
210  { -1, 12, 123, -6 } },
211  { { 0, 128, 0, 0 }, /* 6 */
212  { -7, 124, 12, -1 },
213  { -10, 111, 30, -3 },
214  { -10, 93, 51, -6 },
215  { -9, 73, 73, -9 },
216  { -6, 51, 93, -10 },
217  { -3, 30, 111, -10 },
218  { -1, 12, 124, -7 } },
219  { { 0, 128, 0, 0 }, /* 7 */
220  { -7, 123, 13, -1 },
221  { -11, 112, 31, -4 },
222  { -11, 94, 52, -7 },
223  { -10, 74, 74, -10 },
224  { -7, 52, 94, -11 },
225  { -4, 31, 112, -11 },
226  { -1, 13, 123, -7 } },
227  { { 0, 128, 0, 0 }, /* 8 */
228  { -8, 124, 13, -1 },
229  { -12, 112, 32, -4 },
230  { -12, 94, 53, -7 },
231  { -10, 74, 74, -10 },
232  { -7, 53, 94, -12 },
233  { -4, 32, 112, -12 },
234  { -1, 13, 124, -8 } },
235  { { 0, 128, 0, 0 }, /* 9 */
236  { -9, 124, 14, -1 },
237  { -13, 112, 33, -4 },
238  { -13, 95, 54, -8 },
239  { -11, 75, 75, -11 },
240  { -8, 54, 95, -13 },
241  { -4, 33, 112, -13 },
242  { -1, 14, 124, -9 } },
243  { { 0, 128, 0, 0 }, /* 10 */
244  { -9, 123, 15, -1 },
245  { -14, 113, 34, -5 },
246  { -14, 95, 55, -8 },
247  { -12, 76, 76, -12 },
248  { -8, 55, 95, -14 },
249  { -5, 34, 112, -13 },
250  { -1, 15, 123, -9 } },
251  { { 0, 128, 0, 0 }, /* 11 */
252  { -10, 124, 15, -1 },
253  { -14, 113, 34, -5 },
254  { -15, 96, 56, -9 },
255  { -13, 77, 77, -13 },
256  { -9, 56, 96, -15 },
257  { -5, 34, 113, -14 },
258  { -1, 15, 124, -10 } },
259  { { 0, 128, 0, 0 }, /* 12 */
260  { -10, 123, 16, -1 },
261  { -15, 113, 35, -5 },
262  { -16, 98, 56, -10 },
263  { -14, 78, 78, -14 },
264  { -10, 56, 98, -16 },
265  { -5, 35, 113, -15 },
266  { -1, 16, 123, -10 } },
267  { { 0, 128, 0, 0 }, /* 13 */
268  { -11, 124, 17, -2 },
269  { -16, 113, 36, -5 },
270  { -17, 98, 57, -10 },
271  { -14, 78, 78, -14 },
272  { -10, 57, 98, -17 },
273  { -5, 36, 113, -16 },
274  { -2, 17, 124, -11 } },
275  { { 0, 128, 0, 0 }, /* 14 */
276  { -12, 125, 17, -2 },
277  { -17, 114, 37, -6 },
278  { -18, 99, 58, -11 },
279  { -15, 79, 79, -15 },
280  { -11, 58, 99, -18 },
281  { -6, 37, 114, -17 },
282  { -2, 17, 125, -12 } },
283  { { 0, 128, 0, 0 }, /* 15 */
284  { -12, 124, 18, -2 },
285  { -18, 114, 38, -6 },
286  { -19, 99, 59, -11 },
287  { -16, 80, 80, -16 },
288  { -11, 59, 99, -19 },
289  { -6, 38, 114, -18 },
290  { -2, 18, 124, -12 } },
291  { { 0, 128, 0, 0 }, /* 16 */
292  { -4, 118, 16, -2 },
293  { -7, 106, 34, -5 },
294  { -8, 90, 53, -7 },
295  { -8, 72, 72, -8 },
296  { -7, 53, 90, -8 },
297  { -5, 34, 106, -7 },
298  { -2, 16, 118, -4 } },
299 };
300 
301 static const VP56Tree vp6_pcr_tree[] = {
302  { 8, 0},
303  { 4, 1},
304  { 2, 2}, {-1}, {-2},
305  { 2, 3}, {-3}, {-4},
306  { 8, 4},
307  { 4, 5},
308  { 2, 6}, {-5}, {-6},
309  { 2, 7}, {-7}, {-8},
310  {-0},
311 };
312 
313 static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 };
314 
315 static const uint8_t vp6_huff_coeff_map[] = {
316  13, 14, 11, 0, 1, 15, 16, 18, 2, 17, 3, 4, 19, 20, 5, 6, 21, 22, 7, 8, 9, 10
317 };
318 
319 static const uint8_t vp6_huff_run_map[] = {
320  10, 13, 11, 12, 0, 1, 2, 3, 14, 8, 15, 16, 4, 5, 6, 7
321 };
322 
323 #endif /* AVCODEC_VP6DATA_H */
vp6_def_fdv_vector_model
static const uint8_t vp6_def_fdv_vector_model[2][8]
Definition: vp6data.h:33
vp6_block_copy_filter
static const int16_t vp6_block_copy_filter[17][8][4]
Definition: vp6data.h:162
vp6_def_coeff_reorder
static const uint8_t vp6_def_coeff_reorder[]
Definition: vp6data.h:43
vp6_huff_coeff_map
static const uint8_t vp6_huff_coeff_map[]
Definition: vp6data.h:315
vp6_huff_run_map
static const uint8_t vp6_huff_run_map[]
Definition: vp6data.h:319
vp6_dccv_pct
static const uint8_t vp6_dccv_pct[2][11]
Definition: vp6data.h:85
vp6_def_runv_coeff_model
static const uint8_t vp6_def_runv_coeff_model[2][14]
Definition: vp6data.h:65
vp56.h
vp6_pcr_tree
static const VP56Tree vp6_pcr_tree[]
Definition: vp6data.h:301
vp6_sig_dct_pct
static const uint8_t vp6_sig_dct_pct[2][2]
Definition: vp6data.h:70
vp6_fdv_pct
static const uint8_t vp6_fdv_pct[2][8]
Definition: vp6data.h:80
vp6_coord_div
static const uint8_t vp6_coord_div[]
Definition: vp6data.h:313
VP56Tree
Definition: vp56.h:62
vp6_il_coeff_reorder
static const uint8_t vp6_il_coeff_reorder[]
Definition: vp6data.h:54
vp6_coeff_reorder_pct
static const uint8_t vp6_coeff_reorder_pct[]
Definition: vp6data.h:90
vp6_dccv_lc
static const int vp6_dccv_lc[3][5][2]
Definition: vp6data.h:145
vp6_pdv_pct
static const uint8_t vp6_pdv_pct[2][7]
Definition: vp6data.h:75
vp6_coeff_groups
static const uint8_t vp6_coeff_groups[]
Definition: vp6data.h:151
vp6_def_pdv_vector_model
static const uint8_t vp6_def_pdv_vector_model[2][7]
Definition: vp6data.h:38
vp6_runv_pct
static const uint8_t vp6_runv_pct[2][14]
Definition: vp6data.h:101
vp6_ract_pct
static const uint8_t vp6_ract_pct[3][2][6][11]
Definition: vp6data.h:106