shithub: libvpx

Download patch

ref: 9b0d306a2fcbdefe31fa35a367293dbf23af0048
parent: e0d294c3afb8d0172a2679aafc8374d60303822f
author: Johann <[email protected]>
date: Wed May 3 08:28:32 EDT 2017

sub pel avg variance neon: add neon optimizations

These are missing an optimized version of vpx_comp_avg_pred

BUG=webm:1423

Change-Id: I31fa6ef842e98f7ff3ea079ffed51ae33178e2ed

--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -1276,6 +1276,21 @@
                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_neon, 0),
                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_neon, 0),
                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_neon, 0)));
+
+INSTANTIATE_TEST_CASE_P(
+    NEON, VpxSubpelAvgVarianceTest,
+    ::testing::Values(
+        make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_neon, 0),
+        make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_neon, 0),
+        make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_neon, 0),
+        make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_neon, 0),
+        make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_neon, 0),
+        make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_neon, 0),
+        make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_neon, 0),
+        make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_neon, 0),
+        make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_neon, 0),
+        make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_neon, 0),
+        make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_neon, 0)));
 #endif  // HAVE_NEON
 
 #if HAVE_MSA
--- a/vpx_dsp/arm/subpel_variance_neon.c
+++ b/vpx_dsp/arm/subpel_variance_neon.c
@@ -107,3 +107,42 @@
 sub_pixel_varianceNxM(32, 64);
 sub_pixel_varianceNxM(64, 32);
 sub_pixel_varianceNxM(64, 64);
+
+// TODO(johannkoenig): support 4xM block sizes.
+#define sub_pixel_avg_varianceNxM(n, m)                              \
+  uint32_t vpx_sub_pixel_avg_variance##n##x##m##_neon(               \
+      const uint8_t *a, int a_stride, int xoffset, int yoffset,      \
+      const uint8_t *b, int b_stride, uint32_t *sse,                 \
+      const uint8_t *second_pred) {                                  \
+    DECLARE_ALIGNED(16, uint8_t, fdata3[n * (m + 1)]);               \
+    DECLARE_ALIGNED(16, uint8_t, temp2[n * m]);                      \
+    DECLARE_ALIGNED(16, uint8_t, temp3[n * m]);                      \
+                                                                     \
+    if (n == 8) {                                                    \
+      var_filter_block2d_bil_w8(a, fdata3, a_stride, 1, (m + 1),     \
+                                bilinear_filters[xoffset]);          \
+      var_filter_block2d_bil_w8(fdata3, temp2, n, n, m,              \
+                                bilinear_filters[yoffset]);          \
+    } else {                                                         \
+      var_filter_block2d_bil_w16(a, fdata3, a_stride, 1, (m + 1), n, \
+                                 bilinear_filters[xoffset]);         \
+      var_filter_block2d_bil_w16(fdata3, temp2, n, n, m, n,          \
+                                 bilinear_filters[yoffset]);         \
+    }                                                                \
+                                                                     \
+    vpx_comp_avg_pred(temp3, second_pred, n, m, temp2, n);           \
+                                                                     \
+    return vpx_variance##n##x##m(temp3, n, b, b_stride, sse);        \
+  }
+
+sub_pixel_avg_varianceNxM(8, 4);
+sub_pixel_avg_varianceNxM(8, 8);
+sub_pixel_avg_varianceNxM(8, 16);
+sub_pixel_avg_varianceNxM(16, 8);
+sub_pixel_avg_varianceNxM(16, 16);
+sub_pixel_avg_varianceNxM(16, 32);
+sub_pixel_avg_varianceNxM(32, 16);
+sub_pixel_avg_varianceNxM(32, 32);
+sub_pixel_avg_varianceNxM(32, 64);
+sub_pixel_avg_varianceNxM(64, 32);
+sub_pixel_avg_varianceNxM(64, 64);
--- a/vpx_dsp/vpx_dsp_rtcd_defs.pl
+++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl
@@ -1220,37 +1220,37 @@
   specialize qw/vpx_sub_pixel_variance4x4 msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance64x64 avx2 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance64x64 neon avx2 msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance64x32 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance64x32 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance32x64 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance32x64 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance32x32 avx2 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance32x32 neon avx2 msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance32x16 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance32x16 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance16x32 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance16x32 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance16x16 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance16x16 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance16x8 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance16x8 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance8x16 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance8x16 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance8x8 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance8x8 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
-  specialize qw/vpx_sub_pixel_avg_variance8x4 msa sse2 ssse3/;
+  specialize qw/vpx_sub_pixel_avg_variance8x4 neon msa sse2 ssse3/;
 
 add_proto qw/uint32_t vpx_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int  yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
   specialize qw/vpx_sub_pixel_avg_variance4x8 msa sse2 ssse3/;