Originally committed as revision 16068 to svn://svn.ffmpeg.org/ffmpeg/trunk
Aurelien Jacobs authored on 2008/12/12 07:56:19... | ... |
@@ -67,7 +67,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags) |
67 | 67 |
* first nb_codes nodes.count must be set |
68 | 68 |
*/ |
69 | 69 |
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, |
70 |
- Node *nodes, huff_cmp_t cmp, int flags) |
|
70 |
+ Node *nodes, HuffCmp cmp, int flags) |
|
71 | 71 |
{ |
72 | 72 |
int i, j; |
73 | 73 |
int cur_node; |
... | ... |
@@ -35,8 +35,8 @@ typedef struct { |
35 | 35 |
#define FF_HUFFMAN_FLAG_HNODE_FIRST 0x01 |
36 | 36 |
#define FF_HUFFMAN_FLAG_ZERO_COUNT 0x02 |
37 | 37 |
|
38 |
-typedef int (*huff_cmp_t)(const void *va, const void *vb); |
|
38 |
+typedef int (*HuffCmp)(const void *va, const void *vb); |
|
39 | 39 |
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, |
40 |
- Node *nodes, huff_cmp_t cmp, int flags); |
|
40 |
+ Node *nodes, HuffCmp cmp, int flags); |
|
41 | 41 |
|
42 | 42 |
#endif /* AVCODEC_HUFFMAN_H */ |
... | ... |
@@ -33,10 +33,10 @@ |
33 | 33 |
#include "vp5data.h" |
34 | 34 |
|
35 | 35 |
|
36 |
-static int vp5_parse_header(vp56_context_t *s, const uint8_t *buf, int buf_size, |
|
36 |
+static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, |
|
37 | 37 |
int *golden_frame) |
38 | 38 |
{ |
39 |
- vp56_range_coder_t *c = &s->c; |
|
39 |
+ VP56RangeCoder *c = &s->c; |
|
40 | 40 |
int rows, cols; |
41 | 41 |
|
42 | 42 |
vp56_init_range_decoder(&s->c, buf, buf_size); |
... | ... |
@@ -84,10 +84,10 @@ static int vp5_adjust(int v, int t) |
84 | 84 |
return v; |
85 | 85 |
} |
86 | 86 |
|
87 |
-static void vp5_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) |
|
87 |
+static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect) |
|
88 | 88 |
{ |
89 |
- vp56_range_coder_t *c = &s->c; |
|
90 |
- vp56_model_t *model = s->modelp; |
|
89 |
+ VP56RangeCoder *c = &s->c; |
|
90 |
+ Vp56Model *model = s->modelp; |
|
91 | 91 |
int comp, di; |
92 | 92 |
|
93 | 93 |
for (comp=0; comp<2; comp++) { |
... | ... |
@@ -108,10 +108,10 @@ static void vp5_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) |
108 | 108 |
} |
109 | 109 |
} |
110 | 110 |
|
111 |
-static void vp5_parse_vector_models(vp56_context_t *s) |
|
111 |
+static void vp5_parse_vector_models(VP56Context *s) |
|
112 | 112 |
{ |
113 |
- vp56_range_coder_t *c = &s->c; |
|
114 |
- vp56_model_t *model = s->modelp; |
|
113 |
+ VP56RangeCoder *c = &s->c; |
|
114 |
+ Vp56Model *model = s->modelp; |
|
115 | 115 |
int comp, node; |
116 | 116 |
|
117 | 117 |
for (comp=0; comp<2; comp++) { |
... | ... |
@@ -131,10 +131,10 @@ static void vp5_parse_vector_models(vp56_context_t *s) |
131 | 131 |
model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7); |
132 | 132 |
} |
133 | 133 |
|
134 |
-static void vp5_parse_coeff_models(vp56_context_t *s) |
|
134 |
+static void vp5_parse_coeff_models(VP56Context *s) |
|
135 | 135 |
{ |
136 |
- vp56_range_coder_t *c = &s->c; |
|
137 |
- vp56_model_t *model = s->modelp; |
|
136 |
+ VP56RangeCoder *c = &s->c; |
|
137 |
+ Vp56Model *model = s->modelp; |
|
138 | 138 |
uint8_t def_prob[11]; |
139 | 139 |
int node, cg, ctx; |
140 | 140 |
int ct; /* code type */ |
... | ... |
@@ -177,10 +177,10 @@ static void vp5_parse_coeff_models(vp56_context_t *s) |
177 | 177 |
model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254); |
178 | 178 |
} |
179 | 179 |
|
180 |
-static void vp5_parse_coeff(vp56_context_t *s) |
|
180 |
+static void vp5_parse_coeff(VP56Context *s) |
|
181 | 181 |
{ |
182 |
- vp56_range_coder_t *c = &s->c; |
|
183 |
- vp56_model_t *model = s->modelp; |
|
182 |
+ VP56RangeCoder *c = &s->c; |
|
183 |
+ Vp56Model *model = s->modelp; |
|
184 | 184 |
uint8_t *permute = s->scantable.permutated; |
185 | 185 |
uint8_t *model1, *model2; |
186 | 186 |
int coeff, sign, coeff_idx; |
... | ... |
@@ -250,9 +250,9 @@ static void vp5_parse_coeff(vp56_context_t *s) |
250 | 250 |
} |
251 | 251 |
} |
252 | 252 |
|
253 |
-static void vp5_default_models_init(vp56_context_t *s) |
|
253 |
+static void vp5_default_models_init(VP56Context *s) |
|
254 | 254 |
{ |
255 |
- vp56_model_t *model = s->modelp; |
|
255 |
+ Vp56Model *model = s->modelp; |
|
256 | 256 |
int i; |
257 | 257 |
|
258 | 258 |
for (i=0; i<2; i++) { |
... | ... |
@@ -267,7 +267,7 @@ static void vp5_default_models_init(vp56_context_t *s) |
267 | 267 |
|
268 | 268 |
static av_cold int vp5_decode_init(AVCodecContext *avctx) |
269 | 269 |
{ |
270 |
- vp56_context_t *s = avctx->priv_data; |
|
270 |
+ VP56Context *s = avctx->priv_data; |
|
271 | 271 |
|
272 | 272 |
vp56_init(avctx, 1, 0); |
273 | 273 |
s->vp56_coord_div = vp5_coord_div; |
... | ... |
@@ -286,7 +286,7 @@ AVCodec vp5_decoder = { |
286 | 286 |
"vp5", |
287 | 287 |
CODEC_TYPE_VIDEO, |
288 | 288 |
CODEC_ID_VP5, |
289 |
- sizeof(vp56_context_t), |
|
289 |
+ sizeof(VP56Context), |
|
290 | 290 |
vp5_decode_init, |
291 | 291 |
NULL, |
292 | 292 |
vp56_free, |
... | ... |
@@ -28,20 +28,20 @@ |
28 | 28 |
#include "vp56data.h" |
29 | 29 |
|
30 | 30 |
|
31 |
-void vp56_init_dequant(vp56_context_t *s, int quantizer) |
|
31 |
+void vp56_init_dequant(VP56Context *s, int quantizer) |
|
32 | 32 |
{ |
33 | 33 |
s->quantizer = quantizer; |
34 | 34 |
s->dequant_dc = vp56_dc_dequant[quantizer] << 2; |
35 | 35 |
s->dequant_ac = vp56_ac_dequant[quantizer] << 2; |
36 | 36 |
} |
37 | 37 |
|
38 |
-static int vp56_get_vectors_predictors(vp56_context_t *s, int row, int col, |
|
39 |
- vp56_frame_t ref_frame) |
|
38 |
+static int vp56_get_vectors_predictors(VP56Context *s, int row, int col, |
|
39 |
+ VP56Frame ref_frame) |
|
40 | 40 |
{ |
41 | 41 |
int nb_pred = 0; |
42 |
- vp56_mv_t vect[2] = {{0,0}, {0,0}}; |
|
42 |
+ VP56mv vect[2] = {{0,0}, {0,0}}; |
|
43 | 43 |
int pos, offset; |
44 |
- vp56_mv_t mvp; |
|
44 |
+ VP56mv mvp; |
|
45 | 45 |
|
46 | 46 |
for (pos=0; pos<12; pos++) { |
47 | 47 |
mvp.x = col + vp56_candidate_predictor_pos[pos][0]; |
... | ... |
@@ -73,10 +73,10 @@ static int vp56_get_vectors_predictors(vp56_context_t *s, int row, int col, |
73 | 73 |
return nb_pred+1; |
74 | 74 |
} |
75 | 75 |
|
76 |
-static void vp56_parse_mb_type_models(vp56_context_t *s) |
|
76 |
+static void vp56_parse_mb_type_models(VP56Context *s) |
|
77 | 77 |
{ |
78 |
- vp56_range_coder_t *c = &s->c; |
|
79 |
- vp56_model_t *model = s->modelp; |
|
78 |
+ VP56RangeCoder *c = &s->c; |
|
79 |
+ Vp56Model *model = s->modelp; |
|
80 | 80 |
int i, ctx, type; |
81 | 81 |
|
82 | 82 |
for (ctx=0; ctx<3; ctx++) { |
... | ... |
@@ -144,11 +144,11 @@ static void vp56_parse_mb_type_models(vp56_context_t *s) |
144 | 144 |
} |
145 | 145 |
} |
146 | 146 |
|
147 |
-static vp56_mb_t vp56_parse_mb_type(vp56_context_t *s, |
|
148 |
- vp56_mb_t prev_type, int ctx) |
|
147 |
+static VP56mb vp56_parse_mb_type(VP56Context *s, |
|
148 |
+ VP56mb prev_type, int ctx) |
|
149 | 149 |
{ |
150 | 150 |
uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type]; |
151 |
- vp56_range_coder_t *c = &s->c; |
|
151 |
+ VP56RangeCoder *c = &s->c; |
|
152 | 152 |
|
153 | 153 |
if (vp56_rac_get_prob(c, mb_type_model[0])) |
154 | 154 |
return prev_type; |
... | ... |
@@ -156,9 +156,9 @@ static vp56_mb_t vp56_parse_mb_type(vp56_context_t *s, |
156 | 156 |
return vp56_rac_get_tree(c, vp56_pmbt_tree, mb_type_model); |
157 | 157 |
} |
158 | 158 |
|
159 |
-static void vp56_decode_4mv(vp56_context_t *s, int row, int col) |
|
159 |
+static void vp56_decode_4mv(VP56Context *s, int row, int col) |
|
160 | 160 |
{ |
161 |
- vp56_mv_t mv = {0,0}; |
|
161 |
+ VP56mv mv = {0,0}; |
|
162 | 162 |
int type[4]; |
163 | 163 |
int b; |
164 | 164 |
|
... | ... |
@@ -173,7 +173,7 @@ static void vp56_decode_4mv(vp56_context_t *s, int row, int col) |
173 | 173 |
for (b=0; b<4; b++) { |
174 | 174 |
switch (type[b]) { |
175 | 175 |
case VP56_MB_INTER_NOVEC_PF: |
176 |
- s->mv[b] = (vp56_mv_t) {0,0}; |
|
176 |
+ s->mv[b] = (VP56mv) {0,0}; |
|
177 | 177 |
break; |
178 | 178 |
case VP56_MB_INTER_DELTA_PF: |
179 | 179 |
s->parse_vector_adjustment(s, &s->mv[b]); |
... | ... |
@@ -197,13 +197,13 @@ static void vp56_decode_4mv(vp56_context_t *s, int row, int col) |
197 | 197 |
s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2); |
198 | 198 |
s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2); |
199 | 199 |
} else { |
200 |
- s->mv[4] = s->mv[5] = (vp56_mv_t) {mv.x/4, mv.y/4}; |
|
200 |
+ s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4}; |
|
201 | 201 |
} |
202 | 202 |
} |
203 | 203 |
|
204 |
-static vp56_mb_t vp56_decode_mv(vp56_context_t *s, int row, int col) |
|
204 |
+static VP56mb vp56_decode_mv(VP56Context *s, int row, int col) |
|
205 | 205 |
{ |
206 |
- vp56_mv_t *mv, vect = {0,0}; |
|
206 |
+ VP56mv *mv, vect = {0,0}; |
|
207 | 207 |
int ctx, b; |
208 | 208 |
|
209 | 209 |
ctx = vp56_get_vectors_predictors(s, row, col, VP56_FRAME_PREVIOUS); |
... | ... |
@@ -258,14 +258,14 @@ static vp56_mb_t vp56_decode_mv(vp56_context_t *s, int row, int col) |
258 | 258 |
return s->mb_type; |
259 | 259 |
} |
260 | 260 |
|
261 |
-static void vp56_add_predictors_dc(vp56_context_t *s, vp56_frame_t ref_frame) |
|
261 |
+static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame) |
|
262 | 262 |
{ |
263 | 263 |
int idx = s->scantable.permutated[0]; |
264 | 264 |
int b; |
265 | 265 |
|
266 | 266 |
for (b=0; b<6; b++) { |
267 |
- vp56_ref_dc_t *ab = &s->above_blocks[s->above_block_idx[b]]; |
|
268 |
- vp56_ref_dc_t *lb = &s->left_block[vp56_b6to4[b]]; |
|
267 |
+ VP56RefDc *ab = &s->above_blocks[s->above_block_idx[b]]; |
|
268 |
+ VP56RefDc *lb = &s->left_block[vp56_b6to4[b]]; |
|
269 | 269 |
int count = 0; |
270 | 270 |
int dc = 0; |
271 | 271 |
int i; |
... | ... |
@@ -299,7 +299,7 @@ static void vp56_add_predictors_dc(vp56_context_t *s, vp56_frame_t ref_frame) |
299 | 299 |
} |
300 | 300 |
} |
301 | 301 |
|
302 |
-static void vp56_edge_filter(vp56_context_t *s, uint8_t *yuv, |
|
302 |
+static void vp56_edge_filter(VP56Context *s, uint8_t *yuv, |
|
303 | 303 |
int pix_inc, int line_inc, int t) |
304 | 304 |
{ |
305 | 305 |
int pix2_inc = 2 * pix_inc; |
... | ... |
@@ -314,7 +314,7 @@ static void vp56_edge_filter(vp56_context_t *s, uint8_t *yuv, |
314 | 314 |
} |
315 | 315 |
} |
316 | 316 |
|
317 |
-static void vp56_deblock_filter(vp56_context_t *s, uint8_t *yuv, |
|
317 |
+static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv, |
|
318 | 318 |
int stride, int dx, int dy) |
319 | 319 |
{ |
320 | 320 |
int t = vp56_filter_threshold[s->quantizer]; |
... | ... |
@@ -322,7 +322,7 @@ static void vp56_deblock_filter(vp56_context_t *s, uint8_t *yuv, |
322 | 322 |
if (dy) vp56_edge_filter(s, yuv + stride*(10-dy), stride, 1, t); |
323 | 323 |
} |
324 | 324 |
|
325 |
-static void vp56_mc(vp56_context_t *s, int b, int plane, uint8_t *src, |
|
325 |
+static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, |
|
326 | 326 |
int stride, int x, int y) |
327 | 327 |
{ |
328 | 328 |
uint8_t *dst=s->framep[VP56_FRAME_CURRENT]->data[plane]+s->block_offset[b]; |
... | ... |
@@ -392,11 +392,11 @@ static void vp56_mc(vp56_context_t *s, int b, int plane, uint8_t *src, |
392 | 392 |
} |
393 | 393 |
} |
394 | 394 |
|
395 |
-static void vp56_decode_mb(vp56_context_t *s, int row, int col, int is_alpha) |
|
395 |
+static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) |
|
396 | 396 |
{ |
397 | 397 |
AVFrame *frame_current, *frame_ref; |
398 |
- vp56_mb_t mb_type; |
|
399 |
- vp56_frame_t ref_frame; |
|
398 |
+ VP56mb mb_type; |
|
399 |
+ VP56Frame ref_frame; |
|
400 | 400 |
int b, ab, b_max, plane, off; |
401 | 401 |
|
402 | 402 |
if (s->framep[VP56_FRAME_CURRENT]->key_frame) |
... | ... |
@@ -461,7 +461,7 @@ static void vp56_decode_mb(vp56_context_t *s, int row, int col, int is_alpha) |
461 | 461 |
|
462 | 462 |
static int vp56_size_changed(AVCodecContext *avctx) |
463 | 463 |
{ |
464 |
- vp56_context_t *s = avctx->priv_data; |
|
464 |
+ VP56Context *s = avctx->priv_data; |
|
465 | 465 |
int stride = s->framep[VP56_FRAME_CURRENT]->linesize[0]; |
466 | 466 |
int i; |
467 | 467 |
|
... | ... |
@@ -497,7 +497,7 @@ static int vp56_size_changed(AVCodecContext *avctx) |
497 | 497 |
int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
498 | 498 |
const uint8_t *buf, int buf_size) |
499 | 499 |
{ |
500 |
- vp56_context_t *s = avctx->priv_data; |
|
500 |
+ VP56Context *s = avctx->priv_data; |
|
501 | 501 |
AVFrame *const p = s->framep[VP56_FRAME_CURRENT]; |
502 | 502 |
int remaining_buf_size = buf_size; |
503 | 503 |
int is_alpha, alpha_offset; |
... | ... |
@@ -646,7 +646,7 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
646 | 646 |
|
647 | 647 |
av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha) |
648 | 648 |
{ |
649 |
- vp56_context_t *s = avctx->priv_data; |
|
649 |
+ VP56Context *s = avctx->priv_data; |
|
650 | 650 |
int i; |
651 | 651 |
|
652 | 652 |
s->avctx = avctx; |
... | ... |
@@ -686,7 +686,7 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha) |
686 | 686 |
|
687 | 687 |
av_cold int vp56_free(AVCodecContext *avctx) |
688 | 688 |
{ |
689 |
- vp56_context_t *s = avctx->priv_data; |
|
689 |
+ VP56Context *s = avctx->priv_data; |
|
690 | 690 |
|
691 | 691 |
av_free(s->above_blocks); |
692 | 692 |
av_free(s->macroblocks); |
... | ... |
@@ -30,20 +30,20 @@ |
30 | 30 |
#include "bytestream.h" |
31 | 31 |
|
32 | 32 |
|
33 |
-typedef struct vp56_context vp56_context_t; |
|
34 |
-typedef struct vp56_mv vp56_mv_t; |
|
33 |
+typedef struct vp56_context VP56Context; |
|
34 |
+typedef struct vp56_mv VP56mv; |
|
35 | 35 |
|
36 |
-typedef void (*vp56_parse_vector_adjustment_t)(vp56_context_t *s, |
|
37 |
- vp56_mv_t *vect); |
|
38 |
-typedef int (*vp56_adjust_t)(int v, int t); |
|
39 |
-typedef void (*vp56_filter_t)(vp56_context_t *s, uint8_t *dst, uint8_t *src, |
|
36 |
+typedef void (*VP56ParseVectorAdjustment)(VP56Context *s, |
|
37 |
+ VP56mv *vect); |
|
38 |
+typedef int (*VP56Adjust)(int v, int t); |
|
39 |
+typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src, |
|
40 | 40 |
int offset1, int offset2, int stride, |
41 |
- vp56_mv_t mv, int mask, int select, int luma); |
|
42 |
-typedef void (*vp56_parse_coeff_t)(vp56_context_t *s); |
|
43 |
-typedef void (*vp56_default_models_init_t)(vp56_context_t *s); |
|
44 |
-typedef void (*vp56_parse_vector_models_t)(vp56_context_t *s); |
|
45 |
-typedef void (*vp56_parse_coeff_models_t)(vp56_context_t *s); |
|
46 |
-typedef int (*vp56_parse_header_t)(vp56_context_t *s, const uint8_t *buf, |
|
41 |
+ VP56mv mv, int mask, int select, int luma); |
|
42 |
+typedef void (*VP56ParseCoeff)(VP56Context *s); |
|
43 |
+typedef void (*VP56DefaultModelsInit)(VP56Context *s); |
|
44 |
+typedef void (*VP56ParseVectorModels)(VP56Context *s); |
|
45 |
+typedef void (*VP56ParseCoeffModels)(VP56Context *s); |
|
46 |
+typedef int (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf, |
|
47 | 47 |
int buf_size, int *golden_frame); |
48 | 48 |
|
49 | 49 |
typedef struct { |
... | ... |
@@ -51,13 +51,13 @@ typedef struct { |
51 | 51 |
int bits; |
52 | 52 |
const uint8_t *buffer; |
53 | 53 |
unsigned long code_word; |
54 |
-} vp56_range_coder_t; |
|
54 |
+} VP56RangeCoder; |
|
55 | 55 |
|
56 | 56 |
typedef struct { |
57 | 57 |
uint8_t not_null_dc; |
58 |
- vp56_frame_t ref_frame; |
|
58 |
+ VP56Frame ref_frame; |
|
59 | 59 |
DCTELEM dc_coeff; |
60 |
-} vp56_ref_dc_t; |
|
60 |
+} VP56RefDc; |
|
61 | 61 |
|
62 | 62 |
struct vp56_mv { |
63 | 63 |
int x; |
... | ... |
@@ -66,8 +66,8 @@ struct vp56_mv { |
66 | 66 |
|
67 | 67 |
typedef struct { |
68 | 68 |
uint8_t type; |
69 |
- vp56_mv_t mv; |
|
70 |
-} vp56_macroblock_t; |
|
69 |
+ VP56mv mv; |
|
70 |
+} VP56Macroblock; |
|
71 | 71 |
|
72 | 72 |
typedef struct { |
73 | 73 |
uint8_t coeff_reorder[64]; /* used in vp6 only */ |
... | ... |
@@ -84,7 +84,7 @@ typedef struct { |
84 | 84 |
uint8_t coeff_runv[2][14]; /* run value (vp6 only) */ |
85 | 85 |
uint8_t mb_type[3][10][10]; /* model for decoding MB type */ |
86 | 86 |
uint8_t mb_types_stats[3][10][2];/* contextual, next MB type stats */ |
87 |
-} vp56_model_t; |
|
87 |
+} Vp56Model; |
|
88 | 88 |
|
89 | 89 |
struct vp56_context { |
90 | 90 |
AVCodecContext *avctx; |
... | ... |
@@ -94,9 +94,9 @@ struct vp56_context { |
94 | 94 |
AVFrame *framep[6]; |
95 | 95 |
uint8_t *edge_emu_buffer_alloc; |
96 | 96 |
uint8_t *edge_emu_buffer; |
97 |
- vp56_range_coder_t c; |
|
98 |
- vp56_range_coder_t cc; |
|
99 |
- vp56_range_coder_t *ccp; |
|
97 |
+ VP56RangeCoder c; |
|
98 |
+ VP56RangeCoder cc; |
|
99 |
+ VP56RangeCoder *ccp; |
|
100 | 100 |
int sub_version; |
101 | 101 |
|
102 | 102 |
/* frame info */ |
... | ... |
@@ -111,19 +111,19 @@ struct vp56_context { |
111 | 111 |
uint16_t dequant_ac; |
112 | 112 |
|
113 | 113 |
/* DC predictors management */ |
114 |
- vp56_ref_dc_t *above_blocks; |
|
115 |
- vp56_ref_dc_t left_block[4]; |
|
114 |
+ VP56RefDc *above_blocks; |
|
115 |
+ VP56RefDc left_block[4]; |
|
116 | 116 |
int above_block_idx[6]; |
117 | 117 |
DCTELEM prev_dc[3][3]; /* [plan][ref_frame] */ |
118 | 118 |
|
119 | 119 |
/* blocks / macroblock */ |
120 |
- vp56_mb_t mb_type; |
|
121 |
- vp56_macroblock_t *macroblocks; |
|
120 |
+ VP56mb mb_type; |
|
121 |
+ VP56Macroblock *macroblocks; |
|
122 | 122 |
DECLARE_ALIGNED_16(DCTELEM, block_coeff[6][64]); |
123 | 123 |
|
124 | 124 |
/* motion vectors */ |
125 |
- vp56_mv_t mv[6]; /* vectors for each block in MB */ |
|
126 |
- vp56_mv_t vector_candidate[2]; |
|
125 |
+ VP56mv mv[6]; /* vectors for each block in MB */ |
|
126 |
+ VP56mv vector_candidate[2]; |
|
127 | 127 |
int vector_candidate_pos; |
128 | 128 |
|
129 | 129 |
/* filtering hints */ |
... | ... |
@@ -146,17 +146,17 @@ struct vp56_context { |
146 | 146 |
int stride[4]; /* stride for each plan */ |
147 | 147 |
|
148 | 148 |
const uint8_t *vp56_coord_div; |
149 |
- vp56_parse_vector_adjustment_t parse_vector_adjustment; |
|
150 |
- vp56_adjust_t adjust; |
|
151 |
- vp56_filter_t filter; |
|
152 |
- vp56_parse_coeff_t parse_coeff; |
|
153 |
- vp56_default_models_init_t default_models_init; |
|
154 |
- vp56_parse_vector_models_t parse_vector_models; |
|
155 |
- vp56_parse_coeff_models_t parse_coeff_models; |
|
156 |
- vp56_parse_header_t parse_header; |
|
157 |
- |
|
158 |
- vp56_model_t *modelp; |
|
159 |
- vp56_model_t models[2]; |
|
149 |
+ VP56ParseVectorAdjustment parse_vector_adjustment; |
|
150 |
+ VP56Adjust adjust; |
|
151 |
+ VP56Filter filter; |
|
152 |
+ VP56ParseCoeff parse_coeff; |
|
153 |
+ VP56DefaultModelsInit default_models_init; |
|
154 |
+ VP56ParseVectorModels parse_vector_models; |
|
155 |
+ VP56ParseCoeffModels parse_coeff_models; |
|
156 |
+ VP56ParseHeader parse_header; |
|
157 |
+ |
|
158 |
+ Vp56Model *modelp; |
|
159 |
+ Vp56Model models[2]; |
|
160 | 160 |
|
161 | 161 |
/* huffman decoding */ |
162 | 162 |
int use_huffman; |
... | ... |
@@ -170,7 +170,7 @@ struct vp56_context { |
170 | 170 |
|
171 | 171 |
void vp56_init(AVCodecContext *avctx, int flip, int has_alpha); |
172 | 172 |
int vp56_free(AVCodecContext *avctx); |
173 |
-void vp56_init_dequant(vp56_context_t *s, int quantizer); |
|
173 |
+void vp56_init_dequant(VP56Context *s, int quantizer); |
|
174 | 174 |
int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
175 | 175 |
const uint8_t *buf, int buf_size); |
176 | 176 |
|
... | ... |
@@ -179,7 +179,7 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
179 | 179 |
* vp56 specific range coder implementation |
180 | 180 |
*/ |
181 | 181 |
|
182 |
-static inline void vp56_init_range_decoder(vp56_range_coder_t *c, |
|
182 |
+static inline void vp56_init_range_decoder(VP56RangeCoder *c, |
|
183 | 183 |
const uint8_t *buf, int buf_size) |
184 | 184 |
{ |
185 | 185 |
c->high = 255; |
... | ... |
@@ -188,7 +188,7 @@ static inline void vp56_init_range_decoder(vp56_range_coder_t *c, |
188 | 188 |
c->code_word = bytestream_get_be16(&c->buffer); |
189 | 189 |
} |
190 | 190 |
|
191 |
-static inline int vp56_rac_get_prob(vp56_range_coder_t *c, uint8_t prob) |
|
191 |
+static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) |
|
192 | 192 |
{ |
193 | 193 |
unsigned int low = 1 + (((c->high - 1) * prob) / 256); |
194 | 194 |
unsigned int low_shift = low << 8; |
... | ... |
@@ -213,7 +213,7 @@ static inline int vp56_rac_get_prob(vp56_range_coder_t *c, uint8_t prob) |
213 | 213 |
return bit; |
214 | 214 |
} |
215 | 215 |
|
216 |
-static inline int vp56_rac_get(vp56_range_coder_t *c) |
|
216 |
+static inline int vp56_rac_get(VP56RangeCoder *c) |
|
217 | 217 |
{ |
218 | 218 |
/* equiprobable */ |
219 | 219 |
int low = (c->high + 1) >> 1; |
... | ... |
@@ -235,7 +235,7 @@ static inline int vp56_rac_get(vp56_range_coder_t *c) |
235 | 235 |
return bit; |
236 | 236 |
} |
237 | 237 |
|
238 |
-static inline int vp56_rac_gets(vp56_range_coder_t *c, int bits) |
|
238 |
+static inline int vp56_rac_gets(VP56RangeCoder *c, int bits) |
|
239 | 239 |
{ |
240 | 240 |
int value = 0; |
241 | 241 |
|
... | ... |
@@ -246,14 +246,14 @@ static inline int vp56_rac_gets(vp56_range_coder_t *c, int bits) |
246 | 246 |
return value; |
247 | 247 |
} |
248 | 248 |
|
249 |
-static inline int vp56_rac_gets_nn(vp56_range_coder_t *c, int bits) |
|
249 |
+static inline int vp56_rac_gets_nn(VP56RangeCoder *c, int bits) |
|
250 | 250 |
{ |
251 | 251 |
int v = vp56_rac_gets(c, 7) << 1; |
252 | 252 |
return v + !v; |
253 | 253 |
} |
254 | 254 |
|
255 |
-static inline int vp56_rac_get_tree(vp56_range_coder_t *c, |
|
256 |
- const vp56_tree_t *tree, |
|
255 |
+static inline int vp56_rac_get_tree(VP56RangeCoder *c, |
|
256 |
+ const VP56Tree *tree, |
|
257 | 257 |
const uint8_t *probs) |
258 | 258 |
{ |
259 | 259 |
while (tree->val > 0) { |
... | ... |
@@ -44,7 +44,7 @@ const uint8_t vp56_def_mb_types_stats[3][10][2] = { |
44 | 44 |
{ 1, 2 }, { 0, 1 }, { 0, 1 }, { 1, 1 }, { 0, 0 }, }, |
45 | 45 |
}; |
46 | 46 |
|
47 |
-const vp56_tree_t vp56_pva_tree[] = { |
|
47 |
+const VP56Tree vp56_pva_tree[] = { |
|
48 | 48 |
{ 8, 0}, |
49 | 49 |
{ 4, 1}, |
50 | 50 |
{ 2, 2}, {-0}, {-1}, |
... | ... |
@@ -54,7 +54,7 @@ const vp56_tree_t vp56_pva_tree[] = { |
54 | 54 |
{ 2, 6}, {-6}, {-7}, |
55 | 55 |
}; |
56 | 56 |
|
57 |
-const vp56_tree_t vp56_pc_tree[] = { |
|
57 |
+const VP56Tree vp56_pc_tree[] = { |
|
58 | 58 |
{ 4, 6}, |
59 | 59 |
{ 2, 7}, {-0}, {-1}, |
60 | 60 |
{ 4, 8}, |
... | ... |
@@ -34,7 +34,7 @@ typedef enum { |
34 | 34 |
VP56_FRAME_GOLDEN2 = 3, |
35 | 35 |
VP56_FRAME_UNUSED = 4, |
36 | 36 |
VP56_FRAME_UNUSED2 = 5, |
37 |
-} vp56_frame_t; |
|
37 |
+} VP56Frame; |
|
38 | 38 |
|
39 | 39 |
typedef enum { |
40 | 40 |
VP56_MB_INTER_NOVEC_PF = 0, /**< Inter MB, no vector, from previous frame */ |
... | ... |
@@ -47,23 +47,23 @@ typedef enum { |
47 | 47 |
VP56_MB_INTER_4V = 7, /**< Inter MB, 4 vectors, from previous frame */ |
48 | 48 |
VP56_MB_INTER_V1_GF = 8, /**< Inter MB, first vector, from golden frame */ |
49 | 49 |
VP56_MB_INTER_V2_GF = 9, /**< Inter MB, second vector, from golden frame */ |
50 |
-} vp56_mb_t; |
|
50 |
+} VP56mb; |
|
51 | 51 |
|
52 | 52 |
typedef struct { |
53 | 53 |
int8_t val; |
54 | 54 |
int8_t prob_idx; |
55 |
-} vp56_tree_t; |
|
55 |
+} VP56Tree; |
|
56 | 56 |
|
57 | 57 |
extern const uint8_t vp56_b2p[]; |
58 | 58 |
extern const uint8_t vp56_b6to4[]; |
59 | 59 |
extern const uint8_t vp56_coeff_parse_table[6][11]; |
60 | 60 |
extern const uint8_t vp56_def_mb_types_stats[3][10][2]; |
61 |
-extern const vp56_tree_t vp56_pva_tree[]; |
|
62 |
-extern const vp56_tree_t vp56_pc_tree[]; |
|
61 |
+extern const VP56Tree vp56_pva_tree[]; |
|
62 |
+extern const VP56Tree vp56_pc_tree[]; |
|
63 | 63 |
extern const uint8_t vp56_coeff_bias[]; |
64 | 64 |
extern const uint8_t vp56_coeff_bit_length[]; |
65 | 65 |
|
66 |
-static const vp56_frame_t vp56_reference_frame[] = { |
|
66 |
+static const VP56Frame vp56_reference_frame[] = { |
|
67 | 67 |
VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_NOVEC_PF */ |
68 | 68 |
VP56_FRAME_CURRENT, /* VP56_MB_INTRA */ |
69 | 69 |
VP56_FRAME_PREVIOUS, /* VP56_MB_INTER_DELTA_PF */ |
... | ... |
@@ -212,7 +212,7 @@ static const uint8_t vp56_mb_type_model_model[] = { |
212 | 212 |
171, 83, 199, 140, 125, 104, |
213 | 213 |
}; |
214 | 214 |
|
215 |
-static const vp56_tree_t vp56_pmbtm_tree[] = { |
|
215 |
+static const VP56Tree vp56_pmbtm_tree[] = { |
|
216 | 216 |
{ 4, 0}, |
217 | 217 |
{ 2, 1}, {-8}, {-4}, |
218 | 218 |
{ 8, 2}, |
... | ... |
@@ -221,7 +221,7 @@ static const vp56_tree_t vp56_pmbtm_tree[] = { |
221 | 221 |
{ 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0}, |
222 | 222 |
}; |
223 | 223 |
|
224 |
-static const vp56_tree_t vp56_pmbt_tree[] = { |
|
224 |
+static const VP56Tree vp56_pmbt_tree[] = { |
|
225 | 225 |
{ 8, 1}, |
226 | 226 |
{ 4, 2}, |
227 | 227 |
{ 2, 4}, {-VP56_MB_INTER_NOVEC_PF}, {-VP56_MB_INTER_DELTA_PF}, |
... | ... |
@@ -37,13 +37,13 @@ |
37 | 37 |
#include "vp6data.h" |
38 | 38 |
|
39 | 39 |
|
40 |
-static void vp6_parse_coeff(vp56_context_t *s); |
|
41 |
-static void vp6_parse_coeff_huffman(vp56_context_t *s); |
|
40 |
+static void vp6_parse_coeff(VP56Context *s); |
|
41 |
+static void vp6_parse_coeff_huffman(VP56Context *s); |
|
42 | 42 |
|
43 |
-static int vp6_parse_header(vp56_context_t *s, const uint8_t *buf, int buf_size, |
|
43 |
+static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, |
|
44 | 44 |
int *golden_frame) |
45 | 45 |
{ |
46 |
- vp56_range_coder_t *c = &s->c; |
|
46 |
+ VP56RangeCoder *c = &s->c; |
|
47 | 47 |
int parse_filter_info = 0; |
48 | 48 |
int coeff_offset = 0; |
49 | 49 |
int vrt_shift = 0; |
... | ... |
@@ -151,7 +151,7 @@ static int vp6_parse_header(vp56_context_t *s, const uint8_t *buf, int buf_size, |
151 | 151 |
return res; |
152 | 152 |
} |
153 | 153 |
|
154 |
-static void vp6_coeff_order_table_init(vp56_context_t *s) |
|
154 |
+static void vp6_coeff_order_table_init(VP56Context *s) |
|
155 | 155 |
{ |
156 | 156 |
int i, pos, idx = 1; |
157 | 157 |
|
... | ... |
@@ -162,9 +162,9 @@ static void vp6_coeff_order_table_init(vp56_context_t *s) |
162 | 162 |
s->modelp->coeff_index_to_pos[idx++] = pos; |
163 | 163 |
} |
164 | 164 |
|
165 |
-static void vp6_default_models_init(vp56_context_t *s) |
|
165 |
+static void vp6_default_models_init(VP56Context *s) |
|
166 | 166 |
{ |
167 |
- vp56_model_t *model = s->modelp; |
|
167 |
+ Vp56Model *model = s->modelp; |
|
168 | 168 |
|
169 | 169 |
model->vector_dct[0] = 0xA2; |
170 | 170 |
model->vector_dct[1] = 0xA4; |
... | ... |
@@ -180,10 +180,10 @@ static void vp6_default_models_init(vp56_context_t *s) |
180 | 180 |
vp6_coeff_order_table_init(s); |
181 | 181 |
} |
182 | 182 |
|
183 |
-static void vp6_parse_vector_models(vp56_context_t *s) |
|
183 |
+static void vp6_parse_vector_models(VP56Context *s) |
|
184 | 184 |
{ |
185 |
- vp56_range_coder_t *c = &s->c; |
|
186 |
- vp56_model_t *model = s->modelp; |
|
185 |
+ VP56RangeCoder *c = &s->c; |
|
186 |
+ Vp56Model *model = s->modelp; |
|
187 | 187 |
int comp, node; |
188 | 188 |
|
189 | 189 |
for (comp=0; comp<2; comp++) { |
... | ... |
@@ -211,7 +211,7 @@ static int vp6_huff_cmp(const void *va, const void *vb) |
211 | 211 |
return (a->count - b->count)*16 + (b->sym - a->sym); |
212 | 212 |
} |
213 | 213 |
|
214 |
-static void vp6_build_huff_tree(vp56_context_t *s, uint8_t coeff_model[], |
|
214 |
+static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], |
|
215 | 215 |
const uint8_t *map, unsigned size, VLC *vlc) |
216 | 216 |
{ |
217 | 217 |
Node nodes[2*size], *tmp = &nodes[size]; |
... | ... |
@@ -231,10 +231,10 @@ static void vp6_build_huff_tree(vp56_context_t *s, uint8_t coeff_model[], |
231 | 231 |
FF_HUFFMAN_FLAG_HNODE_FIRST); |
232 | 232 |
} |
233 | 233 |
|
234 |
-static void vp6_parse_coeff_models(vp56_context_t *s) |
|
234 |
+static void vp6_parse_coeff_models(VP56Context *s) |
|
235 | 235 |
{ |
236 |
- vp56_range_coder_t *c = &s->c; |
|
237 |
- vp56_model_t *model = s->modelp; |
|
236 |
+ VP56RangeCoder *c = &s->c; |
|
237 |
+ Vp56Model *model = s->modelp; |
|
238 | 238 |
int def_prob[11]; |
239 | 239 |
int node, cg, ctx, pos; |
240 | 240 |
int ct; /* code type */ |
... | ... |
@@ -296,13 +296,13 @@ static void vp6_parse_coeff_models(vp56_context_t *s) |
296 | 296 |
} |
297 | 297 |
} |
298 | 298 |
|
299 |
-static void vp6_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) |
|
299 |
+static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) |
|
300 | 300 |
{ |
301 |
- vp56_range_coder_t *c = &s->c; |
|
302 |
- vp56_model_t *model = s->modelp; |
|
301 |
+ VP56RangeCoder *c = &s->c; |
|
302 |
+ Vp56Model *model = s->modelp; |
|
303 | 303 |
int comp; |
304 | 304 |
|
305 |
- *vect = (vp56_mv_t) {0,0}; |
|
305 |
+ *vect = (VP56mv) {0,0}; |
|
306 | 306 |
if (s->vector_candidate_pos < 2) |
307 | 307 |
*vect = s->vector_candidate[0]; |
308 | 308 |
|
... | ... |
@@ -338,7 +338,7 @@ static void vp6_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect) |
338 | 338 |
* Read number of consecutive blocks with null DC or AC. |
339 | 339 |
* This value is < 74. |
340 | 340 |
*/ |
341 |
-static unsigned vp6_get_nb_null(vp56_context_t *s) |
|
341 |
+static unsigned vp6_get_nb_null(VP56Context *s) |
|
342 | 342 |
{ |
343 | 343 |
unsigned val = get_bits(&s->gb, 2); |
344 | 344 |
if (val == 2) |
... | ... |
@@ -350,9 +350,9 @@ static unsigned vp6_get_nb_null(vp56_context_t *s) |
350 | 350 |
return val; |
351 | 351 |
} |
352 | 352 |
|
353 |
-static void vp6_parse_coeff_huffman(vp56_context_t *s) |
|
353 |
+static void vp6_parse_coeff_huffman(VP56Context *s) |
|
354 | 354 |
{ |
355 |
- vp56_model_t *model = s->modelp; |
|
355 |
+ Vp56Model *model = s->modelp; |
|
356 | 356 |
uint8_t *permute = s->scantable.permutated; |
357 | 357 |
VLC *vlc_coeff; |
358 | 358 |
int coeff, sign, coeff_idx; |
... | ... |
@@ -405,10 +405,10 @@ static void vp6_parse_coeff_huffman(vp56_context_t *s) |
405 | 405 |
} |
406 | 406 |
} |
407 | 407 |
|
408 |
-static void vp6_parse_coeff(vp56_context_t *s) |
|
408 |
+static void vp6_parse_coeff(VP56Context *s) |
|
409 | 409 |
{ |
410 |
- vp56_range_coder_t *c = s->ccp; |
|
411 |
- vp56_model_t *model = s->modelp; |
|
410 |
+ VP56RangeCoder *c = s->ccp; |
|
411 |
+ Vp56Model *model = s->modelp; |
|
412 | 412 |
uint8_t *permute = s->scantable.permutated; |
413 | 413 |
uint8_t *model1, *model2, *model3; |
414 | 414 |
int coeff, sign, coeff_idx; |
... | ... |
@@ -522,7 +522,7 @@ static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride, |
522 | 522 |
} |
523 | 523 |
} |
524 | 524 |
|
525 |
-static void vp6_filter_diag2(vp56_context_t *s, uint8_t *dst, uint8_t *src, |
|
525 |
+static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src, |
|
526 | 526 |
int stride, int h_weight, int v_weight) |
527 | 527 |
{ |
528 | 528 |
uint8_t *tmp = s->edge_emu_buffer+16; |
... | ... |
@@ -563,9 +563,9 @@ static void vp6_filter_diag4(uint8_t *dst, uint8_t *src, int stride, |
563 | 563 |
} |
564 | 564 |
} |
565 | 565 |
|
566 |
-static void vp6_filter(vp56_context_t *s, uint8_t *dst, uint8_t *src, |
|
566 |
+static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src, |
|
567 | 567 |
int offset1, int offset2, int stride, |
568 |
- vp56_mv_t mv, int mask, int select, int luma) |
|
568 |
+ VP56mv mv, int mask, int select, int luma) |
|
569 | 569 |
{ |
570 | 570 |
int filter4 = 0; |
571 | 571 |
int x8 = mv.x & mask; |
... | ... |
@@ -615,7 +615,7 @@ static void vp6_filter(vp56_context_t *s, uint8_t *dst, uint8_t *src, |
615 | 615 |
|
616 | 616 |
static av_cold int vp6_decode_init(AVCodecContext *avctx) |
617 | 617 |
{ |
618 |
- vp56_context_t *s = avctx->priv_data; |
|
618 |
+ VP56Context *s = avctx->priv_data; |
|
619 | 619 |
|
620 | 620 |
vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6, |
621 | 621 |
avctx->codec->id == CODEC_ID_VP6A); |
... | ... |
@@ -635,7 +635,7 @@ AVCodec vp6_decoder = { |
635 | 635 |
"vp6", |
636 | 636 |
CODEC_TYPE_VIDEO, |
637 | 637 |
CODEC_ID_VP6, |
638 |
- sizeof(vp56_context_t), |
|
638 |
+ sizeof(VP56Context), |
|
639 | 639 |
vp6_decode_init, |
640 | 640 |
NULL, |
641 | 641 |
vp56_free, |
... | ... |
@@ -649,7 +649,7 @@ AVCodec vp6f_decoder = { |
649 | 649 |
"vp6f", |
650 | 650 |
CODEC_TYPE_VIDEO, |
651 | 651 |
CODEC_ID_VP6F, |
652 |
- sizeof(vp56_context_t), |
|
652 |
+ sizeof(VP56Context), |
|
653 | 653 |
vp6_decode_init, |
654 | 654 |
NULL, |
655 | 655 |
vp56_free, |
... | ... |
@@ -663,7 +663,7 @@ AVCodec vp6a_decoder = { |
663 | 663 |
"vp6a", |
664 | 664 |
CODEC_TYPE_VIDEO, |
665 | 665 |
CODEC_ID_VP6A, |
666 |
- sizeof(vp56_context_t), |
|
666 |
+ sizeof(VP56Context), |
|
667 | 667 |
vp6_decode_init, |
668 | 668 |
NULL, |
669 | 669 |
vp56_free, |