]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vb.c
Perform the DC prediction reversal immediately after decoding all of
[ffmpeg] / libavcodec / vb.c
index e0a587431c5c4c64e9cbefa53a4c8e532eb04a4c..02efa030a5a252d7cbfe6cf893e7031c3c5447ee 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /**
- * @file vb.c
+ * @file libavcodec/vb.c
  * VB Video decoder
  */
 
@@ -173,8 +173,10 @@ static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int offset)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
 {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
     VBDecContext * const c = avctx->priv_data;
     uint8_t *outptr, *srcptr;
     int i, j;
@@ -183,6 +185,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const
     int rest = buf_size;
     int offset = 0;
 
+    if(c->pic.data[0])
+        avctx->release_buffer(avctx, &c->pic);
+    c->pic.reference = 1;
+    if(avctx->get_buffer(avctx, &c->pic) < 0){
+        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+        return -1;
+    }
+
     c->stream = buf;
     flags = bytestream_get_le16(&c->stream);
     rest -= 2;
@@ -245,12 +255,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return -1;
     }
 
-    c->pic.reference = 1;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
     c->frame      = av_malloc( avctx->width * avctx->height);
     c->prev_frame = av_malloc( avctx->width * avctx->height);