]> granicus.if.org Git - libvpx/commitdiff
Fix overflow in RD error calculation code.
authorRonald S. Bultje <rbultje@google.com>
Fri, 3 May 2013 17:33:07 +0000 (10:33 -0700)
committerRonald S. Bultje <rbultje@google.com>
Fri, 3 May 2013 17:33:07 +0000 (10:33 -0700)
Change-Id: I61ef1f198c876f9f79787ea7d7385a862cfbae19

vp9/encoder/vp9_rdopt.c

index f971d91c59107e5366fb91ad0d3a29a8369cbdba..990be6527e164b390a563fd6721a63fb7b9ed575 100644 (file)
@@ -603,7 +603,7 @@ static int block_error(int16_t *coeff, int16_t *dqcoeff,
 
   for (i = 0; i < block_size; i++) {
     int this_diff = coeff[i] - dqcoeff[i];
-    error += this_diff * this_diff;
+    error += (unsigned)this_diff * this_diff;
   }
   error >>= shift;