summaryrefslogtreecommitdiffstats
path: root/third_party/aom/test/av1_convolve_2d_test_util.h
blob: 3a53dbdfe3ab82b16a1a82fbee48acbbca968d59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

#ifndef TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
#define TEST_HIPREC_CONVOLVE_TEST_UTIL_H_

#include "config/av1_rtcd.h"
#include "config/aom_dsp_rtcd.h"

#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
#include "test/acm_random.h"
#include "test/util.h"

#include "test/clear_system_state.h"
#include "test/register_state_check.h"

namespace libaom_test {

namespace AV1Convolve2D {

typedef void (*convolve_2d_func)(const uint8_t *src, int src_stride,
                                 uint8_t *dst, int dst_stride, int w, int h,
                                 InterpFilterParams *filter_params_x,
                                 InterpFilterParams *filter_params_y,
                                 const int subpel_x_q4, const int subpel_y_q4,
                                 ConvolveParams *conv_params);

typedef ::testing::tuple<convolve_2d_func, int, int, BLOCK_SIZE>
    Convolve2DParam;

::testing::internal::ParamGenerator<Convolve2DParam> BuildParams(
    convolve_2d_func filter, int subx_exist, int suby_exist);

class AV1Convolve2DSrTest : public ::testing::TestWithParam<Convolve2DParam> {
 public:
  virtual ~AV1Convolve2DSrTest();
  virtual void SetUp();

  virtual void TearDown();

 protected:
  void RunCheckOutput(convolve_2d_func test_impl);
  void RunSpeedTest(convolve_2d_func test_impl);

  libaom_test::ACMRandom rnd_;
};

class AV1JntConvolve2DTest : public ::testing::TestWithParam<Convolve2DParam> {
 public:
  virtual ~AV1JntConvolve2DTest();
  virtual void SetUp();

  virtual void TearDown();

 protected:
  void RunCheckOutput(convolve_2d_func test_impl);
  void RunSpeedTest(convolve_2d_func test_impl);

  libaom_test::ACMRandom rnd_;
};
}  // namespace AV1Convolve2D

namespace AV1HighbdConvolve2D {
typedef void (*highbd_convolve_2d_func)(
    const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
    int h, InterpFilterParams *filter_params_x,
    InterpFilterParams *filter_params_y, const int subpel_x_q4,
    const int subpel_y_q4, ConvolveParams *conv_params, int bd);

typedef ::testing::tuple<int, highbd_convolve_2d_func, int, int, BLOCK_SIZE>
    HighbdConvolve2DParam;

::testing::internal::ParamGenerator<HighbdConvolve2DParam> BuildParams(
    highbd_convolve_2d_func filter, int subx_exist, int suby_exist);

class AV1HighbdConvolve2DSrTest
    : public ::testing::TestWithParam<HighbdConvolve2DParam> {
 public:
  virtual ~AV1HighbdConvolve2DSrTest();
  virtual void SetUp();

  virtual void TearDown();

 protected:
  void RunCheckOutput(highbd_convolve_2d_func test_impl);
  void RunSpeedTest(highbd_convolve_2d_func test_impl);

  libaom_test::ACMRandom rnd_;
};

class AV1HighbdJntConvolve2DTest
    : public ::testing::TestWithParam<HighbdConvolve2DParam> {
 public:
  virtual ~AV1HighbdJntConvolve2DTest();
  virtual void SetUp();

  virtual void TearDown();

 protected:
  void RunCheckOutput(highbd_convolve_2d_func test_impl);
  void RunSpeedTest(highbd_convolve_2d_func test_impl);

  libaom_test::ACMRandom rnd_;
};
}  // namespace AV1HighbdConvolve2D

}  // namespace libaom_test

#endif  // TEST_HIPREC_CONVOLVE_TEST_UTIL_H_