blob: d45fcde91bb91844f65a5b64bebdd7333780df93 [file] [log] [blame]
David Barker33231d42016-10-06 17:25:40 +01001/*
2 * Copyright (c) 2016 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "third_party/googletest/src/include/gtest/gtest.h"
12
13#include "./aom_dsp_rtcd.h"
14#include "./av1_rtcd.h"
15
16#include "aom_ports/mem.h"
17#include "test/acm_random.h"
18#include "test/clear_system_state.h"
19#include "test/register_state_check.h"
20#include "test/transform_test_base.h"
21#include "test/util.h"
22
23using libaom_test::ACMRandom;
24
25namespace {
26typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
27 int tx_type);
28using std::tr1::tuple;
29using libaom_test::FhtFunc;
30typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht16x32Param;
31
32void fht16x32_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
33 av1_fht16x32_c(in, out, stride, tx_type);
34}
35
36void iht16x32_ref(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
37 av1_iht16x32_512_add_c(in, out, stride, tx_type);
38}
39
40class AV1Trans16x32HT : public libaom_test::TransformTestBase,
41 public ::testing::TestWithParam<Ht16x32Param> {
42 public:
43 virtual ~AV1Trans16x32HT() {}
44
45 virtual void SetUp() {
46 fwd_txfm_ = GET_PARAM(0);
47 inv_txfm_ = GET_PARAM(1);
48 tx_type_ = GET_PARAM(2);
49 pitch_ = 16;
David Barker78250222016-10-13 15:10:14 +010050 height_ = 32;
David Barker33231d42016-10-06 17:25:40 +010051 fwd_txfm_ref = fht16x32_ref;
52 inv_txfm_ref = iht16x32_ref;
53 bit_depth_ = GET_PARAM(3);
54 mask_ = (1 << bit_depth_) - 1;
55 num_coeffs_ = GET_PARAM(4);
56 }
57 virtual void TearDown() { libaom_test::ClearSystemState(); }
58
59 protected:
60 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
61 fwd_txfm_(in, out, stride, tx_type_);
62 }
63
64 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
65 inv_txfm_(out, dst, stride, tx_type_);
66 }
67
68 FhtFunc fwd_txfm_;
69 IhtFunc inv_txfm_;
70};
71
Yi Luo63bd6dc2016-11-17 09:13:39 -080072TEST_P(AV1Trans16x32HT, AccuracyCheck) { RunAccuracyCheck(48); }
David Barker33231d42016-10-06 17:25:40 +010073TEST_P(AV1Trans16x32HT, CoeffCheck) { RunCoeffCheck(); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080074TEST_P(AV1Trans16x32HT, MemCheck) { RunMemCheck(); }
David Barker33231d42016-10-06 17:25:40 +010075TEST_P(AV1Trans16x32HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080076TEST_P(AV1Trans16x32HT, InvAccuracyCheck) { RunInvAccuracyCheck(9); }
David Barker33231d42016-10-06 17:25:40 +010077
78using std::tr1::make_tuple;
Yi Luo63bd6dc2016-11-17 09:13:39 -080079const Ht16x32Param kArrayHt16x32Param_c[] = {
80 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 0, AOM_BITS_8, 512),
81 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 1, AOM_BITS_8, 512),
82 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 2, AOM_BITS_8, 512),
83 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 3, AOM_BITS_8, 512),
84#if CONFIG_EXT_TX
85 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 4, AOM_BITS_8, 512),
86 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 5, AOM_BITS_8, 512),
87 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 6, AOM_BITS_8, 512),
88 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 7, AOM_BITS_8, 512),
89 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 8, AOM_BITS_8, 512),
90 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 9, AOM_BITS_8, 512),
91 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 10, AOM_BITS_8, 512),
92 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 11, AOM_BITS_8, 512),
93 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 12, AOM_BITS_8, 512),
94 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 13, AOM_BITS_8, 512),
95 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 14, AOM_BITS_8, 512),
96 make_tuple(&av1_fht16x32_c, &av1_iht16x32_512_add_c, 15, AOM_BITS_8, 512)
97#endif // CONFIG_EXT_TX
98};
99INSTANTIATE_TEST_CASE_P(C, AV1Trans16x32HT,
100 ::testing::ValuesIn(kArrayHt16x32Param_c));
David Barker33231d42016-10-06 17:25:40 +0100101
102#if HAVE_SSE2
103const Ht16x32Param kArrayHt16x32Param_sse2[] = {
104 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 0, AOM_BITS_8,
105 512),
106 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 1, AOM_BITS_8,
107 512),
108 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 2, AOM_BITS_8,
109 512),
110 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 3, AOM_BITS_8,
111 512),
112#if CONFIG_EXT_TX
113 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 4, AOM_BITS_8,
114 512),
115 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 5, AOM_BITS_8,
116 512),
117 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 6, AOM_BITS_8,
118 512),
119 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 7, AOM_BITS_8,
120 512),
121 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 8, AOM_BITS_8,
122 512),
123 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 9, AOM_BITS_8,
124 512),
125 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 10, AOM_BITS_8,
126 512),
127 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 11, AOM_BITS_8,
128 512),
129 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 12, AOM_BITS_8,
130 512),
131 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 13, AOM_BITS_8,
132 512),
133 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 14, AOM_BITS_8,
134 512),
135 make_tuple(&av1_fht16x32_sse2, &av1_iht16x32_512_add_sse2, 15, AOM_BITS_8,
136 512)
137#endif // CONFIG_EXT_TX
138};
139INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans16x32HT,
140 ::testing::ValuesIn(kArrayHt16x32Param_sse2));
141#endif // HAVE_SSE2
142
143} // namespace