diff options
Diffstat (limited to 'third_party/aom/test/dct16x16_test.cc')
-rw-r--r-- | third_party/aom/test/dct16x16_test.cc | 121 |
1 files changed, 58 insertions, 63 deletions
diff --git a/third_party/aom/test/dct16x16_test.cc b/third_party/aom/test/dct16x16_test.cc index 89263ce89..c2c072494 100644 --- a/third_party/aom/test/dct16x16_test.cc +++ b/third_party/aom/test/dct16x16_test.cc @@ -226,9 +226,9 @@ void reference_16x16_dct_2d(int16_t input[256], double output[256]) { 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); + TxfmParam *txfm_param); typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, - int tx_type); + const TxfmParam *txfm_param); typedef std::tr1::tuple<FdctFunc, IdctFunc, int, aom_bit_depth_t> Dct16x16Param; typedef std::tr1::tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t> Ht16x16Param; @@ -236,31 +236,46 @@ typedef std::tr1::tuple<IdctFunc, IdctFunc, int, aom_bit_depth_t> Idct16x16Param; void fdct16x16_ref(const int16_t *in, tran_low_t *out, int stride, - int /*tx_type*/) { + TxfmParam * /*txfm_param*/) { aom_fdct16x16_c(in, out, stride); } void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride, - int /*tx_type*/) { + const TxfmParam * /*txfm_param*/) { aom_idct16x16_256_add_c(in, dest, stride); } -void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { - av1_fht16x16_c(in, out, stride, tx_type); +void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, + TxfmParam *txfm_param) { + av1_fht16x16_c(in, out, stride, txfm_param); } void iht16x16_ref(const tran_low_t *in, uint8_t *dest, int stride, - int tx_type) { - av1_iht16x16_256_add_c(in, dest, stride, tx_type); + const TxfmParam *txfm_param) { + av1_iht16x16_256_add_c(in, dest, stride, txfm_param); } #if CONFIG_HIGHBITDEPTH -void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { - av1_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 10); +void fht16x16_10(const int16_t *in, tran_low_t *out, int stride, + TxfmParam *txfm_param) { + av1_fwd_txfm2d_16x16_c(in, out, stride, txfm_param->tx_type, 10); } -void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { - av1_highbd_iht16x16_256_add_c(in, out, stride, tx_type, 12); +void fht16x16_12(const int16_t *in, tran_low_t *out, int stride, + TxfmParam *txfm_param) { + av1_fwd_txfm2d_16x16_c(in, out, stride, txfm_param->tx_type, 12); +} + +void iht16x16_10(const tran_low_t *in, uint8_t *out, int stride, + const TxfmParam *txfm_param) { + av1_inv_txfm2d_add_16x16_c(in, CONVERT_TO_SHORTPTR(out), stride, + txfm_param->tx_type, 10); +} + +void iht16x16_12(const tran_low_t *in, uint8_t *out, int stride, + const TxfmParam *txfm_param) { + av1_inv_txfm2d_add_16x16_c(in, CONVERT_TO_SHORTPTR(out), stride, + txfm_param->tx_type, 12); } #endif // CONFIG_HIGHBITDEPTH @@ -346,7 +361,7 @@ class Trans16x16TestBase { for (int j = 0; j < kNumCoeffs; ++j) input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); - fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); + fwd_txfm_ref(input_block, output_ref_block, pitch_, &txfm_param_); ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); // The minimum quant value is 4. @@ -373,7 +388,7 @@ class Trans16x16TestBase { for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_; } - fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); + fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, &txfm_param_); ASM_REGISTER_STATE_CHECK( RunFwdTxfm(input_extreme_block, output_block, pitch_)); @@ -409,7 +424,7 @@ class Trans16x16TestBase { if (i == 1) for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_; - fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); + fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, &txfm_param_); // clear reconstructed pixel buffers memset(dst, 0, kNumCoeffs * sizeof(uint8_t)); @@ -424,12 +439,12 @@ class Trans16x16TestBase { for (int j = 1; j < kNumCoeffs; ++j) output_ref_block[j] = (output_ref_block[j] / ac_thred) * ac_thred; if (bit_depth_ == AOM_BITS_8) { - inv_txfm_ref(output_ref_block, ref, pitch_, tx_type_); + inv_txfm_ref(output_ref_block, ref, pitch_, &txfm_param_); ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block, dst, pitch_)); #if CONFIG_HIGHBITDEPTH } else { inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_, - tx_type_); + &txfm_param_); ASM_REGISTER_STATE_CHECK( RunInvTxfm(output_ref_block, CONVERT_TO_BYTEPTR(dst16), pitch_)); #endif @@ -558,11 +573,11 @@ class Trans16x16TestBase { } int pitch_; - int tx_type_; aom_bit_depth_t bit_depth_; int mask_; FhtFunc fwd_txfm_ref; IhtFunc inv_txfm_ref; + TxfmParam txfm_param_; }; class Trans16x16DCT : public Trans16x16TestBase, @@ -573,13 +588,13 @@ class Trans16x16DCT : public Trans16x16TestBase, virtual void SetUp() { fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); - tx_type_ = GET_PARAM(2); bit_depth_ = GET_PARAM(3); pitch_ = 16; fwd_txfm_ref = fdct16x16_ref; inv_txfm_ref = idct16x16_ref; mask_ = (1 << bit_depth_) - 1; inv_txfm_ref = idct16x16_ref; + txfm_param_.tx_type = GET_PARAM(2); } virtual void TearDown() { libaom_test::ClearSystemState(); } @@ -617,19 +632,27 @@ class Trans16x16HT : public Trans16x16TestBase, virtual void SetUp() { fwd_txfm_ = GET_PARAM(0); inv_txfm_ = GET_PARAM(1); - tx_type_ = GET_PARAM(2); bit_depth_ = GET_PARAM(3); pitch_ = 16; - fwd_txfm_ref = fht16x16_ref; - inv_txfm_ref = iht16x16_ref; mask_ = (1 << bit_depth_) - 1; + txfm_param_.tx_type = GET_PARAM(2); #if CONFIG_HIGHBITDEPTH switch (bit_depth_) { - case AOM_BITS_10: inv_txfm_ref = iht16x16_10; break; - case AOM_BITS_12: inv_txfm_ref = iht16x16_12; break; - default: inv_txfm_ref = iht16x16_ref; break; + case AOM_BITS_10: + fwd_txfm_ref = fht16x16_10; + inv_txfm_ref = iht16x16_10; + break; + case AOM_BITS_12: + fwd_txfm_ref = fht16x16_12; + inv_txfm_ref = iht16x16_12; + break; + default: + fwd_txfm_ref = fht16x16_ref; + inv_txfm_ref = iht16x16_ref; + break; } #else + fwd_txfm_ref = fht16x16_ref; inv_txfm_ref = iht16x16_ref; #endif } @@ -637,10 +660,10 @@ class Trans16x16HT : public Trans16x16TestBase, protected: void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) { - fwd_txfm_(in, out, stride, tx_type_); + fwd_txfm_(in, out, stride, &txfm_param_); } void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) { - inv_txfm_(out, dst, stride, tx_type_); + inv_txfm_(out, dst, stride, &txfm_param_); } FhtFunc fwd_txfm_; @@ -767,23 +790,18 @@ INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT, INSTANTIATE_TEST_CASE_P( C, Trans16x16HT, ::testing::Values( - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 0, AOM_BITS_10), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 1, AOM_BITS_10), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 2, AOM_BITS_10), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_10, 3, AOM_BITS_10), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 0, AOM_BITS_12), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 1, AOM_BITS_12), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 2, AOM_BITS_12), - make_tuple(&av1_highbd_fht16x16_c, &iht16x16_12, 3, AOM_BITS_12), + make_tuple(&fht16x16_10, &iht16x16_10, 0, AOM_BITS_10), + make_tuple(&fht16x16_10, &iht16x16_10, 1, AOM_BITS_10), + make_tuple(&fht16x16_10, &iht16x16_10, 2, AOM_BITS_10), + make_tuple(&fht16x16_10, &iht16x16_10, 3, AOM_BITS_10), + make_tuple(&fht16x16_12, &iht16x16_12, 0, AOM_BITS_12), + make_tuple(&fht16x16_12, &iht16x16_12, 1, AOM_BITS_12), + make_tuple(&fht16x16_12, &iht16x16_12, 2, AOM_BITS_12), + make_tuple(&fht16x16_12, &iht16x16_12, 3, AOM_BITS_12), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 0, AOM_BITS_8), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 1, AOM_BITS_8), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 2, AOM_BITS_8), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 3, AOM_BITS_8))); -INSTANTIATE_TEST_CASE_P( - C, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_highbd_fdct16x16_1_c, AOM_BITS_8), - make_tuple(&aom_highbd_fdct16x16_1_c, AOM_BITS_10), - make_tuple(&aom_highbd_fdct16x16_1_c, AOM_BITS_12))); #else INSTANTIATE_TEST_CASE_P( C, Trans16x16HT, @@ -792,9 +810,6 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 1, AOM_BITS_8), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 2, AOM_BITS_8), make_tuple(&av1_fht16x16_c, &av1_iht16x16_256_add_c, 3, AOM_BITS_8))); -INSTANTIATE_TEST_CASE_P(C, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_fdct16x16_1_c, - AOM_BITS_8))); #endif // CONFIG_HIGHBITDEPTH #if HAVE_NEON_ASM && !CONFIG_HIGHBITDEPTH @@ -819,17 +834,8 @@ INSTANTIATE_TEST_CASE_P( 2, AOM_BITS_8), make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_sse2, 3, AOM_BITS_8))); -INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_fdct16x16_1_sse2, - AOM_BITS_8))); #endif // HAVE_SSE2 && !CONFIG_HIGHBITDEPTH -#if HAVE_AVX2 && !CONFIG_HIGHBITDEPTH -INSTANTIATE_TEST_CASE_P(AVX2, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_fdct16x16_1_avx2, - AOM_BITS_8))); -#endif // HAVE_AVX2 && !CONFIG_HIGHBITDEPTH - #if HAVE_SSE2 && CONFIG_HIGHBITDEPTH INSTANTIATE_TEST_CASE_P(SSE2, Trans16x16DCT, ::testing::Values(make_tuple(&aom_fdct16x16_sse2, @@ -843,14 +849,6 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 2, AOM_BITS_8), make_tuple(&av1_fht16x16_sse2, &av1_iht16x16_256_add_c, 3, AOM_BITS_8))); -// TODO(luoyi): -// For this test case, we should test function: aom_highbd_fdct16x16_1_sse2. -// However this function is not available yet. if we mistakely test -// aom_fdct16x16_1_sse2, it could only pass AOM_BITS_8/AOM_BITS_10 but not -// AOM_BITS_12. -INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_fdct16x16_1_sse2, - AOM_BITS_8))); #endif // HAVE_SSE2 && CONFIG_HIGHBITDEPTH #if HAVE_MSA && !CONFIG_HIGHBITDEPTH @@ -869,8 +867,5 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&av1_fht16x16_msa, &av1_iht16x16_256_add_msa, 3, AOM_BITS_8))); #endif // !CONFIG_EXT_TX -INSTANTIATE_TEST_CASE_P(MSA, PartialTrans16x16Test, - ::testing::Values(make_tuple(&aom_fdct16x16_1_msa, - AOM_BITS_8))); #endif // HAVE_MSA && !CONFIG_HIGHBITDEPTH } // namespace |