[FFmpeg-devel] [PATCH] avfilter/[vf_nnedi, vf_estdif]: Check interlaced flag on correct frame

Kacper Michajlow kasper93 at gmail.com
Tue May 4 22:14:12 EEST 2021


On Tue, 4 May 2021 at 21:05, Kacper Michajłow <kasper93 at gmail.com> wrote:

> Fixes regression in vf_nnedi after
> 24dc6d386c6f7edb8f6945319f53a7f0b1642bb8 and vf_estdif while at it.
>
> Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
> ---
>  libavfilter/vf_estdif.c | 2 +-
>  libavfilter/vf_nnedi.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_estdif.c b/libavfilter/vf_estdif.c
> index 9dda604d3c..900e28ce67 100644
> --- a/libavfilter/vf_estdif.c
> +++ b/libavfilter/vf_estdif.c
> @@ -500,7 +500,7 @@ static int config_input(AVFilterLink *inlink)
>          return 0;
>      }
>
> -    if ((s->deint && !in->interlaced_frame) || ctx->is_disabled) {
> +    if ((s->deint && !s->prev->interlaced_frame) || ctx->is_disabled) {
>          s->prev->pts *= 2;
>          ret = ff_filter_frame(ctx->outputs[0], s->prev);
>          s->prev = in;
> diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c
> index 6096e88812..686091ac8d 100644
> --- a/libavfilter/vf_nnedi.c
> +++ b/libavfilter/vf_nnedi.c
> @@ -695,7 +695,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
>          return 0;
>      }
>
> -    if ((s->deint && !in->interlaced_frame) || ctx->is_disabled) {
> +    if ((s->deint && !s->prev->interlaced_frame) || ctx->is_disabled) {
>          s->prev->pts *= 2;
>          ret = ff_filter_frame(ctx->outputs[0], s->prev);
>          s->prev = in;
> --
> 2.28.0.308.g675a4aaf3b
>
>
While fixing this reggression in vf_nnedi I also noticed that yadif checks
also surrounding frames, but this is only in yadif and likely all
deinterlace filers would need to be adjusted if we want to have same logic,
so I left it as is.It works fine for my test file.

    if ((yadif->deint && !yadif->cur->interlaced_frame) ||
        ctx->is_disabled ||
        (yadif->deint && !yadif->prev->interlaced_frame &&
yadif->prev->repeat_pict) ||
        (yadif->deint && !yadif->next->interlaced_frame &&
yadif->next->repeat_pict)
    ) {


More information about the ffmpeg-devel mailing list