diff options
Diffstat (limited to 'libavcodec/vp6.c')
-rw-r--r-- | libavcodec/vp6.c | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index 37938038c4..ad81060886 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -38,6 +38,7 @@ #include "vp56.h" #include "vp56data.h" #include "vp6data.h" +#include "vpx_rac.h" #define VP6_MAX_HUFF_SIZE 12 @@ -46,7 +47,7 @@ static int vp6_parse_coeff_huffman(VP56Context *s); static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) { - VP56RangeCoder *c = &s->c; + VPXRangeCoder *c = &s->c; int parse_filter_info = 0; int coeff_offset = 0; int vrt_shift = 0; @@ -107,7 +108,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) res = VP56_SIZE_CHANGE; } - ret = ff_vp56_init_range_decoder(c, buf+6, buf_size-6); + ret = ff_vpx_init_range_decoder(c, buf+6, buf_size-6); if (ret < 0) goto fail; vp56_rac_gets(c, 2); @@ -126,26 +127,26 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) buf += 2; buf_size -= 2; } - ret = ff_vp56_init_range_decoder(c, buf+1, buf_size-1); + ret = ff_vpx_init_range_decoder(c, buf+1, buf_size-1); if (ret < 0) return ret; - s->golden_frame = vp56_rac_get(c); + s->golden_frame = vpx_rac_get(c); if (s->filter_header) { - s->deblock_filtering = vp56_rac_get(c); + s->deblock_filtering = vpx_rac_get(c); if (s->deblock_filtering) - vp56_rac_get(c); + vpx_rac_get(c); if (s->sub_version > 7) - parse_filter_info = vp56_rac_get(c); + parse_filter_info = vpx_rac_get(c); } } if (parse_filter_info) { - if (vp56_rac_get(c)) { + if (vpx_rac_get(c)) { s->filter_mode = 2; s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift; s->max_vector_length = 2 << vp56_rac_gets(c, 3); - } else if (vp56_rac_get(c)) { + } else if (vpx_rac_get(c)) { s->filter_mode = 1; } else { s->filter_mode = 0; @@ -156,7 +157,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) s->filter_selection = 16; } - s->use_huffman = vp56_rac_get(c); + s->use_huffman = vpx_rac_get(c); s->parse_coeff = vp6_parse_coeff; if (coeff_offset) { @@ -172,7 +173,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size) if (ret < 0) return ret; } else { - ret = ff_vp56_init_range_decoder(&s->cc, buf, buf_size); + ret = ff_vpx_init_range_decoder(&s->cc, buf, buf_size); if (ret < 0) goto fail; s->ccp = &s->cc; @@ -231,25 +232,25 @@ static void vp6_default_models_init(VP56Context *s) static void vp6_parse_vector_models(VP56Context *s) { - VP56RangeCoder *c = &s->c; + VPXRangeCoder *c = &s->c; VP56Model *model = s->modelp; int comp, node; for (comp=0; comp<2; comp++) { - if (vp56_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][0])) + if (vpx_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][0])) model->vector_dct[comp] = vp56_rac_gets_nn(c, 7); - if (vp56_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][1])) + if (vpx_rac_get_prob_branchy(c, vp6_sig_dct_pct[comp][1])) model->vector_sig[comp] = vp56_rac_gets_nn(c, 7); } for (comp=0; comp<2; comp++) for (node=0; node<7; node++) - if (vp56_rac_get_prob_branchy(c, vp6_pdv_pct[comp][node])) + if (vpx_rac_get_prob_branchy(c, vp6_pdv_pct[comp][node])) model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7); for (comp=0; comp<2; comp++) for (node=0; node<8; node++) - if (vp56_rac_get_prob_branchy(c, vp6_fdv_pct[comp][node])) + if (vpx_rac_get_prob_branchy(c, vp6_fdv_pct[comp][node])) model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7); } @@ -284,7 +285,7 @@ static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], static int vp6_parse_coeff_models(VP56Context *s) { - VP56RangeCoder *c = &s->c; + VPXRangeCoder *c = &s->c; VP56Model *model = s->modelp; int def_prob[11]; int node, cg, ctx, pos; @@ -295,30 +296,30 @@ static int vp6_parse_coeff_models(VP56Context *s) for (pt=0; pt<2; pt++) for (node=0; node<11; node++) - if (vp56_rac_get_prob_branchy(c, vp6_dccv_pct[pt][node])) { + if (vpx_rac_get_prob_branchy(c, vp6_dccv_pct[pt][node])) { def_prob[node] = vp56_rac_gets_nn(c, 7); model->coeff_dccv[pt][node] = def_prob[node]; } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { model->coeff_dccv[pt][node] = def_prob[node]; } - if (vp56_rac_get(c)) { + if (vpx_rac_get(c)) { for (pos=1; pos<64; pos++) - if (vp56_rac_get_prob_branchy(c, vp6_coeff_reorder_pct[pos])) + if (vpx_rac_get_prob_branchy(c, vp6_coeff_reorder_pct[pos])) model->coeff_reorder[pos] = vp56_rac_gets(c, 4); vp6_coeff_order_table_init(s); } for (cg=0; cg<2; cg++) for (node=0; node<14; node++) - if (vp56_rac_get_prob_branchy(c, vp6_runv_pct[cg][node])) + if (vpx_rac_get_prob_branchy(c, vp6_runv_pct[cg][node])) model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7); for (ct=0; ct<3; ct++) for (pt=0; pt<2; pt++) for (cg=0; cg<6; cg++) for (node=0; node<11; node++) - if (vp56_rac_get_prob_branchy(c, vp6_ract_pct[ct][pt][cg][node])) { + if (vpx_rac_get_prob_branchy(c, vp6_ract_pct[ct][pt][cg][node])) { def_prob[node] = vp56_rac_gets_nn(c, 7); model->coeff_ract[pt][ct][cg][node] = def_prob[node]; } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { @@ -353,7 +354,7 @@ static int vp6_parse_coeff_models(VP56Context *s) static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) { - VP56RangeCoder *c = &s->c; + VPXRangeCoder *c = &s->c; VP56Model *model = s->modelp; int comp; @@ -364,14 +365,14 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) for (comp=0; comp<2; comp++) { int i, delta = 0; - if (vp56_rac_get_prob_branchy(c, model->vector_dct[comp])) { + if (vpx_rac_get_prob_branchy(c, model->vector_dct[comp])) { static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4}; for (i=0; i<sizeof(prob_order); i++) { int j = prob_order[i]; - delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j])<<j; + delta |= vpx_rac_get_prob(c, model->vector_fdv[comp][j])<<j; } if (delta & 0xF0) - delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3])<<3; + delta |= vpx_rac_get_prob(c, model->vector_fdv[comp][3])<<3; else delta |= 8; } else { @@ -379,7 +380,7 @@ static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) model->vector_pdv[comp]); } - if (delta && vp56_rac_get_prob_branchy(c, model->vector_sig[comp])) + if (delta && vpx_rac_get_prob_branchy(c, model->vector_sig[comp])) delta = -delta; if (!comp) @@ -468,7 +469,7 @@ static int vp6_parse_coeff_huffman(VP56Context *s) static int vp6_parse_coeff(VP56Context *s) { - VP56RangeCoder *c = s->ccp; + VPXRangeCoder *c = s->ccp; VP56Model *model = s->modelp; uint8_t *permute = s->idct_scantable; uint8_t *model1, *model2, *model3; @@ -476,7 +477,7 @@ static int vp6_parse_coeff(VP56Context *s) int b, i, cg, idx, ctx; int pt = 0; /* plane type (0 for Y, 1 for U or V) */ - if (vpX_rac_is_end(c)) { + if (vpx_rac_is_end(c)) { av_log(s->avctx, AV_LOG_ERROR, "End of AC stream reached in vp6_parse_coeff\n"); return AVERROR_INVALIDDATA; } @@ -494,17 +495,17 @@ static int vp6_parse_coeff(VP56Context *s) coeff_idx = 0; for (;;) { - if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob_branchy(c, model2[0])) { + if ((coeff_idx>1 && ct==0) || vpx_rac_get_prob_branchy(c, model2[0])) { /* parse a coeff */ - if (vp56_rac_get_prob_branchy(c, model2[2])) { - if (vp56_rac_get_prob_branchy(c, model2[3])) { + if (vpx_rac_get_prob_branchy(c, model2[2])) { + if (vpx_rac_get_prob_branchy(c, model2[3])) { idx = vp56_rac_get_tree(c, ff_vp56_pc_tree, model1); coeff = ff_vp56_coeff_bias[idx+5]; for (i=ff_vp56_coeff_bit_length[idx]; i>=0; i--) - coeff += vp56_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i; + coeff += vpx_rac_get_prob(c, ff_vp56_coeff_parse_table[idx][i]) << i; } else { - if (vp56_rac_get_prob_branchy(c, model2[4])) - coeff = 3 + vp56_rac_get_prob(c, model1[5]); + if (vpx_rac_get_prob_branchy(c, model2[4])) + coeff = 3 + vpx_rac_get_prob(c, model1[5]); else coeff = 2; } @@ -513,7 +514,7 @@ static int vp6_parse_coeff(VP56Context *s) ct = 1; coeff = 1; } - sign = vp56_rac_get(c); + sign = vpx_rac_get(c); coeff = (coeff ^ -sign) + sign; if (coeff_idx) coeff *= s->dequant_ac; @@ -524,14 +525,14 @@ static int vp6_parse_coeff(VP56Context *s) /* parse a run */ ct = 0; if (coeff_idx > 0) { - if (!vp56_rac_get_prob_branchy(c, model2[1])) + if (!vpx_rac_get_prob_branchy(c, model2[1])) break; model3 = model->coeff_runv[coeff_idx >= 6]; run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); if (!run) for (run=9, i=0; i<6; i++) - run += vp56_rac_get_prob(c, model3[i+8]) << i; + run += vpx_rac_get_prob(c, model3[i+8]) << i; } } coeff_idx += run; |