]> git.sesse.net Git - ffmpeg/commitdiff
mpegvideo_enc: Simplify picture allocation
authorVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 15 Apr 2015 14:16:13 +0000 (15:16 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Sun, 19 Apr 2015 22:17:56 +0000 (23:17 +0100)
libavcodec/mpegvideo_enc.c

index 0ad131f5e06e1920c1be5eccfdb0488c3263cac3..b0d80b1079c2ad84f1e8d8e60edbd19d4bb3a277 100644 (file)
@@ -1006,14 +1006,12 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
         if (direct) {
             if ((ret = av_frame_ref(pic->f, pic_arg)) < 0)
                 return ret;
-            if (ff_alloc_picture(s, pic, 1) < 0) {
-                return -1;
-            }
-        } else {
-            if (ff_alloc_picture(s, pic, 0) < 0) {
-                return -1;
-            }
+        }
+        ret = ff_alloc_picture(s, pic, direct);
+        if (ret < 0)
+            return ret;
 
+        if (!direct) {
             if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] &&
                 pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] &&
                 pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) {