2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 * 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.
12 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
14 #include "./aom_dsp_rtcd.h"
15 #include "./av1_rtcd.h"
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"
24 using libaom_test::ACMRandom
;
28 typedef void (*IhtFunc
)(const tran_low_t
*in
, uint8_t *out
, int stride
,
29 const TxfmParam
*txfm_param
);
30 using std::tr1::tuple
;
31 using libaom_test::FhtFunc
;
32 typedef tuple
<FhtFunc
, IhtFunc
, TX_TYPE
, aom_bit_depth_t
, int> Ht4x8Param
;
34 void fht4x8_ref(const int16_t *in
, tran_low_t
*out
, int stride
,
35 TxfmParam
*txfm_param
) {
36 av1_fht4x8_c(in
, out
, stride
, txfm_param
);
39 void iht4x8_ref(const tran_low_t
*in
, uint8_t *out
, int stride
,
40 const TxfmParam
*txfm_param
) {
41 av1_iht4x8_32_add_c(in
, out
, stride
, txfm_param
);
44 class AV1Trans4x8HT
: public libaom_test::TransformTestBase
,
45 public ::testing::TestWithParam
<Ht4x8Param
> {
47 virtual ~AV1Trans4x8HT() {}
49 virtual void SetUp() {
50 fwd_txfm_
= GET_PARAM(0);
51 inv_txfm_
= GET_PARAM(1);
54 fwd_txfm_ref
= fht4x8_ref
;
55 inv_txfm_ref
= iht4x8_ref
;
56 bit_depth_
= GET_PARAM(3);
57 mask_
= (1 << bit_depth_
) - 1;
58 num_coeffs_
= GET_PARAM(4);
59 txfm_param_
.tx_type
= GET_PARAM(2);
61 virtual void TearDown() { libaom_test::ClearSystemState(); }
64 void RunFwdTxfm(const int16_t *in
, tran_low_t
*out
, int stride
) {
65 fwd_txfm_(in
, out
, stride
, &txfm_param_
);
68 void RunInvTxfm(const tran_low_t
*out
, uint8_t *dst
, int stride
) {
69 inv_txfm_(out
, dst
, stride
, &txfm_param_
);
76 TEST_P(AV1Trans4x8HT
, AccuracyCheck
) { RunAccuracyCheck(0, 0.00001); }
77 TEST_P(AV1Trans4x8HT
, CoeffCheck
) { RunCoeffCheck(); }
78 TEST_P(AV1Trans4x8HT
, MemCheck
) { RunMemCheck(); }
79 TEST_P(AV1Trans4x8HT
, InvCoeffCheck
) { RunInvCoeffCheck(); }
80 TEST_P(AV1Trans4x8HT
, InvAccuracyCheck
) { RunInvAccuracyCheck(0); }
82 using std::tr1::make_tuple
;
84 const Ht4x8Param kArrayHt4x8Param_c
[] = {
85 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, DCT_DCT
, AOM_BITS_8
, 32),
86 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, ADST_DCT
, AOM_BITS_8
, 32),
87 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, DCT_ADST
, AOM_BITS_8
, 32),
88 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, ADST_ADST
, AOM_BITS_8
, 32),
89 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, FLIPADST_DCT
, AOM_BITS_8
, 32),
90 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, DCT_FLIPADST
, AOM_BITS_8
, 32),
91 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, FLIPADST_FLIPADST
, AOM_BITS_8
,
93 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, ADST_FLIPADST
, AOM_BITS_8
,
95 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, FLIPADST_ADST
, AOM_BITS_8
,
97 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, IDTX
, AOM_BITS_8
, 32),
98 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, V_DCT
, AOM_BITS_8
, 32),
99 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, H_DCT
, AOM_BITS_8
, 32),
100 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, V_ADST
, AOM_BITS_8
, 32),
101 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, H_ADST
, AOM_BITS_8
, 32),
102 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, V_FLIPADST
, AOM_BITS_8
, 32),
103 make_tuple(&av1_fht4x8_c
, &av1_iht4x8_32_add_c
, H_FLIPADST
, AOM_BITS_8
, 32)
105 INSTANTIATE_TEST_CASE_P(C
, AV1Trans4x8HT
,
106 ::testing::ValuesIn(kArrayHt4x8Param_c
));
109 const Ht4x8Param kArrayHt4x8Param_sse2
[] = {
110 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, DCT_DCT
, AOM_BITS_8
,
112 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, ADST_DCT
, AOM_BITS_8
,
114 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, DCT_ADST
, AOM_BITS_8
,
116 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, ADST_ADST
, AOM_BITS_8
,
118 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, FLIPADST_DCT
,
120 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, DCT_FLIPADST
,
122 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, FLIPADST_FLIPADST
,
124 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, ADST_FLIPADST
,
126 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, FLIPADST_ADST
,
128 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, IDTX
, AOM_BITS_8
, 32),
129 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, V_DCT
, AOM_BITS_8
, 32),
130 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, H_DCT
, AOM_BITS_8
, 32),
131 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, V_ADST
, AOM_BITS_8
, 32),
132 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, H_ADST
, AOM_BITS_8
, 32),
133 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, V_FLIPADST
, AOM_BITS_8
,
135 make_tuple(&av1_fht4x8_sse2
, &av1_iht4x8_32_add_sse2
, H_FLIPADST
, AOM_BITS_8
,
138 INSTANTIATE_TEST_CASE_P(SSE2
, AV1Trans4x8HT
,
139 ::testing::ValuesIn(kArrayHt4x8Param_sse2
));
143 #endif // !CONFIG_DAALA_TX