]> granicus.if.org Git - libvpx/commitdiff
lpf_8_test: simplify function wrapper generation
authorJames Zern <jzern@google.com>
Sat, 13 Feb 2016 03:32:05 +0000 (19:32 -0800)
committerJames Zern <jzern@google.com>
Tue, 16 Feb 2016 22:58:33 +0000 (14:58 -0800)
Change-Id: Ie4d3e80a4e43dd4ada78d073e308e10db4ea3239

test/lpf_8_test.cc

index 0bf6b0c232231942fcf48efe167896daf3cdf07a..c582bc34dba79173192c85f6b826db7d29edd021 100644 (file)
@@ -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 <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,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<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);
-}
-#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 <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);
 }
 #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<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;
 
 class Loop8Test6Param : public ::testing::TestWithParam<loop8_param_t> {
  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<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 @@ 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<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 @@ 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<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 @@ 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<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 @@ 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<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 @@ 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<vpx_lpf_vertical_16_msa>,
+                   &wrapper_nc<vpx_lpf_vertical_16_c>, 8, 1)));
 
 INSTANTIATE_TEST_CASE_P(
     MSA, Loop8Test9Param,