diff options
author | James Zern <jzern@google.com> | 2017-04-07 07:32:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-04-07 07:32:14 +0000 |
commit | 04e9456567790666b65de4c1989cc1b5a5b8480d (patch) | |
tree | 77e53b64d9e763aba1c5ea5d4364d23c2ae9e803 | |
parent | 6af42f5102ad7c00d3fed389b186663a88d812ee (diff) | |
parent | 7ac3acf762ca450140d51616c15ca006e9e1df13 (diff) | |
download | libvpx-04e9456567790666b65de4c1989cc1b5a5b8480d.tar libvpx-04e9456567790666b65de4c1989cc1b5a5b8480d.tar.gz libvpx-04e9456567790666b65de4c1989cc1b5a5b8480d.tar.bz2 libvpx-04e9456567790666b65de4c1989cc1b5a5b8480d.zip |
Merge changes from topic 'Wshorten'
* changes:
configure: enable -Wshorten-64-to-32 for hbd
vp9_encodeframe: resolve -Wshorten-64-to-32 in hbd
Resolve -Wshorten-64-to-32 in highbd variance.
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 3 | ||||
-rw-r--r-- | vpx_dsp/variance.c | 2 | ||||
-rw-r--r-- | vpx_dsp/x86/highbd_variance_sse2.c | 22 |
4 files changed, 21 insertions, 14 deletions
@@ -594,11 +594,9 @@ process_toolchain() { if enabled mips || [ -z "${INLINE}" ]; then enabled extra_warnings || check_add_cflags -Wno-unused-function fi - if ! enabled vp9_highbitdepth; then - # Avoid this warning for third_party C++ sources. Some reorganization - # would be needed to apply this only to test/*.cc. - check_cflags -Wshorten-64-to-32 && add_cflags_only -Wshorten-64-to-32 - fi + # Avoid this warning for third_party C++ sources. Some reorganization + # would be needed to apply this only to test/*.cc. + check_cflags -Wshorten-64-to-32 && add_cflags_only -Wshorten-64-to-32 fi if enabled icc; then diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4e0c32049..9b09e3891 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -157,7 +157,8 @@ unsigned int vp9_high_get_sby_perpixel_variance(VP9_COMP *cpi, CONVERT_TO_BYTEPTR(VP9_HIGH_VAR_OFFS_8), 0, &sse); break; } - return ROUND64_POWER_OF_TWO((int64_t)var, num_pels_log2_lookup[bs]); + return (unsigned int)ROUND64_POWER_OF_TWO((int64_t)var, + num_pels_log2_lookup[bs]); } #endif // CONFIG_VP9_HIGHBITDEPTH diff --git a/vpx_dsp/variance.c b/vpx_dsp/variance.c index d1fa0560d..421415025 100644 --- a/vpx_dsp/variance.c +++ b/vpx_dsp/variance.c @@ -294,7 +294,7 @@ static void highbd_12_variance(const uint8_t *a8, int a_stride, uint32_t *sse) { \ int sum; \ highbd_8_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)); \ } \ \ uint32_t vpx_highbd_10_variance##W##x##H##_c(const uint8_t *a, int a_stride, \ diff --git a/vpx_dsp/x86/highbd_variance_sse2.c b/vpx_dsp/x86/highbd_variance_sse2.c index 414ae5de1..a6f7c3d25 100644 --- a/vpx_dsp/x86/highbd_variance_sse2.c +++ b/vpx_dsp/x86/highbd_variance_sse2.c @@ -135,7 +135,7 @@ HIGH_GET_VAR(8); highbd_8_variance_sse2( \ src, src_stride, ref, ref_stride, w, h, sse, &sum, \ vpx_highbd_calc##block_size##x##block_size##var_sse2, block_size); \ - return *sse - (((int64_t)sum * sum) >> shift); \ + return *sse - (uint32_t)(((int64_t)sum * sum) >> shift); \ } \ \ uint32_t vpx_highbd_10_variance##w##x##h##_sse2( \ @@ -293,12 +293,13 @@ DECLS(sse2); } \ } \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + return sse - (uint32_t)((cast se * se) >> (wlog2 + hlog2)); \ } \ \ uint32_t vpx_highbd_10_sub_pixel_variance##w##x##h##_##opt( \ const uint8_t *src8, int src_stride, int x_offset, int y_offset, \ const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr) { \ + int64_t var; \ uint32_t sse; \ uint16_t *src = CONVERT_TO_SHORTPTR(src8); \ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \ @@ -328,7 +329,8 @@ DECLS(sse2); se = ROUND_POWER_OF_TWO(se, 2); \ sse = ROUND_POWER_OF_TWO(sse, 4); \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + var = (int64_t)(sse) - ((cast se * se) >> (wlog2 + hlog2)); \ + return (var >= 0) ? (uint32_t)var : 0; \ } \ \ uint32_t vpx_highbd_12_sub_pixel_variance##w##x##h##_##opt( \ @@ -337,6 +339,7 @@ DECLS(sse2); int start_row; \ uint32_t sse; \ int se = 0; \ + int64_t var; \ uint64_t long_sse = 0; \ uint16_t *src = CONVERT_TO_SHORTPTR(src8); \ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \ @@ -375,7 +378,8 @@ DECLS(sse2); se = ROUND_POWER_OF_TWO(se, 4); \ sse = (uint32_t)ROUND_POWER_OF_TWO(long_sse, 8); \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + var = (int64_t)(sse) - ((cast se * se) >> (wlog2 + hlog2)); \ + return (var >= 0) ? (uint32_t)var : 0; \ } #define FNS(opt) \ @@ -444,13 +448,14 @@ DECLS(sse2); } \ } \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + return sse - (uint32_t)((cast se * se) >> (wlog2 + hlog2)); \ } \ \ uint32_t vpx_highbd_10_sub_pixel_avg_variance##w##x##h##_##opt( \ const uint8_t *src8, int src_stride, int x_offset, int y_offset, \ const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr, \ const uint8_t *sec8) { \ + int64_t var; \ uint32_t sse; \ uint16_t *src = CONVERT_TO_SHORTPTR(src8); \ uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \ @@ -481,7 +486,8 @@ DECLS(sse2); se = ROUND_POWER_OF_TWO(se, 2); \ sse = ROUND_POWER_OF_TWO(sse, 4); \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + var = (int64_t)(sse) - ((cast se * se) >> (wlog2 + hlog2)); \ + return (var >= 0) ? (uint32_t)var : 0; \ } \ \ uint32_t vpx_highbd_12_sub_pixel_avg_variance##w##x##h##_##opt( \ @@ -489,6 +495,7 @@ DECLS(sse2); const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr, \ const uint8_t *sec8) { \ int start_row; \ + int64_t var; \ uint32_t sse; \ int se = 0; \ uint64_t long_sse = 0; \ @@ -530,7 +537,8 @@ DECLS(sse2); se = ROUND_POWER_OF_TWO(se, 4); \ sse = (uint32_t)ROUND_POWER_OF_TWO(long_sse, 8); \ *sse_ptr = sse; \ - return sse - ((cast se * se) >> (wlog2 + hlog2)); \ + var = (int64_t)(sse) - ((cast se * se) >> (wlog2 + hlog2)); \ + return (var >= 0) ? (uint32_t)var : 0; \ } #define FNS(opt1) \ |