]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/v210dec.c
Make sure the EC code does not attempt to use inter based concealment if there
[ffmpeg] / libavcodec / v210dec.c
index 7e7f944b2c7416656cc1aa1f3d208edfee134998..ceeccb634609f5117c57b40170196adf0e629b38 100644 (file)
@@ -30,17 +30,16 @@ static av_cold int decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
         return -1;
     }
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0)
-        return -1;
-    avctx->pix_fmt = PIX_FMT_YUV422P16;
+    avctx->pix_fmt             = PIX_FMT_YUV422P16;
     avctx->bits_per_raw_sample = 10;
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame         = avcodec_alloc_frame();
 
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+                        AVPacket *avpkt)
 {
     int h, w;
     AVFrame *pic = avctx->coded_frame;
@@ -67,13 +66,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     pic->pict_type = FF_I_TYPE;
     pic->key_frame = 1;
 
-#define READ_PIXELS(a, b, c)       \
-    do {                           \
-        val = le2me_32(*src++);      \
+#define READ_PIXELS(a, b, c)         \
+    do {                             \
+        val  = le2me_32(*src++);     \
         *a++ =  val <<  6;           \
         *b++ = (val >>  4) & 0xFFC0; \
         *c++ = (val >> 14) & 0xFFC0; \
-    } while (0);
+    } while (0)
 
     for (h = 0; h < avctx->height; h++) {
         const uint32_t *src = (const uint32_t*)psrc;
@@ -100,9 +99,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
         }
 
         psrc += stride;
-        y += pic->linesize[0]/2 - avctx->width;
-        u += pic->linesize[1]/2 - avctx->width/2;
-        v += pic->linesize[2]/2 - avctx->width/2;
+        y += pic->linesize[0] / 2 - avctx->width;
+        u += pic->linesize[1] / 2 - avctx->width / 2;
+        v += pic->linesize[2] / 2 - avctx->width / 2;
     }
 
     *data_size = sizeof(AVFrame);
@@ -113,6 +112,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
 
 static av_cold int decode_close(AVCodecContext *avctx)
 {
+    AVFrame *pic = avctx->coded_frame;
+    if (pic->data[0])
+        avctx->release_buffer(avctx, pic);
     av_freep(&avctx->coded_frame);
 
     return 0;