Merge commit 'e0a1d0a2b04eb5220d00fc7ce46a57cc5e3c7118'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Nov 2014 16:14:18 +0000 (17:14 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Nov 2014 16:14:38 +0000 (17:14 +0100)
* commit 'e0a1d0a2b04eb5220d00fc7ce46a57cc5e3c7118':
  mpegvideo_enc: rework direct mode check

Conflicts:
libavcodec/mpegvideo_enc.c

See: ad985671986464015f3136ad6882ef232c19fc22
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/mpegvideo_enc.c

@@@ -1116,32 -985,23 +1116,29 @@@ static int load_input_picture(MpegEncCo
      }
  
      if (pic_arg) {
-         if (!pic_arg->buf[0])
-             direct = 0;
-         if (pic_arg->linesize[0] != s->linesize)
-             direct = 0;
-         if (pic_arg->linesize[1] != s->uvlinesize)
-             direct = 0;
-         if (pic_arg->linesize[2] != s->uvlinesize)
+         if (!pic_arg->buf[0] ||
+             pic_arg->linesize[0] != s->linesize ||
+             pic_arg->linesize[1] != s->uvlinesize ||
+             pic_arg->linesize[2] != s->uvlinesize)
              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],
 +        av_dlog(s->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", pic_arg->linesize[0],
                  pic_arg->linesize[1], s->linesize, s->uvlinesize);
  
-         if (direct) {
-             i = ff_find_unused_picture(s, 1);
-             if (i < 0)
-                 return i;
+         i = ff_find_unused_picture(s, direct);
+         if (i < 0)
+             return i;
  
-             pic = &s->picture[i];
-             pic->reference = 3;
+         pic = &s->picture[i];
+         pic->reference = 3;
  
+         if (direct) {
              if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
                  return ret;
              if (ff_alloc_picture(s, pic, 1) < 0) {