avcodec/mpegvideo_enc: dont use direct mode for unaligned input
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 15 Mar 2014 13:50:37 +0000 (14:50 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 15 Mar 2014 13:56:42 +0000 (14:56 +0100)
Fixes Ticket3456

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c

index 6bc5102..7e081a5 100644 (file)
@@ -1039,6 +1039,10 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
             direct = 0;
         if ((s->width & 15) || (s->height & 15))
             direct = 0;
+        if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1))
+            direct = 0;
+        if (s->linesize & (STRIDE_ALIGN-1))
+            direct = 0;
 
         av_dlog(s->avctx, "%d %d %td %td\n", pic_arg->linesize[0],
                 pic_arg->linesize[1], s->linesize, s->uvlinesize);