ref: 6c4007be1c7b663db1717a0768b8299517b6708d
parent: ccb894ce737c4e82066b60038721184fcc392e5a
author: Alex Converse <[email protected]>
date: Thu Nov 19 10:43:24 EST 2015
Be explicit about overflow in vpx_variance16x16_sse2. The product always fits in uint32_t, but the operands don't. An optimizing compiler should generate the wraparound code. (Verified with clang). Change-Id: I25eb64df99152992bc898b8ccbb01d55c8d16e3c
--- a/vpx_dsp/x86/variance_sse2.c
+++ b/vpx_dsp/x86/variance_sse2.c
@@ -223,7 +223,7 @@
unsigned int *sse) {
int sum;
vpx_get16x16var_sse2(src, src_stride, ref, ref_stride, sse, &sum);
- return *sse - (((unsigned int)sum * sum) >> 8);
+ return *sse - (((uint32_t)((int64_t)sum * sum)) >> 8);
}
unsigned int vpx_variance32x32_sse2(const uint8_t *src, int src_stride,