xref: /aosp_15_r20/external/libaom/test/hiprec_convolve_test_util.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker  *
4*77c1e3ccSAndroid Build Coastguard Worker  * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker  * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker  * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker  */
11*77c1e3ccSAndroid Build Coastguard Worker 
12*77c1e3ccSAndroid Build Coastguard Worker #ifndef AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
13*77c1e3ccSAndroid Build Coastguard Worker #define AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
14*77c1e3ccSAndroid Build Coastguard Worker 
15*77c1e3ccSAndroid Build Coastguard Worker #include <tuple>
16*77c1e3ccSAndroid Build Coastguard Worker 
17*77c1e3ccSAndroid Build Coastguard Worker #include "config/av1_rtcd.h"
18*77c1e3ccSAndroid Build Coastguard Worker 
19*77c1e3ccSAndroid Build Coastguard Worker #include "gtest/gtest.h"
20*77c1e3ccSAndroid Build Coastguard Worker #include "test/acm_random.h"
21*77c1e3ccSAndroid Build Coastguard Worker #include "test/util.h"
22*77c1e3ccSAndroid Build Coastguard Worker #include "test/register_state_check.h"
23*77c1e3ccSAndroid Build Coastguard Worker 
24*77c1e3ccSAndroid Build Coastguard Worker #include "aom_ports/aom_timer.h"
25*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/convolve.h"
26*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/mv.h"
27*77c1e3ccSAndroid Build Coastguard Worker 
28*77c1e3ccSAndroid Build Coastguard Worker namespace libaom_test {
29*77c1e3ccSAndroid Build Coastguard Worker 
30*77c1e3ccSAndroid Build Coastguard Worker namespace AV1HiprecConvolve {
31*77c1e3ccSAndroid Build Coastguard Worker 
32*77c1e3ccSAndroid Build Coastguard Worker typedef void (*hiprec_convolve_func)(const uint8_t *src, ptrdiff_t src_stride,
33*77c1e3ccSAndroid Build Coastguard Worker                                      uint8_t *dst, ptrdiff_t dst_stride,
34*77c1e3ccSAndroid Build Coastguard Worker                                      const int16_t *filter_x, int x_step_q4,
35*77c1e3ccSAndroid Build Coastguard Worker                                      const int16_t *filter_y, int y_step_q4,
36*77c1e3ccSAndroid Build Coastguard Worker                                      int w, int h,
37*77c1e3ccSAndroid Build Coastguard Worker                                      const WienerConvolveParams *conv_params);
38*77c1e3ccSAndroid Build Coastguard Worker 
39*77c1e3ccSAndroid Build Coastguard Worker typedef std::tuple<int, int, int, hiprec_convolve_func> HiprecConvolveParam;
40*77c1e3ccSAndroid Build Coastguard Worker 
41*77c1e3ccSAndroid Build Coastguard Worker ::testing::internal::ParamGenerator<HiprecConvolveParam> BuildParams(
42*77c1e3ccSAndroid Build Coastguard Worker     hiprec_convolve_func filter);
43*77c1e3ccSAndroid Build Coastguard Worker 
44*77c1e3ccSAndroid Build Coastguard Worker class AV1HiprecConvolveTest
45*77c1e3ccSAndroid Build Coastguard Worker     : public ::testing::TestWithParam<HiprecConvolveParam> {
46*77c1e3ccSAndroid Build Coastguard Worker  public:
47*77c1e3ccSAndroid Build Coastguard Worker   ~AV1HiprecConvolveTest() override;
48*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override;
49*77c1e3ccSAndroid Build Coastguard Worker 
50*77c1e3ccSAndroid Build Coastguard Worker  protected:
51*77c1e3ccSAndroid Build Coastguard Worker   void RunCheckOutput(hiprec_convolve_func test_impl);
52*77c1e3ccSAndroid Build Coastguard Worker   void RunSpeedTest(hiprec_convolve_func test_impl);
53*77c1e3ccSAndroid Build Coastguard Worker 
54*77c1e3ccSAndroid Build Coastguard Worker   libaom_test::ACMRandom rnd_;
55*77c1e3ccSAndroid Build Coastguard Worker };
56*77c1e3ccSAndroid Build Coastguard Worker 
57*77c1e3ccSAndroid Build Coastguard Worker }  // namespace AV1HiprecConvolve
58*77c1e3ccSAndroid Build Coastguard Worker 
59*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
60*77c1e3ccSAndroid Build Coastguard Worker namespace AV1HighbdHiprecConvolve {
61*77c1e3ccSAndroid Build Coastguard Worker typedef void (*highbd_hiprec_convolve_func)(
62*77c1e3ccSAndroid Build Coastguard Worker     const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
63*77c1e3ccSAndroid Build Coastguard Worker     ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4,
64*77c1e3ccSAndroid Build Coastguard Worker     const int16_t *filter_y, int y_step_q4, int w, int h,
65*77c1e3ccSAndroid Build Coastguard Worker     const WienerConvolveParams *conv_params, int bps);
66*77c1e3ccSAndroid Build Coastguard Worker 
67*77c1e3ccSAndroid Build Coastguard Worker typedef std::tuple<int, int, int, int, highbd_hiprec_convolve_func>
68*77c1e3ccSAndroid Build Coastguard Worker     HighbdHiprecConvolveParam;
69*77c1e3ccSAndroid Build Coastguard Worker 
70*77c1e3ccSAndroid Build Coastguard Worker ::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams(
71*77c1e3ccSAndroid Build Coastguard Worker     highbd_hiprec_convolve_func filter);
72*77c1e3ccSAndroid Build Coastguard Worker 
73*77c1e3ccSAndroid Build Coastguard Worker class AV1HighbdHiprecConvolveTest
74*77c1e3ccSAndroid Build Coastguard Worker     : public ::testing::TestWithParam<HighbdHiprecConvolveParam> {
75*77c1e3ccSAndroid Build Coastguard Worker  public:
76*77c1e3ccSAndroid Build Coastguard Worker   ~AV1HighbdHiprecConvolveTest() override;
77*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override;
78*77c1e3ccSAndroid Build Coastguard Worker 
79*77c1e3ccSAndroid Build Coastguard Worker  protected:
80*77c1e3ccSAndroid Build Coastguard Worker   void RunCheckOutput(highbd_hiprec_convolve_func test_impl);
81*77c1e3ccSAndroid Build Coastguard Worker   void RunSpeedTest(highbd_hiprec_convolve_func test_impl);
82*77c1e3ccSAndroid Build Coastguard Worker 
83*77c1e3ccSAndroid Build Coastguard Worker   libaom_test::ACMRandom rnd_;
84*77c1e3ccSAndroid Build Coastguard Worker };
85*77c1e3ccSAndroid Build Coastguard Worker 
86*77c1e3ccSAndroid Build Coastguard Worker }  // namespace AV1HighbdHiprecConvolve
87*77c1e3ccSAndroid Build Coastguard Worker #endif  // CONFIG_AV1_HIGHBITDEPTH
88*77c1e3ccSAndroid Build Coastguard Worker }  // namespace libaom_test
89*77c1e3ccSAndroid Build Coastguard Worker 
90*77c1e3ccSAndroid Build Coastguard Worker #endif  // AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_
91