summaryrefslogtreecommitdiff
path: root/libavcodec/rawdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-02 03:52:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-02 03:56:57 +0100
commit1e28fa21de232ba4f37c23eb052465fc07bc1507 (patch)
treefc597695fb90cb377c7c8bd671268648b2dacd0c /libavcodec/rawdec.c
parente9fd51b0d6dc65bdfcd702531c400ae9ee50a67d (diff)
rawdec: fix NV12
Fixes Ticket646 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index af42114138..a4cb151197 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);