X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvp5.c;h=e5036e62a9ba9577081e71d781fdc594f6610261;hb=f5950b8fd61ec85e0ad8790bea56b37ceea19436;hp=36716237cc6d545a8eb0e3622486a5c59e4cd959;hpb=bb675d3ac6d722d5e117ae9042a996b55ca05b1d;p=ffmpeg diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c index 36716237cc6..e5036e62a9b 100644 --- a/libavcodec/vp5.c +++ b/libavcodec/vp5.c @@ -27,8 +27,7 @@ #include #include "avcodec.h" -#include "dsputil.h" -#include "get_bits.h" +#include "internal.h" #include "vp56.h" #include "vp56data.h" @@ -42,17 +41,17 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, int rows, cols; ff_vp56_init_range_decoder(&s->c, buf, buf_size); - s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); + s->frames[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c); vp56_rac_get(c); ff_vp56_init_dequant(s, vp56_rac_gets(c, 6)); - if (s->framep[VP56_FRAME_CURRENT]->key_frame) + if (s->frames[VP56_FRAME_CURRENT]->key_frame) { vp56_rac_gets(c, 8); if(vp56_rac_gets(c, 5) > 5) return AVERROR_INVALIDDATA; vp56_rac_gets(c, 2); if (vp56_rac_get(c)) { - av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); + avpriv_report_missing_feature(s->avctx, "Interlacing"); return AVERROR_PATCHWELCOME; } rows = vp56_rac_gets(c, 8); /* number of stored macroblock rows */ @@ -68,7 +67,9 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, if (!s->macroblocks || /* first frame */ 16*cols != s->avctx->coded_width || 16*rows != s->avctx->coded_height) { - avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); + int ret = ff_set_dimensions(s->avctx, 16 * cols, 16 * rows); + if (ret < 0) + return ret; return VP56_SIZE_CHANGE; } } else if (!s->macroblocks) @@ -139,7 +140,7 @@ static int vp5_parse_coeff_models(VP56Context *s) if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) { def_prob[node] = vp56_rac_gets_nn(c, 7); model->coeff_dccv[pt][node] = def_prob[node]; - } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) { + } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { model->coeff_dccv[pt][node] = def_prob[node]; } @@ -150,7 +151,7 @@ static int vp5_parse_coeff_models(VP56Context *s) if (vp56_rac_get_prob(c, vp5_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->framep[VP56_FRAME_CURRENT]->key_frame) { + } else if (s->frames[VP56_FRAME_CURRENT]->key_frame) { model->coeff_ract[pt][ct][cg][node] = def_prob[node]; } @@ -174,7 +175,7 @@ static void vp5_parse_coeff(VP56Context *s) { VP56RangeCoder *c = &s->c; VP56Model *model = s->modelp; - uint8_t *permute = s->scantable.permutated; + uint8_t *permute = s->idct_scantable; uint8_t *model1, *model2; int coeff, sign, coeff_idx; int b, i, cg, idx, ctx, ctx_last; @@ -265,8 +266,11 @@ static void vp5_default_models_init(VP56Context *s) static av_cold int vp5_decode_init(AVCodecContext *avctx) { VP56Context *s = avctx->priv_data; + int ret; - ff_vp56_init(avctx, 1, 0); + if ((ret = ff_vp56_init(avctx, 1, 0)) < 0) + return ret; + ff_vp5dsp_init(&s->vp56dsp); s->vp56_coord_div = vp5_coord_div; s->parse_vector_adjustment = vp5_parse_vector_adjustment; s->parse_coeff = vp5_parse_coeff; @@ -280,12 +284,12 @@ static av_cold int vp5_decode_init(AVCodecContext *avctx) AVCodec ff_vp5_decoder = { .name = "vp5", + .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP5, .priv_data_size = sizeof(VP56Context), .init = vp5_decode_init, .close = ff_vp56_free, .decode = ff_vp56_decode_frame, - .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"), + .capabilities = AV_CODEC_CAP_DR1, };