blob: cbce074e506b5bb6500bcaeda704b45616da0a39 [file] [log] [blame]
David Barker33231d42016-10-06 17:25:40 +01001/*
Yaowu Xubde4ac82016-11-28 15:26:06 -08002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
David Barker33231d42016-10-06 17:25:40 +01003 *
Yaowu Xubde4ac82016-11-28 15:26:06 -08004 * 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.
David Barker33231d42016-10-06 17:25:40 +010010 */
11
Tom Finegan7a07ece2017-02-07 17:14:05 -080012#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
David Barker33231d42016-10-06 17:25:40 +010013
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
24using libaom_test::ACMRandom;
25
26namespace {
27typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070028 const TxfmParam *txfm_param);
David Barker33231d42016-10-06 17:25:40 +010029using std::tr1::tuple;
30using libaom_test::FhtFunc;
Urvang Joshi2283d372017-10-02 17:16:45 -070031typedef tuple<FhtFunc, IhtFunc, TX_TYPE, aom_bit_depth_t, int> Ht32x16Param;
David Barker33231d42016-10-06 17:25:40 +010032
Lester Lud8b1ddc2017-07-06 16:13:29 -070033void fht32x16_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070034 TxfmParam *txfm_param) {
35 av1_fht32x16_c(in, out, stride, txfm_param);
David Barker33231d42016-10-06 17:25:40 +010036}
37
Lester Lud8b1ddc2017-07-06 16:13:29 -070038void iht32x16_ref(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070039 const TxfmParam *txfm_param) {
40 av1_iht32x16_512_add_c(in, out, stride, txfm_param);
David Barker33231d42016-10-06 17:25:40 +010041}
42
43class AV1Trans32x16HT : public libaom_test::TransformTestBase,
44 public ::testing::TestWithParam<Ht32x16Param> {
45 public:
46 virtual ~AV1Trans32x16HT() {}
47
48 virtual void SetUp() {
49 fwd_txfm_ = GET_PARAM(0);
50 inv_txfm_ = GET_PARAM(1);
David Barker33231d42016-10-06 17:25:40 +010051 pitch_ = 32;
David Barker78250222016-10-13 15:10:14 +010052 height_ = 16;
David Barker33231d42016-10-06 17:25:40 +010053 fwd_txfm_ref = fht32x16_ref;
54 inv_txfm_ref = iht32x16_ref;
55 bit_depth_ = GET_PARAM(3);
56 mask_ = (1 << bit_depth_) - 1;
57 num_coeffs_ = GET_PARAM(4);
Lester Lu27319b62017-07-10 16:57:15 -070058 txfm_param_.tx_type = GET_PARAM(2);
David Barker33231d42016-10-06 17:25:40 +010059 }
60 virtual void TearDown() { libaom_test::ClearSystemState(); }
61
62 protected:
63 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -070064 fwd_txfm_(in, out, stride, &txfm_param_);
David Barker33231d42016-10-06 17:25:40 +010065 }
66
67 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -070068 inv_txfm_(out, dst, stride, &txfm_param_);
David Barker33231d42016-10-06 17:25:40 +010069 }
70
71 FhtFunc fwd_txfm_;
72 IhtFunc inv_txfm_;
73};
74
Yi Luo63bd6dc2016-11-17 09:13:39 -080075TEST_P(AV1Trans32x16HT, MemCheck) { RunMemCheck(); }
Angie Chiange6aece82017-01-09 17:27:56 -080076TEST_P(AV1Trans32x16HT, AccuracyCheck) { RunAccuracyCheck(4, 0.2); }
David Barker33231d42016-10-06 17:25:40 +010077TEST_P(AV1Trans32x16HT, CoeffCheck) { RunCoeffCheck(); }
78TEST_P(AV1Trans32x16HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Angie Chiange6aece82017-01-09 17:27:56 -080079TEST_P(AV1Trans32x16HT, InvAccuracyCheck) { RunInvAccuracyCheck(4); }
David Barker33231d42016-10-06 17:25:40 +010080
81using std::tr1::make_tuple;
Yi Luo63bd6dc2016-11-17 09:13:39 -080082const Ht32x16Param kArrayHt32x16Param_c[] = {
Urvang Joshi2283d372017-10-02 17:16:45 -070083 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, DCT_DCT, AOM_BITS_8,
84 512),
85 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, ADST_DCT, AOM_BITS_8,
86 512),
87 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, DCT_ADST, AOM_BITS_8,
88 512),
89 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, ADST_ADST, AOM_BITS_8,
90 512),
Yi Luo63bd6dc2016-11-17 09:13:39 -080091#if CONFIG_EXT_TX
Urvang Joshi2283d372017-10-02 17:16:45 -070092 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, FLIPADST_DCT, AOM_BITS_8,
93 512),
94 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, DCT_FLIPADST, AOM_BITS_8,
95 512),
96 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, FLIPADST_FLIPADST,
97 AOM_BITS_8, 512),
98 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, ADST_FLIPADST,
99 AOM_BITS_8, 512),
100 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, FLIPADST_ADST,
101 AOM_BITS_8, 512),
102 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, IDTX, AOM_BITS_8, 512),
103 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, V_DCT, AOM_BITS_8, 512),
104 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, H_DCT, AOM_BITS_8, 512),
105 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, V_ADST, AOM_BITS_8, 512),
106 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, H_ADST, AOM_BITS_8, 512),
107 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, V_FLIPADST, AOM_BITS_8,
108 512),
109 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, H_FLIPADST, AOM_BITS_8,
110 512)
Yi Luo63bd6dc2016-11-17 09:13:39 -0800111#endif // CONFIG_EXT_TX
112};
113INSTANTIATE_TEST_CASE_P(C, AV1Trans32x16HT,
114 ::testing::ValuesIn(kArrayHt32x16Param_c));
David Barker33231d42016-10-06 17:25:40 +0100115
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200116#if HAVE_SSE2
David Barker33231d42016-10-06 17:25:40 +0100117const Ht32x16Param kArrayHt32x16Param_sse2[] = {
Urvang Joshi2283d372017-10-02 17:16:45 -0700118 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, DCT_DCT,
119 AOM_BITS_8, 512),
120 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, ADST_DCT,
121 AOM_BITS_8, 512),
122 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, DCT_ADST,
123 AOM_BITS_8, 512),
124 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, ADST_ADST,
125 AOM_BITS_8, 512),
David Barker33231d42016-10-06 17:25:40 +0100126#if CONFIG_EXT_TX
Urvang Joshi2283d372017-10-02 17:16:45 -0700127 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, FLIPADST_DCT,
128 AOM_BITS_8, 512),
129 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, DCT_FLIPADST,
130 AOM_BITS_8, 512),
131 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, FLIPADST_FLIPADST,
132 AOM_BITS_8, 512),
133 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, ADST_FLIPADST,
134 AOM_BITS_8, 512),
135 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, FLIPADST_ADST,
136 AOM_BITS_8, 512),
137 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, IDTX, AOM_BITS_8,
David Barker33231d42016-10-06 17:25:40 +0100138 512),
Urvang Joshi2283d372017-10-02 17:16:45 -0700139 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, V_DCT, AOM_BITS_8,
David Barker33231d42016-10-06 17:25:40 +0100140 512),
Urvang Joshi2283d372017-10-02 17:16:45 -0700141 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, H_DCT, AOM_BITS_8,
David Barker33231d42016-10-06 17:25:40 +0100142 512),
Urvang Joshi2283d372017-10-02 17:16:45 -0700143 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, V_ADST, AOM_BITS_8,
David Barker33231d42016-10-06 17:25:40 +0100144 512),
Urvang Joshi2283d372017-10-02 17:16:45 -0700145 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, H_ADST, AOM_BITS_8,
David Barker33231d42016-10-06 17:25:40 +0100146 512),
Urvang Joshi2283d372017-10-02 17:16:45 -0700147 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, V_FLIPADST,
148 AOM_BITS_8, 512),
149 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, H_FLIPADST,
150 AOM_BITS_8, 512)
David Barker33231d42016-10-06 17:25:40 +0100151#endif // CONFIG_EXT_TX
152};
Yi Luo3b0b5f12017-01-12 17:47:54 -0800153INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans32x16HT,
David Barker33231d42016-10-06 17:25:40 +0100154 ::testing::ValuesIn(kArrayHt32x16Param_sse2));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200155#endif // HAVE_SSE2
David Barker33231d42016-10-06 17:25:40 +0100156
157} // namespace