]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_yadif.c
avcodec/mpegvideo: fix edge emulation with uvlinesize below 25
[ffmpeg] / libavfilter / vf_yadif.c
index 9427994f3da5dc6427b91ff222a9a0eef5a93ccf..70670c3eb9d7a0196345e709ebc4aa99714f66c1 100644 (file)
@@ -325,8 +325,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
     yadif->cur  = yadif->next;
     yadif->next = frame;
 
-    if (!yadif->cur)
-        return 0;
+    if (!yadif->cur &&
+        !(yadif->cur = av_frame_clone(yadif->next)))
+        return AVERROR(ENOMEM);
 
     if (checkstride(yadif, yadif->next, yadif->cur)) {
         av_log(ctx, AV_LOG_VERBOSE, "Reallocating frame due to differing stride\n");
@@ -352,9 +353,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
         return ff_filter_frame(ctx->outputs[0], yadif->out);
     }
 
-    if (!yadif->prev &&
-        !(yadif->prev = av_frame_clone(yadif->cur)))
-        return AVERROR(ENOMEM);
+    if (!yadif->prev)
+        return 0;
 
     yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h);
     if (!yadif->out)
@@ -400,7 +400,7 @@ static int request_frame(AVFilterLink *link)
         } else if (ret < 0) {
             return ret;
         }
-    } while (!yadif->cur);
+    } while (!yadif->prev);
 
     return 0;
 }