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 | |
| 26 | namespace { |
| 27 | typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
| 28 | int tx_type); |
| 29 | using std::tr1::tuple; |
| 30 | using libaom_test::FhtFunc; |
| 31 | typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht16x8Param; |
| 32 | |
| 33 | void fht16x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { |
| 34 | av1_fht16x8_c(in, out, stride, tx_type); |
| 35 | } |
| 36 | |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 37 | void iht16x8_ref(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { |
| 38 | av1_iht16x8_128_add_c(in, out, stride, tx_type); |
| 39 | } |
| 40 | |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 41 | class AV1Trans16x8HT : public libaom_test::TransformTestBase, |
| 42 | public ::testing::TestWithParam<Ht16x8Param> { |
| 43 | public: |
| 44 | virtual ~AV1Trans16x8HT() {} |
| 45 | |
| 46 | virtual void SetUp() { |
| 47 | fwd_txfm_ = GET_PARAM(0); |
| 48 | inv_txfm_ = GET_PARAM(1); |
| 49 | tx_type_ = GET_PARAM(2); |
| 50 | pitch_ = 16; |
David Barker | 7825022 | 2016-10-13 15:10:14 +0100 | [diff] [blame] | 51 | height_ = 8; |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 52 | inv_txfm_ref = iht16x8_ref; |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 53 | fwd_txfm_ref = fht16x8_ref; |
| 54 | bit_depth_ = GET_PARAM(3); |
| 55 | mask_ = (1 << bit_depth_) - 1; |
| 56 | num_coeffs_ = GET_PARAM(4); |
| 57 | } |
| 58 | virtual void TearDown() { libaom_test::ClearSystemState(); } |
| 59 | |
| 60 | protected: |
| 61 | void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
| 62 | fwd_txfm_(in, out, stride, tx_type_); |
| 63 | } |
| 64 | |
| 65 | void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
| 66 | inv_txfm_(out, dst, stride, tx_type_); |
| 67 | } |
| 68 | |
| 69 | FhtFunc fwd_txfm_; |
| 70 | IhtFunc inv_txfm_; |
| 71 | }; |
| 72 | |
Angie Chiang | e6aece8 | 2017-01-09 17:27:56 -0800 | [diff] [blame] | 73 | TEST_P(AV1Trans16x8HT, AccuracyCheck) { RunAccuracyCheck(1, 0.001); } |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 74 | TEST_P(AV1Trans16x8HT, CoeffCheck) { RunCoeffCheck(); } |
Yi Luo | 63bd6dc | 2016-11-17 09:13:39 -0800 | [diff] [blame] | 75 | TEST_P(AV1Trans16x8HT, MemCheck) { RunMemCheck(); } |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 76 | TEST_P(AV1Trans16x8HT, InvCoeffCheck) { RunInvCoeffCheck(); } |
Debargha Mukherjee | f0aa420 | 2016-12-12 15:40:24 -0800 | [diff] [blame] | 77 | TEST_P(AV1Trans16x8HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); } |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 78 | |
| 79 | using std::tr1::make_tuple; |
| 80 | |
Debargha Mukherjee | f0aa420 | 2016-12-12 15:40:24 -0800 | [diff] [blame] | 81 | const Ht16x8Param kArrayHt16x8Param_c[] = { |
| 82 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 0, AOM_BITS_8, 128), |
| 83 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 1, AOM_BITS_8, 128), |
| 84 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 2, AOM_BITS_8, 128), |
| 85 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 3, AOM_BITS_8, 128), |
| 86 | #if CONFIG_EXT_TX |
| 87 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 4, AOM_BITS_8, 128), |
| 88 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 5, AOM_BITS_8, 128), |
| 89 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 6, AOM_BITS_8, 128), |
| 90 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 7, AOM_BITS_8, 128), |
| 91 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 8, AOM_BITS_8, 128), |
| 92 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 9, AOM_BITS_8, 128), |
| 93 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 10, AOM_BITS_8, 128), |
| 94 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 11, AOM_BITS_8, 128), |
| 95 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 12, AOM_BITS_8, 128), |
| 96 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 13, AOM_BITS_8, 128), |
| 97 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 14, AOM_BITS_8, 128), |
| 98 | make_tuple(&av1_fht16x8_c, &av1_iht16x8_128_add_c, 15, AOM_BITS_8, 128) |
| 99 | #endif // CONFIG_EXT_TX |
| 100 | }; |
| 101 | INSTANTIATE_TEST_CASE_P(C, AV1Trans16x8HT, |
| 102 | ::testing::ValuesIn(kArrayHt16x8Param_c)); |
| 103 | |
Sebastien Alaiwan | c6a48a2 | 2017-04-20 10:12:43 +0200 | [diff] [blame] | 104 | #if HAVE_SSE2 |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 105 | const Ht16x8Param kArrayHt16x8Param_sse2[] = { |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 106 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 0, AOM_BITS_8, 128), |
| 107 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 1, AOM_BITS_8, 128), |
| 108 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 2, AOM_BITS_8, 128), |
| 109 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 3, AOM_BITS_8, 128), |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 110 | #if CONFIG_EXT_TX |
David Barker | 4f803ef | 2016-10-13 16:02:59 +0100 | [diff] [blame] | 111 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 4, AOM_BITS_8, 128), |
| 112 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 5, AOM_BITS_8, 128), |
| 113 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 6, AOM_BITS_8, 128), |
| 114 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 7, AOM_BITS_8, 128), |
| 115 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 8, AOM_BITS_8, 128), |
| 116 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 9, AOM_BITS_8, 128), |
| 117 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 10, AOM_BITS_8, 128), |
| 118 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 11, AOM_BITS_8, 128), |
| 119 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 12, AOM_BITS_8, 128), |
| 120 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 13, AOM_BITS_8, 128), |
| 121 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 14, AOM_BITS_8, 128), |
| 122 | make_tuple(&av1_fht16x8_sse2, &av1_iht16x8_128_add_sse2, 15, AOM_BITS_8, 128) |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 123 | #endif // CONFIG_EXT_TX |
| 124 | }; |
Yi Luo | f10cba2 | 2016-12-14 13:54:47 -0800 | [diff] [blame] | 125 | INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans16x8HT, |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 126 | ::testing::ValuesIn(kArrayHt16x8Param_sse2)); |
Sebastien Alaiwan | c6a48a2 | 2017-04-20 10:12:43 +0200 | [diff] [blame] | 127 | #endif // HAVE_SSE2 |
Geza Lore | 1a800f6 | 2016-09-02 16:05:53 +0100 | [diff] [blame] | 128 | |
| 129 | } // namespace |