Commit a3f7ddc3 authored by Geza Lore's avatar Geza Lore Committed by James Zern

Clean up FunctionEquivalenceTest.

remove use of tuple in favor of struct.

Change-Id: If3b1aa5c2fc3cfe1446fff7a8fd270f2ca85fedf
parent c804e0df
......@@ -23,14 +23,11 @@
#include "./vp10_rtcd.h"
#include "test/acm_random.h"
#include "vp10/common/enums.h"
#include "vpx_dsp/blend.h"
using libvpx_test::ACMRandom;
using libvpx_test::FunctionEquivalenceTest;
using std::tr1::make_tuple;
namespace {
......@@ -44,29 +41,27 @@ class BlendA64Mask1DTest : public FunctionEquivalenceTest<F> {
static const int kMaxMaskWidth = 2 * MAX_SB_SIZE;
static const int kMaxMaskSize = kMaxMaskWidth;
BlendA64Mask1DTest() : rng_(ACMRandom::DeterministicSeed()) {}
virtual ~BlendA64Mask1DTest() {}
virtual void Execute(T *p_src0, T *p_src1) = 0;
virtual void Execute(const T *p_src0, const T *p_src1) = 0;
void Common() {
w_ = 1 << rng_(MAX_SB_SIZE_LOG2 + 1);
h_ = 1 << rng_(MAX_SB_SIZE_LOG2 + 1);
w_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1);
h_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1);
dst_offset_ = rng_(33);
dst_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
dst_offset_ = this->rng_(33);
dst_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
src0_offset_ = rng_(33);
src0_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
src0_offset_ = this->rng_(33);
src0_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
src1_offset_ = rng_(33);
src1_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
src1_offset_ = this->rng_(33);
src1_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
T *p_src0;
T *p_src1;
switch (rng_(3)) {
switch (this->rng_(3)) {
case 0: // Separate sources
p_src0 = src0_;
p_src1 = src1_;
......@@ -97,8 +92,6 @@ class BlendA64Mask1DTest : public FunctionEquivalenceTest<F> {
}
}
ACMRandom rng_;
T dst_ref_[kBufSize];
T dst_tst_[kBufSize];
size_t dst_stride_;
......@@ -126,19 +119,18 @@ typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride,
const uint8_t *src0, uint32_t src0_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, int h, int w);
typedef libvpx_test::FuncParam<F8B> TestFuncs;
class BlendA64Mask1DTest8B : public BlendA64Mask1DTest<F8B, uint8_t> {
protected:
void Execute(uint8_t *p_src0, uint8_t *p_src1) {
ref_func_(dst_ref_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, h_, w_);
tst_func_(dst_tst_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, h_, w_);
void Execute(const uint8_t *p_src0, const uint8_t *p_src1) {
params_.ref_func(dst_ref_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_, mask_, h_, w_);
ASM_REGISTER_STATE_CHECK(
params_.tst_func(dst_tst_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_, mask_, h_, w_));
}
};
......@@ -215,16 +207,15 @@ static void blend_a64_vmask_ref(
INSTANTIATE_TEST_CASE_P(
C, BlendA64Mask1DTest8B,
::testing::Values(
make_tuple(blend_a64_hmask_ref, vpx_blend_a64_hmask_c),
make_tuple(blend_a64_vmask_ref, vpx_blend_a64_vmask_c)));
::testing::Values(TestFuncs(blend_a64_hmask_ref, vpx_blend_a64_hmask_c),
TestFuncs(blend_a64_vmask_ref, vpx_blend_a64_vmask_c)));
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
SSE4_1, BlendA64Mask1DTest8B,
::testing::Values(
make_tuple(blend_a64_hmask_ref, vpx_blend_a64_hmask_sse4_1),
make_tuple(blend_a64_vmask_ref, vpx_blend_a64_vmask_sse4_1)));
TestFuncs(blend_a64_hmask_ref, vpx_blend_a64_hmask_sse4_1),
TestFuncs(blend_a64_vmask_ref, vpx_blend_a64_vmask_sse4_1)));
#endif // HAVE_SSE4_1
#if CONFIG_VP9_HIGHBITDEPTH
......@@ -236,20 +227,20 @@ typedef void (*FHBD)(uint8_t *dst, uint32_t dst_stride,
const uint8_t *src0, uint32_t src0_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, int h, int w, int bd);
typedef libvpx_test::FuncParam<FHBD> TestFuncsHBD;
class BlendA64Mask1DTestHBD : public BlendA64Mask1DTest<FHBD, uint16_t> {
protected:
void Execute(uint16_t *p_src0, uint16_t *p_src1) {
ref_func_(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, h_, w_, bit_depth_);
ASM_REGISTER_STATE_CHECK(
tst_func_(CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, h_, w_, bit_depth_));
void Execute(const uint16_t *p_src0, const uint16_t *p_src1) {
params_.ref_func(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, h_, w_, bit_depth_);
ASM_REGISTER_STATE_CHECK(params_.tst_func(
CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, h_, w_, bit_depth_));
}
int bit_depth_;
......@@ -359,15 +350,17 @@ static void highbd_blend_a64_vmask_ref(
INSTANTIATE_TEST_CASE_P(
C, BlendA64Mask1DTestHBD,
::testing::Values(
make_tuple(highbd_blend_a64_hmask_ref, vpx_highbd_blend_a64_hmask_c),
make_tuple(highbd_blend_a64_vmask_ref, vpx_highbd_blend_a64_vmask_c)));
TestFuncsHBD(highbd_blend_a64_hmask_ref, vpx_highbd_blend_a64_hmask_c),
TestFuncsHBD(highbd_blend_a64_vmask_ref, vpx_highbd_blend_a64_vmask_c)));
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
SSE4_1, BlendA64Mask1DTestHBD,
::testing::Values(
make_tuple(highbd_blend_a64_hmask_ref, vpx_highbd_blend_a64_hmask_sse4_1),
make_tuple(highbd_blend_a64_vmask_ref, vpx_highbd_blend_a64_vmask_sse4_1)));
TestFuncsHBD(highbd_blend_a64_hmask_ref,
vpx_highbd_blend_a64_hmask_sse4_1),
TestFuncsHBD(highbd_blend_a64_vmask_ref,
vpx_highbd_blend_a64_vmask_sse4_1)));
#endif // HAVE_SSE4_1
#endif // CONFIG_VP9_HIGHBITDEPTH
......
......@@ -23,14 +23,11 @@
#include "./vp10_rtcd.h"
#include "test/acm_random.h"
#include "vp10/common/enums.h"
#include "vpx_dsp/blend.h"
using libvpx_test::ACMRandom;
using libvpx_test::FunctionEquivalenceTest;
using std::tr1::make_tuple;
namespace {
......@@ -44,35 +41,33 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> {
static const int kMaxMaskWidth = 2 * MAX_SB_SIZE;
static const int kMaxMaskSize = kMaxMaskWidth * kMaxMaskWidth;
BlendA64MaskTest() : rng_(ACMRandom::DeterministicSeed()) {}
virtual ~BlendA64MaskTest() {}
virtual void Execute(const T *p_src0, const T *p_src1) = 0;
void Common() {
w_ = 1 << rng_(MAX_SB_SIZE_LOG2 + 1);
h_ = 1 << rng_(MAX_SB_SIZE_LOG2 + 1);
w_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1);
h_ = 1 << this->rng_(MAX_SB_SIZE_LOG2 + 1);
subx_ = rng_(2);
suby_ = rng_(2);
subx_ = this->rng_(2);
suby_ = this->rng_(2);
dst_offset_ = rng_(33);
dst_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
dst_offset_ = this->rng_(33);
dst_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
src0_offset_ = rng_(33);
src0_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
src0_offset_ = this->rng_(33);
src0_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
src1_offset_ = rng_(33);
src1_stride_ = rng_(kMaxWidth + 1 - w_) + w_;
src1_offset_ = this->rng_(33);
src1_stride_ = this->rng_(kMaxWidth + 1 - w_) + w_;
mask_stride_ = rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1))
+ w_ * (subx_ ? 2 : 1);
mask_stride_ = this->rng_(kMaxWidth + 1 - w_ * (subx_ ? 2 : 1)) +
w_ * (subx_ ? 2 : 1);
T *p_src0;
T *p_src1;
switch (rng_(3)) {
switch (this->rng_(3)) {
case 0: // Separate sources
p_src0 = src0_;
p_src1 = src1_;
......@@ -103,8 +98,6 @@ class BlendA64MaskTest : public FunctionEquivalenceTest<F> {
}
}
ACMRandom rng_;
T dst_ref_[kBufSize];
T dst_tst_[kBufSize];
size_t dst_stride_;
......@@ -137,21 +130,20 @@ typedef void (*F8B)(uint8_t *dst, uint32_t dst_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, uint32_t mask_stride,
int h, int w, int suby, int subx);
typedef libvpx_test::FuncParam<F8B> TestFuncs;
class BlendA64MaskTest8B : public BlendA64MaskTest<F8B, uint8_t> {
protected:
void Execute(const uint8_t *p_src0, const uint8_t *p_src1) {
ref_func_(dst_ref_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, kMaxMaskWidth,
h_, w_, suby_, subx_);
tst_func_(dst_tst_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, kMaxMaskWidth,
h_, w_, suby_, subx_);
params_.ref_func(dst_ref_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, kMaxMaskWidth, h_, w_, suby_, subx_);
ASM_REGISTER_STATE_CHECK(
params_.tst_func(dst_tst_ + dst_offset_, dst_stride_,
p_src0 + src0_offset_, src0_stride_,
p_src1 + src1_offset_, src1_stride_,
mask_, kMaxMaskWidth, h_, w_, suby_, subx_));
}
};
......@@ -191,8 +183,8 @@ TEST_P(BlendA64MaskTest8B, ExtremeValues) {
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
SSE4_1_C_COMPARE, BlendA64MaskTest8B,
::testing::Values(make_tuple(vpx_blend_a64_mask_c,
vpx_blend_a64_mask_sse4_1)));
::testing::Values(
TestFuncs(vpx_blend_a64_mask_c, vpx_blend_a64_mask_sse4_1)));
#endif // HAVE_SSE4_1
#if CONFIG_VP9_HIGHBITDEPTH
......@@ -205,22 +197,20 @@ typedef void (*FHBD)(uint8_t *dst, uint32_t dst_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, uint32_t mask_stride,
int h, int w, int suby, int subx, int bd);
typedef libvpx_test::FuncParam<FHBD> TestFuncsHBD;
class BlendA64MaskTestHBD : public BlendA64MaskTest<FHBD, uint16_t> {
protected:
void Execute(const uint16_t *p_src0, const uint16_t *p_src1) {
ref_func_(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, kMaxMaskWidth,
h_, w_, suby_, subx_, bit_depth_);
ASM_REGISTER_STATE_CHECK(
tst_func_(CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, kMaxMaskWidth,
h_, w_, suby_, subx_, bit_depth_));
params_.ref_func(CONVERT_TO_BYTEPTR(dst_ref_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, kMaxMaskWidth, h_, w_, suby_, subx_, bit_depth_);
ASM_REGISTER_STATE_CHECK(params_.tst_func(
CONVERT_TO_BYTEPTR(dst_tst_ + dst_offset_), dst_stride_,
CONVERT_TO_BYTEPTR(p_src0 + src0_offset_), src0_stride_,
CONVERT_TO_BYTEPTR(p_src1 + src1_offset_), src1_stride_,
mask_, kMaxMaskWidth, h_, w_, suby_, subx_, bit_depth_));
}
int bit_depth_;
......@@ -290,8 +280,9 @@ TEST_P(BlendA64MaskTestHBD, ExtremeValues) {
#if HAVE_SSE4_1
INSTANTIATE_TEST_CASE_P(
SSE4_1_C_COMPARE, BlendA64MaskTestHBD,
::testing::Values(make_tuple(vpx_highbd_blend_a64_mask_c,
vpx_highbd_blend_a64_mask_sse4_1)));
::testing::Values(
TestFuncsHBD(vpx_highbd_blend_a64_mask_c,
vpx_highbd_blend_a64_mask_sse4_1)));
#endif // HAVE_SSE4_1
#endif // CONFIG_VP9_HIGHBITDEPTH
} // namespace
......@@ -12,19 +12,44 @@
#define TEST_FUNCTION_EQUIVALENCE_TEST_H_
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/util.h"
using libvpx_test::ACMRandom;
namespace libvpx_test {
// Base class for tests that compare 2 implementations of the same function
// for equivalence. The template parameter should be pointer to a function
// that is being tested.
//
// The test takes a 3-parameters encapsulating struct 'FuncParam', containing:
// - Pointer to reference function
// - Pointer to tested function
// - Integer bit depth (default to 0).
//
// These values are then accessible in the tests as member of params_:
// params_.ref_func, params_.tst_func, and params_.bit_depth.
//
template <typename T>
struct FuncParam {
FuncParam(T ref = NULL, T tst = NULL, int bit_depth = 0)
: ref_func(ref), tst_func(tst), bit_depth(bit_depth) {}
T ref_func;
T tst_func;
int bit_depth;
};
template <typename T>
class FunctionEquivalenceTest :
public ::testing::TestWithParam< std::tr1::tuple< T, T > > {
class FunctionEquivalenceTest : public ::testing::TestWithParam<FuncParam<T> > {
public:
FunctionEquivalenceTest() : rng_(ACMRandom::DeterministicSeed()) {}
virtual ~FunctionEquivalenceTest() {}
virtual void SetUp() {
ref_func_ = std::tr1::get<0>(this->GetParam());
tst_func_ = std::tr1::get<1>(this->GetParam());
params_ = this->GetParam();
}
virtual void TearDown() {
......@@ -32,8 +57,8 @@ class FunctionEquivalenceTest :
}
protected:
T ref_func_;
T tst_func_;
ACMRandom rng_;
FuncParam<T> params_;
};
} // namespace libvpx_test
......
......@@ -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 @@ static const int kMaskMax = 64;
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 @@ TEST_P(ObmcSadTest, RandomValues) {
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 @@ TEST_P(ObmcSadTest, ExtremeValues) {
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 @@ TEST_P(ObmcSadTest, ExtremeValues) {
#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 @@ INSTANTIATE_TEST_CASE_P(SSE4_1_C_COMPARE, ObmcSadTest,
////////////////////////////////////////////////////////////////////////////////
#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 @@ TEST_P(ObmcSadHBDTest, RandomValues) {
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 @@ TEST_P(ObmcSadHBDTest, ExtremeValues) {
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 @@ TEST_P(ObmcSadHBDTest, ExtremeValues) {
#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,
......
......@@ -31,25 +31,21 @@ const int kNumIterations = 10000;
static const int16_t kInt13Max = (1 << 12) - 1;
typedef uint64_t (*SSI16Func)(const int16_t *src,
int stride ,
int size);
typedef uint64_t (*SSI16Func)(const int16_t *src, int stride, int size);
typedef libvpx_test::FuncParam<SSI16Func> TestFuncs;
typedef std::tr1::tuple<SSI16Func, SSI16Func> SumSquaresParam;
class SumSquaresTest : public ::testing::TestWithParam<SumSquaresParam> {
class SumSquaresTest :
public ::testing::TestWithParam<TestFuncs> {
public:
virtual ~SumSquaresTest() {}
virtual void SetUp() {
ref_func_ = GET_PARAM(0);
tst_func_ = GET_PARAM(1);
params_ = this->GetParam();
}
virtual void TearDown() { libvpx_test::ClearSystemState(); }
protected:
SSI16Func ref_func_;
SSI16Func tst_func_;
TestFuncs params_;
};
TEST_P(SumSquaresTest, OperationCheck) {
......@@ -74,9 +70,9 @@ TEST_P(SumSquaresTest, OperationCheck) {
}
}
uint64_t res_ref = ref_func_(src, stride, size);