From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id D288543973 for ; Fri, 4 Nov 2022 13:24:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7B47968B586; Fri, 4 Nov 2022 15:24:23 +0200 (EET) Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6FE1068B57A for ; Fri, 4 Nov 2022 15:24:16 +0200 (EET) Received: by mail-vs1-f48.google.com with SMTP id z189so4526214vsb.4 for ; Fri, 04 Nov 2022 06:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=aOOkumw7ws4g3zlhxf3xLyyPd25UBVRlO38t0j5sm/8=; b=q0Usop+ASMn4GaiX8jNadu/Q+erFesKtT8yQecWC40uKBpnqJKDOM1wU35erHWfaWB PVr+hdSMzfd3OX/3r3mR2BPD2ftcgBrfFtKCSf55AIK9OHmKP+jVPuzFsJ2T6Rg0fV/l 4YVMJFYZwqBi6+gk3zjbth5mJThOqh2uTfU3GrBu7v8ZnjR85dhEmC95qHjEMTmZ+NN5 KGoXMAYFBreHFTOEwwfit1ixU8rLIdxiXnqVc7iiSc8uPSvJ8GRfqonrNkDgGVrQO9GL sbvFAtJ2WVmfK3mNZV6MKoHXeQCrAYsfaMJyZ5XDgPnopqDnZ/fJMDC3hlso4dbqlgSQ eflQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aOOkumw7ws4g3zlhxf3xLyyPd25UBVRlO38t0j5sm/8=; b=VL7/8SpTPTUfSU9oRTOwhsLJMBcEo+dcKFxtVgB1mv7wCw8+VcV+Zz1gaIfgD2P6rF A007Et8Y+lerfXCr52JxD8TawaYsyZW291aj/Ta+wrC8Qp7hKZtBrsALlOc2uRCIEvEh /tnlS0ImWMsw46JnF8nzUIrsRfYbZP6EHossntBAZY8d4kZ/mBj7ZtR0PnIM/TcXkfTh 5+L3N8AUIRv1N5qH43t/foGAOGEhxMbHYbJR0eu2lQKszBzqhEYcAN6xoXBAqCnELux5 bXampeAheM7mk5w0g3r/RNuzmuN9y8CPkwt7ksJj1UmXa25rgdq5SmQdizPoYpOsVFpA nplQ== X-Gm-Message-State: ACrzQf3v42Hn0+OPHftzKoOWgMSDyK37V9ng8UHf+hbIYNq0rhlXFpn/ Nb3rs0Ew3dOiwgODSnFZmIj0SfpxP///TUpQ/uiQCWkb X-Google-Smtp-Source: AMsMyM7JutvmKyMOdKRMrdGbiFC5z9dRPvqi3rfb8H2DugV+cYig42EK40N3vJDfNmwBGujt0sR8pvqhqpMZ++0ayVk= X-Received: by 2002:a05:6102:ac3:b0:3ac:e685:eded with SMTP id m3-20020a0561020ac300b003ace685ededmr15869167vsh.61.1667568254884; Fri, 04 Nov 2022 06:24:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:612c:612:b0:314:ac6a:1eb7 with HTTP; Fri, 4 Nov 2022 06:24:13 -0700 (PDT) In-Reply-To: <399842a707482604827e62860e98cb37@nodoa.me> References: <399842a707482604827e62860e98cb37@nodoa.me> From: Paul B Mahol Date: Fri, 4 Nov 2022 14:24:13 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] lavfi/vf_fieldmatch: keep fields as-is if not matched properly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 11/3/22, mail@nodoa.me wrote: > Makes it possible to use deinterlacers which output one frame for each field > as fallback if field > matching fails (combmatch=full). > > Currently, the documented example with fallback on a post-deinterlacer will > only work in case the > deinterlacer outputs one frame per first field (as yadif=mode=0). The reason > for that is that > fieldmatch will attempt to match the second field regardless of whether it > recognizes the end > result is still interlaced. This produces garbled output with for example > mixed telecined 24fps and > 60i content combined with a field-based deinterlaced such as yadif=mode=1. > This patch orders fieldmatch to revert to using the second field of the > current frame in case the > end result is still interlaced and a post-deinterlacer is assumed to be > used. > Are there samples, ways to reproduce this? > Signed-off-by: lovesyk > --- > libavfilter/vf_fieldmatch.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c > index 40e559df9e..bf946beec9 100644 > --- a/libavfilter/vf_fieldmatch.c > +++ b/libavfilter/vf_fieldmatch.c > @@ -680,7 +680,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *in) > AVFilterLink *outlink = ctx->outputs[0]; > FieldMatchContext *fm = ctx->priv; > int combs[] = { -1, -1, -1, -1, -1 }; > - int order, field, i, match, sc = 0, ret = 0; > + int order, field, i, match, interlaced_frame, sc = 0, ret = 0; > const int *fxo; > AVFrame *gen_frames[] = { NULL, NULL, NULL, NULL, NULL }; > AVFrame *dst = NULL; > @@ -793,6 +793,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *in) > } > } > > + /* keep fields as-is if not matched properly */ > + interlaced_frame = combs[match] >= fm->combpel; > + if (interlaced_frame && fm->combmatch == COMBMATCH_FULL) { > + match = mC; > + } > + > /* get output frame and drop the others */ > if (fm->ppsrc) { > /* field matching was based on a filtered/post-processed input, we > now > @@ -813,7 +819,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *in) > > /* mark the frame we are unable to match properly as interlaced so a > proper > * de-interlacer can take the relay */ > - dst->interlaced_frame = combs[match] >= fm->combpel; > + dst->interlaced_frame = interlaced_frame; > if (dst->interlaced_frame) { > av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still > interlaced\n", > outlink->frame_count_in, av_ts2timestr(in->pts, > &inlink->time_base)); > -- > 2.34.2 > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".