[FFmpeg-trac] #9459(avfilter:new): w3fdif inserting extraneous frame (at beginning?) when selective deinterlacing all-progressive input

FFmpeg trac at avcodec.org
Mon Oct 18 04:03:35 EEST 2021


#9459: w3fdif inserting extraneous frame (at beginning?) when selective
deinterlacing all-progressive input
------------------------------------+------------------------------------
             Reporter:  Tim         |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Comment (by Tim):

 Looking at yadif_common.c and checking for behavior differences, I notice
 ff_yadif_filter_frame() returns before the call to ff_filter_frame() when
 !yadif->prev, whereas filter_frame() checks for !s->prev but later (so in
 case of selective deinterlacing, ff_filter_frame() is called even when
 !s->prev)…

 I guess the following might be a possible solution, but this is pure
 guesswork:

 {{{
 diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c
 index c2ea76dfa3..41a45ea06c 100644
 --- a/libavfilter/vf_w3fdif.c
 +++ b/libavfilter/vf_w3fdif.c
 @@ -526,6 +526,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
 *frame)
              return AVERROR(ENOMEM);
      }

 +    if (!s->prev)
 +        return 0;
 +
      if ((s->deint && !s->cur->interlaced_frame) || ctx->is_disabled) {
          AVFrame *out = av_frame_clone(s->cur);
          if (!out)
 @@ -537,9 +540,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
 *frame)
          return ff_filter_frame(ctx->outputs[0], out);
      }

 -    if (!s->prev)
 -        return 0;
 -
      ret = filter(ctx, 0);
      if (ret < 0 || s->mode == 0)
          return ret;
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9459#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list