Mercurial > libavcodec.hg
annotate vp56data.h @ 5775:38f220befc32 libavcodec
Replace "signed short" typecast with "int16_t" as suggested by
Mans Rullgard. Value at the right side is 16 bit length signed.
We can not know for sure that short is in fact 16 bits, even if
this virtually always is the case.
author | voroshil |
---|---|
date | Thu, 04 Oct 2007 15:13:42 +0000 |
parents | 314be1cfdcb0 |
children | 1d83e9c34641 |
rev | line source |
---|---|
3695 | 1 /** |
2 * @file vp56data.h | |
3 * VP5 and VP6 compatible video decoder (common data) | |
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 | |
24 #ifndef VP56DATA_H | |
25 #define VP56DATA_H | |
26 | |
4078
6a10cc9adb8a
Don't include inttypes.h/stdint.h directly, there is an abstraction in
diego
parents:
3947
diff
changeset
|
27 #include "common.h" |
3695 | 28 |
29 typedef enum { | |
30 VP56_FRAME_CURRENT = 0, | |
31 VP56_FRAME_PREVIOUS = 1, | |
32 VP56_FRAME_GOLDEN = 2, | |
5714
314be1cfdcb0
add a new vp6a codec (add alpha plan support to vp6)
aurel
parents:
5709
diff
changeset
|
33 VP56_FRAME_GOLDEN2 = 3, |
314be1cfdcb0
add a new vp6a codec (add alpha plan support to vp6)
aurel
parents:
5709
diff
changeset
|
34 VP56_FRAME_UNUSED = 4, |
314be1cfdcb0
add a new vp6a codec (add alpha plan support to vp6)
aurel
parents:
5709
diff
changeset
|
35 VP56_FRAME_UNUSED2 = 5, |
3695 | 36 } vp56_frame_t; |
37 | |
38 typedef enum { | |
39 VP56_MB_INTER_NOVEC_PF = 0, /**< Inter MB, no vector, from previous frame */ | |
40 VP56_MB_INTRA = 1, /**< Intra MB */ | |
41 VP56_MB_INTER_DELTA_PF = 2, /**< Inter MB, above/left vector + delta, from previous frame */ | |
42 VP56_MB_INTER_V1_PF = 3, /**< Inter MB, first vector, from previous frame */ | |
43 VP56_MB_INTER_V2_PF = 4, /**< Inter MB, second vector, from previous frame */ | |
44 VP56_MB_INTER_NOVEC_GF = 5, /**< Inter MB, no vector, from golden frame */ | |
45 VP56_MB_INTER_DELTA_GF = 6, /**< Inter MB, above/left vector + delta, from golden frame */ | |
46 VP56_MB_INTER_4V = 7, /**< Inter MB, 4 vectors, from previous frame */ | |
47 VP56_MB_INTER_V1_GF = 8, /**< Inter MB, first vector, from golden frame */ | |
48 VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */ | |
49 } vp56_mb_t; | |
50 | |
51 typedef struct { | |
52 int8_t val; | |
53 int8_t prob_idx; | |
54 } vp56_tree_t; | |
55 | |
5709 | 56 extern const uint8_t vp56_b2p[]; |
3695 | 57 extern const uint8_t vp56_b6to4[]; |
58 extern const uint8_t vp56_coeff_parse_table[6][11]; | |
59 extern const uint8_t vp56_def_mb_types_stats[3][10][2]; | |
60 extern const vp56_tree_t vp56_pva_tree[]; | |
61 extern const vp56_tree_t vp56_pc_tree[]; | |
62 extern const uint8_t vp56_coeff_bias[]; | |
63 extern const uint8_t vp56_coeff_bit_length[]; | |
64 | |
65 static const vp56_frame_t vp56_reference_frame[] = { | |
66 VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */ | |
67 VP56_FRAME_CURRENT, /* VP56_MB_INTRA */ | |
68 VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_DELTA_PF */ | |
69 VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V1_PF */ | |
70 VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_V2_PF */ | |
71 VP56_FRAME_GOLDEN, /* VP56_MB_INTER_NOVEC_GF */ | |
72 VP56_FRAME_GOLDEN, /* VP56_MB_INTER_DELTA_GF */ | |
73 VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_4V */ | |
74 VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V1_GF */ | |
75 VP56_FRAME_GOLDEN, /* VP56_MB_INTER_V2_GF */ | |
76 }; | |
77 | |
78 static const uint8_t vp56_ac_dequant[64] = { | |
79 94, 92, 90, 88, 86, 82, 78, 74, | |
80 70, 66, 62, 58, 54, 53, 52, 51, | |
81 50, 49, 48, 47, 46, 45, 44, 43, | |
82 42, 40, 39, 37, 36, 35, 34, 33, | |
83 32, 31, 30, 29, 28, 27, 26, 25, | |
84 24, 23, 22, 21, 20, 19, 18, 17, | |
85 16, 15, 14, 13, 12, 11, 10, 9, | |
86 8, 7, 6, 5, 4, 3, 2, 1, | |
87 }; | |
88 | |
89 static const uint8_t vp56_dc_dequant[64] = { | |
90 47, 47, 47, 47, 45, 43, 43, 43, | |
91 43, 43, 42, 41, 41, 40, 40, 40, | |
92 40, 35, 35, 35, 35, 33, 33, 33, | |
93 33, 32, 32, 32, 27, 27, 26, 26, | |
94 25, 25, 24, 24, 23, 23, 19, 19, | |
95 19, 19, 18, 18, 17, 16, 16, 16, | |
96 16, 16, 15, 11, 11, 11, 10, 10, | |
97 9, 8, 7, 5, 3, 3, 2, 2, | |
98 }; | |
99 | |
100 static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] = { | |
101 { { { 9, 15 }, { 32, 25 }, { 7, 19 }, { 9, 21 }, { 1, 12 }, | |
102 { 14, 12 }, { 3, 18 }, { 14, 23 }, { 3, 10 }, { 0, 4 }, }, | |
103 { { 41, 22 }, { 1, 0 }, { 1, 31 }, { 0, 0 }, { 0, 0 }, | |
104 { 0, 1 }, { 1, 7 }, { 0, 1 }, { 98, 25 }, { 4, 10 }, }, | |
105 { { 2, 3 }, { 2, 3 }, { 0, 2 }, { 0, 2 }, { 0, 0 }, | |
106 { 11, 4 }, { 1, 4 }, { 0, 2 }, { 3, 2 }, { 0, 4 }, }, }, | |
107 { { { 48, 39 }, { 1, 2 }, { 11, 27 }, { 29, 44 }, { 7, 27 }, | |
108 { 1, 4 }, { 0, 3 }, { 1, 6 }, { 1, 2 }, { 0, 0 }, }, | |
109 { { 123, 37 }, { 6, 4 }, { 1, 27 }, { 0, 0 }, { 0, 0 }, | |
110 { 5, 8 }, { 1, 7 }, { 0, 1 }, { 12, 10 }, { 0, 2 }, }, | |
111 { { 49, 46 }, { 3, 4 }, { 7, 31 }, { 42, 41 }, { 0, 0 }, | |
112 { 2, 6 }, { 1, 7 }, { 1, 4 }, { 2, 4 }, { 0, 1 }, }, }, | |
113 { { { 21, 32 }, { 1, 2 }, { 4, 10 }, { 32, 43 }, { 6, 23 }, | |
114 { 2, 3 }, { 1, 19 }, { 1, 6 }, { 12, 21 }, { 0, 7 }, }, | |
115 { { 26, 14 }, { 14, 12 }, { 0, 24 }, { 0, 0 }, { 0, 0 }, | |
116 { 55, 17 }, { 1, 9 }, { 0, 36 }, { 5, 7 }, { 1, 3 }, }, | |
117 { { 26, 25 }, { 1, 1 }, { 2, 10 }, { 67, 39 }, { 0, 0 }, | |
118 { 1, 1 }, { 0, 14 }, { 0, 2 }, { 31, 26 }, { 1, 6 }, }, }, | |
119 { { { 69, 83 }, { 0, 0 }, { 0, 2 }, { 10, 29 }, { 3, 12 }, | |
120 { 0, 1 }, { 0, 3 }, { 0, 3 }, { 2, 2 }, { 0, 0 }, }, | |
121 { { 209, 5 }, { 0, 0 }, { 0, 27 }, { 0, 0 }, { 0, 0 }, | |
122 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, | |
123 { { 103, 46 }, { 1, 2 }, { 2, 10 }, { 33, 42 }, { 0, 0 }, | |
124 { 1, 4 }, { 0, 3 }, { 0, 1 }, { 1, 3 }, { 0, 0 }, }, }, | |
125 { { { 11, 20 }, { 1, 4 }, { 18, 36 }, { 43, 48 }, { 13, 35 }, | |
126 { 0, 2 }, { 0, 5 }, { 3, 12 }, { 1, 2 }, { 0, 0 }, }, | |
127 { { 2, 5 }, { 4, 5 }, { 0, 121 }, { 0, 0 }, { 0, 0 }, | |
128 { 0, 3 }, { 2, 4 }, { 1, 4 }, { 2, 2 }, { 0, 1 }, }, | |
129 { { 14, 31 }, { 9, 13 }, { 14, 54 }, { 22, 29 }, { 0, 0 }, | |
130 { 2, 6 }, { 4, 18 }, { 6, 13 }, { 1, 5 }, { 0, 1 }, }, }, | |
131 { { { 70, 44 }, { 0, 1 }, { 2, 10 }, { 37, 46 }, { 8, 26 }, | |
132 { 0, 2 }, { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, }, | |
133 { { 175, 5 }, { 0, 1 }, { 0, 48 }, { 0, 0 }, { 0, 0 }, | |
134 { 0, 2 }, { 0, 1 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, }, | |
135 { { 85, 39 }, { 0, 0 }, { 1, 9 }, { 69, 40 }, { 0, 0 }, | |
136 { 0, 1 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 0 }, }, }, | |
137 { { { 8, 15 }, { 0, 1 }, { 8, 21 }, { 74, 53 }, { 22, 42 }, | |
138 { 0, 1 }, { 0, 2 }, { 0, 3 }, { 1, 2 }, { 0, 0 }, }, | |
139 { { 83, 5 }, { 2, 3 }, { 0, 102 }, { 0, 0 }, { 0, 0 }, | |
140 { 1, 3 }, { 0, 2 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, | |
141 { { 31, 28 }, { 0, 0 }, { 3, 14 }, { 130, 34 }, { 0, 0 }, | |
142 { 0, 1 }, { 0, 3 }, { 0, 1 }, { 3, 3 }, { 0, 1 }, }, }, | |
143 { { { 141, 42 }, { 0, 0 }, { 1, 4 }, { 11, 24 }, { 1, 11 }, | |
144 { 0, 1 }, { 0, 1 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, }, | |
145 { { 233, 6 }, { 0, 0 }, { 0, 8 }, { 0, 0 }, { 0, 0 }, | |
146 { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, }, | |
147 { { 171, 25 }, { 0, 0 }, { 1, 5 }, { 25, 21 }, { 0, 0 }, | |
148 { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, }, | |
149 { { { 8, 19 }, { 4, 10 }, { 24, 45 }, { 21, 37 }, { 9, 29 }, | |
150 { 0, 3 }, { 1, 7 }, { 11, 25 }, { 0, 2 }, { 0, 1 }, }, | |
151 { { 34, 16 }, { 112, 21 }, { 1, 28 }, { 0, 0 }, { 0, 0 }, | |
152 { 6, 8 }, { 1, 7 }, { 0, 3 }, { 2, 5 }, { 0, 2 }, }, | |
153 { { 17, 21 }, { 68, 29 }, { 6, 15 }, { 13, 22 }, { 0, 0 }, | |
154 { 6, 12 }, { 3, 14 }, { 4, 10 }, { 1, 7 }, { 0, 3 }, }, }, | |
155 { { { 46, 42 }, { 0, 1 }, { 2, 10 }, { 54, 51 }, { 10, 30 }, | |
156 { 0, 2 }, { 0, 2 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, | |
157 { { 159, 35 }, { 2, 2 }, { 0, 25 }, { 0, 0 }, { 0, 0 }, | |
158 { 3, 6 }, { 0, 5 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, }, | |
159 { { 51, 39 }, { 0, 1 }, { 2, 12 }, { 91, 44 }, { 0, 0 }, | |
160 { 0, 2 }, { 0, 3 }, { 0, 1 }, { 2, 3 }, { 0, 1 }, }, }, | |
161 { { { 28, 32 }, { 0, 0 }, { 3, 10 }, { 75, 51 }, { 14, 33 }, | |
162 { 0, 1 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, | |
163 { { 75, 39 }, { 5, 7 }, { 2, 48 }, { 0, 0 }, { 0, 0 }, | |
164 { 3, 11 }, { 2, 16 }, { 1, 4 }, { 7, 10 }, { 0, 2 }, }, | |
165 { { 81, 25 }, { 0, 0 }, { 2, 9 }, { 106, 26 }, { 0, 0 }, | |
166 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, }, | |
167 { { { 100, 46 }, { 0, 1 }, { 3, 9 }, { 21, 37 }, { 5, 20 }, | |
168 { 0, 1 }, { 0, 2 }, { 1, 2 }, { 0, 1 }, { 0, 0 }, }, | |
169 { { 212, 21 }, { 0, 1 }, { 0, 9 }, { 0, 0 }, { 0, 0 }, | |
170 { 1, 2 }, { 0, 2 }, { 0, 0 }, { 2, 2 }, { 0, 0 }, }, | |
171 { { 140, 37 }, { 0, 1 }, { 1, 8 }, { 24, 33 }, { 0, 0 }, | |
172 { 1, 2 }, { 0, 2 }, { 0, 1 }, { 1, 2 }, { 0, 0 }, }, }, | |
173 { { { 27, 29 }, { 0, 1 }, { 9, 25 }, { 53, 51 }, { 12, 34 }, | |
174 { 0, 1 }, { 0, 3 }, { 1, 5 }, { 0, 2 }, { 0, 0 }, }, | |
175 { { 4, 2 }, { 0, 0 }, { 0, 172 }, { 0, 0 }, { 0, 0 }, | |
176 { 0, 1 }, { 0, 2 }, { 0, 0 }, { 2, 0 }, { 0, 0 }, }, | |
177 { { 14, 23 }, { 1, 3 }, { 11, 53 }, { 90, 31 }, { 0, 0 }, | |
178 { 0, 3 }, { 1, 5 }, { 2, 6 }, { 1, 2 }, { 0, 0 }, }, }, | |
179 { { { 80, 38 }, { 0, 0 }, { 1, 4 }, { 69, 33 }, { 5, 16 }, | |
180 { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 1 }, { 0, 0 }, }, | |
181 { { 187, 22 }, { 1, 1 }, { 0, 17 }, { 0, 0 }, { 0, 0 }, | |
182 { 3, 6 }, { 0, 4 }, { 0, 1 }, { 4, 4 }, { 0, 1 }, }, | |
183 { { 123, 29 }, { 0, 0 }, { 1, 7 }, { 57, 30 }, { 0, 0 }, | |
184 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, }, }, | |
185 { { { 16, 20 }, { 0, 0 }, { 2, 8 }, { 104, 49 }, { 15, 33 }, | |
186 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, | |
187 { { 133, 6 }, { 1, 2 }, { 1, 70 }, { 0, 0 }, { 0, 0 }, | |
188 { 0, 2 }, { 0, 4 }, { 0, 3 }, { 1, 1 }, { 0, 0 }, }, | |
189 { { 13, 14 }, { 0, 0 }, { 4, 20 }, { 175, 20 }, { 0, 0 }, | |
190 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, }, | |
191 { { { 194, 16 }, { 0, 0 }, { 1, 1 }, { 1, 9 }, { 1, 3 }, | |
192 { 0, 0 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, | |
193 { { 251, 1 }, { 0, 0 }, { 0, 2 }, { 0, 0 }, { 0, 0 }, | |
194 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, }, | |
195 { { 202, 23 }, { 0, 0 }, { 1, 3 }, { 2, 9 }, { 0, 0 }, | |
196 { 0, 1 }, { 0, 1 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, }, }, | |
197 }; | |
198 | |
199 static const uint8_t vp56_filter_threshold[] = { | |
200 14, 14, 13, 13, 12, 12, 10, 10, | |
201 10, 10, 8, 8, 8, 8, 8, 8, | |
202 8, 8, 8, 8, 8, 8, 8, 8, | |
203 8, 8, 8, 8, 8, 8, 8, 8, | |
204 8, 8, 8, 8, 7, 7, 7, 7, | |
205 7, 7, 6, 6, 6, 6, 6, 6, | |
206 5, 5, 5, 5, 4, 4, 4, 4, | |
207 4, 4, 4, 3, 3, 3, 3, 2, | |
208 }; | |
209 | |
210 static const uint8_t vp56_mb_type_model_model[] = { | |
211 171, 83, 199, 140, 125, 104, | |
212 }; | |
213 | |
214 static const vp56_tree_t vp56_pmbtm_tree[] = { | |
215 { 4, 0}, | |
216 { 2, 1}, {-8}, {-4}, | |
217 { 8, 2}, | |
218 { 6, 3}, | |
219 { 4, 4}, | |
220 { 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0}, | |
221 }; | |
222 | |
223 static const vp56_tree_t vp56_pmbt_tree[] = { | |
224 { 8, 1}, | |
225 { 4, 2}, | |
226 { 2, 4}, {-VP56_MB_INTER_NOVEC_PF}, {-VP56_MB_INTER_DELTA_PF}, | |
227 { 2, 5}, {-VP56_MB_INTER_V1_PF}, {-VP56_MB_INTER_V2_PF}, | |
228 { 4, 3}, | |
229 { 2, 6}, {-VP56_MB_INTRA}, {-VP56_MB_INTER_4V}, | |
230 { 4, 7}, | |
231 { 2, 8}, {-VP56_MB_INTER_NOVEC_GF}, {-VP56_MB_INTER_DELTA_GF}, | |
232 { 2, 9}, {-VP56_MB_INTER_V1_GF}, {-VP56_MB_INTER_V2_GF}, | |
233 }; | |
234 | |
235 /* relative pos of surrounding blocks, from closest to farthest */ | |
236 static const int8_t vp56_candidate_predictor_pos[12][2] = { | |
237 { 0, -1 }, | |
238 { -1, 0 }, | |
239 { -1, -1 }, | |
240 { 1, -1 }, | |
241 { 0, -2 }, | |
242 { -2, 0 }, | |
243 { -2, -1 }, | |
244 { -1, -2 }, | |
245 { 1, -2 }, | |
246 { 2, -1 }, | |
247 { -2, -2 }, | |
248 { 2, -2 }, | |
249 }; | |
250 | |
251 #endif /* VP56DATA */ |