blob: d2598f9f5cf220d00915cb125f6ee0dfa5b3499a [file] [log] [blame]
Yi Luo267f73a2016-02-29 09:53:42 -08001/*
2 * Copyright (c) 2016 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "third_party/googletest/src/include/gtest/gtest.h"
12
13#include "./vp10_rtcd.h"
14#include "./vpx_dsp_rtcd.h"
15
16#include "test/acm_random.h"
17#include "test/clear_system_state.h"
18#include "test/register_state_check.h"
19#include "test/transform_test_base.h"
20#include "test/util.h"
21#include "vpx_ports/mem.h"
22
23using libvpx_test::ACMRandom;
24
25namespace {
26typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
27 int tx_type);
28
29using libvpx_test::FhtFunc;
30typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t, int> Ht4x4Param;
31
32void fht4x4_ref(const int16_t *in, tran_low_t *out, int stride,
33 int tx_type) {
34 vp10_fht4x4_c(in, out, stride, tx_type);
35}
36
37class VP10Trans4x4HT
38 : public libvpx_test::TransformTestBase,
39 public ::testing::TestWithParam<Ht4x4Param> {
40 public:
41 virtual ~VP10Trans4x4HT() {}
42
43 virtual void SetUp() {
44 fwd_txfm_ = GET_PARAM(0);
45 inv_txfm_ = GET_PARAM(1);
46 tx_type_ = GET_PARAM(2);
47 pitch_ = 4;
48 fwd_txfm_ref = fht4x4_ref;
49 bit_depth_ = GET_PARAM(3);
50 mask_ = (1 << bit_depth_) - 1;
51 num_coeffs_ = GET_PARAM(4);
52 }
53 virtual void TearDown() { libvpx_test::ClearSystemState(); }
54
55 protected:
56 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) {
57 fwd_txfm_(in, out, stride, tx_type_);
58 }
59
60 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) {
61 inv_txfm_(out, dst, stride, tx_type_);
62 }
63
64 FhtFunc fwd_txfm_;
65 IhtFunc inv_txfm_;
66};
67
68TEST_P(VP10Trans4x4HT, CoeffCheck) {
69 RunCoeffCheck();
70}
71
72using std::tr1::make_tuple;
73
74#if HAVE_SSE2
75INSTANTIATE_TEST_CASE_P(
76 SSE2, VP10Trans4x4HT,
77 ::testing::Values(
78#if !CONFIG_EXT_TX
79 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 0,
80 VPX_BITS_8, 16),
81 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 1,
82 VPX_BITS_8, 16),
83 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 2,
84 VPX_BITS_8, 16),
85 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 3,
86 VPX_BITS_8, 16)));
87#else
88 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 0,
89 VPX_BITS_8, 16),
90 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 1,
91 VPX_BITS_8, 16),
92 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 2,
93 VPX_BITS_8, 16),
94 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 3,
95 VPX_BITS_8, 16),
96 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 4,
97 VPX_BITS_8, 16),
98 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 5,
99 VPX_BITS_8, 16),
100 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 6,
101 VPX_BITS_8, 16),
102 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 7,
103 VPX_BITS_8, 16),
104 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 8,
105 VPX_BITS_8, 16),
106 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 9,
107 VPX_BITS_8, 16),
108 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 10,
109 VPX_BITS_8, 16),
110 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 11,
111 VPX_BITS_8, 16),
112 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 12,
113 VPX_BITS_8, 16),
114 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 13,
115 VPX_BITS_8, 16),
116 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 14,
117 VPX_BITS_8, 16),
118 make_tuple(&vp10_fht4x4_sse2, &vp10_iht4x4_16_add_sse2, 15,
119 VPX_BITS_8, 16)));
120#endif // !CONFIG_EXT_TX
121#endif // HAVE_SSE2
122
123} // namespace