vp56data.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 Libav.
5  *
6  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
26 #ifndef AVCODEC_VP56DATA_H
27 #define AVCODEC_VP56DATA_H
28 
29 #include "libavutil/common.h"
30 
31 typedef enum {
39 } VP56Frame;
40 
41 typedef enum {
52 } VP56mb;
53 
54 typedef struct VP56Tree {
55  int8_t val;
56  int8_t prob_idx;
57 } VP56Tree;
58 
59 extern const uint8_t ff_vp56_b2p[];
60 extern const uint8_t ff_vp56_b6to4[];
61 extern const uint8_t ff_vp56_coeff_parse_table[6][11];
62 extern const uint8_t ff_vp56_def_mb_types_stats[3][10][2];
63 extern const VP56Tree ff_vp56_pva_tree[];
64 extern const VP56Tree ff_vp56_pc_tree[];
65 extern const uint8_t ff_vp56_coeff_bias[];
66 extern const uint8_t ff_vp56_coeff_bit_length[];
67 
68 static const VP56Frame vp56_reference_frame[] = {
69  VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */
70  VP56_FRAME_CURRENT, /* VP56_MB_INTRA */
71  VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_DELTA_PF */
72  VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V1_PF */
73  VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V2_PF */
74  VP56_FRAME_GOLDEN, /* VP56_MB_INTER_NOVEC_GF */
75  VP56_FRAME_GOLDEN, /* VP56_MB_INTER_DELTA_GF */
76  VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_4V */
77  VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V1_GF */
78  VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V2_GF */
79 };
80 
81 static const uint8_t vp56_ac_dequant[64] = {
82  94, 92, 90, 88, 86, 82, 78, 74,
83  70, 66, 62, 58, 54, 53, 52, 51,
84  50, 49, 48, 47, 46, 45, 44, 43,
85  42, 40, 39, 37, 36, 35, 34, 33,
86  32, 31, 30, 29, 28, 27, 26, 25,
87  24, 23, 22, 21, 20, 19, 18, 17,
88  16, 15, 14, 13, 12, 11, 10, 9,
89  8, 7, 6, 5, 4, 3, 2, 1,
90 };
91 
92 static const uint8_t vp56_dc_dequant[64] = {
93  47, 47, 47, 47, 45, 43, 43, 43,
94  43, 43, 42, 41, 41, 40, 40, 40,
95  40, 35, 35, 35, 35, 33, 33, 33,
96  33, 32, 32, 32, 27, 27, 26, 26,
97  25, 25, 24, 24, 23, 23, 19, 19,
98  19, 19, 18, 18, 17, 16, 16, 16,
99  16, 16, 15, 11, 11, 11, 10, 10,
100  9, 8, 7, 5, 3, 3, 2, 2,
101 };
102 
103 static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] = {
104  { { { 9, 15 }, { 32, 25 }, { 7, 19 }, { 9, 21 }, { 1, 12 },
105  { 14, 12 }, { 3, 18 }, { 14, 23 }, { 3, 10 }, { 0, 4 }, },
106  { { 41, 22 }, { 1, 0 }, { 1, 31 }, { 0, 0 }, { 0, 0 },
107  { 0, 1 }, { 1, 7 }, { 0, 1 }, { 98, 25 }, { 4, 10 }, },
108  { { 2, 3 }, { 2, 3 }, { 0, 2 }, { 0, 2 }, { 0, 0 },
109  { 11, 4 }, { 1, 4 }, { 0, 2 }, { 3, 2 }, { 0, 4 }, }, },
110  { { { 48, 39 }, { 1, 2 }, { 11, 27 }, { 29, 44 }, { 7, 27 },
111  { 1, 4 }, { 0, 3 }, { 1, 6 }, { 1, 2 }, { 0, 0 }, },
112  { { 123, 37 }, { 6, 4 }, { 1, 27 }, { 0, 0 }, { 0, 0 },
113  { 5, 8 }, { 1, 7 }, { 0, 1 }, { 12, 10 }, { 0, 2 }, },
114  { { 49, 46 }, { 3, 4 }, { 7, 31 }, { 42, 41 }, { 0, 0 },
115  { 2, 6 }, { 1, 7 }, { 1, 4 }, { 2, 4 }, { 0, 1 }, }, },
116  { { { 21, 32 }, { 1, 2 }, { 4, 10 }, { 32, 43 }, { 6, 23 },
117  { 2, 3 }, { 1, 19 }, { 1, 6 }, { 12, 21 }, { 0, 7 }, },
118  { { 26, 14 }, { 14, 12 }, { 0, 24 }, { 0, 0 }, { 0, 0 },
119  { 55, 17 }, { 1, 9 }, { 0, 36 }, { 5, 7 }, { 1, 3 }, },
120  { { 26, 25 }, { 1, 1 }, { 2, 10 }, { 67, 39 }, { 0, 0 },
121  { 1, 1 }, { 0, 14 }, { 0, 2 }, { 31, 26 }, { 1, 6 }, }, },
122  { { { 69, 83 }, { 0, 0 }, { 0, 2 }, { 10, 29 }, { 3, 12 },
123  { 0, 1 }, { 0, 3 }, { 0, 3 }, { 2, 2 }, { 0, 0 }, },
124  { { 209, 5 }, { 0, 0 }, { 0, 27 }, { 0, 0 }, { 0, 0 },
125  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
126  { { 103, 46 }, { 1, 2 }, { 2, 10 }, { 33, 42 }, { 0, 0 },
127  { 1, 4 }, { 0, 3 }, { 0, 1 }, { 1, 3 }, { 0, 0 }, }, },
128  { { { 11, 20 }, { 1, 4 }, { 18, 36 }, { 43, 48 }, { 13, 35 },
129  { 0, 2 }, { 0, 5 }, { 3, 12 }, { 1, 2 }, { 0, 0 }, },
130  { { 2, 5 }, { 4, 5 }, { 0, 121 }, { 0, 0 }, { 0, 0 },
131  { 0, 3 }, { 2, 4 }, { 1, 4 }, { 2, 2 }, { 0, 1 }, },
132  { { 14, 31 }, { 9, 13 }, { 14, 54 }, { 22, 29 }, { 0, 0 },
133  { 2, 6 }, { 4, 18 }, { 6, 13 }, { 1, 5 }, { 0, 1 }, }, },
134  { { { 70, 44 }, { 0, 1 }, { 2, 10 }, { 37, 46 }, { 8, 26 },
135  { 0, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, },
136  { { 175, 5 }, { 0, 1 }, { 0, 48 }, { 0, 0 }, { 0, 0 },
137  { 0, 2 }, { 0, 1 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, },
138  { { 85, 39 }, { 0, 0 }, { 1, 9 }, { 69, 40 }, { 0, 0 },
139  { 0, 1 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 0 }, }, },
140  { { { 8, 15 }, { 0, 1 }, { 8, 21 }, { 74, 53 }, { 22, 42 },
141  { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 0, 0 }, },
142  { { 83, 5 }, { 2, 3 }, { 0, 102 }, { 0, 0 }, { 0, 0 },
143  { 1, 3 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
144  { { 31, 28 }, { 0, 0 }, { 3, 14 }, { 130, 34 }, { 0, 0 },
145  { 0, 1 }, { 0, 3 }, { 0, 1 }, { 3, 3 }, { 0, 1 }, }, },
146  { { { 141, 42 }, { 0, 0 }, { 1, 4 }, { 11, 24 }, { 1, 11 },
147  { 0, 1 }, { 0, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, },
148  { { 233, 6 }, { 0, 0 }, { 0, 8 }, { 0, 0 }, { 0, 0 },
149  { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, },
150  { { 171, 25 }, { 0, 0 }, { 1, 5 }, { 25, 21 }, { 0, 0 },
151  { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, },
152  { { { 8, 19 }, { 4, 10 }, { 24, 45 }, { 21, 37 }, { 9, 29 },
153  { 0, 3 }, { 1, 7 }, { 11, 25 }, { 0, 2 }, { 0, 1 }, },
154  { { 34, 16 }, { 112, 21 }, { 1, 28 }, { 0, 0 }, { 0, 0 },
155  { 6, 8 }, { 1, 7 }, { 0, 3 }, { 2, 5 }, { 0, 2 }, },
156  { { 17, 21 }, { 68, 29 }, { 6, 15 }, { 13, 22 }, { 0, 0 },
157  { 6, 12 }, { 3, 14 }, { 4, 10 }, { 1, 7 }, { 0, 3 }, }, },
158  { { { 46, 42 }, { 0, 1 }, { 2, 10 }, { 54, 51 }, { 10, 30 },
159  { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, },
160  { { 159, 35 }, { 2, 2 }, { 0, 25 }, { 0, 0 }, { 0, 0 },
161  { 3, 6 }, { 0, 5 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, },
162  { { 51, 39 }, { 0, 1 }, { 2, 12 }, { 91, 44 }, { 0, 0 },
163  { 0, 2 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 1 }, }, },
164  { { { 28, 32 }, { 0, 0 }, { 3, 10 }, { 75, 51 }, { 14, 33 },
165  { 0, 1 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, },
166  { { 75, 39 }, { 5, 7 }, { 2, 48 }, { 0, 0 }, { 0, 0 },
167  { 3, 11 }, { 2, 16 }, { 1, 4 }, { 7, 10 }, { 0, 2 }, },
168  { { 81, 25 }, { 0, 0 }, { 2, 9 }, { 106, 26 }, { 0, 0 },
169  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, },
170  { { { 100, 46 }, { 0, 1 }, { 3, 9 }, { 21, 37 }, { 5, 20 },
171  { 0, 1 }, { 0, 2 }, { 1, 2 }, { 0, 1 }, { 0, 0 }, },
172  { { 212, 21 }, { 0, 1 }, { 0, 9 }, { 0, 0 }, { 0, 0 },
173  { 1, 2 }, { 0, 2 }, { 0, 0 }, { 2, 2 }, { 0, 0 }, },
174  { { 140, 37 }, { 0, 1 }, { 1, 8 }, { 24, 33 }, { 0, 0 },
175  { 1, 2 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, },
176  { { { 27, 29 }, { 0, 1 }, { 9, 25 }, { 53, 51 }, { 12, 34 },
177  { 0, 1 }, { 0, 3 }, { 1, 5 }, { 0, 2 }, { 0, 0 }, },
178  { { 4, 2 }, { 0, 0 }, { 0, 172 }, { 0, 0 }, { 0, 0 },
179  { 0, 1 }, { 0, 2 }, { 0, 0 }, { 2, 0 }, { 0, 0 }, },
180  { { 14, 23 }, { 1, 3 }, { 11, 53 }, { 90, 31 }, { 0, 0 },
181  { 0, 3 }, { 1, 5 }, { 2, 6 }, { 1, 2 }, { 0, 0 }, }, },
182  { { { 80, 38 }, { 0, 0 }, { 1, 4 }, { 69, 33 }, { 5, 16 },
183  { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, },
184  { { 187, 22 }, { 1, 1 }, { 0, 17 }, { 0, 0 }, { 0, 0 },
185  { 3, 6 }, { 0, 4 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, },
186  { { 123, 29 }, { 0, 0 }, { 1, 7 }, { 57, 30 }, { 0, 0 },
187  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, },
188  { { { 16, 20 }, { 0, 0 }, { 2, 8 }, { 104, 49 }, { 15, 33 },
189  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, },
190  { { 133, 6 }, { 1, 2 }, { 1, 70 }, { 0, 0 }, { 0, 0 },
191  { 0, 2 }, { 0, 4 }, { 0, 3 }, { 1, 1 }, { 0, 0 }, },
192  { { 13, 14 }, { 0, 0 }, { 4, 20 }, { 175, 20 }, { 0, 0 },
193  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, },
194  { { { 194, 16 }, { 0, 0 }, { 1, 1 }, { 1, 9 }, { 1, 3 },
195  { 0, 0 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, },
196  { { 251, 1 }, { 0, 0 }, { 0, 2 }, { 0, 0 }, { 0, 0 },
197  { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, },
198  { { 202, 23 }, { 0, 0 }, { 1, 3 }, { 2, 9 }, { 0, 0 },
199  { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, },
200 };
201 
202 static const uint8_t vp56_filter_threshold[] = {
203  14, 14, 13, 13, 12, 12, 10, 10,
204  10, 10, 8, 8, 8, 8, 8, 8,
205  8, 8, 8, 8, 8, 8, 8, 8,
206  8, 8, 8, 8, 8, 8, 8, 8,
207  8, 8, 8, 8, 7, 7, 7, 7,
208  7, 7, 6, 6, 6, 6, 6, 6,
209  5, 5, 5, 5, 4, 4, 4, 4,
210  4, 4, 4, 3, 3, 3, 3, 2,
211 };
212 
214  171, 83, 199, 140, 125, 104,
215 };
216 
217 static const VP56Tree vp56_pmbtm_tree[] = {
218  { 4, 0},
219  { 2, 1}, {-8}, {-4},
220  { 8, 2},
221  { 6, 3},
222  { 4, 4},
223  { 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0},
224 };
225 
226 static const VP56Tree vp56_pmbt_tree[] = {
227  { 8, 1},
228  { 4, 2},
231  { 4, 3},
232  { 2, 6}, {-VP56_MB_INTRA}, {-VP56_MB_INTER_4V},
233  { 4, 7},
236 };
237 
238 /* relative pos of surrounding blocks, from closest to farthest */
239 static const int8_t vp56_candidate_predictor_pos[12][2] = {
240  { 0, -1 },
241  { -1, 0 },
242  { -1, -1 },
243  { 1, -1 },
244  { 0, -2 },
245  { -2, 0 },
246  { -2, -1 },
247  { -1, -2 },
248  { 1, -2 },
249  { 2, -1 },
250  { -2, -2 },
251  { 2, -2 },
252 };
253 
254 #endif /* AVCODEC_VP56DATA_H */
Inter MB, first vector, from previous frame.
Definition: vp56data.h:45
Intra MB.
Definition: vp56data.h:43
const uint8_t ff_vp56_coeff_bias[]
Definition: vp56data.c:67
const uint8_t ff_vp56_coeff_parse_table[6][11]
Definition: vp56data.c:31
uint8_t
static const uint8_t vp56_mb_type_model_model[]
Definition: vp56data.h:213
struct VP56Tree VP56Tree
VP56Frame
Definition: vp56data.h:31
const VP56Tree ff_vp56_pva_tree[]
Definition: vp56data.c:49
Inter MB, second vector, from golden frame.
Definition: vp56data.h:51
Inter MB, first vector, from golden frame.
Definition: vp56data.h:50
static const VP56Tree vp56_pmbt_tree[]
Definition: vp56data.h:226
static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2]
Definition: vp56data.h:103
static const VP56Frame vp56_reference_frame[]
Definition: vp56data.h:68
static const uint8_t vp56_filter_threshold[]
Definition: vp56data.h:202
const uint8_t ff_vp56_b6to4[]
Definition: vp56data.c:29
int8_t prob_idx
Definition: vp56data.h:56
static const VP56Tree vp56_pmbtm_tree[]
Definition: vp56data.h:217
Inter MB, 4 vectors, from previous frame.
Definition: vp56data.h:49
static const uint8_t vp56_ac_dequant[64]
Definition: vp56data.h:81
Inter MB, no vector, from previous frame.
Definition: vp56data.h:42
static const uint8_t vp56_dc_dequant[64]
Definition: vp56data.h:92
Inter MB, second vector, from previous frame.
Definition: vp56data.h:46
Inter MB, above/left vector + delta, from golden frame.
Definition: vp56data.h:48
int8_t val
Definition: vp56data.h:55
const VP56Tree ff_vp56_pc_tree[]
Definition: vp56data.c:59
Inter MB, no vector, from golden frame.
Definition: vp56data.h:47
common internal and external API header
const uint8_t ff_vp56_coeff_bit_length[]
Definition: vp56data.c:68
VP56mb
Definition: vp56data.h:41
Inter MB, above/left vector + delta, from previous frame.
Definition: vp56data.h:44
const uint8_t ff_vp56_def_mb_types_stats[3][10][2]
Definition: vp56data.c:40
const uint8_t ff_vp56_b2p[]
Definition: vp56data.c:28
static const int8_t vp56_candidate_predictor_pos[12][2]
Definition: vp56data.h:239