Clean up FunctionEquivalenceTest.
remove use of tuple in favor of struct.
Change-Id: If3b1aa5c2fc3cfe1446fff7a8fd270f2ca85fedf
diff --git a/test/obmc_sad_test.cc b/test/obmc_sad_test.cc
index 95d56ae..beb7106 100644
--- a/test/obmc_sad_test.cc
+++ b/test/obmc_sad_test.cc
@@ -9,9 +9,9 @@
*/
#include "third_party/googletest/src/include/gtest/gtest.h"
-#include "test/acm_random.h"
#include "test/function_equivalence_test.h"
+#include "test/register_state_check.h"
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
@@ -19,9 +19,6 @@
#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
-using std::tr1::make_tuple;
-
-using libvpx_test::ACMRandom;
using libvpx_test::FunctionEquivalenceTest;
namespace {
@@ -31,18 +28,13 @@
typedef unsigned int (*ObmcSadF)(const uint8_t *pre, int pre_stride,
const int32_t *wsrc, const int32_t *mask);
+typedef libvpx_test::FuncParam<ObmcSadF> TestFuncs;
////////////////////////////////////////////////////////////////////////////////
// 8 bit
////////////////////////////////////////////////////////////////////////////////
-class ObmcSadTest : public FunctionEquivalenceTest<ObmcSadF> {
- public:
- ObmcSadTest() : rng_(ACMRandom::DeterministicSeed()) {}
-
- protected:
- ACMRandom rng_;
-};
+class ObmcSadTest : public FunctionEquivalenceTest<ObmcSadF> {};
TEST_P(ObmcSadTest, RandomValues) {
DECLARE_ALIGNED(32, uint8_t, pre[MAX_SB_SQUARE]);
@@ -58,8 +50,10 @@
mask[i] = rng_(kMaskMax * kMaskMax + 1);
}
- const unsigned int ref_res = ref_func_(pre, pre_stride, wsrc, mask);
- const unsigned int tst_res = tst_func_(pre, pre_stride, wsrc, mask);
+ const unsigned int ref_res = params_.ref_func(pre, pre_stride, wsrc, mask);
+ unsigned int tst_res;
+ ASM_REGISTER_STATE_CHECK(tst_res =
+ params_.tst_func(pre, pre_stride, wsrc, mask));
ASSERT_EQ(ref_res, tst_res);
}
@@ -79,8 +73,10 @@
mask[i] = kMaskMax * kMaskMax;
}
- const unsigned int ref_res = ref_func_(pre, pre_stride, wsrc, mask);
- const unsigned int tst_res = tst_func_(pre, pre_stride, wsrc, mask);
+ const unsigned int ref_res = params_.ref_func(pre, pre_stride, wsrc, mask);
+ unsigned int tst_res;
+ ASM_REGISTER_STATE_CHECK(tst_res =
+ params_.tst_func(pre, pre_stride, wsrc, mask));
ASSERT_EQ(ref_res, tst_res);
}
@@ -89,23 +85,23 @@
#if HAVE_SSE4_1
const ObmcSadTest::ParamType sse4_functions[] = {
#if CONFIG_EXT_PARTITION
- make_tuple(vpx_obmc_sad128x128_c, vpx_obmc_sad128x128_sse4_1),
- make_tuple(vpx_obmc_sad128x64_c, vpx_obmc_sad128x64_sse4_1),
- make_tuple(vpx_obmc_sad64x128_c, vpx_obmc_sad64x128_sse4_1),
+ TestFuncs(vpx_obmc_sad128x128_c, vpx_obmc_sad128x128_sse4_1),
+ TestFuncs(vpx_obmc_sad128x64_c, vpx_obmc_sad128x64_sse4_1),
+ TestFuncs(vpx_obmc_sad64x128_c, vpx_obmc_sad64x128_sse4_1),
#endif // CONFIG_EXT_PARTITION
- make_tuple(vpx_obmc_sad64x64_c, vpx_obmc_sad64x64_sse4_1),
- make_tuple(vpx_obmc_sad64x32_c, vpx_obmc_sad64x32_sse4_1),
- make_tuple(vpx_obmc_sad32x64_c, vpx_obmc_sad32x64_sse4_1),
- make_tuple(vpx_obmc_sad32x32_c, vpx_obmc_sad32x32_sse4_1),
- make_tuple(vpx_obmc_sad32x16_c, vpx_obmc_sad32x16_sse4_1),
- make_tuple(vpx_obmc_sad16x32_c, vpx_obmc_sad16x32_sse4_1),
- make_tuple(vpx_obmc_sad16x16_c, vpx_obmc_sad16x16_sse4_1),
- make_tuple(vpx_obmc_sad16x8_c, vpx_obmc_sad16x8_sse4_1),
- make_tuple(vpx_obmc_sad8x16_c, vpx_obmc_sad8x16_sse4_1),
- make_tuple(vpx_obmc_sad8x8_c, vpx_obmc_sad8x8_sse4_1),
- make_tuple(vpx_obmc_sad8x4_c, vpx_obmc_sad8x4_sse4_1),
- make_tuple(vpx_obmc_sad4x8_c, vpx_obmc_sad4x8_sse4_1),
- make_tuple(vpx_obmc_sad4x4_c, vpx_obmc_sad4x4_sse4_1)
+ TestFuncs(vpx_obmc_sad64x64_c, vpx_obmc_sad64x64_sse4_1),
+ TestFuncs(vpx_obmc_sad64x32_c, vpx_obmc_sad64x32_sse4_1),
+ TestFuncs(vpx_obmc_sad32x64_c, vpx_obmc_sad32x64_sse4_1),
+ TestFuncs(vpx_obmc_sad32x32_c, vpx_obmc_sad32x32_sse4_1),
+ TestFuncs(vpx_obmc_sad32x16_c, vpx_obmc_sad32x16_sse4_1),
+ TestFuncs(vpx_obmc_sad16x32_c, vpx_obmc_sad16x32_sse4_1),
+ TestFuncs(vpx_obmc_sad16x16_c, vpx_obmc_sad16x16_sse4_1),
+ TestFuncs(vpx_obmc_sad16x8_c, vpx_obmc_sad16x8_sse4_1),
+ TestFuncs(vpx_obmc_sad8x16_c, vpx_obmc_sad8x16_sse4_1),
+ TestFuncs(vpx_obmc_sad8x8_c, vpx_obmc_sad8x8_sse4_1),
+ TestFuncs(vpx_obmc_sad8x4_c, vpx_obmc_sad8x4_sse4_1),
+ TestFuncs(vpx_obmc_sad4x8_c, vpx_obmc_sad4x8_sse4_1),
+ TestFuncs(vpx_obmc_sad4x4_c, vpx_obmc_sad4x4_sse4_1)
};
INSTANTIATE_TEST_CASE_P(SSE4_1_C_COMPARE, ObmcSadTest,
@@ -117,13 +113,7 @@
////////////////////////////////////////////////////////////////////////////////
#if CONFIG_VP9_HIGHBITDEPTH
-class ObmcSadHBDTest : public FunctionEquivalenceTest<ObmcSadF> {
- public:
- ObmcSadHBDTest() : rng_(ACMRandom::DeterministicSeed()) {}
-
- protected:
- ACMRandom rng_;
-};
+class ObmcSadHBDTest : public FunctionEquivalenceTest<ObmcSadF> {};
TEST_P(ObmcSadHBDTest, RandomValues) {
DECLARE_ALIGNED(32, uint16_t, pre[MAX_SB_SQUARE]);
@@ -139,10 +129,11 @@
mask[i] = rng_(kMaskMax * kMaskMax + 1);
}
- const unsigned int ref_res = ref_func_(CONVERT_TO_BYTEPTR(pre), pre_stride,
- wsrc, mask);
- const unsigned int tst_res = tst_func_(CONVERT_TO_BYTEPTR(pre), pre_stride,
- wsrc, mask);
+ const unsigned int ref_res =
+ params_.ref_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask);
+ unsigned int tst_res;
+ ASM_REGISTER_STATE_CHECK(tst_res =
+ params_.tst_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask));
ASSERT_EQ(ref_res, tst_res);
}
@@ -162,10 +153,11 @@
mask[i] = kMaskMax * kMaskMax;
}
- const unsigned int ref_res = ref_func_(CONVERT_TO_BYTEPTR(pre), pre_stride,
- wsrc, mask);
- const unsigned int tst_res = tst_func_(CONVERT_TO_BYTEPTR(pre), pre_stride,
- wsrc, mask);
+ const unsigned int ref_res =
+ params_.ref_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask);
+ unsigned int tst_res;
+ ASM_REGISTER_STATE_CHECK(tst_res =
+ params_.tst_func(CONVERT_TO_BYTEPTR(pre), pre_stride, wsrc, mask));
ASSERT_EQ(ref_res, tst_res);
}
@@ -174,23 +166,23 @@
#if HAVE_SSE4_1
ObmcSadHBDTest::ParamType sse4_functions_hbd[] = {
#if CONFIG_EXT_PARTITION
- make_tuple(vpx_highbd_obmc_sad128x128_c, vpx_highbd_obmc_sad128x128_sse4_1),
- make_tuple(vpx_highbd_obmc_sad128x64_c, vpx_highbd_obmc_sad128x64_sse4_1),
- make_tuple(vpx_highbd_obmc_sad64x128_c, vpx_highbd_obmc_sad64x128_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad128x128_c, vpx_highbd_obmc_sad128x128_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad128x64_c, vpx_highbd_obmc_sad128x64_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad64x128_c, vpx_highbd_obmc_sad64x128_sse4_1),
#endif // CONFIG_EXT_PARTITION
- make_tuple(vpx_highbd_obmc_sad64x64_c, vpx_highbd_obmc_sad64x64_sse4_1),
- make_tuple(vpx_highbd_obmc_sad64x32_c, vpx_highbd_obmc_sad64x32_sse4_1),
- make_tuple(vpx_highbd_obmc_sad32x64_c, vpx_highbd_obmc_sad32x64_sse4_1),
- make_tuple(vpx_highbd_obmc_sad32x32_c, vpx_highbd_obmc_sad32x32_sse4_1),
- make_tuple(vpx_highbd_obmc_sad32x16_c, vpx_highbd_obmc_sad32x16_sse4_1),
- make_tuple(vpx_highbd_obmc_sad16x32_c, vpx_highbd_obmc_sad16x32_sse4_1),
- make_tuple(vpx_highbd_obmc_sad16x16_c, vpx_highbd_obmc_sad16x16_sse4_1),
- make_tuple(vpx_highbd_obmc_sad16x8_c, vpx_highbd_obmc_sad16x8_sse4_1),
- make_tuple(vpx_highbd_obmc_sad8x16_c, vpx_highbd_obmc_sad8x16_sse4_1),
- make_tuple(vpx_highbd_obmc_sad8x8_c, vpx_highbd_obmc_sad8x8_sse4_1),
- make_tuple(vpx_highbd_obmc_sad8x4_c, vpx_highbd_obmc_sad8x4_sse4_1),
- make_tuple(vpx_highbd_obmc_sad4x8_c, vpx_highbd_obmc_sad4x8_sse4_1),
- make_tuple(vpx_highbd_obmc_sad4x4_c, vpx_highbd_obmc_sad4x4_sse4_1)
+ TestFuncs(vpx_highbd_obmc_sad64x64_c, vpx_highbd_obmc_sad64x64_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad64x32_c, vpx_highbd_obmc_sad64x32_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad32x64_c, vpx_highbd_obmc_sad32x64_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad32x32_c, vpx_highbd_obmc_sad32x32_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad32x16_c, vpx_highbd_obmc_sad32x16_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad16x32_c, vpx_highbd_obmc_sad16x32_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad16x16_c, vpx_highbd_obmc_sad16x16_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad16x8_c, vpx_highbd_obmc_sad16x8_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad8x16_c, vpx_highbd_obmc_sad8x16_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad8x8_c, vpx_highbd_obmc_sad8x8_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad8x4_c, vpx_highbd_obmc_sad8x4_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad4x8_c, vpx_highbd_obmc_sad4x8_sse4_1),
+ TestFuncs(vpx_highbd_obmc_sad4x4_c, vpx_highbd_obmc_sad4x4_sse4_1)
};
INSTANTIATE_TEST_CASE_P(SSE4_1_C_COMPARE, ObmcSadHBDTest,