[FFmpeg-cvslog] avcodec/012v: improve stride selection

Michael Niedermayer git at videolan.org
Sat Jul 13 16:26:11 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jul 13 16:18:06 2013 +0200| [4cdb42b428ef425aceeee548af1ee1a8798a02a2] | committer: Michael Niedermayer

avcodec/012v: improve stride selection

Fixes decoding some files
Fixes Ticket2126

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cdb42b428ef425aceeee548af1ee1a8798a02a2
---

 libavcodec/012v.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/012v.c b/libavcodec/012v.c
index 58e3cd6..f694769 100644
--- a/libavcodec/012v.c
+++ b/libavcodec/012v.c
@@ -49,6 +49,12 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
         av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n");
         return AVERROR_INVALIDDATA;
     }
+
+    if (   avctx->codec_tag == MKTAG('0', '1', '2', 'v')
+        && avpkt->size % avctx->height == 0
+        && avpkt->size / avctx->height * 3 >= width * 8)
+        stride = avpkt->size / avctx->height;
+
     if (avpkt->size < avctx->height * stride) {
         av_log(avctx, AV_LOG_ERROR, "Packet too small: %d instead of %d\n",
                avpkt->size, avctx->height * stride);



More information about the ffmpeg-cvslog mailing list