diff options
Diffstat (limited to 'media/libaom/src/test/av1_highbd_iht_test.cc')
-rw-r--r-- | media/libaom/src/test/av1_highbd_iht_test.cc | 79 |
1 files changed, 63 insertions, 16 deletions
diff --git a/media/libaom/src/test/av1_highbd_iht_test.cc b/media/libaom/src/test/av1_highbd_iht_test.cc index 2d6490c2ad..8fea500db9 100644 --- a/media/libaom/src/test/av1_highbd_iht_test.cc +++ b/media/libaom/src/test/av1_highbd_iht_test.cc @@ -9,6 +9,8 @@ * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ +#include <tuple> + #include "third_party/googletest/src/googletest/include/gtest/gtest.h" #include "config/av1_rtcd.h" @@ -25,15 +27,32 @@ namespace { -using ::testing::tuple; using libaom_test::ACMRandom; +using std::tuple; typedef void (*HbdHtFunc)(const int16_t *input, int32_t *output, int stride, TX_TYPE tx_type, int bd); typedef void (*IHbdHtFunc)(const int32_t *coeff, uint16_t *output, int stride, TX_TYPE tx_type, int bd); - +static const char *tx_type_name[] = { + "DCT_DCT", + "ADST_DCT", + "DCT_ADST", + "ADST_ADST", + "FLIPADST_DCT", + "DCT_FLIPADST", + "FLIPADST_FLIPADST", + "ADST_FLIPADST", + "FLIPADST_ADST", + "IDTX", + "V_DCT", + "H_DCT", + "V_ADST", + "H_ADST", + "V_FLIPADST", + "H_FLIPADST", +}; // Test parameter argument list: // <transform reference function, // optimized inverse transform function, @@ -138,7 +157,7 @@ void AV1HighbdInvHTNxN::RunBitexactCheck() { TEST_P(AV1HighbdInvHTNxN, InvTransResultCheck) { RunBitexactCheck(); } -using ::testing::make_tuple; +using std::make_tuple; #if HAVE_SSE4_1 #define PARAM_LIST_4X4 \ @@ -167,27 +186,28 @@ const IHbdHtParam kArrayIhtParam[] = { make_tuple(PARAM_LIST_4X4, FLIPADST_ADST, 12), }; -INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdInvHTNxN, - ::testing::ValuesIn(kArrayIhtParam)); +INSTANTIATE_TEST_SUITE_P(SSE4_1, AV1HighbdInvHTNxN, + ::testing::ValuesIn(kArrayIhtParam)); #endif // HAVE_SSE4_1 typedef void (*HighbdInvTxfm2dFunc)(const int32_t *input, uint8_t *output, int stride, const TxfmParam *txfm_param); -typedef ::testing::tuple<const HighbdInvTxfm2dFunc> AV1HighbdInvTxfm2dParam; +typedef std::tuple<const HighbdInvTxfm2dFunc> AV1HighbdInvTxfm2dParam; class AV1HighbdInvTxfm2d : public ::testing::TestWithParam<AV1HighbdInvTxfm2dParam> { public: virtual void SetUp() { target_func_ = GET_PARAM(0); } void RunAV1InvTxfm2dTest(TX_TYPE tx_type, TX_SIZE tx_size, int run_times, - int bit_depth); + int bit_depth, int gt_int16 = 0); private: HighbdInvTxfm2dFunc target_func_; }; void AV1HighbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type_, TX_SIZE tx_size_, - int run_times, int bit_depth_) { + int run_times, int bit_depth_, + int gt_int16) { FwdTxfm2dFunc fwd_func_ = libaom_test::fwd_txfm_func_ls[tx_size_]; TxfmParam txfm_param; const int BLK_WIDTH = 64; @@ -234,8 +254,15 @@ void AV1HighbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type_, TX_SIZE tx_size_, inv_input[scan[i]] = 0; } txfm_param.eob = eob; - aom_usec_timer ref_timer, test_timer; + if (gt_int16) { + const uint16_t inv_input_mask = + static_cast<uint16_t>((1 << (bit_depth_ + 7)) - 1); + for (int i = 0; i < eob; i++) { + inv_input[scan[i]] = (rnd.Rand31() & inv_input_mask); + } + } + aom_usec_timer ref_timer, test_timer; aom_usec_timer_start(&ref_timer); for (int i = 0; i < run_times; ++i) { av1_highbd_inv_txfm_add_c(inv_input, CONVERT_TO_BYTEPTR(ref_output), @@ -264,7 +291,8 @@ void AV1HighbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type_, TX_SIZE tx_size_, ASSERT_EQ(ref_output[r * stride + c], output[r * stride + c]) << "[" << r << "," << c << "] " << cnt << " tx_size: " << static_cast<int>(tx_size_) - << " tx_type: " << tx_type_ << " eob " << eob; + << " bit_depth_: " << bit_depth_ + << " tx_type: " << tx_type_name[tx_type_] << " eob " << eob; } } } @@ -272,8 +300,8 @@ void AV1HighbdInvTxfm2d::RunAV1InvTxfm2dTest(TX_TYPE tx_type_, TX_SIZE tx_size_, } TEST_P(AV1HighbdInvTxfm2d, match) { - int bitdepth_ar[2] = { 10, 12 }; - for (int k = 0; k < 2; ++k) { + int bitdepth_ar[3] = { 8, 10, 12 }; + for (int k = 0; k < 3; ++k) { int bd = bitdepth_ar[k]; for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) { for (int i = 0; i < (int)TX_TYPES; ++i) { @@ -287,6 +315,25 @@ TEST_P(AV1HighbdInvTxfm2d, match) { } } +TEST_P(AV1HighbdInvTxfm2d, gt_int16) { + int bitdepth_ar[3] = { 8, 10, 12 }; + static const TX_TYPE types[] = { + DCT_DCT, ADST_DCT, FLIPADST_DCT, IDTX, V_DCT, H_DCT, H_ADST, H_FLIPADST + }; + for (int k = 0; k < 3; ++k) { + int bd = bitdepth_ar[k]; + for (int j = 0; j < (int)(TX_SIZES_ALL); ++j) { + const TX_SIZE sz = static_cast<TX_SIZE>(j); + for (uint8_t i = 0; i < sizeof(types) / sizeof(TX_TYPE); ++i) { + const TX_TYPE tp = types[i]; + if (libaom_test::IsTxSizeTypeValid(sz, tp)) { + RunAV1InvTxfm2dTest(tp, sz, 1, bd, 1); + } + } + } + } +} + TEST_P(AV1HighbdInvTxfm2d, DISABLED_Speed) { int bitdepth_ar[2] = { 10, 12 }; for (int k = 0; k < 2; ++k) { @@ -304,12 +351,12 @@ TEST_P(AV1HighbdInvTxfm2d, DISABLED_Speed) { } #if HAVE_SSE4_1 -INSTANTIATE_TEST_CASE_P(SSE4_1, AV1HighbdInvTxfm2d, - ::testing::Values(av1_highbd_inv_txfm_add_sse4_1)); +INSTANTIATE_TEST_SUITE_P(SSE4_1, AV1HighbdInvTxfm2d, + ::testing::Values(av1_highbd_inv_txfm_add_sse4_1)); #endif #if HAVE_AVX2 -INSTANTIATE_TEST_CASE_P(AVX2, AV1HighbdInvTxfm2d, - ::testing::Values(av1_highbd_inv_txfm_add_avx2)); +INSTANTIATE_TEST_SUITE_P(AVX2, AV1HighbdInvTxfm2d, + ::testing::Values(av1_highbd_inv_txfm_add_avx2)); #endif } // namespace |