ref: 45a7b5ebd7fcf7b329710e3f347ce40bd2bf6a84
parent: 548889c35ad177861dbec9fd9b14ac9bb070723a
author: James Zern <jzern@google.com>
date: Fri Feb 12 14:32:05 EST 2016
lpf_8_test: simplify function wrapper generation Change-Id: Ie4d3e80a4e43dd4ada78d073e308e10db4ea3239
--- a/test/lpf_8_test.cc
+++ b/test/lpf_8_test.cc
@@ -42,6 +42,17 @@
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 <loop_op_nc_t fn>
+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,107 +61,21 @@
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<loop_op_t, loop_op_t, int, int> loop8_param_t;
-typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> 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);
+// 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 <loop_op_nc_t fn>
+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);
}
-#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);
-}
#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);
-}
+typedef std::tr1::tuple<loop_op_t, loop_op_t, int, int> loop8_param_t;
+typedef std::tr1::tuple<dual_loop_op_t, dual_loop_op_t, int> dualloop8_param_t;
-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)
-
class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
public:
virtual ~Loop8Test6Param() {}
@@ -546,8 +471,8 @@
&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<vpx_highbd_lpf_vertical_16_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_c>, 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 @@
&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<vpx_highbd_lpf_vertical_16_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_c>, 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 @@
&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<vpx_highbd_lpf_vertical_16_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_c>, 12, 1),
+ make_tuple(&wrapper_nc<vpx_highbd_lpf_vertical_16_dual_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_dual_c>, 8, 1),
+ make_tuple(&wrapper_nc<vpx_highbd_lpf_vertical_16_dual_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_dual_c>, 10, 1),
+ make_tuple(&wrapper_nc<vpx_highbd_lpf_vertical_16_dual_sse2>,
+ &wrapper_nc<vpx_highbd_lpf_vertical_16_dual_c>, 12, 1)));
#else
INSTANTIATE_TEST_CASE_P(
SSE2, Loop8Test6Param,
@@ -590,9 +515,10 @@
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<vpx_lpf_vertical_16_sse2>,
+ &wrapper_nc<vpx_lpf_vertical_16_c>, 8, 1),
+ make_tuple(&wrapper_nc<vpx_lpf_vertical_16_dual_sse2>,
+ &wrapper_nc<vpx_lpf_vertical_16_dual_c>, 8, 1)));
#endif // CONFIG_VP9_HIGHBITDEPTH
#endif
@@ -663,10 +589,10 @@
&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<vpx_lpf_vertical_16_neon>,
+ &wrapper_nc<vpx_lpf_vertical_16_c>, 8, 1),
+ make_tuple(&wrapper_nc<vpx_lpf_vertical_16_dual_neon>,
+ &wrapper_nc<vpx_lpf_vertical_16_dual_c>, 8, 1),
#endif // HAVE_NEON_ASM
make_tuple(&vpx_lpf_horizontal_8_neon,
&vpx_lpf_horizontal_8_c, 8, 1),
@@ -700,7 +626,8 @@
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<vpx_lpf_vertical_16_msa>,
+ &wrapper_nc<vpx_lpf_vertical_16_c>, 8, 1)));
INSTANTIATE_TEST_CASE_P(
MSA, Loop8Test9Param,