ref: 89ab1dca50809bf1c8d25f7af42e9850e67b16c2
parent: 3f2a06674a9d5d013980b65284156a389fe760bc
parent: c855ed72a636f28cbe03e1baea65dbb9d6c2dab9
author: Johann <[email protected]>
date: Thu May 28 15:39:32 EDT 2015
Merge "Remove conversion warnings from hbd shifts"
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -41,6 +41,25 @@
using ::std::tr1::tuple;
using libvpx_test::ACMRandom;
+// Truncate high bit depth results by downshifting (with rounding) by:
+// 2 * (bit_depth - 8) for sse
+// (bit_depth - 8) for se
+static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
+ switch (bit_depth) {
+ case VPX_BITS_12:
+ *sse = (*sse + 128) >> 8;
+ *se = (*se + 8) >> 4;
+ break;
+ case VPX_BITS_10:
+ *sse = (*sse + 8) >> 4;
+ *se = (*se + 2) >> 2;
+ break;
+ case VPX_BITS_8:
+ default:
+ break;
+ }
+}
+
static unsigned int mb_ss_ref(const int16_t *src) {
unsigned int res = 0;
for (int i = 0; i < 256; ++i) {
@@ -76,10 +95,7 @@
}
}
}
- if (bit_depth > VPX_BITS_8) {
- sse = ROUND_POWER_OF_TWO(sse, 2 * (bit_depth - 8));
- se = ROUND_POWER_OF_TWO(se, bit_depth - 8);
- }
+ RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = sse;
return sse - (((int64_t) se * se) >> (l2w + l2h));
}
@@ -125,10 +141,7 @@
}
}
}
- if (bit_depth > VPX_BITS_8) {
- sse = ROUND_POWER_OF_TWO(sse, 2 * (bit_depth - 8));
- se = ROUND_POWER_OF_TWO(se, bit_depth - 8);
- }
+ RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = sse;
return sse - (((int64_t) se * se) >> (l2w + l2h));
}
@@ -496,10 +509,7 @@
}
}
}
- if (bit_depth > 8) {
- sse = ROUND_POWER_OF_TWO(sse, 2*(bit_depth-8));
- se = ROUND_POWER_OF_TWO(se, bit_depth-8);
- }
+ RoundHighBitDepth(bit_depth, &se, &sse);
*sse_ptr = sse;
return sse - (((int64_t) se * se) >> (l2w + l2h));
}