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