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