/* * Copyright (c) 2017 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include #include #include #include "third_party/googletest/src/include/gtest/gtest.h" #include "./vp9_rtcd.h" #include "./vpx_dsp_rtcd.h" #include "test/acm_random.h" #include "test/buffer.h" #include "test/clear_system_state.h" #include "test/register_state_check.h" #include "test/util.h" #include "vp9/common/vp9_entropy.h" #include "vpx/vpx_codec.h" #include "vpx/vpx_integer.h" #include "vpx_ports/mem.h" using libvpx_test::ACMRandom; using libvpx_test::Buffer; using std::tr1::make_tuple; using std::tr1::tuple; namespace { typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride); typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride); typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride, int tx_type); typedef void (*FhtFuncRef)(const Buffer &in, Buffer *out, int size, int tx_type); typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, int tx_type); typedef void (*IhtWithBdFunc)(const tran_low_t *in, uint8_t *out, int stride, int tx_type, int bd); template void fdct_wrapper(const int16_t *in, tran_low_t *out, int stride, int tx_type) { (void)tx_type; fn(in, out, stride); } template void idct_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type, int bd) { (void)tx_type; (void)bd; fn(in, out, stride); } template void iht_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type, int bd) { (void)bd; fn(in, out, stride, tx_type); } #if CONFIG_VP9_HIGHBITDEPTH typedef void (*HighbdIdctFunc)(const tran_low_t *in, uint16_t *out, int stride, int bd); typedef void (*HighbdIhtFunc)(const tran_low_t *in, uint16_t *out, int stride, int tx_type, int bd); template void highbd_idct_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type, int bd) { (void)tx_type; fn(in, CAST_TO_SHORTPTR(out), stride, bd); } template void highbd_iht_wrapper(const tran_low_t *in, uint8_t *out, int stride, int tx_type, int bd) { fn(in, CAST_TO_SHORTPTR(out), stride, tx_type, bd); } #endif // CONFIG_VP9_HIGHBITDEPTH /* forward transform, inverse transform, size, transform type, bit depth */ typedef tuple DctParam; void fdct_ref(const Buffer &in, Buffer *out, int size, int /*tx_type*/) { const int16_t *i = in.TopLeftPixel(); const int i_stride = in.stride(); tran_low_t *o = out->TopLeftPixel(); if (size == 4) { vpx_fdct4x4_c(i, o, i_stride); } else if (size == 8) { vpx_fdct8x8_c(i, o, i_stride); } else if (size == 16) { vpx_fdct16x16_c(i, o, i_stride); } else if (size == 32) { vpx_fdct32x32_c(i, o, i_stride); } } void fht_ref(const Buffer &in, Buffer *out, int size, int tx_type) { const int16_t *i = in.TopLeftPixel(); const int i_stride = in.stride(); tran_low_t *o = out->TopLeftPixel(); if (size == 4) { vp9_fht4x4_c(i, o, i_stride, tx_type); } else if (size == 8) { vp9_fht8x8_c(i, o, i_stride, tx_type); } else if (size == 16) { vp9_fht16x16_c(i, o, i_stride, tx_type); } } void fwht_ref(const Buffer &in, Buffer *out, int size, int /*tx_type*/) { ASSERT_EQ(size, 4); vp9_fwht4x4_c(in.TopLeftPixel(), out->TopLeftPixel(), in.stride()); } class TransTestBase : public ::testing::TestWithParam { public: virtual void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); size_ = GET_PARAM(2); tx_type_ = GET_PARAM(3); bit_depth_ = GET_PARAM(4); pixel_size_ = GET_PARAM(5); max_pixel_value_ = (1 << bit_depth_) - 1; // Randomize stride_ to a value less than or equal to 1024 stride_ = rnd_(1024) + 1; if (stride_ < size_) { stride_ = size_; } // Align stride_ to 16 if it's bigger than 16. if (stride_ > 16) { stride_ &= ~15; } block_size_ = size_ * stride_; src_ = reinterpret_cast( vpx_memalign(16, pixel_size_ * block_size_)); ASSERT_TRUE(src_ != NULL); dst_ = reinterpret_cast( vpx_memalign(16, pixel_size_ * block_size_)); ASSERT_TRUE(dst_ != NULL); } virtual void TearDown() { vpx_free(src_); src_ = NULL; vpx_free(dst_); dst_ = NULL; libvpx_test::ClearSystemState(); } void InitMem() { if (pixel_size_ == 1) { for (int j = 0; j < block_size_; ++j) { src_[j] = rnd_.Rand16() & max_pixel_value_; } for (int j = 0; j < block_size_; ++j) { dst_[j] = rnd_.Rand16() & max_pixel_value_; } } else { ASSERT_EQ(pixel_size_, 2); uint16_t *const src = reinterpret_cast(src_); uint16_t *const dst = reinterpret_cast(dst_); for (int j = 0; j < block_size_; ++j) { src[j] = rnd_.Rand16() & max_pixel_value_; } for (int j = 0; j < block_size_; ++j) { dst[j] = rnd_.Rand16() & max_pixel_value_; } } } void RunFwdTxfm(const Buffer &in, Buffer *out) { fwd_txfm_(in.TopLeftPixel(), out->TopLeftPixel(), in.stride(), tx_type_); } void RunInvTxfm(const Buffer &in, uint8_t *out) { inv_txfm_(in.TopLeftPixel(), out, stride_, tx_type_, bit_depth_); } protected: void RunAccuracyCheck(int limit) { ACMRandom rnd(ACMRandom::DeterministicSeed()); Buffer test_input_block = Buffer(size_, size_, 8, size_ == 4 ? 0 : 16); ASSERT_TRUE(test_input_block.Init()); Buffer test_temp_block = Buffer(size_, size_, 0, 16); ASSERT_TRUE(test_temp_block.Init()); uint32_t max_error = 0; int64_t total_error = 0; const int count_test_block = 10000; for (int i = 0; i < count_test_block; ++i) { InitMem(); for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { if (pixel_size_ == 1) { test_input_block.TopLeftPixel()[h * test_input_block.stride() + w] = src_[h * stride_ + w] - dst_[h * stride_ + w]; } else { ASSERT_EQ(pixel_size_, 2); const uint16_t *const src = reinterpret_cast(src_); const uint16_t *const dst = reinterpret_cast(dst_); test_input_block.TopLeftPixel()[h * test_input_block.stride() + w] = src[h * stride_ + w] - dst[h * stride_ + w]; } } } ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, &test_temp_block)); ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst_)); for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { int diff; if (pixel_size_ == 1) { diff = dst_[h * stride_ + w] - src_[h * stride_ + w]; } else { ASSERT_EQ(pixel_size_, 2); const uint16_t *const src = reinterpret_cast(src_); const uint16_t *const dst = reinterpret_cast(dst_); diff = dst[h * stride_ + w] - src[h * stride_ + w]; } const uint32_t error = diff * diff; if (max_error < error) max_error = error; total_error += error; } } } EXPECT_GE(static_cast(limit), max_error) << "Error: 4x4 FHT/IHT has an individual round trip error > " << limit; EXPECT_GE(count_test_block * limit, total_error) << "Error: 4x4 FHT/IHT has average round trip error > " << limit << " per block"; } void RunCoeffCheck() { ACMRandom rnd(ACMRandom::DeterministicSeed()); const int count_test_block = 5000; Buffer input_block = Buffer(size_, size_, 8, size_ == 4 ? 0 : 16); ASSERT_TRUE(input_block.Init()); Buffer output_ref_block = Buffer(size_, size_, 0); ASSERT_TRUE(output_ref_block.Init()); Buffer output_block = Buffer(size_, size_, 0, 16); ASSERT_TRUE(output_block.Init()); for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with input range [-max_pixel_value_, // max_pixel_value_]. input_block.Set(&rnd, -max_pixel_value_, max_pixel_value_); fwd_txfm_ref(input_block, &output_ref_block, size_, tx_type_); ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, &output_block)); // The minimum quant value is 4. EXPECT_TRUE(output_block.CheckValues(output_ref_block)); if (::testing::Test::HasFailure()) { printf("Size: %d Transform type: %d\n", size_, tx_type_); output_block.PrintDifference(output_ref_block); return; } } } void RunMemCheck() { ACMRandom rnd(ACMRandom::DeterministicSeed()); const int count_test_block = 5000; Buffer input_extreme_block = Buffer(size_, size_, 8, size_ == 4 ? 0 : 16); ASSERT_TRUE(input_extreme_block.Init()); Buffer output_ref_block = Buffer(size_, size_, 0); ASSERT_TRUE(output_ref_block.Init()); Buffer output_block = Buffer(size_, size_, 0, 16); ASSERT_TRUE(output_block.Init()); for (int i = 0; i < count_test_block; ++i) { // Initialize a test block with -max_pixel_value_ or max_pixel_value_. if (i == 0) { input_extreme_block.Set(max_pixel_value_); } else if (i == 1) { input_extreme_block.Set(-max_pixel_value_); } else { for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { input_extreme_block .TopLeftPixel()[h * input_extreme_block.stride() + w] = rnd.Rand8() % 2 ? max_pixel_value_ : -max_pixel_value_; } } } fwd_txfm_ref(input_extreme_block, &output_ref_block, size_, tx_type_); ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, &output_block)); // The minimum quant value is 4. EXPECT_TRUE(output_block.CheckValues(output_ref_block)); for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { EXPECT_GE( 4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block.TopLeftPixel()[h * output_block.stride() + w])) << "Error: 4x4 FDCT has coefficient larger than " "4*DCT_MAX_VALUE" << " at " << w << "," << h; if (::testing::Test::HasFailure()) { printf("Size: %d Transform type: %d\n", size_, tx_type_); output_block.DumpBuffer(); return; } } } } } void RunInvAccuracyCheck(int limit) { ACMRandom rnd(ACMRandom::DeterministicSeed()); const int count_test_block = 1000; Buffer in = Buffer(size_, size_, 4); ASSERT_TRUE(in.Init()); Buffer coeff = Buffer(size_, size_, 0, 16); ASSERT_TRUE(coeff.Init()); Buffer dst = Buffer(size_, size_, 0, 16); ASSERT_TRUE(dst.Init()); Buffer src = Buffer(size_, size_, 0); ASSERT_TRUE(src.Init()); Buffer dst16 = Buffer(size_, size_, 0, 16); ASSERT_TRUE(dst16.Init()); Buffer src16 = Buffer(size_, size_, 0); ASSERT_TRUE(src16.Init()); for (int i = 0; i < count_test_block; ++i) { InitMem(); // Initialize a test block with input range [-max_pixel_value_, // max_pixel_value_]. for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { if (pixel_size_ == 1) { in.TopLeftPixel()[h * in.stride() + w] = src_[h * stride_ + w] - dst_[h * stride_ + w]; } else { ASSERT_EQ(pixel_size_, 2); const uint16_t *const src = reinterpret_cast(src_); const uint16_t *const dst = reinterpret_cast(dst_); in.TopLeftPixel()[h * in.stride() + w] = src[h * stride_ + w] - dst[h * stride_ + w]; } } } fwd_txfm_ref(in, &coeff, size_, tx_type_); ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst_)); for (int h = 0; h < size_; ++h) { for (int w = 0; w < size_; ++w) { int diff; if (pixel_size_ == 1) { diff = dst_[h * stride_ + w] - src_[h * stride_ + w]; } else { ASSERT_EQ(pixel_size_, 2); const uint16_t *const src = reinterpret_cast(src_); const uint16_t *const dst = reinterpret_cast(dst_); diff = dst[h * stride_ + w] - src[h * stride_ + w]; } const uint32_t error = diff * diff; EXPECT_GE(static_cast(limit), error) << "Error: " << size_ << "x" << size_ << " IDCT has error " << error << " at " << w << "," << h; } } } } FhtFunc fwd_txfm_; FhtFuncRef fwd_txfm_ref; IhtWithBdFunc inv_txfm_; ACMRandom rnd_; uint8_t *src_; uint8_t *dst_; vpx_bit_depth_t bit_depth_; int tx_type_; int max_pixel_value_; int size_; int stride_; int pixel_size_; int block_size_; }; /* -------------------------------------------------------------------------- */ class TransDCT : public TransTestBase { public: TransDCT() { fwd_txfm_ref = fdct_ref; } }; TEST_P(TransDCT, AccuracyCheck) { RunAccuracyCheck(1); } TEST_P(TransDCT, CoeffCheck) { RunCoeffCheck(); } TEST_P(TransDCT, MemCheck) { RunMemCheck(); } TEST_P(TransDCT, InvAccuracyCheck) { RunInvAccuracyCheck(1); } /* TODO:(johannkoenig) Determine why these fail AccuracyCheck make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_12, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_12, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_12, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_12, 2), */ const DctParam c_dct_tests[] = { #if CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_12, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_12, 2), #endif // CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &idct_wrapper, 32, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1) }; INSTANTIATE_TEST_CASE_P(C, TransDCT, ::testing::ValuesIn(c_dct_tests)); #if !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 const DctParam sse2_dct_tests[] = { #if CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 32, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 16, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 8, 0, VPX_BITS_12, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_12, 2), #endif // CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &idct_wrapper, 32, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1) }; INSTANTIATE_TEST_CASE_P(SSE2, TransDCT, ::testing::ValuesIn(sse2_dct_tests)); #endif // HAVE_SSE2 #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64 // TODO(johannkoenig): high bit depth fdct8x8. INSTANTIATE_TEST_CASE_P( SSSE3, TransDCT, ::testing::Values( // vpx_fdct8x8_ssse3 is only available in 64 bit builds. make_tuple(&fdct_wrapper, &idct_wrapper, 8, 0, VPX_BITS_8, 1))); #endif // HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH && ARCH_X86_64 #if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH // TODO(johannkoenig): high bit depth fdct32x32. INSTANTIATE_TEST_CASE_P( AVX2, TransDCT, ::testing::Values(make_tuple(&fdct_wrapper, &idct_wrapper, 32, 0, VPX_BITS_8, 1))); #endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_NEON INSTANTIATE_TEST_CASE_P( NEON, TransDCT, ::testing::Values(make_tuple(&fdct_wrapper, &idct_wrapper, 32, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1))); #endif // HAVE_NEON #if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH INSTANTIATE_TEST_CASE_P( MSA, TransDCT, ::testing::Values(make_tuple(&fdct_wrapper, &idct_wrapper, 32, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1))); #endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH #if HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH INSTANTIATE_TEST_CASE_P( VSX, TransDCT, ::testing::Values(make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1))); #endif // HAVE_VSX && !CONFIG_VP9_HIGHBITDEPTH && #endif // !CONFIG_EMULATE_HARDWARE /* -------------------------------------------------------------------------- */ class TransHT : public TransTestBase { public: TransHT() { fwd_txfm_ref = fht_ref; } }; TEST_P(TransHT, AccuracyCheck) { RunAccuracyCheck(1); } TEST_P(TransHT, CoeffCheck) { RunCoeffCheck(); } TEST_P(TransHT, MemCheck) { RunMemCheck(); } TEST_P(TransHT, InvAccuracyCheck) { RunInvAccuracyCheck(1); } /* TODO:(johannkoenig) Determine why these fail AccuracyCheck make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 0, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 1, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 2, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 3, VPX_BITS_12, 2), */ const DctParam c_ht_tests[] = { #if CONFIG_VP9_HIGHBITDEPTH make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 0, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 1, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 2, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 3, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 0, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 1, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 2, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht16x16_c, &highbd_iht_wrapper, 16, 3, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 0, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 1, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 2, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 3, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 0, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 1, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 2, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 3, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 0, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 1, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 2, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht8x8_c, &highbd_iht_wrapper, 8, 3, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_12, 2), #endif // CONFIG_VP9_HIGHBITDEPTH make_tuple(&vp9_fht16x16_c, &iht_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_c, &iht_wrapper, 16, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_c, &iht_wrapper, 16, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_c, &iht_wrapper, 16, 3, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_c, &iht_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_c, &iht_wrapper, 8, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_c, &iht_wrapper, 8, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_c, &iht_wrapper, 8, 3, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_c, &iht_wrapper, 4, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_c, &iht_wrapper, 4, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_c, &iht_wrapper, 4, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_c, &iht_wrapper, 4, 3, VPX_BITS_8, 1) }; INSTANTIATE_TEST_CASE_P(C, TransHT, ::testing::ValuesIn(c_ht_tests)); #if !CONFIG_EMULATE_HARDWARE #if HAVE_SSE2 INSTANTIATE_TEST_CASE_P( SSE2, TransHT, ::testing::Values( make_tuple(&vp9_fht16x16_sse2, &iht_wrapper, 16, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_sse2, &iht_wrapper, 16, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_sse2, &iht_wrapper, 16, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht16x16_sse2, &iht_wrapper, 16, 3, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_sse2, &iht_wrapper, 8, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_sse2, &iht_wrapper, 8, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_sse2, &iht_wrapper, 8, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht8x8_sse2, &iht_wrapper, 8, 3, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_sse2, &iht_wrapper, 4, 0, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_sse2, &iht_wrapper, 4, 1, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_sse2, &iht_wrapper, 4, 2, VPX_BITS_8, 1), make_tuple(&vp9_fht4x4_sse2, &iht_wrapper, 4, 3, VPX_BITS_8, 1))); #endif // HAVE_SSE2 #if HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH INSTANTIATE_TEST_CASE_P( SSE4_1, TransHT, ::testing::Values( make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_8, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_10, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 0, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 1, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 2, VPX_BITS_12, 2), make_tuple(&vp9_highbd_fht4x4_c, &highbd_iht_wrapper, 4, 3, VPX_BITS_12, 2))); #endif // HAVE_SSE4_1 && CONFIG_VP9_HIGHBITDEPTH #endif // !CONFIG_EMULATE_HARDWARE /* -------------------------------------------------------------------------- */ class TransWHT : public TransTestBase { public: TransWHT() { fwd_txfm_ref = fwht_ref; } }; TEST_P(TransWHT, AccuracyCheck) { RunAccuracyCheck(0); } TEST_P(TransWHT, CoeffCheck) { RunCoeffCheck(); } TEST_P(TransWHT, MemCheck) { RunMemCheck(); } TEST_P(TransWHT, InvAccuracyCheck) { RunInvAccuracyCheck(0); } const DctParam c_wht_tests[] = { #if CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_8, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_10, 2), make_tuple(&fdct_wrapper, &highbd_idct_wrapper, 4, 0, VPX_BITS_12, 2), #endif // CONFIG_VP9_HIGHBITDEPTH make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1) }; INSTANTIATE_TEST_CASE_P(C, TransWHT, ::testing::ValuesIn(c_wht_tests)); #if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE INSTANTIATE_TEST_CASE_P( SSE2, TransWHT, ::testing::Values(make_tuple(&fdct_wrapper, &idct_wrapper, 4, 0, VPX_BITS_8, 1))); #endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE } // namespace