Make satd unit test support all bit-depth settings

Turn on satd unit test for c function in both regular and high
bit-depth settings.

Change-Id: I4b0c56addfb84964ede0da3ab760fe0ee640cfd0
This commit is contained in:
Jingning Han
2017-01-27 10:46:53 -08:00
committed by James Zern
parent 59917dd18e
commit a7949f2dd2

View File

@@ -186,7 +186,7 @@ class IntProColTest : public AverageTestBase,
int16_t sum_c_; int16_t sum_c_;
}; };
typedef int (*SatdFunc)(const int16_t *coeffs, int length); typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
typedef std::tr1::tuple<int, SatdFunc> SatdTestParam; typedef std::tr1::tuple<int, SatdFunc> SatdTestParam;
class SatdTest : public ::testing::Test, class SatdTest : public ::testing::Test,
@@ -196,7 +196,7 @@ class SatdTest : public ::testing::Test,
satd_size_ = GET_PARAM(0); satd_size_ = GET_PARAM(0);
satd_func_ = GET_PARAM(1); satd_func_ = GET_PARAM(1);
rnd_.Reset(ACMRandom::DeterministicSeed()); rnd_.Reset(ACMRandom::DeterministicSeed());
src_ = reinterpret_cast<int16_t *>( src_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*src_) * satd_size_)); vpx_memalign(16, sizeof(*src_) * satd_size_));
ASSERT_TRUE(src_ != NULL); ASSERT_TRUE(src_ != NULL);
} }
@@ -206,12 +206,15 @@ class SatdTest : public ::testing::Test,
vpx_free(src_); vpx_free(src_);
} }
void FillConstant(const int16_t val) { void FillConstant(const tran_low_t val) {
for (int i = 0; i < satd_size_; ++i) src_[i] = val; for (int i = 0; i < satd_size_; ++i) src_[i] = val;
} }
void FillRandom() { void FillRandom() {
for (int i = 0; i < satd_size_; ++i) src_[i] = rnd_.Rand16(); for (int i = 0; i < satd_size_; ++i) {
const int16_t tmp = rnd_.Rand16();
src_[i] = (tran_low_t)tmp;
}
} }
void Check(const int expected) { void Check(const int expected) {
@@ -223,7 +226,7 @@ class SatdTest : public ::testing::Test,
int satd_size_; int satd_size_;
private: private:
int16_t *src_; tran_low_t *src_;
SatdFunc satd_func_; SatdFunc satd_func_;
ACMRandom rnd_; ACMRandom rnd_;
}; };
@@ -315,13 +318,11 @@ INSTANTIATE_TEST_CASE_P(
::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c), ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c))); make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
#if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(C, SatdTest, INSTANTIATE_TEST_CASE_P(C, SatdTest,
::testing::Values(make_tuple(16, &vpx_satd_c), ::testing::Values(make_tuple(16, &vpx_satd_c),
make_tuple(64, &vpx_satd_c), make_tuple(64, &vpx_satd_c),
make_tuple(256, &vpx_satd_c), make_tuple(256, &vpx_satd_c),
make_tuple(1024, &vpx_satd_c))); make_tuple(1024, &vpx_satd_c)));
#endif
#if HAVE_SSE2 #if HAVE_SSE2
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
@@ -347,6 +348,8 @@ INSTANTIATE_TEST_CASE_P(
make_tuple(64, &vpx_int_pro_col_sse2, make_tuple(64, &vpx_int_pro_col_sse2,
&vpx_int_pro_col_c))); &vpx_int_pro_col_c)));
// TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
// in place.
#if !CONFIG_VP9_HIGHBITDEPTH #if !CONFIG_VP9_HIGHBITDEPTH
INSTANTIATE_TEST_CASE_P(SSE2, SatdTest, INSTANTIATE_TEST_CASE_P(SSE2, SatdTest,
::testing::Values(make_tuple(16, &vpx_satd_sse2), ::testing::Values(make_tuple(16, &vpx_satd_sse2),