As old bits are shifted out of the accumulator, they cause signed
overflows when they reach the end.  Making the variable unsigned fixes
this.

Signed-off-by: Mans Rullgard <[email protected]>
---
 libswscale/swscale.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 98daf22..975a0bd 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -510,7 +510,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t 
*lumFilter,
     const uint8_t * const d128=dither_8x8_220[y&7];
     uint8_t *g = c->table_gU[128] + c->table_gV[128];
     int i;
-    int acc = 0;
+    unsigned acc = 0;
 
     for (i = 0; i < dstW - 1; i += 2) {
         int j;
-- 
1.7.7.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to