avfilter/vf_yadif: fix filtering a single image

Found-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-05-02 02:08:19 +02:00
parent e881a96632
commit 0f9f24c9cf

View File

@ -325,8 +325,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
yadif->cur = yadif->next; yadif->cur = yadif->next;
yadif->next = frame; yadif->next = frame;
if (!yadif->cur) if (!yadif->cur &&
return 0; !(yadif->cur = av_frame_clone(yadif->next)))
return AVERROR(ENOMEM);
if (checkstride(yadif, yadif->next, yadif->cur)) { if (checkstride(yadif, yadif->next, yadif->cur)) {
av_log(ctx, AV_LOG_VERBOSE, "Reallocating frame due to differing stride\n"); 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); return ff_filter_frame(ctx->outputs[0], yadif->out);
} }
if (!yadif->prev && if (!yadif->prev)
!(yadif->prev = av_frame_clone(yadif->cur))) return 0;
return AVERROR(ENOMEM);
yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h); yadif->out = ff_get_video_buffer(ctx->outputs[0], link->w, link->h);
if (!yadif->out) if (!yadif->out)