]> granicus.if.org Git - libvpx/commitdiff
vpx_dsp/quantize: fix int sanitizer warnings
authorHien Ho <hienho@google.com>
Tue, 1 Oct 2019 22:50:29 +0000 (15:50 -0700)
committerHien Ho <hienho@google.com>
Thu, 3 Oct 2019 18:55:56 +0000 (18:55 +0000)
From unit test: AVX/VP9QuantizeTest; SSSE3/VP9QuantizeTest ...
implicit conversion from type 'int' of value -139812 (32-bit, signed)
to type 'tran_low_t' (aka 'short') changed the value to -8740 (16-bit,
 signed)

BUG=webm:1615

Change-Id: I730946ac6c7a250dcbcfd8a2712c0f1150ddb4fd

vpx_dsp/quantize.c

index dfc22cd8584eb39a15c099bd50f3581e7001dcf0..61818f692e6193cd28280b86e8bb207547850095 100644 (file)
@@ -156,7 +156,7 @@ void vpx_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
              quant_shift_ptr[rc != 0]) >>
             16;  // quantization
       qcoeff_ptr[rc] = (tmp ^ coeff_sign) - coeff_sign;
-      dqcoeff_ptr[rc] = qcoeff_ptr[rc] * dequant_ptr[rc != 0];
+      dqcoeff_ptr[rc] = (tran_low_t)(qcoeff_ptr[rc] * dequant_ptr[rc != 0]);
 
       if (tmp) eob = i;
     }