Commit e4788e9c authored by Neil Birkbeck's avatar Neil Birkbeck Committed by Michael Niedermayer

avfilter/vf_yadif: fix extra leading dup frame when deint=1

Logic for handling single frame in yadif (0f9f24c9), caused deint=1 (e.g., yadif=0:-1:1) to output extra duplicate leading frame:

ffmpeg -i fate-suite/ffmpeg-synthetic/vsynth1/%02d.pgm  -vf yadif=0:-1:1,showinfo -f null -y /dev/null
 [Parsed_showinfo_1 @ 0x1d967d0] n:0 pts:0 pts_time:0 pos:-1 fmt:gray sar:0/1 s:352x432 i:P iskey:1 type:I checksum:E457EEA0 plane_checksum:[E457EEA0] mean:[126] stdev:[46.6]
 [Parsed_showinfo_1 @ 0x1d967d0] n:1 pts:0 pts_time:0 pos:-1 fmt:gray sar:0/1 s:352x432 i:P iskey:1 type:I checksum:E457EEA0 plane_checksum:[E457EEA0] mean:[126] stdev:[46.6]
(Outputs 51 frames)

After patch, vf "yadif=0:-1:1" behaves correctly (like "yadif=0:-1:0") and outputs 50 frames, first two:

[Parsed_showinfo_1 @ 0x1e307d0] n:0 pts:0 pts_time:0 pos:-1 fmt:gray sar:0/1 s:352x432 i:P iskey:1 type:I checksum:68E8D1EB plane_checksum:[68E8D1EB] mean:[126] stdev:[46.0]
[Parsed_showinfo_1 @ 0x1e307d0] n:1 pts:2 pts_time:0.04 pos:-1 fmt:gray sar:0/1 s:352x432 i:P iskey:1 type:I checksum:4E674BC7 plane_checksum:[4E674BC7] mean:[125] stdev:[46.0]
(Outputs 50 frames)
Signed-off-by: 's avatarNeil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fc9ced41
...@@ -342,6 +342,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ...@@ -342,6 +342,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
return -1; return -1;
} }
if (!yadif->prev)
return 0;
if ((yadif->deint && !yadif->cur->interlaced_frame) || ctx->is_disabled) { if ((yadif->deint && !yadif->cur->interlaced_frame) || ctx->is_disabled) {
yadif->out = av_frame_clone(yadif->cur); yadif->out = av_frame_clone(yadif->cur);
if (!yadif->out) if (!yadif->out)
...@@ -353,9 +356,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) ...@@ -353,9 +356,6 @@ 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)
return 0;
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)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment