shithub: libvpx

Download patch

ref: 3a04c9c9c4c4935925f4c00dcc70610100c5e9dd
parent: 039f9e08f04bc7919c7db4fe4be93a7ac3cc1f84
parent: c0241664aac3a1805db9bd8e09e071ac326531e0
author: Alex Converse <[email protected]>
date: Tue Aug 2 18:26:55 EDT 2016

Merge "Resolve -Wshorten-64-to-32 in variance."

--- 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)                              \