blob: fc5748d0a7cfae5342580bbf15194afd445106a1 [file] [log] [blame]
Geza Lore1a800f62016-09-02 16:05:53 +01001/*
Yaowu Xubde4ac82016-11-28 15:26:06 -08002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Geza Lore1a800f62016-09-02 16:05:53 +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.
Geza Lore1a800f62016-09-02 16:05:53 +010010 */
Tom Finegan7a07ece2017-02-07 17:14:05 -080011#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
Geza Lore1a800f62016-09-02 16:05:53 +010012
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,
Lester Lu27319b62017-07-10 16:57:15 -070027 const TxfmParam *txfm_param);
Geza Lore1a800f62016-09-02 16:05:53 +010028using libaom_test::FhtFunc;
Johann123e8a62017-12-28 14:40:49 -080029using std::tr1::tuple;
Urvang Joshi2283d372017-10-02 17:16:45 -070030typedef tuple<FhtFunc, IhtFunc, TX_TYPE, aom_bit_depth_t, int> Ht8x16Param;
Geza Lore1a800f62016-09-02 16:05:53 +010031
Lester Lud8b1ddc2017-07-06 16:13:29 -070032void fht8x16_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070033 TxfmParam *txfm_param) {
34 av1_fht8x16_c(in, out, stride, txfm_param);
Geza Lore1a800f62016-09-02 16:05:53 +010035}
36
Lester Lud8b1ddc2017-07-06 16:13:29 -070037void iht8x16_ref(const tran_low_t *in, uint8_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070038 const TxfmParam *txfm_param) {
39 av1_iht8x16_128_add_c(in, out, stride, txfm_param);
David Barker4f803ef2016-10-13 16:02:59 +010040}
41
Geza Lore1a800f62016-09-02 16:05:53 +010042class AV1Trans8x16HT : public libaom_test::TransformTestBase,
43 public ::testing::TestWithParam<Ht8x16Param> {
44 public:
45 virtual ~AV1Trans8x16HT() {}
46
47 virtual void SetUp() {
48 fwd_txfm_ = GET_PARAM(0);
49 inv_txfm_ = GET_PARAM(1);
Geza Lore1a800f62016-09-02 16:05:53 +010050 pitch_ = 8;
David Barker78250222016-10-13 15:10:14 +010051 height_ = 16;
David Barker4f803ef2016-10-13 16:02:59 +010052 inv_txfm_ref = iht8x16_ref;
Geza Lore1a800f62016-09-02 16:05:53 +010053 fwd_txfm_ref = fht8x16_ref;
54 bit_depth_ = GET_PARAM(3);
55 mask_ = (1 << bit_depth_) - 1;
56 num_coeffs_ = GET_PARAM(4);
Lester Lu27319b62017-07-10 16:57:15 -070057 txfm_param_.tx_type = GET_PARAM(2);
Geza Lore1a800f62016-09-02 16:05:53 +010058 }
59 virtual void TearDown() { libaom_test::ClearSystemState(); }
60
61 protected:
62 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -070063 fwd_txfm_(in, out, stride, &txfm_param_);
Geza Lore1a800f62016-09-02 16:05:53 +010064 }
65
66 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
Lester Lu27319b62017-07-10 16:57:15 -070067 inv_txfm_(out, dst, stride, &txfm_param_);
Geza Lore1a800f62016-09-02 16:05:53 +010068 }
69
70 FhtFunc fwd_txfm_;
71 IhtFunc inv_txfm_;
72};
73
Angie Chiange6aece82017-01-09 17:27:56 -080074TEST_P(AV1Trans8x16HT, AccuracyCheck) { RunAccuracyCheck(1, 0.001); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080075TEST_P(AV1Trans8x16HT, MemCheck) { RunMemCheck(); }
Geza Lore1a800f62016-09-02 16:05:53 +010076TEST_P(AV1Trans8x16HT, CoeffCheck) { RunCoeffCheck(); }
David Barker4f803ef2016-10-13 16:02:59 +010077TEST_P(AV1Trans8x16HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080078TEST_P(AV1Trans8x16HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
Geza Lore1a800f62016-09-02 16:05:53 +010079
80using std::tr1::make_tuple;
81
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080082const Ht8x16Param kArrayHt8x16Param_c[] = {
Urvang Joshi2283d372017-10-02 17:16:45 -070083 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, DCT_DCT, AOM_BITS_8, 128),
84 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, ADST_DCT, AOM_BITS_8, 128),
85 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, DCT_ADST, AOM_BITS_8, 128),
86 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, ADST_ADST, AOM_BITS_8,
87 128),
Urvang Joshi2283d372017-10-02 17:16:45 -070088 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, FLIPADST_DCT, AOM_BITS_8,
89 128),
90 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, DCT_FLIPADST, AOM_BITS_8,
91 128),
92 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, FLIPADST_FLIPADST,
93 AOM_BITS_8, 128),
94 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, ADST_FLIPADST, AOM_BITS_8,
95 128),
96 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, FLIPADST_ADST, AOM_BITS_8,
97 128),
98 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, IDTX, AOM_BITS_8, 128),
99 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, V_DCT, AOM_BITS_8, 128),
100 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, H_DCT, AOM_BITS_8, 128),
101 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, V_ADST, AOM_BITS_8, 128),
102 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, H_ADST, AOM_BITS_8, 128),
103 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, V_FLIPADST, AOM_BITS_8,
104 128),
105 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, H_FLIPADST, AOM_BITS_8,
106 128)
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -0800107};
108INSTANTIATE_TEST_CASE_P(C, AV1Trans8x16HT,
109 ::testing::ValuesIn(kArrayHt8x16Param_c));
110
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200111#if HAVE_SSE2
Geza Lore1a800f62016-09-02 16:05:53 +0100112const Ht8x16Param kArrayHt8x16Param_sse2[] = {
Urvang Joshi2283d372017-10-02 17:16:45 -0700113 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, DCT_DCT, AOM_BITS_8,
114 128),
115 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, ADST_DCT, AOM_BITS_8,
116 128),
117 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, DCT_ADST, AOM_BITS_8,
118 128),
119 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, ADST_ADST,
120 AOM_BITS_8, 128),
Urvang Joshi2283d372017-10-02 17:16:45 -0700121 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, FLIPADST_DCT,
122 AOM_BITS_8, 128),
123 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, DCT_FLIPADST,
124 AOM_BITS_8, 128),
125 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, FLIPADST_FLIPADST,
126 AOM_BITS_8, 128),
127 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, ADST_FLIPADST,
128 AOM_BITS_8, 128),
129 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, FLIPADST_ADST,
130 AOM_BITS_8, 128),
131 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, IDTX, AOM_BITS_8,
132 128),
133 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, V_DCT, AOM_BITS_8,
134 128),
135 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, H_DCT, AOM_BITS_8,
136 128),
137 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, V_ADST, AOM_BITS_8,
138 128),
139 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, H_ADST, AOM_BITS_8,
140 128),
141 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, V_FLIPADST,
142 AOM_BITS_8, 128),
143 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, H_FLIPADST,
144 AOM_BITS_8, 128)
Geza Lore1a800f62016-09-02 16:05:53 +0100145};
Yi Luof10cba22016-12-14 13:54:47 -0800146INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans8x16HT,
Geza Lore1a800f62016-09-02 16:05:53 +0100147 ::testing::ValuesIn(kArrayHt8x16Param_sse2));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200148#endif // HAVE_SSE2
Geza Lore1a800f62016-09-02 16:05:53 +0100149
150} // namespace