[FFmpeg-cvslog] rawdec: fix NV12

Michael Niedermayer git at videolan.org
Wed Jan 2 04:03:16 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Jan  2 03:52:54 2013 +0100| [1e28fa21de232ba4f37c23eb052465fc07bc1507] | committer: Michael Niedermayer

rawdec: fix NV12

Fixes Ticket646

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

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

 libavcodec/rawdec.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index af42114..a4cb151 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -237,6 +237,15 @@ static int raw_decode(AVCodecContext *avctx,
         FFALIGN(frame->linesize[0], linesize_align)*avctx->height <= buf_size)
         frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align);
 
+    if(avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') &&
+        FFALIGN(frame->linesize[0], linesize_align)*avctx->height +
+        FFALIGN(frame->linesize[1], linesize_align)*((avctx->height+1)/2) <= buf_size) {
+        int la0 = FFALIGN(frame->linesize[0], linesize_align);
+        frame->data[1] += (la0 - frame->linesize[0])*avctx->height;
+        frame->linesize[0] = la0;
+        frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align);
+    }
+
     if(context->flip)
         flip(avctx, picture);
 



More information about the ffmpeg-cvslog mailing list