Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 1 | /* |
Yaowu Xu | bde4ac8 | 2016-11-28 15:26:06 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 3 | * |
Yaowu Xu | bde4ac8 | 2016-11-28 15:26:06 -0800 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
Tom Finegan | 7a07ece | 2017-02-07 17:14:05 -0800 | [diff] [blame] | 12 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 13 | |
| 14 | #include "./aom_dsp_rtcd.h" |
| 15 | #include "./av1_rtcd.h" |
| 16 | |
| 17 | #include "aom_ports/mem.h" |
| 18 | #include "test/acm_random.h" |
| 19 | #include "test/clear_system_state.h" |
| 20 | #include "test/register_state_check.h" |
| 21 | #include "test/transform_test_base.h" |
| 22 | #include "test/util.h" |
| 23 | |
| 24 | using libaom_test::ACMRandom; |
| 25 | |
Monty Montgomery | 359854f | 2017-10-31 04:08:10 -0400 | [diff] [blame] | 26 | #if !CONFIG_DAALA_TX |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 27 | namespace { |
| 28 | typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 29 | const TxfmParam *txfm_param); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 30 | using std::tr1::tuple; |
| 31 | using libaom_test::FhtFunc; |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 32 | typedef tuple<FhtFunc, IhtFunc, TX_TYPE, aom_bit_depth_t, int> Ht16x8Param; |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 33 | |
Lester Lu | d8b1ddc | 2017-07-06 16:13:29 -0700 | [diff] [blame] | 34 | void fht16x8_ref(const int16_t *in, tran_low_t *out, int stride, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 35 | TxfmParam *txfm_param) { |
| 36 | av1_fht16x8_c(in, out, stride, txfm_param); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 37 | } |
| 38 | |
Lester Lu | d8b1ddc | 2017-07-06 16:13:29 -0700 | [diff] [blame] | 39 | void iht16x8_ref(const tran_low_t *in, uint8_t *out, int stride, |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 40 | const TxfmParam *txfm_param) { |
| 41 | av1_iht16x8_128_add_c(in, out, stride, txfm_param); |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 42 | } |
| 43 | |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 44 | class AV1Trans16x8HT : public libaom_test::TransformTestBase, |
| 45 | public ::testing::TestWithParam<Ht16x8Param> { |
| 46 | public: |
| 47 | virtual ~AV1Trans16x8HT() {} |
| 48 | |
| 49 | virtual void SetUp() { |
| 50 | fwd_txfm_ = GET_PARAM(0); |
| 51 | inv_txfm_ = GET_PARAM(1); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 52 | pitch_ = 16; |
David Barker | 7825022 | 2016-10-13 15:10:14 +0100 | [diff] [blame] | 53 | height_ = 8; |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 54 | inv_txfm_ref = iht16x8_ref; |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 55 | fwd_txfm_ref = fht16x8_ref; |
| 56 | bit_depth_ = GET_PARAM(3); |
| 57 | mask_ = (1 << bit_depth_) - 1; |
| 58 | num_coeffs_ = GET_PARAM(4); |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 59 | txfm_param_.tx_type = GET_PARAM(2); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 60 | } |
| 61 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
| 62 | |
| 63 | protected: |
| 64 | void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 65 | fwd_txfm_(in, out, stride, &txfm_param_); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
Lester Lu | 27319b6 | 2017-07-10 16:57:15 -0700 | [diff] [blame] | 69 | inv_txfm_(out, dst, stride, &txfm_param_); |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | FhtFunc fwd_txfm_; |
| 73 | IhtFunc inv_txfm_; |
| 74 | }; |
| 75 | |
Angie Chiang | e6aece8 | 2017-01-09 17:27:56 -0800 | [diff] [blame] | 76 | TEST_P(AV1Trans16x8HT, AccuracyCheck) { RunAccuracyCheck(1, 0.001); } |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 77 | TEST_P(AV1Trans16x8HT, CoeffCheck) { RunCoeffCheck(); } |
Yi Luo | 63bd6dc | 2016-11-17 09:13:39 -0800 | [diff] [blame] | 78 | TEST_P(AV1Trans16x8HT, MemCheck) { RunMemCheck(); } |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 79 | TEST_P(AV1Trans16x8HT, InvCoeffCheck) { RunInvCoeffCheck(); } |
Debargha Mukherjee | f0aa420 | 2016-12-12 15:40:24 -0800 | [diff] [blame] | 80 | TEST_P(AV1Trans16x8HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); } |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 81 | |
| 82 | using std::tr1::make_tuple; |
| 83 | |
Debargha Mukherjee | f0aa420 | 2016-12-12 15:40:24 -0800 | [diff] [blame] | 84 | const Ht16x8Param kArrayHt16x8Param_c[] = { |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 85 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, DCT_DCT, AOM_BITS_8, 128), |
| 86 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, ADST_DCT, AOM_BITS_8, 128), |
| 87 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, DCT_ADST, AOM_BITS_8, 128), |
| 88 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, ADST_ADST, AOM_BITS_8, |
| 89 | 128), |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 90 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, FLIPADST_DCT, AOM_BITS_8, |
| 91 | 128), |
| 92 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, DCT_FLIPADST, AOM_BITS_8, |
| 93 | 128), |
| 94 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, FLIPADST_FLIPADST, |
| 95 | AOM_BITS_8, 128), |
| 96 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, ADST_FLIPADST, AOM_BITS_8, |
| 97 | 128), |
| 98 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, FLIPADST_ADST, AOM_BITS_8, |
| 99 | 128), |
| 100 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, IDTX, AOM_BITS_8, 128), |
| 101 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, V_DCT, AOM_BITS_8, 128), |
| 102 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, H_DCT, AOM_BITS_8, 128), |
| 103 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, V_ADST, AOM_BITS_8, 128), |
| 104 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, H_ADST, AOM_BITS_8, 128), |
| 105 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, V_FLIPADST, AOM_BITS_8, |
| 106 | 128), |
| 107 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, H_FLIPADST, AOM_BITS_8, |
| 108 | 128) |
Debargha Mukherjee | f0aa420 | 2016-12-12 15:40:24 -0800 | [diff] [blame] | 109 | }; |
| 110 | INSTANTIATE_TEST_CASE_P(C, AV1Trans16x8HT, |
| 111 | ::testing::ValuesIn(kArrayHt16x8Param_c)); |
| 112 | |
Sebastien Alaiwan | c6a48a2 | 2017-04-20 10:12:43 +0200 | [diff] [blame] | 113 | #if HAVE_SSE2 |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 114 | const Ht16x8Param kArrayHt16x8Param_sse2[] = { |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 115 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, DCT_DCT, AOM_BITS_8, |
| 116 | 128), |
| 117 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, ADST_DCT, AOM_BITS_8, |
| 118 | 128), |
| 119 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, DCT_ADST, AOM_BITS_8, |
| 120 | 128), |
| 121 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, ADST_ADST, |
| 122 | AOM_BITS_8, 128), |
Urvang Joshi | 2283d37 | 2017-10-02 17:16:45 -0700 | [diff] [blame] | 123 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, FLIPADST_DCT, |
| 124 | AOM_BITS_8, 128), |
| 125 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, DCT_FLIPADST, |
| 126 | AOM_BITS_8, 128), |
| 127 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, FLIPADST_FLIPADST, |
| 128 | AOM_BITS_8, 128), |
| 129 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, ADST_FLIPADST, |
| 130 | AOM_BITS_8, 128), |
| 131 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, FLIPADST_ADST, |
| 132 | AOM_BITS_8, 128), |
| 133 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, IDTX, AOM_BITS_8, |
| 134 | 128), |
| 135 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, V_DCT, AOM_BITS_8, |
| 136 | 128), |
| 137 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, H_DCT, AOM_BITS_8, |
| 138 | 128), |
| 139 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, V_ADST, AOM_BITS_8, |
| 140 | 128), |
| 141 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, H_ADST, AOM_BITS_8, |
| 142 | 128), |
| 143 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, V_FLIPADST, |
| 144 | AOM_BITS_8, 128), |
| 145 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, H_FLIPADST, |
| 146 | AOM_BITS_8, 128) |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 147 | }; |
Yi Luo | f10cba2 | 2016-12-14 13:54:47 -0800 | [diff] [blame] | 148 | INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans16x8HT, |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 149 | ::testing::ValuesIn(kArrayHt16x8Param_sse2)); |
Sebastien Alaiwan | c6a48a2 | 2017-04-20 10:12:43 +0200 | [diff] [blame] | 150 | #endif // HAVE_SSE2 |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 151 | |
| 152 | } // namespace |
Monty Montgomery | 359854f | 2017-10-31 04:08:10 -0400 | [diff] [blame] | 153 | |
| 154 | #endif // !CONFIG_DAALA_TX |