blob: cde1d0ca34c23f05dd81d66c50f81eca3df9ecde [file] [log] [blame]
Urvang Joshid4668822017-05-17 14:57:09 -07001/*
2 * Copyright (c) 2017, Alliance for Open Media. All rights reserved
3 *
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.
10 */
11
12#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
13
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
23#if CONFIG_TX64X64
24
25using libaom_test::ACMRandom;
26
27namespace {
28typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
29 int tx_type);
30using std::tr1::tuple;
31using libaom_test::FhtFunc;
32typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht64x64Param;
33
34void fht64x64_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
35 av1_fht64x64_c(in, out, stride, tx_type);
36}
37
38void iht64x64_ref(const tran_low_t *in, uint8_t *dest, int stride,
39 int tx_type) {
40 av1_iht64x64_4096_add_c(in, dest, stride, tx_type);
41}
42
Urvang Joshid4668822017-05-17 14:57:09 -070043class AV1Trans64x64HT : public libaom_test::TransformTestBase,
44 public ::testing::TestWithParam<Ht64x64Param> {
45 public:
46 virtual ~AV1Trans64x64HT() {}
47
48 virtual void SetUp() {
49 fwd_txfm_ = GET_PARAM(0);
50 inv_txfm_ = GET_PARAM(1);
51 tx_type_ = GET_PARAM(2);
52 pitch_ = 64;
53 height_ = 64;
54 fwd_txfm_ref = fht64x64_ref;
55 inv_txfm_ref = iht64x64_ref;
56 bit_depth_ = GET_PARAM(3);
57 mask_ = (1 << bit_depth_) - 1;
58 num_coeffs_ = GET_PARAM(4);
59 }
60 virtual void TearDown() { libaom_test::ClearSystemState(); }
61
62 protected:
63 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
64 fwd_txfm_(in, out, stride, tx_type_);
65 }
66
67 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
68 inv_txfm_(out, dst, stride, tx_type_);
69 }
70
71 FhtFunc fwd_txfm_;
72 IhtFunc inv_txfm_;
73};
74
75TEST_P(AV1Trans64x64HT, AccuracyCheck) { RunAccuracyCheck(4, 0.2); }
76TEST_P(AV1Trans64x64HT, CoeffCheck) { RunCoeffCheck(); }
77TEST_P(AV1Trans64x64HT, MemCheck) { RunMemCheck(); }
78TEST_P(AV1Trans64x64HT, InvCoeffCheck) { RunInvCoeffCheck(); }
79TEST_P(AV1Trans64x64HT, InvAccuracyCheck) { RunInvAccuracyCheck(4); }
80
81using std::tr1::make_tuple;
82
83const Ht64x64Param kArrayHt64x64Param_c[] = {
84 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 0, AOM_BITS_8, 4096),
85 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 1, AOM_BITS_8, 4096),
86 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 2, AOM_BITS_8, 4096),
87 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 3, AOM_BITS_8, 4096),
88#if CONFIG_EXT_TX
89 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 4, AOM_BITS_8, 4096),
90 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 5, AOM_BITS_8, 4096),
91 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 6, AOM_BITS_8, 4096),
92 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 7, AOM_BITS_8, 4096),
93 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 8, AOM_BITS_8, 4096),
94 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 9, AOM_BITS_8, 4096),
95 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 10, AOM_BITS_8, 4096),
96 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 11, AOM_BITS_8, 4096),
97 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 12, AOM_BITS_8, 4096),
98 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 13, AOM_BITS_8, 4096),
99 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 14, AOM_BITS_8, 4096),
100 make_tuple(&av1_fht64x64_c, &av1_iht64x64_4096_add_c, 15, AOM_BITS_8, 4096)
101#endif // CONFIG_EXT_TX
102};
103INSTANTIATE_TEST_CASE_P(C, AV1Trans64x64HT,
104 ::testing::ValuesIn(kArrayHt64x64Param_c));
105
106} // namespace
107
108#endif // CONFIG_TX64X64