[vlc-devel] [PATCH 17/25] deinterlace: fix Merge{8,16}BitGeneric
Victorien Le Couviour--Tuffet
victorien.lecouviour.tuffet at gmail.com
Tue Apr 14 12:40:28 CEST 2020
This mistake resulted in an off by one when the real pixel average would a
have a decimal part equal to 0.5.
---
modules/video_filter/deinterlace/merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/video_filter/deinterlace/merge.c b/modules/video_filter/deinterlace/merge.c
index 40d758a377..3c3ffe7ecb 100644
--- a/modules/video_filter/deinterlace/merge.c
+++ b/modules/video_filter/deinterlace/merge.c
@@ -45,7 +45,7 @@ void Merge8BitGeneric( void *_p_dest, const void *_p_s1,
const uint8_t *p_s2 = _p_s2;
for( ; i_bytes > 0; i_bytes-- )
- *p_dest++ = ( *p_s1++ + *p_s2++ ) >> 1;
+ *p_dest++ = ( *p_s1++ + *p_s2++ + 1 ) >> 1;
}
void Merge16BitGeneric( void *_p_dest, const void *_p_s1,
@@ -56,7 +56,7 @@ void Merge16BitGeneric( void *_p_dest, const void *_p_s1,
const uint16_t *p_s2 = _p_s2;
for( size_t i_words = i_bytes / 2; i_words > 0; i_words-- )
- *p_dest++ = ( *p_s1++ + *p_s2++ ) >> 1;
+ *p_dest++ = ( *p_s1++ + *p_s2++ + 1 ) >> 1;
}
#if defined(CAN_COMPILE_SSE)
--
2.24.1
More information about the vlc-devel
mailing list