[FFmpeg-devel] [PATCH] avfilter/vf_bwdif: Remove undesireable spatial preference logic

Philip Langdale philipl at overt.org
Sat Mar 25 00:20:58 EET 2023


bwdif inherited this check from yadif, which was originally supposed to
prefer the spatial predictor if the temporal predictor was too far off.

However, the core bwdif algorithm already accounts for the spatial
predictor, so this additional check actually ends up preferring a worse
value, reducing the overall quality.

This was found by cyanreg while writing bwdif_vulkan, and the visual
improvement is pretty dramatic in some samples. If we agree that this
change is desirable, we should update all implementations.

Signed-off-by: Philip Langdale <philipl at overt.org>
---
 libavfilter/vf_bwdif.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index 65c617ebb3..441bb11e7b 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -106,11 +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.37.2



More information about the ffmpeg-devel mailing list