ref: c0241664aac3a1805db9bd8e09e071ac326531e0
parent: 4508eb3123bd9b65a099715ea143680d268ad2ff
author: Alex Converse <[email protected]>
date: Thu Jul 28 05:48:50 EDT 2016
Resolve -Wshorten-64-to-32 in variance. The subtrahend is small enough to fit into uint32_t. Change-Id: Ic4d7128aaa665eaf6b25d562610ba8942c46137f
--- a/vpx_dsp/variance.c
+++ b/vpx_dsp/variance.c
@@ -150,7 +150,7 @@
uint32_t *sse) { \
int sum; \
variance(a, a_stride, b, b_stride, W, H, sse, &sum); \
- return *sse - (((int64_t)sum * sum) / (W * H)); \
+ return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
}
#define SUBPIX_VAR(W, H) \
--- a/vpx_dsp/x86/variance_sse2.c
+++ b/vpx_dsp/x86/variance_sse2.c
@@ -231,7 +231,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 32, 32, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 10);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 10);
}
unsigned int vpx_variance32x16_sse2(const uint8_t *src, int src_stride,
@@ -240,7 +240,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 32, 16, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 9);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 9);
}
unsigned int vpx_variance16x32_sse2(const uint8_t *src, int src_stride,
@@ -249,7 +249,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 16, 32, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 9);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 9);
}
unsigned int vpx_variance64x64_sse2(const uint8_t *src, int src_stride,
@@ -258,7 +258,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 64, 64, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 12);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 12);
}
unsigned int vpx_variance64x32_sse2(const uint8_t *src, int src_stride,
@@ -267,7 +267,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 64, 32, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 11);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}
unsigned int vpx_variance32x64_sse2(const uint8_t *src, int src_stride,
@@ -276,7 +276,7 @@
int sum;
variance_sse2(src, src_stride, ref, ref_stride, 32, 64, sse, &sum,
vpx_get16x16var_sse2, 16);
- return *sse - (((int64_t)sum * sum) >> 11);
+ return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}
unsigned int vpx_mse8x8_sse2(const uint8_t *src, int src_stride,
@@ -353,7 +353,7 @@
} \
} \
*sse_ptr = sse; \
- return sse - (cast_prod(cast se * se) >> (wlog2 + hlog2)); \
+ return sse - (unsigned int)(cast_prod(cast se * se) >> (wlog2 + hlog2)); \
}
#define FNS(opt1, opt2) \
@@ -424,7 +424,7 @@
} \
} \
*sseptr = sse; \
- return sse - (cast_prod(cast se * se) >> (wlog2 + hlog2)); \
+ return sse - (unsigned int)(cast_prod(cast se * se) >> (wlog2 + hlog2)); \
}
#define FNS(opt1, opt2) \