blob: 88c38acdd9e9dee8b37c691544780e138dac5279 [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 */
Geza Lore1a800f62016-09-02 16:05:53 +010011#include "third_party/googletest/src/include/gtest/gtest.h"
12
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,
27 int tx_type);
28using std::tr1::tuple;
29using libaom_test::FhtFunc;
30typedef tuple<FhtFunc, IhtFunc, int, aom_bit_depth_t, int> Ht8x16Param;
31
32void fht8x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
33 av1_fht8x16_c(in, out, stride, tx_type);
34}
35
David Barker4f803ef2016-10-13 16:02:59 +010036void iht8x16_ref(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
37 av1_iht8x16_128_add_c(in, out, stride, tx_type);
38}
39
Geza Lore1a800f62016-09-02 16:05:53 +010040class AV1Trans8x16HT : public libaom_test::TransformTestBase,
41 public ::testing::TestWithParam<Ht8x16Param> {
42 public:
43 virtual ~AV1Trans8x16HT() {}
44
45 virtual void SetUp() {
46 fwd_txfm_ = GET_PARAM(0);
47 inv_txfm_ = GET_PARAM(1);
48 tx_type_ = GET_PARAM(2);
49 pitch_ = 8;
David Barker78250222016-10-13 15:10:14 +010050 height_ = 16;
David Barker4f803ef2016-10-13 16:02:59 +010051 inv_txfm_ref = iht8x16_ref;
Geza Lore1a800f62016-09-02 16:05:53 +010052 fwd_txfm_ref = fht8x16_ref;
53 bit_depth_ = GET_PARAM(3);
54 mask_ = (1 << bit_depth_) - 1;
55 num_coeffs_ = GET_PARAM(4);
56 }
57 virtual void TearDown() { libaom_test::ClearSystemState(); }
58
59 protected:
60 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
61 fwd_txfm_(in, out, stride, tx_type_);
62 }
63
64 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
65 inv_txfm_(out, dst, stride, tx_type_);
66 }
67
68 FhtFunc fwd_txfm_;
69 IhtFunc inv_txfm_;
70};
71
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080072TEST_P(AV1Trans8x16HT, AccuracyCheck) { RunAccuracyCheck(1); }
Yi Luo63bd6dc2016-11-17 09:13:39 -080073TEST_P(AV1Trans8x16HT, MemCheck) { RunMemCheck(); }
Geza Lore1a800f62016-09-02 16:05:53 +010074TEST_P(AV1Trans8x16HT, CoeffCheck) { RunCoeffCheck(); }
David Barker4f803ef2016-10-13 16:02:59 +010075TEST_P(AV1Trans8x16HT, InvCoeffCheck) { RunInvCoeffCheck(); }
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080076TEST_P(AV1Trans8x16HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
Geza Lore1a800f62016-09-02 16:05:53 +010077
78using std::tr1::make_tuple;
79
Debargha Mukherjeef0aa4202016-12-12 15:40:24 -080080const Ht8x16Param kArrayHt8x16Param_c[] = {
81 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 0, AOM_BITS_8, 128),
82 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 1, AOM_BITS_8, 128),
83 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 2, AOM_BITS_8, 128),
84 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 3, AOM_BITS_8, 128),
85#if CONFIG_EXT_TX
86 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 4, AOM_BITS_8, 128),
87 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 5, AOM_BITS_8, 128),
88 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 6, AOM_BITS_8, 128),
89 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 7, AOM_BITS_8, 128),
90 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 8, AOM_BITS_8, 128),
91 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 9, AOM_BITS_8, 128),
92 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 10, AOM_BITS_8, 128),
93 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 11, AOM_BITS_8, 128),
94 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 12, AOM_BITS_8, 128),
95 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 13, AOM_BITS_8, 128),
96 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 14, AOM_BITS_8, 128),
97 make_tuple(&av1_fht8x16_c, &av1_iht8x16_128_add_c, 15, AOM_BITS_8, 128)
98#endif // CONFIG_EXT_TX
99};
100INSTANTIATE_TEST_CASE_P(C, AV1Trans8x16HT,
101 ::testing::ValuesIn(kArrayHt8x16Param_c));
102
Yaowu Xu46f0f292016-11-28 10:08:53 -0800103#if HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
Geza Lore1a800f62016-09-02 16:05:53 +0100104const Ht8x16Param kArrayHt8x16Param_sse2[] = {
David Barker4f803ef2016-10-13 16:02:59 +0100105 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 0, AOM_BITS_8, 128),
106 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 1, AOM_BITS_8, 128),
107 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 2, AOM_BITS_8, 128),
108 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 3, AOM_BITS_8, 128),
Geza Lore1a800f62016-09-02 16:05:53 +0100109#if CONFIG_EXT_TX
David Barker4f803ef2016-10-13 16:02:59 +0100110 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 4, AOM_BITS_8, 128),
111 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 5, AOM_BITS_8, 128),
112 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 6, AOM_BITS_8, 128),
113 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 7, AOM_BITS_8, 128),
114 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 8, AOM_BITS_8, 128),
115 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 9, AOM_BITS_8, 128),
116 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 10, AOM_BITS_8, 128),
117 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 11, AOM_BITS_8, 128),
118 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 12, AOM_BITS_8, 128),
119 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 13, AOM_BITS_8, 128),
120 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 14, AOM_BITS_8, 128),
121 make_tuple(&av1_fht8x16_sse2, &av1_iht8x16_128_add_sse2, 15, AOM_BITS_8, 128)
Geza Lore1a800f62016-09-02 16:05:53 +0100122#endif // CONFIG_EXT_TX
123};
Yi Luof10cba22016-12-14 13:54:47 -0800124INSTANTIATE_TEST_CASE_P(SSE2, AV1Trans8x16HT,
Geza Lore1a800f62016-09-02 16:05:53 +0100125 ::testing::ValuesIn(kArrayHt8x16Param_sse2));
Yaowu Xu46f0f292016-11-28 10:08:53 -0800126#endif // HAVE_SSE2 && !CONFIG_EMULATE_HARDWARE
Geza Lore1a800f62016-09-02 16:05:53 +0100127
128} // namespace