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
;
29 typedef void (*IhtFunc
)(const tran_low_t
*in
, uint8_t *out
, int stride
,
30 const TxfmParam
*txfm_param
);
31 using std::tr1::tuple
;
32 using libaom_test::FhtFunc
;
33 typedef tuple
<FhtFunc
, IhtFunc
, TX_TYPE
, aom_bit_depth_t
, int> Ht16x32Param
;
35 void fht16x32_ref(const int16_t *in
, tran_low_t
*out
, int stride
,
36 TxfmParam
*txfm_param
) {
37 av1_fht16x32_c(in
, out
, stride
, txfm_param
);
40 void iht16x32_ref(const tran_low_t
*in
, uint8_t *out
, int stride
,
41 const TxfmParam
*txfm_param
) {
42 av1_iht16x32_512_add_c(in
, out
, stride
, txfm_param
);
45 class AV1Trans16x32HT
: public libaom_test::TransformTestBase
,
46 public ::testing::TestWithParam
<Ht16x32Param
> {
48 virtual ~AV1Trans16x32HT() {}
50 virtual void SetUp() {
51 fwd_txfm_
= GET_PARAM(0);
52 inv_txfm_
= GET_PARAM(1);
55 fwd_txfm_ref
= fht16x32_ref
;
56 inv_txfm_ref
= iht16x32_ref
;
57 bit_depth_
= GET_PARAM(3);
58 mask_
= (1 << bit_depth_
) - 1;
59 num_coeffs_
= GET_PARAM(4);
60 txfm_param_
.tx_type
= GET_PARAM(2);
62 virtual void TearDown() { libaom_test::ClearSystemState(); }
65 void RunFwdTxfm(const int16_t *in
, tran_low_t
*out
, int stride
) {
66 fwd_txfm_(in
, out
, stride
, &txfm_param_
);
69 void RunInvTxfm(const tran_low_t
*out
, uint8_t *dst
, int stride
) {
70 inv_txfm_(out
, dst
, stride
, &txfm_param_
);
77 TEST_P(AV1Trans16x32HT
, AccuracyCheck
) { RunAccuracyCheck(4, 0.2); }
78 TEST_P(AV1Trans16x32HT
, CoeffCheck
) { RunCoeffCheck(); }
79 TEST_P(AV1Trans16x32HT
, MemCheck
) { RunMemCheck(); }
80 TEST_P(AV1Trans16x32HT
, InvCoeffCheck
) { RunInvCoeffCheck(); }
81 TEST_P(AV1Trans16x32HT
, InvAccuracyCheck
) { RunInvAccuracyCheck(4); }
83 using std::tr1::make_tuple
;
84 const Ht16x32Param kArrayHt16x32Param_c
[] = {
85 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, DCT_DCT
, AOM_BITS_8
,
87 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, ADST_DCT
, AOM_BITS_8
,
89 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, DCT_ADST
, AOM_BITS_8
,
91 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, ADST_ADST
, AOM_BITS_8
,
93 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, FLIPADST_DCT
, AOM_BITS_8
,
95 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, DCT_FLIPADST
, AOM_BITS_8
,
97 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, FLIPADST_FLIPADST
,
99 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, ADST_FLIPADST
,
101 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, FLIPADST_ADST
,
103 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, IDTX
, AOM_BITS_8
, 512),
104 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, V_DCT
, AOM_BITS_8
, 512),
105 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, H_DCT
, AOM_BITS_8
, 512),
106 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, V_ADST
, AOM_BITS_8
, 512),
107 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, H_ADST
, AOM_BITS_8
, 512),
108 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, V_FLIPADST
, AOM_BITS_8
,
110 make_tuple(&av1_fht16x32_c
, &av1_iht16x32_512_add_c
, H_FLIPADST
, AOM_BITS_8
,
113 INSTANTIATE_TEST_CASE_P(C
, AV1Trans16x32HT
,
114 ::testing::ValuesIn(kArrayHt16x32Param_c
));
117 const Ht16x32Param kArrayHt16x32Param_sse2
[] = {
118 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, DCT_DCT
,
120 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, ADST_DCT
,
122 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, DCT_ADST
,
124 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, ADST_ADST
,
126 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, FLIPADST_DCT
,
128 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, DCT_FLIPADST
,
130 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, FLIPADST_FLIPADST
,
132 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, ADST_FLIPADST
,
134 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, FLIPADST_ADST
,
136 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, IDTX
, AOM_BITS_8
,
138 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, V_DCT
, AOM_BITS_8
,
140 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, H_DCT
, AOM_BITS_8
,
142 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, V_ADST
, AOM_BITS_8
,
144 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, H_ADST
, AOM_BITS_8
,
146 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, V_FLIPADST
,
148 make_tuple(&av1_fht16x32_sse2
, &av1_iht16x32_512_add_sse2
, H_FLIPADST
,
151 INSTANTIATE_TEST_CASE_P(SSE2
, AV1Trans16x32HT
,
152 ::testing::ValuesIn(kArrayHt16x32Param_sse2
));
157 #endif // !CONFIG_DAALA_TX