Browse code

swscale: fix signed overflow in yuv2mono_X_c_template

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 <mans@mansr.com>

Mans Rullgard authored on 2011/11/27 06:53:00
Showing 1 changed files
... ...
@@ -510,7 +510,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,
510 510
     const uint8_t * const d128=dither_8x8_220[y&7];
511 511
     uint8_t *g = c->table_gU[128] + c->table_gV[128];
512 512
     int i;
513
-    int acc = 0;
513
+    unsigned acc = 0;
514 514
 
515 515
     for (i = 0; i < dstW - 1; i += 2) {
516 516
         int j;