blob: e38283f865bf9131891b19f8838bf899a16b2c83 [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,
28 int tx_type);
29using std::tr1::tuple;
30using libaom_test::FhtFunc;
31typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht32x16Param;
32
33void fht32x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
34 av1_fht32x16_c(in, out, stride, tx_type);
35}
36
37void iht32x16_ref(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
38 av1_iht32x16_512_add_c(in, out, stride, tx_type);
39}
40
41class AV1Trans32x16HT : public libaom_test::TransformTestBase,
42 public ::testing::TestWithParam<Ht32x16Param> {
43 public:
44 virtual ~AV1Trans32x16HT() {}
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_ = 32;
David Barker78250222016-10-13 15:10:14 +010051 height_ = 16;
David Barker33231d42016-10-06 17:25:40 +010052 fwd_txfm_ref = fht32x16_ref;
53 inv_txfm_ref = iht32x16_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
Yi Luo63bd6dc2016-11-17 09:13:39 -080073TEST_P(AV1Trans32x16HT, MemCheck) { RunMemCheck(); }
Angie Chiange6aece82017-01-09 17:27:56 -080074TEST_P(AV1Trans32x16HT, AccuracyCheck) { RunAccuracyCheck(4, 0.2); }
David Barker33231d42016-10-06 17:25:40 +010075TEST_P(AV1Trans32x16HT, CoeffCheck) { RunCoeffCheck(); }
76TEST_P(AV1Trans32x16HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Angie Chiange6aece82017-01-09 17:27:56 -080077TEST_P(AV1Trans32x16HT, InvAccuracyCheck) { RunInvAccuracyCheck(4); }
David Barker33231d42016-10-06 17:25:40 +010078
79using std::tr1::make_tuple;
Yi Luo63bd6dc2016-11-17 09:13:39 -080080const Ht32x16Param kArrayHt32x16Param_c[] = {
81 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 0, AOM_BITS_8, 512),
82 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 1, AOM_BITS_8, 512),
83 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 2, AOM_BITS_8, 512),
84 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 3, AOM_BITS_8, 512),
85#if CONFIG_EXT_TX
86 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 4, AOM_BITS_8, 512),
87 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 5, AOM_BITS_8, 512),
88 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 6, AOM_BITS_8, 512),
89 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 7, AOM_BITS_8, 512),
90 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 8, AOM_BITS_8, 512),
91 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 9, AOM_BITS_8, 512),
92 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 10, AOM_BITS_8, 512),
93 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 11, AOM_BITS_8, 512),
94 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 12, AOM_BITS_8, 512),
95 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 13, AOM_BITS_8, 512),
96 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 14, AOM_BITS_8, 512),
97 make_tuple(&av1_fht32x16_c, &av1_iht32x16_512_add_c, 15, AOM_BITS_8, 512)
98#endif // CONFIG_EXT_TX
99};
100INSTANTIATE_TEST_CASE_P(C, AV1Trans32x16HT,
101 ::testing::ValuesIn(kArrayHt32x16Param_c));
David Barker33231d42016-10-06 17:25:40 +0100102
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200103#if HAVE_SSE2
David Barker33231d42016-10-06 17:25:40 +0100104const Ht32x16Param kArrayHt32x16Param_sse2[] = {
105 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 0, AOM_BITS_8,
106 512),
107 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 1, AOM_BITS_8,
108 512),
109 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 2, AOM_BITS_8,
110 512),
111 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 3, AOM_BITS_8,
112 512),
113#if CONFIG_EXT_TX
114 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 4, AOM_BITS_8,
115 512),
116 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 5, AOM_BITS_8,
117 512),
118 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 6, AOM_BITS_8,
119 512),
120 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 7, AOM_BITS_8,
121 512),
122 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 8, AOM_BITS_8,
123 512),
124 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 9, AOM_BITS_8,
125 512),
126 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 10, AOM_BITS_8,
127 512),
128 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 11, AOM_BITS_8,
129 512),
130 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 12, AOM_BITS_8,
131 512),
132 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 13, AOM_BITS_8,
133 512),
134 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 14, AOM_BITS_8,
135 512),
136 make_tuple(&av1_fht32x16_sse2, &av1_iht32x16_512_add_sse2, 15, AOM_BITS_8,
137 512)
138#endif // CONFIG_EXT_TX
139};
Yi Luo3b0b5f12017-01-12 17:47:54 -0800140INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans32x16HT,
David Barker33231d42016-10-06 17:25:40 +0100141 ::testing::ValuesIn(kArrayHt32x16Param_sse2));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200142#endif // HAVE_SSE2
David Barker33231d42016-10-06 17:25:40 +0100143
144} // namespace