blob: c797421afffd8c886eea591136be06603317d297 [file] [log] [blame]
David Barker4d03d6f2016-10-03 16:27:27 +01001/*
Yaowu Xubde4ac82016-11-28 15:26:06 -08002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
David Barker4d03d6f2016-10-03 16:27:27 +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 Barker4d03d6f2016-10-03 16:27:27 +010010 */
Tom Finegan7a07ece2017-02-07 17:14:05 -080011#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
David Barker4d03d6f2016-10-03 16:27:27 +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);
David Barker4d03d6f2016-10-03 16:27:27 +010028using std::tr1::tuple;
29using libaom_test::FhtFunc;
30typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht8x4Param;
31
Lester Lud8b1ddc2017-07-06 16:13:29 -070032void fht8x4_ref(const int16_t *in, tran_low_t *out, int stride,
Lester Lu27319b62017-07-10 16:57:15 -070033 TxfmParam *txfm_param) {
34 av1_fht8x4_c(in, out, stride, txfm_param);
David Barker4d03d6f2016-10-03 16:27:27 +010035}
36
Lester Lud8b1ddc2017-07-06 16:13:29 -070037void iht8x4_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_iht8x4_32_add_c(in, out, stride, txfm_param);
David Barker4d03d6f2016-10-03 16:27:27 +010040}
41
42class AV1Trans8x4HT : public libaom_test::TransformTestBase,
43 public ::testing::TestWithParam<Ht8x4Param> {
44 public:
45 virtual ~AV1Trans8x4HT() {}
46
47 virtual void SetUp() {
48 fwd_txfm_ = GET_PARAM(0);
49 inv_txfm_ = GET_PARAM(1);
David Barker4d03d6f2016-10-03 16:27:27 +010050 pitch_ = 8;
David Barker78250222016-10-13 15:10:14 +010051 height_ = 4;
David Barker4d03d6f2016-10-03 16:27:27 +010052 fwd_txfm_ref = fht8x4_ref;
53 inv_txfm_ref = iht8x4_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);
David Barker4d03d6f2016-10-03 16:27:27 +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_);
David Barker4d03d6f2016-10-03 16:27:27 +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_);
David Barker4d03d6f2016-10-03 16:27:27 +010068 }
69
70 FhtFunc fwd_txfm_;
71 IhtFunc inv_txfm_;
72};
73
Angie Chiange6aece82017-01-09 17:27:56 -080074TEST_P(AV1Trans8x4HT, AccuracyCheck) { RunAccuracyCheck(0, 0.00001); }
David Barker4d03d6f2016-10-03 16:27:27 +010075TEST_P(AV1Trans8x4HT, CoeffCheck) { RunCoeffCheck(); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080076TEST_P(AV1Trans8x4HT, MemCheck) { RunMemCheck(); }
David Barker4d03d6f2016-10-03 16:27:27 +010077TEST_P(AV1Trans8x4HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080078TEST_P(AV1Trans8x4HT, InvAccuracyCheck) { RunInvAccuracyCheck(0); }
David Barker4d03d6f2016-10-03 16:27:27 +010079
80using std::tr1::make_tuple;
81
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080082const Ht8x4Param kArrayHt8x4Param_c[] = {
83 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 0, AOM_BITS_8, 32),
84 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 1, AOM_BITS_8, 32),
85 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 2, AOM_BITS_8, 32),
86 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 3, AOM_BITS_8, 32),
87#if CONFIG_EXT_TX
88 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 4, AOM_BITS_8, 32),
89 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 5, AOM_BITS_8, 32),
90 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 6, AOM_BITS_8, 32),
91 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 7, AOM_BITS_8, 32),
92 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 8, AOM_BITS_8, 32),
93 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 9, AOM_BITS_8, 32),
94 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 10, AOM_BITS_8, 32),
95 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 11, AOM_BITS_8, 32),
96 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 12, AOM_BITS_8, 32),
97 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 13, AOM_BITS_8, 32),
98 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 14, AOM_BITS_8, 32),
99 make_tuple(&av1_fht8x4_c, &av1_iht8x4_32_add_c, 15, AOM_BITS_8, 32)
100#endif // CONFIG_EXT_TX
101};
102INSTANTIATE_TEST_CASE_P(C, AV1Trans8x4HT,
103 ::testing::ValuesIn(kArrayHt8x4Param_c));
104
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200105#if HAVE_SSE2
David Barker4d03d6f2016-10-03 16:27:27 +0100106const Ht8x4Param kArrayHt8x4Param_sse2[] = {
107 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 0, AOM_BITS_8, 32),
108 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 1, AOM_BITS_8, 32),
109 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 2, AOM_BITS_8, 32),
110 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 3, AOM_BITS_8, 32),
111#if CONFIG_EXT_TX
112 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 4, AOM_BITS_8, 32),
113 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 5, AOM_BITS_8, 32),
114 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 6, AOM_BITS_8, 32),
115 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 7, AOM_BITS_8, 32),
116 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 8, AOM_BITS_8, 32),
117 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 9, AOM_BITS_8, 32),
118 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 10, AOM_BITS_8, 32),
119 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 11, AOM_BITS_8, 32),
120 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 12, AOM_BITS_8, 32),
121 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 13, AOM_BITS_8, 32),
122 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 14, AOM_BITS_8, 32),
123 make_tuple(&av1_fht8x4_sse2, &av1_iht8x4_32_add_sse2, 15, AOM_BITS_8, 32)
124#endif // CONFIG_EXT_TX
125};
Yi Luof10cba22016-12-14 13:54:47 -0800126INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans8x4HT,
David Barker4d03d6f2016-10-03 16:27:27 +0100127 ::testing::ValuesIn(kArrayHt8x4Param_sse2));
Sebastien Alaiwanc6a48a22017-04-20 10:12:43 +0200128#endif // HAVE_SSE2
David Barker4d03d6f2016-10-03 16:27:27 +0100129
130} // namespace