summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/variance_test.cc811
-rw-r--r--test/vp9_intrapred_test.cc84
-rw-r--r--third_party/googletest/README.libvpx4
-rw-r--r--third_party/googletest/src/src/gtest-all.cc2
4 files changed, 440 insertions, 461 deletions
diff --git a/test/variance_test.cc b/test/variance_test.cc
index 08c84a613..2b6808075 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -41,10 +41,6 @@ typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
const uint8_t *b, int b_stride);
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
-
-using ::std::tr1::get;
-using ::std::tr1::make_tuple;
-using ::std::tr1::tuple;
using libvpx_test::ACMRandom;
// Truncate high bit depth results by downshifting (with rounding) by:
@@ -79,8 +75,8 @@ static unsigned int mb_ss_ref(const int16_t *src) {
* (src - ref).
*/
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
- int l2w, int l2h, int src_stride_coeff,
- int ref_stride_coeff, uint32_t *sse_ptr,
+ int l2w, int l2h, int src_stride,
+ int ref_stride, uint32_t *sse_ptr,
bool use_high_bit_depth_,
vpx_bit_depth_t bit_depth) {
int64_t se = 0;
@@ -91,14 +87,14 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
for (int x = 0; x < w; x++) {
int diff;
if (!use_high_bit_depth_) {
- diff = src[w * y * src_stride_coeff + x] -
- ref[w * y * ref_stride_coeff + x];
+ diff = src[y * src_stride + x] -
+ ref[y * ref_stride + x];
se += diff;
sse += diff * diff;
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- diff = CONVERT_TO_SHORTPTR(src)[w * y * src_stride_coeff + x] -
- CONVERT_TO_SHORTPTR(ref)[w * y * ref_stride_coeff + x];
+ diff = CONVERT_TO_SHORTPTR(src)[y * src_stride + x] -
+ CONVERT_TO_SHORTPTR(ref)[y * ref_stride + x];
se += diff;
sse += diff * diff;
#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -170,6 +166,65 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
(l2w + l2h)));
}
+static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
+ const uint8_t *src,
+ const uint8_t *second_pred,
+ int l2w, int l2h,
+ int xoff, int yoff,
+ uint32_t *sse_ptr,
+ bool use_high_bit_depth,
+ vpx_bit_depth_t bit_depth) {
+ int64_t se = 0;
+ uint64_t sse = 0;
+ const int w = 1 << l2w;
+ const int h = 1 << l2h;
+
+ xoff <<= 1;
+ yoff <<= 1;
+
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++) {
+ // bilinear interpolation at a 16th pel step
+ if (!use_high_bit_depth) {
+ const int a1 = ref[(w + 1) * (y + 0) + x + 0];
+ const int a2 = ref[(w + 1) * (y + 0) + x + 1];
+ const int b1 = ref[(w + 1) * (y + 1) + x + 0];
+ const int b2 = ref[(w + 1) * (y + 1) + x + 1];
+ const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
+ const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
+ const int r = a + (((b - a) * yoff + 8) >> 4);
+ const int diff =
+ ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
+ se += diff;
+ sse += diff * diff;
+#if CONFIG_VP9_HIGHBITDEPTH
+ } else {
+ const uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
+ const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
+ const uint16_t *sec16 = CONVERT_TO_SHORTPTR(second_pred);
+ const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
+ const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
+ const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
+ const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
+ const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
+ const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
+ const int r = a + (((b - a) * yoff + 8) >> 4);
+ const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
+ se += diff;
+ sse += diff * diff;
+#endif // CONFIG_VP9_HIGHBITDEPTH
+ }
+ }
+ }
+ RoundHighBitDepth(bit_depth, &se, &sse);
+ *sse_ptr = static_cast<uint32_t>(sse);
+ return static_cast<uint32_t>(sse -
+ ((static_cast<int64_t>(se) * se) >>
+ (l2w + l2h)));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
public:
SumOfSquaresTest() : func_(GetParam()) {}
@@ -212,339 +267,264 @@ void SumOfSquaresTest::RefTest() {
}
}
-template<typename VarianceFunctionType>
-class VarianceTest
- : public ::testing::TestWithParam<tuple<int, int,
- VarianceFunctionType, int> > {
- public:
- virtual void SetUp() {
- const tuple<int, int, VarianceFunctionType, int>& params = this->GetParam();
- log2width_ = get<0>(params);
- width_ = 1 << log2width_;
- log2height_ = get<1>(params);
- height_ = 1 << log2height_;
- variance_ = get<2>(params);
- if (get<3>(params)) {
- bit_depth_ = static_cast<vpx_bit_depth_t>(get<3>(params));
- use_high_bit_depth_ = true;
+////////////////////////////////////////////////////////////////////////////////
+// Encapsulating struct to store the function to test along with
+// some testing context.
+// Can be used for MSE, SSE, Variance, etc.
+template<typename Func>
+struct TestParams {
+ TestParams(int log2w = 0, int log2h = 0,
+ Func function = NULL, int bit_depth_value = 0)
+ : log2width(log2w), log2height(log2h), func(function) {
+ use_high_bit_depth = (bit_depth_value > 0);
+ if (use_high_bit_depth) {
+ bit_depth = static_cast<vpx_bit_depth_t>(bit_depth_value);
} else {
- bit_depth_ = VPX_BITS_8;
- use_high_bit_depth_ = false;
+ bit_depth = VPX_BITS_8;
}
- mask_ = (1 << bit_depth_) - 1;
+ width = 1 << log2width;
+ height = 1 << log2height;
+ block_size = width * height;
+ mask = (1u << bit_depth) - 1;
+ }
+
+ int log2width;
+ int log2height;
+ int width, height;
+ int block_size;
+ Func func;
+ vpx_bit_depth_t bit_depth;
+ int use_high_bit_depth;
+ uint32_t mask;
+};
+
+// Main class for testing a function type
+template<typename FunctionType>
+class MainTestClass :
+ public ::testing::TestWithParam<TestParams<FunctionType> > {
+ public:
+ virtual void SetUp() {
+ params_ = this->GetParam();
rnd_.Reset(ACMRandom::DeterministicSeed());
- block_size_ = width_ * height_;
- if (!use_high_bit_depth_) {
- src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_ * 2));
- ref_ = new uint8_t[block_size_ * 2];
-#if CONFIG_VP9_HIGHBITDEPTH
- } else {
- src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
- vpx_memalign(16, block_size_ * 2 * sizeof(uint16_t))));
- ref_ = CONVERT_TO_BYTEPTR(new uint16_t[block_size_ * 2]);
-#endif // CONFIG_VP9_HIGHBITDEPTH
- }
+ const size_t unit =
+ use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
+ src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size() * unit));
+ ref_ = new uint8_t[block_size() * unit];
ASSERT_TRUE(src_ != NULL);
ASSERT_TRUE(ref_ != NULL);
}
virtual void TearDown() {
- if (!use_high_bit_depth_) {
- vpx_free(src_);
- delete[] ref_;
-#if CONFIG_VP9_HIGHBITDEPTH
- } else {
- vpx_free(CONVERT_TO_SHORTPTR(src_));
- delete[] CONVERT_TO_SHORTPTR(ref_);
-#endif // CONFIG_VP9_HIGHBITDEPTH
- }
+ vpx_free(src_);
+ delete[] ref_;
+ src_ = NULL;
+ ref_ = NULL;
libvpx_test::ClearSystemState();
}
protected:
+ // We could sub-class MainTestClass into dedicated class for Variance
+ // and MSE/SSE, but it involves a lot of 'this->xxx' dereferencing
+ // to access top class fields xxx. That's cumbersome, so for now we'll just
+ // implement the testing methods here:
+
+ // Variance tests
void ZeroTest();
void RefTest();
void RefStrideTest();
void OneQuarterTest();
+ // MSE/SSE tests
+ void RefTestMse();
+ void RefTestSse();
+ void MaxTestMse();
+ void MaxTestSse();
+
+ protected:
ACMRandom rnd_;
uint8_t *src_;
uint8_t *ref_;
- int width_, log2width_;
- int height_, log2height_;
- vpx_bit_depth_t bit_depth_;
- int mask_;
- bool use_high_bit_depth_;
- int block_size_;
- VarianceFunctionType variance_;
+ TestParams<FunctionType> params_;
+
+ // some relay helpers
+ bool use_high_bit_depth() const { return params_.use_high_bit_depth; }
+ int byte_shift() const { return params_.bit_depth - 8; }
+ int block_size() const { return params_.block_size; }
+ int width() const { return params_.width; }
+ uint32_t mask() const { return params_.mask; }
};
+////////////////////////////////////////////////////////////////////////////////
+// Tests related to variance.
+
template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::ZeroTest() {
+void MainTestClass<VarianceFunctionType>::ZeroTest() {
for (int i = 0; i <= 255; ++i) {
- if (!use_high_bit_depth_) {
- memset(src_, i, block_size_);
+ if (!use_high_bit_depth()) {
+ memset(src_, i, block_size());
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- vpx_memset16(CONVERT_TO_SHORTPTR(src_), i << (bit_depth_ - 8),
- block_size_);
+ vpx_memset16(CONVERT_TO_SHORTPTR(src_), i << byte_shift(), block_size());
#endif // CONFIG_VP9_HIGHBITDEPTH
}
for (int j = 0; j <= 255; ++j) {
- if (!use_high_bit_depth_) {
- memset(ref_, j, block_size_);
+ if (!use_high_bit_depth()) {
+ memset(ref_, j, block_size());
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- vpx_memset16(CONVERT_TO_SHORTPTR(ref_), j << (bit_depth_ - 8),
- block_size_);
+ vpx_memset16(CONVERT_TO_SHORTPTR(ref_),
+ j << byte_shift(), block_size());
#endif // CONFIG_VP9_HIGHBITDEPTH
}
- unsigned int sse;
- unsigned int var;
+ unsigned int sse, var;
ASM_REGISTER_STATE_CHECK(
- var = variance_(src_, width_, ref_, width_, &sse));
+ var = params_.func(src_, width(), ref_, width(), &sse));
EXPECT_EQ(0u, var) << "src values: " << i << " ref values: " << j;
}
}
}
template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::RefTest() {
+void MainTestClass<VarianceFunctionType>::RefTest() {
for (int i = 0; i < 10; ++i) {
- for (int j = 0; j < block_size_; j++) {
- if (!use_high_bit_depth_) {
+ for (int j = 0; j < block_size(); j++) {
+ if (!use_high_bit_depth()) {
src_[j] = rnd_.Rand8();
ref_[j] = rnd_.Rand8();
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
- CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
+ CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask();
+ CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask();
#endif // CONFIG_VP9_HIGHBITDEPTH
}
}
- unsigned int sse1, sse2;
- unsigned int var1;
- const int stride_coeff = 1;
+ unsigned int sse1, sse2, var1, var2;
+ const int stride = width();
ASM_REGISTER_STATE_CHECK(
- var1 = variance_(src_, width_, ref_, width_, &sse1));
- const unsigned int var2 = variance_ref(src_, ref_, log2width_,
- log2height_, stride_coeff,
- stride_coeff, &sse2,
- use_high_bit_depth_, bit_depth_);
- EXPECT_EQ(sse1, sse2)
- << "Error at test index: " << i;
- EXPECT_EQ(var1, var2)
- << "Error at test index: " << i;
+ var1 = params_.func(src_, stride, ref_, stride, &sse1));
+ var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
+ stride, stride, &sse2,
+ use_high_bit_depth(), params_.bit_depth);
+ EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
+ EXPECT_EQ(var1, var2) << "Error at test index: " << i;
}
}
template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::RefStrideTest() {
+void MainTestClass<VarianceFunctionType>::RefStrideTest() {
for (int i = 0; i < 10; ++i) {
- int ref_stride_coeff = i % 2;
- int src_stride_coeff = (i >> 1) % 2;
- for (int j = 0; j < block_size_; j++) {
- int ref_ind = (j / width_) * ref_stride_coeff * width_ + j % width_;
- int src_ind = (j / width_) * src_stride_coeff * width_ + j % width_;
- if (!use_high_bit_depth_) {
+ const int ref_stride = (i & 1) * width();
+ const int src_stride = ((i >> 1) & 1) * width();
+ for (int j = 0; j < block_size(); j++) {
+ const int ref_ind = (j / width()) * ref_stride + j % width();
+ const int src_ind = (j / width()) * src_stride + j % width();
+ if (!use_high_bit_depth()) {
src_[src_ind] = rnd_.Rand8();
ref_[ref_ind] = rnd_.Rand8();
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() & mask_;
- CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() & mask_;
+ CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() & mask();
+ CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() & mask();
#endif // CONFIG_VP9_HIGHBITDEPTH
}
}
unsigned int sse1, sse2;
- unsigned int var1;
+ unsigned int var1, var2;
ASM_REGISTER_STATE_CHECK(
- var1 = variance_(src_, width_ * src_stride_coeff,
- ref_, width_ * ref_stride_coeff, &sse1));
- const unsigned int var2 = variance_ref(src_, ref_, log2width_,
- log2height_, src_stride_coeff,
- ref_stride_coeff, &sse2,
- use_high_bit_depth_, bit_depth_);
- EXPECT_EQ(sse1, sse2)
- << "Error at test index: " << i;
- EXPECT_EQ(var1, var2)
- << "Error at test index: " << i;
+ var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
+ var2 = variance_ref(src_, ref_,
+ params_.log2width, params_.log2height,
+ src_stride, ref_stride, &sse2,
+ use_high_bit_depth(), params_.bit_depth);
+ EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
+ EXPECT_EQ(var1, var2) << "Error at test index: " << i;
}
}
template<typename VarianceFunctionType>
-void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
- const int half = block_size_ / 2;
- if (!use_high_bit_depth_) {
- memset(src_, 255, block_size_);
+void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
+ const int half = block_size() / 2;
+ if (!use_high_bit_depth()) {
+ memset(src_, 255, block_size());
memset(ref_, 255, half);
memset(ref_ + half, 0, half);
#if CONFIG_VP9_HIGHBITDEPTH
} else {
- vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << (bit_depth_ - 8),
- block_size_);
- vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << (bit_depth_ - 8), half);
+ vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size());
+ vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << byte_shift(), half);
vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
#endif // CONFIG_VP9_HIGHBITDEPTH
}
- unsigned int sse;
- unsigned int var;
- ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
- const unsigned int expected = block_size_ * 255 * 255 / 4;
+ unsigned int sse, var, expected;
+ ASM_REGISTER_STATE_CHECK(
+ var = params_.func(src_, width(), ref_, width(), &sse));
+ expected = block_size() * 255 * 255 / 4;
EXPECT_EQ(expected, var);
}
-template<typename MseFunctionType>
-class MseTest
- : public ::testing::TestWithParam<tuple<int, int, MseFunctionType> > {
- public:
- virtual void SetUp() {
- const tuple<int, int, MseFunctionType>& params = this->GetParam();
- log2width_ = get<0>(params);
- width_ = 1 << log2width_;
- log2height_ = get<1>(params);
- height_ = 1 << log2height_;
- mse_ = get<2>(params);
+////////////////////////////////////////////////////////////////////////////////
+// Tests related to MSE / SSE.
- rnd(ACMRandom::DeterministicSeed());
- block_size_ = width_ * height_;
- src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
- ref_ = new uint8_t[block_size_];
- ASSERT_TRUE(src_ != NULL);
- ASSERT_TRUE(ref_ != NULL);
- }
-
- virtual void TearDown() {
- vpx_free(src_);
- delete[] ref_;
- libvpx_test::ClearSystemState();
- }
-
- protected:
- void RefTest_mse();
- void RefTest_sse();
- void MaxTest_mse();
- void MaxTest_sse();
-
- ACMRandom rnd;
- uint8_t* src_;
- uint8_t* ref_;
- int width_, log2width_;
- int height_, log2height_;
- int block_size_;
- MseFunctionType mse_;
-};
-
-template<typename MseFunctionType>
-void MseTest<MseFunctionType>::RefTest_mse() {
+template<typename FunctionType>
+void MainTestClass<FunctionType>::RefTestMse() {
for (int i = 0; i < 10; ++i) {
- for (int j = 0; j < block_size_; j++) {
- src_[j] = rnd.Rand8();
- ref_[j] = rnd.Rand8();
+ for (int j = 0; j < block_size(); ++j) {
+ src_[j] = rnd_.Rand8();
+ ref_[j] = rnd_.Rand8();
}
unsigned int sse1, sse2;
- const int stride_coeff = 1;
- ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse1));
- variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
- stride_coeff, &sse2, false, VPX_BITS_8);
+ const int stride = width();
+ ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
+ variance_ref(src_, ref_, params_.log2width, params_.log2height,
+ stride, stride, &sse2, false, VPX_BITS_8);
EXPECT_EQ(sse1, sse2);
}
}
-template<typename MseFunctionType>
-void MseTest<MseFunctionType>::RefTest_sse() {
+template<typename FunctionType>
+void MainTestClass<FunctionType>::RefTestSse() {
for (int i = 0; i < 10; ++i) {
- for (int j = 0; j < block_size_; j++) {
- src_[j] = rnd.Rand8();
- ref_[j] = rnd.Rand8();
+ for (int j = 0; j < block_size(); ++j) {
+ src_[j] = rnd_.Rand8();
+ ref_[j] = rnd_.Rand8();
}
unsigned int sse2;
unsigned int var1;
- const int stride_coeff = 1;
- ASM_REGISTER_STATE_CHECK(var1 = mse_(src_, width_, ref_, width_));
- variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
- stride_coeff, &sse2, false, VPX_BITS_8);
+ const int stride = width();
+ ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
+ variance_ref(src_, ref_, params_.log2width, params_.log2height,
+ stride, stride, &sse2, false, VPX_BITS_8);
EXPECT_EQ(var1, sse2);
}
}
-template<typename MseFunctionType>
-void MseTest<MseFunctionType>::MaxTest_mse() {
- memset(src_, 255, block_size_);
- memset(ref_, 0, block_size_);
+template<typename FunctionType>
+void MainTestClass<FunctionType>::MaxTestMse() {
+ memset(src_, 255, block_size());
+ memset(ref_, 0, block_size());
unsigned int sse;
- ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse));
- const unsigned int expected = block_size_ * 255 * 255;
+ ASM_REGISTER_STATE_CHECK(params_.func(src_, width(), ref_, width(), &sse));
+ const unsigned int expected = block_size() * 255 * 255;
EXPECT_EQ(expected, sse);
}
-template<typename MseFunctionType>
-void MseTest<MseFunctionType>::MaxTest_sse() {
- memset(src_, 255, block_size_);
- memset(ref_, 0, block_size_);
+template<typename FunctionType>
+void MainTestClass<FunctionType>::MaxTestSse() {
+ memset(src_, 255, block_size());
+ memset(ref_, 0, block_size());
unsigned int var;
- ASM_REGISTER_STATE_CHECK(var = mse_(src_, width_, ref_, width_));
- const unsigned int expected = block_size_ * 255 * 255;
+ ASM_REGISTER_STATE_CHECK(var = params_.func(src_, width(), ref_, width()));
+ const unsigned int expected = block_size() * 255 * 255;
EXPECT_EQ(expected, var);
}
-static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
- const uint8_t *src,
- const uint8_t *second_pred,
- int l2w, int l2h,
- int xoff, int yoff,
- uint32_t *sse_ptr,
- bool use_high_bit_depth,
- vpx_bit_depth_t bit_depth) {
- int64_t se = 0;
- uint64_t sse = 0;
- const int w = 1 << l2w;
- const int h = 1 << l2h;
-
- xoff <<= 1;
- yoff <<= 1;
+////////////////////////////////////////////////////////////////////////////////
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- // bilinear interpolation at a 16th pel step
- if (!use_high_bit_depth) {
- const int a1 = ref[(w + 1) * (y + 0) + x + 0];
- const int a2 = ref[(w + 1) * (y + 0) + x + 1];
- const int b1 = ref[(w + 1) * (y + 1) + x + 0];
- const int b2 = ref[(w + 1) * (y + 1) + x + 1];
- const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
- const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
- const int r = a + (((b - a) * yoff + 8) >> 4);
- const int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
- se += diff;
- sse += diff * diff;
-#if CONFIG_VP9_HIGHBITDEPTH
- } else {
- uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
- uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
- uint16_t *sec16 = CONVERT_TO_SHORTPTR(second_pred);
- const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
- const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
- const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
- const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
- const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
- const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
- const int r = a + (((b - a) * yoff + 8) >> 4);
- const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
- se += diff;
- sse += diff * diff;
-#endif // CONFIG_VP9_HIGHBITDEPTH
- }
- }
- }
- RoundHighBitDepth(bit_depth, &se, &sse);
- *sse_ptr = static_cast<uint32_t>(sse);
- return static_cast<uint32_t>(sse -
- ((static_cast<int64_t>(se) * se) >>
- (l2w + l2h)));
-}
+using ::std::tr1::get;
+using ::std::tr1::make_tuple;
+using ::std::tr1::tuple;
template<typename SubpelVarianceFunctionType>
class SubpelVarianceTest
@@ -716,32 +696,32 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
}
#endif // CONFIG_VP9_HIGHBITDEPTH
}
- unsigned int sse1, sse2;
- unsigned int var1;
+ uint32_t sse1, sse2;
+ uint32_t var1, var2;
ASM_REGISTER_STATE_CHECK(
var1 = subpel_variance_(ref_, width_ + 1, x, y,
src_, width_, &sse1, sec_));
- const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
- log2width_, log2height_,
- x, y, &sse2,
- use_high_bit_depth_,
- bit_depth_);
+ var2 = subpel_avg_variance_ref(ref_, src_, sec_,
+ log2width_, log2height_,
+ x, y, &sse2,
+ use_high_bit_depth_,
+ static_cast<vpx_bit_depth_t>(bit_depth_));
EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
}
}
}
-typedef MseTest<Get4x4SseFunc> VpxSseTest;
-typedef MseTest<VarianceMxNFunc> VpxMseTest;
-typedef VarianceTest<VarianceMxNFunc> VpxVarianceTest;
+typedef MainTestClass<Get4x4SseFunc> VpxSseTest;
+typedef MainTestClass<VarianceMxNFunc> VpxMseTest;
+typedef MainTestClass<VarianceMxNFunc> VpxVarianceTest;
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxSubpelVarianceTest;
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxSubpelAvgVarianceTest;
-TEST_P(VpxSseTest, Ref_sse) { RefTest_sse(); }
-TEST_P(VpxSseTest, Max_sse) { MaxTest_sse(); }
-TEST_P(VpxMseTest, Ref_mse) { RefTest_mse(); }
-TEST_P(VpxMseTest, Max_mse) { MaxTest_mse(); }
+TEST_P(VpxSseTest, RefSse) { RefTestSse(); }
+TEST_P(VpxSseTest, MaxSse) { MaxTestSse(); }
+TEST_P(VpxMseTest, RefMse) { RefTestMse(); }
+TEST_P(VpxMseTest, MaxMse) { MaxTestMse(); }
TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxVarianceTest, Ref) { RefTest(); }
TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
@@ -755,31 +735,33 @@ TEST_P(VpxSubpelAvgVarianceTest, Ref) { RefTest(); }
INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
::testing::Values(vpx_get_mb_ss_c));
+typedef TestParams<Get4x4SseFunc> SseParams;
INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
- ::testing::Values(make_tuple(2, 2,
- &vpx_get4x4sse_cs_c)));
+ ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_c)));
+typedef TestParams<VarianceMxNFunc> MseParams;
INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
- ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_c),
- make_tuple(4, 3, &vpx_mse16x8_c),
- make_tuple(3, 4, &vpx_mse8x16_c),
- make_tuple(3, 3, &vpx_mse8x8_c)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
+ MseParams(4, 3, &vpx_mse16x8_c),
+ MseParams(3, 4, &vpx_mse8x16_c),
+ MseParams(3, 3, &vpx_mse8x8_c)));
+typedef TestParams<VarianceMxNFunc> VarianceParams;
INSTANTIATE_TEST_CASE_P(
C, VpxVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_c, 0),
- make_tuple(6, 5, &vpx_variance64x32_c, 0),
- make_tuple(5, 6, &vpx_variance32x64_c, 0),
- make_tuple(5, 5, &vpx_variance32x32_c, 0),
- make_tuple(5, 4, &vpx_variance32x16_c, 0),
- make_tuple(4, 5, &vpx_variance16x32_c, 0),
- make_tuple(4, 4, &vpx_variance16x16_c, 0),
- make_tuple(4, 3, &vpx_variance16x8_c, 0),
- make_tuple(3, 4, &vpx_variance8x16_c, 0),
- make_tuple(3, 3, &vpx_variance8x8_c, 0),
- make_tuple(3, 2, &vpx_variance8x4_c, 0),
- make_tuple(2, 3, &vpx_variance4x8_c, 0),
- make_tuple(2, 2, &vpx_variance4x4_c, 0)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_c),
+ VarianceParams(6, 5, &vpx_variance64x32_c),
+ VarianceParams(5, 6, &vpx_variance32x64_c),
+ VarianceParams(5, 5, &vpx_variance32x32_c),
+ VarianceParams(5, 4, &vpx_variance32x16_c),
+ VarianceParams(4, 5, &vpx_variance16x32_c),
+ VarianceParams(4, 4, &vpx_variance16x16_c),
+ VarianceParams(4, 3, &vpx_variance16x8_c),
+ VarianceParams(3, 4, &vpx_variance8x16_c),
+ VarianceParams(3, 3, &vpx_variance8x8_c),
+ VarianceParams(3, 2, &vpx_variance8x4_c),
+ VarianceParams(2, 3, &vpx_variance4x8_c),
+ VarianceParams(2, 2, &vpx_variance4x4_c)));
INSTANTIATE_TEST_CASE_P(
C, VpxSubpelVarianceTest,
@@ -814,14 +796,14 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_c, 0)));
#if CONFIG_VP9_HIGHBITDEPTH
-typedef MseTest<VarianceMxNFunc> VpxHBDMseTest;
-typedef VarianceTest<VarianceMxNFunc> VpxHBDVarianceTest;
+typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
+typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc>
VpxHBDSubpelAvgVarianceTest;
-TEST_P(VpxHBDMseTest, Ref_mse) { RefTest_mse(); }
-TEST_P(VpxHBDMseTest, Max_mse) { MaxTest_mse(); }
+TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
+TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); }
TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); }
@@ -849,45 +831,45 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
C, VpxHBDVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_highbd_12_variance64x64_c, 12),
- make_tuple(6, 5, &vpx_highbd_12_variance64x32_c, 12),
- make_tuple(5, 6, &vpx_highbd_12_variance32x64_c, 12),
- make_tuple(5, 5, &vpx_highbd_12_variance32x32_c, 12),
- make_tuple(5, 4, &vpx_highbd_12_variance32x16_c, 12),
- make_tuple(4, 5, &vpx_highbd_12_variance16x32_c, 12),
- make_tuple(4, 4, &vpx_highbd_12_variance16x16_c, 12),
- make_tuple(4, 3, &vpx_highbd_12_variance16x8_c, 12),
- make_tuple(3, 4, &vpx_highbd_12_variance8x16_c, 12),
- make_tuple(3, 3, &vpx_highbd_12_variance8x8_c, 12),
- make_tuple(3, 2, &vpx_highbd_12_variance8x4_c, 12),
- make_tuple(2, 3, &vpx_highbd_12_variance4x8_c, 12),
- make_tuple(2, 2, &vpx_highbd_12_variance4x4_c, 12),
- make_tuple(6, 6, &vpx_highbd_10_variance64x64_c, 10),
- make_tuple(6, 5, &vpx_highbd_10_variance64x32_c, 10),
- make_tuple(5, 6, &vpx_highbd_10_variance32x64_c, 10),
- make_tuple(5, 5, &vpx_highbd_10_variance32x32_c, 10),
- make_tuple(5, 4, &vpx_highbd_10_variance32x16_c, 10),
- make_tuple(4, 5, &vpx_highbd_10_variance16x32_c, 10),
- make_tuple(4, 4, &vpx_highbd_10_variance16x16_c, 10),
- make_tuple(4, 3, &vpx_highbd_10_variance16x8_c, 10),
- make_tuple(3, 4, &vpx_highbd_10_variance8x16_c, 10),
- make_tuple(3, 3, &vpx_highbd_10_variance8x8_c, 10),
- make_tuple(3, 2, &vpx_highbd_10_variance8x4_c, 10),
- make_tuple(2, 3, &vpx_highbd_10_variance4x8_c, 10),
- make_tuple(2, 2, &vpx_highbd_10_variance4x4_c, 10),
- make_tuple(6, 6, &vpx_highbd_8_variance64x64_c, 8),
- make_tuple(6, 5, &vpx_highbd_8_variance64x32_c, 8),
- make_tuple(5, 6, &vpx_highbd_8_variance32x64_c, 8),
- make_tuple(5, 5, &vpx_highbd_8_variance32x32_c, 8),
- make_tuple(5, 4, &vpx_highbd_8_variance32x16_c, 8),
- make_tuple(4, 5, &vpx_highbd_8_variance16x32_c, 8),
- make_tuple(4, 4, &vpx_highbd_8_variance16x16_c, 8),
- make_tuple(4, 3, &vpx_highbd_8_variance16x8_c, 8),
- make_tuple(3, 4, &vpx_highbd_8_variance8x16_c, 8),
- make_tuple(3, 3, &vpx_highbd_8_variance8x8_c, 8),
- make_tuple(3, 2, &vpx_highbd_8_variance8x4_c, 8),
- make_tuple(2, 3, &vpx_highbd_8_variance4x8_c, 8),
- make_tuple(2, 2, &vpx_highbd_8_variance4x4_c, 8)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_highbd_12_variance64x64_c, 12),
+ VarianceParams(6, 5, &vpx_highbd_12_variance64x32_c, 12),
+ VarianceParams(5, 6, &vpx_highbd_12_variance32x64_c, 12),
+ VarianceParams(5, 5, &vpx_highbd_12_variance32x32_c, 12),
+ VarianceParams(5, 4, &vpx_highbd_12_variance32x16_c, 12),
+ VarianceParams(4, 5, &vpx_highbd_12_variance16x32_c, 12),
+ VarianceParams(4, 4, &vpx_highbd_12_variance16x16_c, 12),
+ VarianceParams(4, 3, &vpx_highbd_12_variance16x8_c, 12),
+ VarianceParams(3, 4, &vpx_highbd_12_variance8x16_c, 12),
+ VarianceParams(3, 3, &vpx_highbd_12_variance8x8_c, 12),
+ VarianceParams(3, 2, &vpx_highbd_12_variance8x4_c, 12),
+ VarianceParams(2, 3, &vpx_highbd_12_variance4x8_c, 12),
+ VarianceParams(2, 2, &vpx_highbd_12_variance4x4_c, 12),
+ VarianceParams(6, 6, &vpx_highbd_10_variance64x64_c, 10),
+ VarianceParams(6, 5, &vpx_highbd_10_variance64x32_c, 10),
+ VarianceParams(5, 6, &vpx_highbd_10_variance32x64_c, 10),
+ VarianceParams(5, 5, &vpx_highbd_10_variance32x32_c, 10),
+ VarianceParams(5, 4, &vpx_highbd_10_variance32x16_c, 10),
+ VarianceParams(4, 5, &vpx_highbd_10_variance16x32_c, 10),
+ VarianceParams(4, 4, &vpx_highbd_10_variance16x16_c, 10),
+ VarianceParams(4, 3, &vpx_highbd_10_variance16x8_c, 10),
+ VarianceParams(3, 4, &vpx_highbd_10_variance8x16_c, 10),
+ VarianceParams(3, 3, &vpx_highbd_10_variance8x8_c, 10),
+ VarianceParams(3, 2, &vpx_highbd_10_variance8x4_c, 10),
+ VarianceParams(2, 3, &vpx_highbd_10_variance4x8_c, 10),
+ VarianceParams(2, 2, &vpx_highbd_10_variance4x4_c, 10),
+ VarianceParams(6, 6, &vpx_highbd_8_variance64x64_c, 8),
+ VarianceParams(6, 5, &vpx_highbd_8_variance64x32_c, 8),
+ VarianceParams(5, 6, &vpx_highbd_8_variance32x64_c, 8),
+ VarianceParams(5, 5, &vpx_highbd_8_variance32x32_c, 8),
+ VarianceParams(5, 4, &vpx_highbd_8_variance32x16_c, 8),
+ VarianceParams(4, 5, &vpx_highbd_8_variance16x32_c, 8),
+ VarianceParams(4, 4, &vpx_highbd_8_variance16x16_c, 8),
+ VarianceParams(4, 3, &vpx_highbd_8_variance16x8_c, 8),
+ VarianceParams(3, 4, &vpx_highbd_8_variance8x16_c, 8),
+ VarianceParams(3, 3, &vpx_highbd_8_variance8x8_c, 8),
+ VarianceParams(3, 2, &vpx_highbd_8_variance8x4_c, 8),
+ VarianceParams(2, 3, &vpx_highbd_8_variance4x8_c, 8),
+ VarianceParams(2, 2, &vpx_highbd_8_variance4x4_c, 8)));
INSTANTIATE_TEST_CASE_P(
C, VpxHBDSubpelVarianceTest,
@@ -981,26 +963,26 @@ INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
::testing::Values(vpx_get_mb_ss_sse2));
INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
- ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_sse2),
- make_tuple(4, 3, &vpx_mse16x8_sse2),
- make_tuple(3, 4, &vpx_mse8x16_sse2),
- make_tuple(3, 3, &vpx_mse8x8_sse2)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
+ MseParams(4, 3, &vpx_mse16x8_sse2),
+ MseParams(3, 4, &vpx_mse8x16_sse2),
+ MseParams(3, 3, &vpx_mse8x8_sse2)));
INSTANTIATE_TEST_CASE_P(
SSE2, VpxVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_sse2, 0),
- make_tuple(6, 5, &vpx_variance64x32_sse2, 0),
- make_tuple(5, 6, &vpx_variance32x64_sse2, 0),
- make_tuple(5, 5, &vpx_variance32x32_sse2, 0),
- make_tuple(5, 4, &vpx_variance32x16_sse2, 0),
- make_tuple(4, 5, &vpx_variance16x32_sse2, 0),
- make_tuple(4, 4, &vpx_variance16x16_sse2, 0),
- make_tuple(4, 3, &vpx_variance16x8_sse2, 0),
- make_tuple(3, 4, &vpx_variance8x16_sse2, 0),
- make_tuple(3, 3, &vpx_variance8x8_sse2, 0),
- make_tuple(3, 2, &vpx_variance8x4_sse2, 0),
- make_tuple(2, 3, &vpx_variance4x8_sse2, 0),
- make_tuple(2, 2, &vpx_variance4x4_sse2, 0)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_sse2),
+ VarianceParams(6, 5, &vpx_variance64x32_sse2),
+ VarianceParams(5, 6, &vpx_variance32x64_sse2),
+ VarianceParams(5, 5, &vpx_variance32x32_sse2),
+ VarianceParams(5, 4, &vpx_variance32x16_sse2),
+ VarianceParams(4, 5, &vpx_variance16x32_sse2),
+ VarianceParams(4, 4, &vpx_variance16x16_sse2),
+ VarianceParams(4, 3, &vpx_variance16x8_sse2),
+ VarianceParams(3, 4, &vpx_variance8x16_sse2),
+ VarianceParams(3, 3, &vpx_variance8x8_sse2),
+ VarianceParams(3, 2, &vpx_variance8x4_sse2),
+ VarianceParams(2, 3, &vpx_variance4x8_sse2),
+ VarianceParams(2, 2, &vpx_variance4x4_sse2)));
INSTANTIATE_TEST_CASE_P(
SSE2, VpxSubpelVarianceTest,
@@ -1039,52 +1021,52 @@ INSTANTIATE_TEST_CASE_P(
/* TODO(debargha): This test does not support the highbd version
INSTANTIATE_TEST_CASE_P(
SSE2, VpxHBDMseTest,
- ::testing::Values(make_tuple(4, 4, &vpx_highbd_12_mse16x16_sse2),
- make_tuple(4, 3, &vpx_highbd_12_mse16x8_sse2),
- make_tuple(3, 4, &vpx_highbd_12_mse8x16_sse2),
- make_tuple(3, 3, &vpx_highbd_12_mse8x8_sse2),
- make_tuple(4, 4, &vpx_highbd_10_mse16x16_sse2),
- make_tuple(4, 3, &vpx_highbd_10_mse16x8_sse2),
- make_tuple(3, 4, &vpx_highbd_10_mse8x16_sse2),
- make_tuple(3, 3, &vpx_highbd_10_mse8x8_sse2),
- make_tuple(4, 4, &vpx_highbd_8_mse16x16_sse2),
- make_tuple(4, 3, &vpx_highbd_8_mse16x8_sse2),
- make_tuple(3, 4, &vpx_highbd_8_mse8x16_sse2),
- make_tuple(3, 3, &vpx_highbd_8_mse8x8_sse2)));
+ ::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_sse2),
+ MseParams(4, 3, &vpx_highbd_12_mse16x8_sse2),
+ MseParams(3, 4, &vpx_highbd_12_mse8x16_sse2),
+ MseParams(3, 3, &vpx_highbd_12_mse8x8_sse2),
+ MseParams(4, 4, &vpx_highbd_10_mse16x16_sse2),
+ MseParams(4, 3, &vpx_highbd_10_mse16x8_sse2),
+ MseParams(3, 4, &vpx_highbd_10_mse8x16_sse2),
+ MseParams(3, 3, &vpx_highbd_10_mse8x8_sse2),
+ MseParams(4, 4, &vpx_highbd_8_mse16x16_sse2),
+ MseParams(4, 3, &vpx_highbd_8_mse16x8_sse2),
+ MseParams(3, 4, &vpx_highbd_8_mse8x16_sse2),
+ MseParams(3, 3, &vpx_highbd_8_mse8x8_sse2)));
*/
INSTANTIATE_TEST_CASE_P(
- SSE2, VpxHBDVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
- make_tuple(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
- make_tuple(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
- make_tuple(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
- make_tuple(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
- make_tuple(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
- make_tuple(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
- make_tuple(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
- make_tuple(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
- make_tuple(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
- make_tuple(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
- make_tuple(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
- make_tuple(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
- make_tuple(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
- make_tuple(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
- make_tuple(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
- make_tuple(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
- make_tuple(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
- make_tuple(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
- make_tuple(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
- make_tuple(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
- make_tuple(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
- make_tuple(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
- make_tuple(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
- make_tuple(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
- make_tuple(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
- make_tuple(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
- make_tuple(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
- make_tuple(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
- make_tuple(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
+ SSE2, VpxHBDVarianceTest, ::testing::Values(
+ VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
+ VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
+ VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
+ VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
+ VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
+ VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
+ VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
+ VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
+ VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
+ VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
+ VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
+ VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
+ VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
+ VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
+ VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
+ VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
+ VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
+ VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
+ VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
+ VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
+ VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
+ VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
+ VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
+ VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
+ VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
+ VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
+ VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
+ VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
+ VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
+ VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
INSTANTIATE_TEST_CASE_P(
SSE2, VpxHBDSubpelVarianceTest,
@@ -1199,16 +1181,15 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_AVX2
INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
- ::testing::Values(make_tuple(4, 4,
- &vpx_mse16x16_avx2)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
INSTANTIATE_TEST_CASE_P(
AVX2, VpxVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_avx2, 0),
- make_tuple(6, 5, &vpx_variance64x32_avx2, 0),
- make_tuple(5, 5, &vpx_variance32x32_avx2, 0),
- make_tuple(5, 4, &vpx_variance32x16_avx2, 0),
- make_tuple(4, 4, &vpx_variance16x16_avx2, 0)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_avx2),
+ VarianceParams(6, 5, &vpx_variance64x32_avx2),
+ VarianceParams(5, 5, &vpx_variance32x32_avx2),
+ VarianceParams(5, 4, &vpx_variance32x16_avx2),
+ VarianceParams(4, 4, &vpx_variance16x16_avx2)));
INSTANTIATE_TEST_CASE_P(
AVX2, VpxSubpelVarianceTest,
@@ -1224,13 +1205,12 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_MEDIA
INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,
- ::testing::Values(make_tuple(4, 4,
- &vpx_mse16x16_media)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_media)));
INSTANTIATE_TEST_CASE_P(
MEDIA, VpxVarianceTest,
- ::testing::Values(make_tuple(4, 4, &vpx_variance16x16_media, 0),
- make_tuple(3, 3, &vpx_variance8x8_media, 0)));
+ ::testing::Values(VarianceParams(4, 4, &vpx_variance16x16_media),
+ VarianceParams(3, 3, &vpx_variance8x8_media)));
INSTANTIATE_TEST_CASE_P(
MEDIA, VpxSubpelVarianceTest,
@@ -1240,23 +1220,21 @@ INSTANTIATE_TEST_CASE_P(
#if HAVE_NEON
INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
- ::testing::Values(make_tuple(2, 2,
- &vpx_get4x4sse_cs_neon)));
+ ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_neon)));
INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
- ::testing::Values(make_tuple(4, 4,
- &vpx_mse16x16_neon)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
INSTANTIATE_TEST_CASE_P(
NEON, VpxVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_neon, 0),
- make_tuple(6, 5, &vpx_variance64x32_neon, 0),
- make_tuple(5, 6, &vpx_variance32x64_neon, 0),
- make_tuple(5, 5, &vpx_variance32x32_neon, 0),
- make_tuple(4, 4, &vpx_variance16x16_neon, 0),
- make_tuple(4, 3, &vpx_variance16x8_neon, 0),
- make_tuple(3, 4, &vpx_variance8x16_neon, 0),
- make_tuple(3, 3, &vpx_variance8x8_neon, 0)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_neon),
+ VarianceParams(6, 5, &vpx_variance64x32_neon),
+ VarianceParams(5, 6, &vpx_variance32x64_neon),
+ VarianceParams(5, 5, &vpx_variance32x32_neon),
+ VarianceParams(4, 4, &vpx_variance16x16_neon),
+ VarianceParams(4, 3, &vpx_variance16x8_neon),
+ VarianceParams(3, 4, &vpx_variance8x16_neon),
+ VarianceParams(3, 3, &vpx_variance8x8_neon)));
INSTANTIATE_TEST_CASE_P(
NEON, VpxSubpelVarianceTest,
@@ -1271,30 +1249,29 @@ INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
::testing::Values(vpx_get_mb_ss_msa));
INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
- ::testing::Values(make_tuple(2, 2,
- &vpx_get4x4sse_cs_msa)));
+ ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_msa)));
INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
- ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_msa),
- make_tuple(4, 3, &vpx_mse16x8_msa),
- make_tuple(3, 4, &vpx_mse8x16_msa),
- make_tuple(3, 3, &vpx_mse8x8_msa)));
+ ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
+ MseParams(4, 3, &vpx_mse16x8_msa),
+ MseParams(3, 4, &vpx_mse8x16_msa),
+ MseParams(3, 3, &vpx_mse8x8_msa)));
INSTANTIATE_TEST_CASE_P(
MSA, VpxVarianceTest,
- ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_msa, 0),
- make_tuple(6, 5, &vpx_variance64x32_msa, 0),
- make_tuple(5, 6, &vpx_variance32x64_msa, 0),
- make_tuple(5, 5, &vpx_variance32x32_msa, 0),
- make_tuple(5, 4, &vpx_variance32x16_msa, 0),
- make_tuple(4, 5, &vpx_variance16x32_msa, 0),
- make_tuple(4, 4, &vpx_variance16x16_msa, 0),
- make_tuple(4, 3, &vpx_variance16x8_msa, 0),
- make_tuple(3, 4, &vpx_variance8x16_msa, 0),
- make_tuple(3, 3, &vpx_variance8x8_msa, 0),
- make_tuple(3, 2, &vpx_variance8x4_msa, 0),
- make_tuple(2, 3, &vpx_variance4x8_msa, 0),
- make_tuple(2, 2, &vpx_variance4x4_msa, 0)));
+ ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_msa),
+ VarianceParams(6, 5, &vpx_variance64x32_msa),
+ VarianceParams(5, 6, &vpx_variance32x64_msa),
+ VarianceParams(5, 5, &vpx_variance32x32_msa),
+ VarianceParams(5, 4, &vpx_variance32x16_msa),
+ VarianceParams(4, 5, &vpx_variance16x32_msa),
+ VarianceParams(4, 4, &vpx_variance16x16_msa),
+ VarianceParams(4, 3, &vpx_variance16x8_msa),
+ VarianceParams(3, 4, &vpx_variance8x16_msa),
+ VarianceParams(3, 3, &vpx_variance8x8_msa),
+ VarianceParams(3, 2, &vpx_variance8x4_msa),
+ VarianceParams(2, 3, &vpx_variance4x8_msa),
+ VarianceParams(2, 2, &vpx_variance4x4_msa)));
INSTANTIATE_TEST_CASE_P(
MSA, VpxSubpelVarianceTest,
diff --git a/test/vp9_intrapred_test.cc b/test/vp9_intrapred_test.cc
index 9e7c55a69..cd87b77a8 100644
--- a/test/vp9_intrapred_test.cc
+++ b/test/vp9_intrapred_test.cc
@@ -28,50 +28,23 @@ using libvpx_test::ACMRandom;
const int count_test_block = 100000;
-typedef void (*intra_pred_fn_t)(
- uint16_t* dst, ptrdiff_t stride,
- const uint16_t* above, const uint16_t* left, int bps);
+typedef void (*IntraPred)(uint16_t* dst, ptrdiff_t stride,
+ const uint16_t* above, const uint16_t* left,
+ int bps);
struct IntraPredFunc {
- IntraPredFunc(intra_pred_fn_t pred = NULL, intra_pred_fn_t ref = NULL,
+ IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,
int block_size_value = 0, int bit_depth_value = 0)
: pred_fn(pred), ref_fn(ref),
block_size(block_size_value), bit_depth(bit_depth_value) {}
- intra_pred_fn_t pred_fn;
- intra_pred_fn_t ref_fn;
+ IntraPred pred_fn;
+ IntraPred ref_fn;
int block_size;
int bit_depth;
};
class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
- virtual void SetUp() {
- params_ = GetParam();
- stride_ = params_.block_size * 3;
- mask_ = (1 << params_.bit_depth) - 1;
- }
-
- void Predict() {
- const int bit_depth = params_.bit_depth;
- params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
- ASM_REGISTER_STATE_CHECK(params_.pred_fn(dst_, stride_,
- above_row_, left_col_, bit_depth));
- }
-
- void CheckPrediction(int test_case_number, int *error_count) const {
- // For each pixel ensure that the calculated value is the same as reference.
- const int block_size = params_.block_size;
- for (int y = 0; y < block_size; y++) {
- for (int x = 0; x < block_size; x++) {
- *error_count += ref_dst_[x + y * stride_] != dst_[x + y * stride_];
- if (*error_count == 1) {
- ASSERT_EQ(ref_dst_[x + y * stride_], dst_[x + y * stride_])
- << " Failed on Test Case Number "<< test_case_number;
- }
- }
- }
- }
-
public:
void RunTest(uint16_t* left_col, uint16_t* above_data,
uint16_t* dst, uint16_t* ref_dst) {
@@ -104,10 +77,38 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
ASSERT_EQ(0, error_count);
}
- uint16_t* above_row_;
- uint16_t* left_col_;
- uint16_t* dst_;
- uint16_t* ref_dst_;
+ protected:
+ virtual void SetUp() {
+ params_ = GetParam();
+ stride_ = params_.block_size * 3;
+ mask_ = (1 << params_.bit_depth) - 1;
+ }
+
+ void Predict() {
+ const int bit_depth = params_.bit_depth;
+ params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
+ ASM_REGISTER_STATE_CHECK(params_.pred_fn(dst_, stride_,
+ above_row_, left_col_, bit_depth));
+ }
+
+ void CheckPrediction(int test_case_number, int *error_count) const {
+ // For each pixel ensure that the calculated value is the same as reference.
+ const int block_size = params_.block_size;
+ for (int y = 0; y < block_size; y++) {
+ for (int x = 0; x < block_size; x++) {
+ *error_count += ref_dst_[x + y * stride_] != dst_[x + y * stride_];
+ if (*error_count == 1) {
+ ASSERT_EQ(ref_dst_[x + y * stride_], dst_[x + y * stride_])
+ << " Failed on Test Case Number "<< test_case_number;
+ }
+ }
+ }
+ }
+
+ uint16_t *above_row_;
+ uint16_t *left_col_;
+ uint16_t *dst_;
+ uint16_t *ref_dst_;
ptrdiff_t stride_;
int mask_;
@@ -150,8 +151,7 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
&vpx_highbd_tm_predictor_4x4_c, 4, 8),
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
- &vpx_highbd_tm_predictor_8x8_c, 8, 8)
-));
+ &vpx_highbd_tm_predictor_8x8_c, 8, 8)));
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest,
::testing::Values(
@@ -178,8 +178,7 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
&vpx_highbd_tm_predictor_4x4_c, 4, 10),
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
- &vpx_highbd_tm_predictor_8x8_c, 8, 10)
-));
+ &vpx_highbd_tm_predictor_8x8_c, 8, 10)));
INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest,
::testing::Values(
@@ -206,8 +205,7 @@ INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest,
IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
&vpx_highbd_tm_predictor_4x4_c, 4, 12),
IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
- &vpx_highbd_tm_predictor_8x8_c, 8, 12)
-));
+ &vpx_highbd_tm_predictor_8x8_c, 8, 12)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif // HAVE_SSE2
diff --git a/third_party/googletest/README.libvpx b/third_party/googletest/README.libvpx
index 1eca78dd9..0e3b8b937 100644
--- a/third_party/googletest/README.libvpx
+++ b/third_party/googletest/README.libvpx
@@ -16,4 +16,6 @@ Local Modifications:
free build.
- Added GTEST_ATTRIBUTE_UNUSED_ to test registering dummies in TEST_P
and INSTANTIATE_TEST_CASE_P to remove warnings about unused variables
- under GCC 5. \ No newline at end of file
+ under GCC 5.
+- Only define g_in_fast_death_test_child for non-Windows builds; quiets an
+ unused variable warning.
diff --git a/third_party/googletest/src/src/gtest-all.cc b/third_party/googletest/src/src/gtest-all.cc
index 8d906279a..912868148 100644
--- a/third_party/googletest/src/src/gtest-all.cc
+++ b/third_party/googletest/src/src/gtest-all.cc
@@ -6612,9 +6612,11 @@ GTEST_DEFINE_string_(
namespace internal {
+# if !GTEST_OS_WINDOWS
// Valid only for fast death tests. Indicates the code is running in the
// child process of a fast style death test.
static bool g_in_fast_death_test_child = false;
+# endif // !GTEST_OS_WINDOWS
// Returns a Boolean value indicating whether the caller is currently
// executing in the context of the death test child process. Tools such as