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 9E4C246A85 for ; Sun, 2 Jul 2023 16:54:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 775F068C38D; Sun, 2 Jul 2023 19:54:21 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C37F968C341 for ; Sun, 2 Jul 2023 19:54:15 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 6495F106019A; Sun, 2 Jul 2023 16:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1688316855; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=8FUJDDOBx7OvJYQajA0wUg0L+cZ3iRQgsHZysPUq674=; b=bSuNwtr+gRaZd2R0n6gp3nDZzigp5G31CVU+TpM0FbIrFnMFJbp5Ceamuz19OsmN MEmUBKN+UZJfe78cyrfsGL7AZ7F+/D3930Pri2ZvwGfPwjJpdvO+2ats/zlYUobGFNF dsa2O3RT2jXFotFN4cJHDCjyrSGpYWvJvas4FYkoeiqJpAcYM/YRXHFlbMA9mtsBW2N 3jY5XdgzuBxXCt0uesUDXV9sqMro8lXLOn3gmlSc00+ukSTmBVJ+++huvLHk+QFhVyz Rnla8npiDscI5xujwcHozspxf1xMdMZhDjK1eCErcT3vCCvpMjj2TYXx/kxsoo3cSGJ h+ksyhP8eA== Date: Sun, 2 Jul 2023 18:54:15 +0200 (CEST) From: Lynne To: Ffmpeg Devel , Tmundt75 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_247330_1860967924.1688316855252" Subject: [FFmpeg-devel] [PATCH] lavfi/bwdif: remove interpolated sample clipping 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_247330_1860967924.1688316855252 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit The issue is that clipping the interpolated temporal sample against the spatially predicted sample causes artifacts to appear. Discovered while writing the Vulkan version (where I omitted the same check). The clipping in the code is carried over from yadif. Removing the same code in yadif does not make any difference to the output. I think that the check was simply ill-adapted to the new prediction code and does more harm. I tested replacing the range clip with only an FFMAX, and only an FFMIN, but in both cases, artifacts still appeared. Test sample 1: https://files.lynne.ee/testsamples/mbaff_1080i60_idx.mkvTest sample 2: https://files.lynne.ee/testsamples/mbaff_bdmv_1080i60_8slice.mkv Command line: ./ffmpeg_g -cpuflags 0 -i -vf bwdif=mode=send_field -c:v rawvideo -y .nut Make sure to disable the assembly. Comparisons: https://files.lynne.ee/bwdif_01_before.png https://files.lynne.ee/bwdif_01_after.png Generated from sample 1 via: ffmpeg -ss 00:00:00.184 -i .nut -vf crop=w=420:h=240:x=700:y=300,scale=iw*2:ih*2 -y .png https://files.lynne.ee/bwdif_02_before.png https://files.lynne.ee/bwdif_02_after.pngffmpeg -ss 00:00:00.417 -i .nut -vf crop=w=420:h=240:x=1100:y=200,scale=iw*2:ih*2 -y .png ------=_Part_247330_1860967924.1688316855252 Content-Type: text/x-diff; charset=us-ascii; name=0001-lavfi-bwdif-remove-interpolated-sample-clipping.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-lavfi-bwdif-remove-interpolated-sample-clipping.patch >From abda922dc040ce7237ad3048f55ab20b03f96a27 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sun, 2 Jul 2023 18:10:47 +0200 Subject: [PATCH] lavfi/bwdif: remove interpolated sample clipping The issue is that clipping the interpolated temporal sample against the spatially predicted sample causes artifacts. --- libavfilter/vf_bwdif.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index e278cf1217..55dec526bf 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -106,10 +106,6 @@ typedef struct ThreadData { interpol = (c + e) >> 1; #define FILTER2() \ - if (interpol > d + diff) \ - interpol = d + diff; \ - else if (interpol < d - diff) \ - interpol = d - diff; \ \ dst[0] = av_clip(interpol, 0, clip_max); \ } \ -- 2.40.1 ------=_Part_247330_1860967924.1688316855252 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". ------=_Part_247330_1860967924.1688316855252--