• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016, 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 #ifndef AOM_TEST_AV1_CONVOLVE_2D_TEST_UTIL_H_
13 #define AOM_TEST_AV1_CONVOLVE_2D_TEST_UTIL_H_
14 
15 #include "config/av1_rtcd.h"
16 #include "config/aom_dsp_rtcd.h"
17 
18 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
19 #include "test/acm_random.h"
20 #include "test/util.h"
21 
22 #include "test/clear_system_state.h"
23 #include "test/register_state_check.h"
24 
25 namespace libaom_test {
26 
27 namespace AV1Convolve2D {
28 
29 typedef void (*convolve_2d_func)(const uint8_t *src, int src_stride,
30                                  uint8_t *dst, int dst_stride, int w, int h,
31                                  const InterpFilterParams *filter_params_x,
32                                  const InterpFilterParams *filter_params_y,
33                                  const int subpel_x_q4, const int subpel_y_q4,
34                                  ConvolveParams *conv_params);
35 
36 typedef ::testing::tuple<convolve_2d_func, int, int, BLOCK_SIZE>
37     Convolve2DParam;
38 
39 ::testing::internal::ParamGenerator<Convolve2DParam> BuildParams(
40     convolve_2d_func filter, int subx_exist, int suby_exist);
41 
42 class AV1Convolve2DSrTest : public ::testing::TestWithParam<Convolve2DParam> {
43  public:
44   virtual ~AV1Convolve2DSrTest();
45   virtual void SetUp();
46 
47   virtual void TearDown();
48 
49  protected:
50   void RunCheckOutput(convolve_2d_func test_impl);
51   void RunSpeedTest(convolve_2d_func test_impl);
52 
53   libaom_test::ACMRandom rnd_;
54 };
55 
56 class AV1JntConvolve2DTest : public ::testing::TestWithParam<Convolve2DParam> {
57  public:
58   virtual ~AV1JntConvolve2DTest();
59   virtual void SetUp();
60 
61   virtual void TearDown();
62 
63  protected:
64   void RunCheckOutput(convolve_2d_func test_impl);
65   void RunSpeedTest(convolve_2d_func test_impl);
66 
67   libaom_test::ACMRandom rnd_;
68 };
69 }  // namespace AV1Convolve2D
70 
71 namespace AV1HighbdConvolve2D {
72 typedef void (*highbd_convolve_2d_func)(
73     const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
74     int h, const InterpFilterParams *filter_params_x,
75     const InterpFilterParams *filter_params_y, const int subpel_x_q4,
76     const int subpel_y_q4, ConvolveParams *conv_params, int bd);
77 
78 typedef ::testing::tuple<int, highbd_convolve_2d_func, int, int, BLOCK_SIZE>
79     HighbdConvolve2DParam;
80 
81 ::testing::internal::ParamGenerator<HighbdConvolve2DParam> BuildParams(
82     highbd_convolve_2d_func filter, int subx_exist, int suby_exist);
83 
84 class AV1HighbdConvolve2DSrTest
85     : public ::testing::TestWithParam<HighbdConvolve2DParam> {
86  public:
87   virtual ~AV1HighbdConvolve2DSrTest();
88   virtual void SetUp();
89 
90   virtual void TearDown();
91 
92  protected:
93   void RunCheckOutput(highbd_convolve_2d_func test_impl);
94   void RunSpeedTest(highbd_convolve_2d_func test_impl);
95 
96   libaom_test::ACMRandom rnd_;
97 };
98 
99 class AV1HighbdJntConvolve2DTest
100     : public ::testing::TestWithParam<HighbdConvolve2DParam> {
101  public:
102   virtual ~AV1HighbdJntConvolve2DTest();
103   virtual void SetUp();
104 
105   virtual void TearDown();
106 
107  protected:
108   void RunCheckOutput(highbd_convolve_2d_func test_impl);
109   void RunSpeedTest(highbd_convolve_2d_func test_impl);
110 
111   libaom_test::ACMRandom rnd_;
112 };
113 }  // namespace AV1HighbdConvolve2D
114 
115 }  // namespace libaom_test
116 
117 #endif  // AOM_TEST_AV1_CONVOLVE_2D_TEST_UTIL_H_
118