From patchwork Mon May 24 15:03:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: emcodem X-Patchwork-Id: 27937 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp3032529iof; Mon, 24 May 2021 08:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMAw1yu54sZVOqTs37ZeVEHGCMYI/9tykfxGi3wSfGeffST/I4QhIa8048KLN4WiuQUHGB X-Received: by 2002:a05:600c:2301:: with SMTP id 1mr20590543wmo.180.1621868704039; Mon, 24 May 2021 08:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621868704; cv=none; d=google.com; s=arc-20160816; b=i7DhYGj6IoJusC5w7NTDD2CoCGcPXQdXv5B7aQ/oxnpU9oDhhvZMCbuZHbAdzTkOPa K5Br35dNZuX//tenBa65xlNjc5NIcxXiwKIsctREpKXcpr0nqGcc/2xYccwQCQ+bUIvf 0Ldh+zlSPkquW+6SU8qQMEDrhn+pb/CSzeSFt59qdC7JbHLsIU0T0iFbcvn61EhF60Ep BArgY+MPVAd0fzJ3cwll5LfJzW2vErTemf6+cEcyNdJ0MpjXCNVWo0l4psoCnx0UkF7c UrcxD/r0FDZaJq7wHbaBc8wkJ4UOIvYsFNrv7V08Bci4oFiDjY0peUDITIQS4i2Atwqn VqeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=iTtpujPc+giuKAMd009fLrRGdz7EBOxxAcxpQKA0VE8=; b=e2V0H9jOXe4MHr+HaAfyp+XXPjniw2/Y00JFCl+czEERxtXfcBemyF4lGxXqcscVZZ xX0l1ae7nVIqAVBCwf5ugfrQQpQlusjVO8fppZHAxSin2iq+D/2PzE4bf/uISGdpbz7A IZJVC6elmgCx9SC9ZvFTm0uaSWuJHzDcBYQU3f9EEzlG6fqmOuu0aIZOeu/mkIQcRigI M2NqeOUJnhf0hOx3r64LbuxSkAyMWYLuZ0C5sEjrx0X+CUGtkZFpFdFzN1POv4ewLSgq Hb8Z/lgyr6ARiTYBS+Y7q/OpDjaz9hp4OY6VQ/3DzJJevZw7y+8mBQ8/yc/QoeogLQ44 qDqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bz25si13100674ejc.295.2021.05.24.08.05.02; Mon, 24 May 2021 08:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 35805689806; Mon, 24 May 2021 18:04:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mxfilter2.cpanel.guru (mxfilter2.cpanel.guru [193.93.253.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 49DCB680A9A for ; Mon, 24 May 2021 18:04:53 +0300 (EEST) Received: from cloud03.cpanel.guru (cloud03.cpanel.guru [193.93.253.53]) by mxfilter2.cpanel.guru (Halon) with ESMTPS id 63f4c195-bca1-11eb-8680-0050569e601f; Mon, 24 May 2021 17:04:51 +0200 (CEST) Received: from [178.115.242.98] (port=57081 helo=DESKTOP-1QU2FER.localdomain) by cloud03.cpanel.guru with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1llC8Q-000JE7-RZ; Mon, 24 May 2021 17:04:50 +0200 From: emcodem To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 May 2021 17:03:49 +0200 Message-Id: <20210524150348.30600-1-emcodem@ffastrans.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud03.cpanel.guru X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - ffastrans.com X-Get-Message-Sender-Via: cloud03.cpanel.guru: authenticated_id: emcodem@ffastrans.com X-Authenticated-Sender: cloud03.cpanel.guru: emcodem@ffastrans.com X-Source: X-Source-Args: X-Source-Dir: Subject: [FFmpeg-devel] [PATCH] avisynth.c corrected interlace detection 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 Cc: emcodem Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: KJt6MeTLk6JI Sorry for the delay on this, should have corrected it much earlier. There was some confusion in the interlaced analysis. From 3rdparty decoders perspective, a clip can only be interlaced when it is NOT field_based. This is because in a field_based clip, the fields are separate images, so it is actually progressive. In that case, avisynth still shows is_tff or bff because those values are needed in case the script decides to weave the separated fields later on. --- libavformat/avisynth.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..ff6e6e1bfa 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); - av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); - av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); - /* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; - if (avs_is_field_based(avs->vi)) { + /* separatefields makes field_based==true, weave makes field_based==false + * only non field_based clips can therefore be interlaced */ + av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); + if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; }