]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tscc2.c
avcodec/smacker: Use unsigned for prediction values
[ffmpeg] / libavcodec / tscc2.c
index a8c7ee7996159377eb2083c47604b88cd7f94a44..6aadb51ad4d595a5c1acf091f956c1142c8e7358 100644 (file)
@@ -74,18 +74,14 @@ static av_cold int init_vlcs(TSCC2Context *c)
                                  tscc2_nc_vlc_bits[i],  1, 1,
                                  tscc2_nc_vlc_codes[i], 2, 2,
                                  tscc2_nc_vlc_syms,     1, 1, INIT_VLC_LE);
-        if (ret) {
-            free_vlcs(c);
+        if (ret)
             return ret;
-        }
         ret = ff_init_vlc_sparse(c->ac_vlc + i, 9, tscc2_ac_vlc_sizes[i],
                                  tscc2_ac_vlc_bits[i],  1, 1,
                                  tscc2_ac_vlc_codes[i], 2, 2,
                                  tscc2_ac_vlc_syms[i],  2, 2, INIT_VLC_LE);
-        if (ret) {
-            free_vlcs(c);
+        if (ret)
             return ret;
-        }
     }
 
     return 0;
@@ -240,7 +236,7 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data,
         return buf_size;
     }
 
-    if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) {
+    if ((ret = ff_reget_buffer(avctx, c->pic, 0)) < 0) {
         return ret;
     }
 
@@ -360,15 +356,12 @@ static av_cold int tscc2_decode_init(AVCodecContext *avctx)
     c->slice_quants = av_malloc(c->mb_width * c->mb_height);
     if (!c->slice_quants) {
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate slice information\n");
-        free_vlcs(c);
         return AVERROR(ENOMEM);
     }
 
     c->pic = av_frame_alloc();
-    if (!c->pic) {
-        tscc2_decode_end(avctx);
+    if (!c->pic)
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -383,4 +376,5 @@ AVCodec ff_tscc2_decoder = {
     .close          = tscc2_decode_end,
     .decode         = tscc2_decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };