David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 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 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 12 | #ifndef AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_ |
| 13 | #define AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_ |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 14 | |
Tom Finegan | 44702c8 | 2018-05-22 13:00:39 -0700 | [diff] [blame] | 15 | #include "config/av1_rtcd.h" |
| 16 | |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 17 | #include "test/acm_random.h" |
| 18 | #include "test/util.h" |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 19 | #include "test/clear_system_state.h" |
| 20 | #include "test/register_state_check.h" |
Imdad Sardharwalla | aab6aee | 2018-01-26 16:05:14 +0000 | [diff] [blame] | 21 | #include "third_party/googletest/src/googletest/include/gtest/gtest.h" |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 22 | |
Imdad Sardharwalla | aab6aee | 2018-01-26 16:05:14 +0000 | [diff] [blame] | 23 | #include "aom_ports/aom_timer.h" |
Debargha Mukherjee | 2697139 | 2018-03-12 08:20:46 -0700 | [diff] [blame] | 24 | #include "av1/common/convolve.h" |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 25 | #include "av1/common/mv.h" |
| 26 | |
| 27 | namespace libaom_test { |
| 28 | |
| 29 | namespace AV1HiprecConvolve { |
| 30 | |
| 31 | typedef void (*hiprec_convolve_func)(const uint8_t *src, ptrdiff_t src_stride, |
| 32 | uint8_t *dst, ptrdiff_t dst_stride, |
| 33 | const int16_t *filter_x, int x_step_q4, |
| 34 | const int16_t *filter_y, int y_step_q4, |
Debargha Mukherjee | 2697139 | 2018-03-12 08:20:46 -0700 | [diff] [blame] | 35 | int w, int h, |
| 36 | const ConvolveParams *conv_params); |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 37 | |
James Zern | 9561280 | 2018-03-30 11:37:54 -0700 | [diff] [blame] | 38 | typedef ::testing::tuple<int, int, int, hiprec_convolve_func> |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 39 | 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 | virtual ~AV1HiprecConvolveTest(); |
| 48 | virtual void SetUp(); |
| 49 | |
| 50 | virtual void TearDown(); |
| 51 | |
| 52 | protected: |
| 53 | void RunCheckOutput(hiprec_convolve_func test_impl); |
Imdad Sardharwalla | aab6aee | 2018-01-26 16:05:14 +0000 | [diff] [blame] | 54 | void RunSpeedTest(hiprec_convolve_func test_impl); |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 55 | |
| 56 | libaom_test::ACMRandom rnd_; |
| 57 | }; |
| 58 | |
| 59 | } // namespace AV1HiprecConvolve |
| 60 | |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 61 | namespace AV1HighbdHiprecConvolve { |
| 62 | typedef void (*highbd_hiprec_convolve_func)( |
| 63 | const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, |
| 64 | ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, |
Debargha Mukherjee | 2697139 | 2018-03-12 08:20:46 -0700 | [diff] [blame] | 65 | const int16_t *filter_y, int y_step_q4, int w, int h, |
| 66 | const ConvolveParams *conv_params, int bps); |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 67 | |
James Zern | 9561280 | 2018-03-30 11:37:54 -0700 | [diff] [blame] | 68 | typedef ::testing::tuple<int, int, int, int, highbd_hiprec_convolve_func> |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 69 | HighbdHiprecConvolveParam; |
| 70 | |
| 71 | ::testing::internal::ParamGenerator<HighbdHiprecConvolveParam> BuildParams( |
| 72 | highbd_hiprec_convolve_func filter); |
| 73 | |
| 74 | class AV1HighbdHiprecConvolveTest |
| 75 | : public ::testing::TestWithParam<HighbdHiprecConvolveParam> { |
| 76 | public: |
| 77 | virtual ~AV1HighbdHiprecConvolveTest(); |
| 78 | virtual void SetUp(); |
| 79 | |
| 80 | virtual void TearDown(); |
| 81 | |
| 82 | protected: |
| 83 | void RunCheckOutput(highbd_hiprec_convolve_func test_impl); |
Imdad Sardharwalla | aab6aee | 2018-01-26 16:05:14 +0000 | [diff] [blame] | 84 | void RunSpeedTest(highbd_hiprec_convolve_func test_impl); |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 85 | |
| 86 | libaom_test::ACMRandom rnd_; |
| 87 | }; |
| 88 | |
| 89 | } // namespace AV1HighbdHiprecConvolve |
David Barker | 5d34e6a | 2017-05-18 15:12:50 +0100 | [diff] [blame] | 90 | |
| 91 | } // namespace libaom_test |
| 92 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 93 | #endif // AOM_TEST_HIPREC_CONVOLVE_TEST_UTIL_H_ |