• 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_HIPREC_CONVOLVE_TEST_UTIL_H_
13 #define AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
14 
15 #include <tuple>
16 
17 #include "config/av1_rtcd.h"
18 
19 #include "test/acm_random.h"
20 #include "test/util.h"
21 #include "test/clear_system_state.h"
22 #include "test/register_state_check.h"
23 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
24 
25 #include "aom_ports/aom_timer.h"
26 #include "av1/common/convolve.h"
27 #include "av1/common/mv.h"
28 
29 namespace libaom_test {
30 
31 namespace AV1HiprecConvolve {
32 
33 typedef void (*hiprec_convolve_func)(const uint8_t *src, ptrdiff_t src_stride,
34                                      uint8_t *dst, ptrdiff_t dst_stride,
35                                      const int16_t *filter_x, int x_step_q4,
36                                      const int16_t *filter_y, int y_step_q4,
37                                      int w, int h,
38                                      const ConvolveParams *conv_params);
39 
40 typedef std::tuple<int, int, int, hiprec_convolve_func> HiprecConvolveParam;
41 
42 ::testing::internal::ParamGenerator<HiprecConvolveParam> BuildParams(
43     hiprec_convolve_func filter);
44 
45 class AV1HiprecConvolveTest
46     : public ::testing::TestWithParam<HiprecConvolveParam> {
47  public:
48   virtual ~AV1HiprecConvolveTest();
49   virtual void SetUp();
50 
51   virtual void TearDown();
52 
53  protected:
54   void RunCheckOutput(hiprec_convolve_func test_impl);
55   void RunSpeedTest(hiprec_convolve_func test_impl);
56 
57   libaom_test::ACMRandom rnd_;
58 };
59 
60 }  // namespace AV1HiprecConvolve
61 
62 #if CONFIG_AV1_HIGHBITDEPTH
63 namespace AV1HighbdHiprecConvolve {
64 typedef void (*highbd_hiprec_convolve_func)(
65     const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
66     ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
67     const int16_t *filter_y, int y_step_q4, int w, int h,
68     const ConvolveParams *conv_params, int bps);
69 
70 typedef std::tuple<int, int, int, int, highbd_hiprec_convolve_func>
71     HighbdHiprecConvolveParam;
72 
73 ::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams(
74     highbd_hiprec_convolve_func filter);
75 
76 class AV1HighbdHiprecConvolveTest
77     : public ::testing::TestWithParam<HighbdHiprecConvolveParam> {
78  public:
79   virtual ~AV1HighbdHiprecConvolveTest();
80   virtual void SetUp();
81 
82   virtual void TearDown();
83 
84  protected:
85   void RunCheckOutput(highbd_hiprec_convolve_func test_impl);
86   void RunSpeedTest(highbd_hiprec_convolve_func test_impl);
87 
88   libaom_test::ACMRandom rnd_;
89 };
90 
91 }  // namespace AV1HighbdHiprecConvolve
92 #endif  // CONFIG_AV1_HIGHBITDEPTH
93 }  // namespace libaom_test
94 
95 #endif  // AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
96