X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmss3.c;h=74f4b5e6712b1a846a48d7907b1c25d4e254924c;hb=252500a78fe1a31abc79e6070d16f50382c39343;hp=21226f908513aed2fef0f56c80ceab18e6a11cfd;hpb=67d466d09b105b2b1d3d8da4c21d8975925741ae;p=ffmpeg diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c index 21226f90851..74f4b5e6712 100644 --- a/libavcodec/mss3.c +++ b/libavcodec/mss3.c @@ -298,6 +298,10 @@ static void rac_normalise(RangeCoder *c) c->got_error = 1; c->low = 1; } + if (c->low > c->range) { + c->got_error = 1; + c->low = 1; + } if (c->range >= RAC_BOTTOM) return; } @@ -733,7 +737,7 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return buf_size; c->got_error = 0; - if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) + if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0) return ret; c->pic->key_frame = keyframe; c->pic->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; @@ -840,20 +844,13 @@ static av_cold int mss3_decode_init(AVCodecContext *avctx) b_width * b_height); if (!c->dct_coder[i].prev_dc) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate buffer\n"); - av_frame_free(&c->pic); - while (i >= 0) { - av_freep(&c->dct_coder[i].prev_dc); - i--; - } return AVERROR(ENOMEM); } } c->pic = av_frame_alloc(); - if (!c->pic) { - mss3_decode_end(avctx); + if (!c->pic) return AVERROR(ENOMEM); - } avctx->pix_fmt = AV_PIX_FMT_YUV420P; @@ -872,4 +869,5 @@ AVCodec ff_msa1_decoder = { .close = mss3_decode_end, .decode = mss3_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, };