diff mbox series

[FFmpeg-devel,v2,1/5] avfilter/vf_yadif: Fix edge size when MAX_ALIGN is < 4

Message ID 20220721022514.1466331-1-cphlipot0@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,1/5] avfilter/vf_yadif: Fix edge size when MAX_ALIGN is < 4 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Chris Phlipot July 21, 2022, 2:25 a.m. UTC
If alignment is set to less than 4 filter_edges will produce incorrect
output and not filter the entire edge. To fix this, make sure that
the edge size is at least 3.

Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
---
 libavfilter/vf_yadif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index afa4d1d53d..055327d7a4 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -120,7 +120,7 @@  static void filter_edges(void *dst1, void *prev1, void *cur1, void *next1,
     uint8_t *prev2 = parity ? prev : cur ;
     uint8_t *next2 = parity ? cur  : next;
 
-    const int edge = MAX_ALIGN - 1;
+    const int edge = FFMAX(MAX_ALIGN - 1, 3);
     int offset = FFMAX(w - edge, 3);
 
     /* Only edge pixels need to be processed here.  A constant value of false
@@ -169,7 +169,7 @@  static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1,
     uint16_t *prev2 = parity ? prev : cur ;
     uint16_t *next2 = parity ? cur  : next;
 
-    const int edge = MAX_ALIGN / 2 - 1;
+    const int edge = FFMAX(MAX_ALIGN / 2 - 1, 3);
     int offset = FFMAX(w - edge, 3);
 
     mrefs /= 2;