From 45a7b5ebd7fcf7b329710e3f347ce40bd2bf6a84 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 12 Feb 2016 19:32:05 -0800 Subject: [PATCH] lpf_8_test: simplify function wrapper generation Change-Id: Ie4d3e80a4e43dd4ada78d073e308e10db4ea3239 --- test/lpf_8_test.cc | 159 ++++++++++++--------------------------------- 1 file changed, 43 insertions(+), 116 deletions(-) diff --git a/test/lpf_8_test.cc b/test/lpf_8_test.cc index 0bf6b0c23..c582bc34d 100644 --- a/test/lpf_8_test.cc +++ b/test/lpf_8_test.cc @@ -42,6 +42,17 @@ typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1, int bd); + +// wrapper for loopfilter functions without a 'count' param. +typedef void (*loop_op_nc_t)(uint16_t *s, int p, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh, + int bd); +template +void wrapper_nc(uint16_t *s, int p, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh, + int /*count*/, int bd) { + fn(s, p, blimit, limit, thresh, bd); +} #else typedef void (*loop_op_t)(uint8_t *s, int p, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, @@ -50,106 +61,20 @@ typedef void (*dual_loop_op_t)(uint8_t *s, int p, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1); -#endif // CONFIG_VP9_HIGHBITDEPTH - -typedef std::tr1::tuple loop8_param_t; -typedef std::tr1::tuple dualloop8_param_t; - -#if HAVE_SSE2 -#if CONFIG_VP9_HIGHBITDEPTH -void wrapper_vertical_16_sse2(uint16_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count, int bd) { - vpx_highbd_lpf_vertical_16_sse2(s, p, blimit, limit, thresh, bd); -} - -void wrapper_vertical_16_c(uint16_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count, int bd) { - vpx_highbd_lpf_vertical_16_c(s, p, blimit, limit, thresh, bd); -} - -void wrapper_vertical_16_dual_sse2(uint16_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count, int bd) { - vpx_highbd_lpf_vertical_16_dual_sse2(s, p, blimit, limit, thresh, bd); -} - -void wrapper_vertical_16_dual_c(uint16_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count, int bd) { - vpx_highbd_lpf_vertical_16_dual_c(s, p, blimit, limit, thresh, bd); -} -#else -void wrapper_vertical_16_sse2(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_sse2(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_c(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_dual_sse2(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_dual_sse2(s, p, blimit, limit, thresh); -} -void wrapper_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_dual_c(s, p, blimit, limit, thresh); +// wrapper for loopfilter functions without a 'count' param. +typedef void (*loop_op_nc_t)(uint8_t *s, int p, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh); +template +void wrapper_nc(uint8_t *s, int p, const uint8_t *blimit, + const uint8_t *limit, const uint8_t *thresh, + int /*count*/) { + fn(s, p, blimit, limit, thresh); } #endif // CONFIG_VP9_HIGHBITDEPTH -#endif // HAVE_SSE2 -#if HAVE_NEON_ASM -#if CONFIG_VP9_HIGHBITDEPTH -// No neon high bitdepth functions. -#else -void wrapper_vertical_16_neon(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_neon(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_c(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_dual_neon(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_dual_neon(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_dual_c(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_dual_c(s, p, blimit, limit, thresh); -} -#endif // CONFIG_VP9_HIGHBITDEPTH -#endif // HAVE_NEON_ASM - -#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH) -void wrapper_vertical_16_msa(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_msa(s, p, blimit, limit, thresh); -} - -void wrapper_vertical_16_c(uint8_t *s, int p, const uint8_t *blimit, - const uint8_t *limit, const uint8_t *thresh, - int count) { - vpx_lpf_vertical_16_c(s, p, blimit, limit, thresh); -} -#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH) +typedef std::tr1::tuple loop8_param_t; +typedef std::tr1::tuple dualloop8_param_t; class Loop8Test6Param : public ::testing::TestWithParam { public: @@ -546,8 +471,8 @@ INSTANTIATE_TEST_CASE_P( &vpx_highbd_lpf_horizontal_16_c, 8, 2), make_tuple(&vpx_highbd_lpf_vertical_8_sse2, &vpx_highbd_lpf_vertical_8_c, 8, 1), - make_tuple(&wrapper_vertical_16_sse2, - &wrapper_vertical_16_c, 8, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1), make_tuple(&vpx_highbd_lpf_horizontal_4_sse2, &vpx_highbd_lpf_horizontal_4_c, 10, 1), make_tuple(&vpx_highbd_lpf_vertical_4_sse2, @@ -560,8 +485,8 @@ INSTANTIATE_TEST_CASE_P( &vpx_highbd_lpf_horizontal_16_c, 10, 2), make_tuple(&vpx_highbd_lpf_vertical_8_sse2, &vpx_highbd_lpf_vertical_8_c, 10, 1), - make_tuple(&wrapper_vertical_16_sse2, - &wrapper_vertical_16_c, 10, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 10, 1), make_tuple(&vpx_highbd_lpf_horizontal_4_sse2, &vpx_highbd_lpf_horizontal_4_c, 12, 1), make_tuple(&vpx_highbd_lpf_vertical_4_sse2, @@ -574,14 +499,14 @@ INSTANTIATE_TEST_CASE_P( &vpx_highbd_lpf_horizontal_16_c, 12, 2), make_tuple(&vpx_highbd_lpf_vertical_8_sse2, &vpx_highbd_lpf_vertical_8_c, 12, 1), - make_tuple(&wrapper_vertical_16_sse2, - &wrapper_vertical_16_c, 12, 1), - make_tuple(&wrapper_vertical_16_dual_sse2, - &wrapper_vertical_16_dual_c, 8, 1), - make_tuple(&wrapper_vertical_16_dual_sse2, - &wrapper_vertical_16_dual_c, 10, 1), - make_tuple(&wrapper_vertical_16_dual_sse2, - &wrapper_vertical_16_dual_c, 12, 1))); + make_tuple(&wrapper_nc, + &wrapper_nc, 12, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 10, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 12, 1))); #else INSTANTIATE_TEST_CASE_P( SSE2, Loop8Test6Param, @@ -590,9 +515,10 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&vpx_lpf_horizontal_16_sse2, &vpx_lpf_horizontal_16_c, 8, 1), make_tuple(&vpx_lpf_horizontal_16_sse2, &vpx_lpf_horizontal_16_c, 8, 2), make_tuple(&vpx_lpf_vertical_8_sse2, &vpx_lpf_vertical_8_c, 8, 1), - make_tuple(&wrapper_vertical_16_sse2, &wrapper_vertical_16_c, 8, 1), - make_tuple(&wrapper_vertical_16_dual_sse2, - &wrapper_vertical_16_dual_c, 8, 1))); + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1))); #endif // CONFIG_VP9_HIGHBITDEPTH #endif @@ -663,10 +589,10 @@ INSTANTIATE_TEST_CASE_P( &vpx_lpf_horizontal_16_c, 8, 1), make_tuple(&vpx_lpf_horizontal_16_neon, &vpx_lpf_horizontal_16_c, 8, 2), - make_tuple(&wrapper_vertical_16_neon, - &wrapper_vertical_16_c, 8, 1), - make_tuple(&wrapper_vertical_16_dual_neon, - &wrapper_vertical_16_dual_c, 8, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1), + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1), #endif // HAVE_NEON_ASM make_tuple(&vpx_lpf_horizontal_8_neon, &vpx_lpf_horizontal_8_c, 8, 1), @@ -700,7 +626,8 @@ INSTANTIATE_TEST_CASE_P( make_tuple(&vpx_lpf_horizontal_16_msa, &vpx_lpf_horizontal_16_c, 8, 1), make_tuple(&vpx_lpf_horizontal_16_msa, &vpx_lpf_horizontal_16_c, 8, 2), make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8, 1), - make_tuple(&wrapper_vertical_16_msa, &wrapper_vertical_16_c, 8, 1))); + make_tuple(&wrapper_nc, + &wrapper_nc, 8, 1))); INSTANTIATE_TEST_CASE_P( MSA, Loop8Test9Param, -- 2.40.0