From dd4347e9ece55ec4f0e68ea4791abcf5af1d04d5 Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 11 Jul 2017 05:44:23 -0700 Subject: [PATCH 1/4] sad4d neon: 4x4, 4x8 BUG=webm:1425 Change-Id: I5081b5ce131821d590c53ac1206a94f50cb8b468 --- test/sad_test.cc | 2 ++ vpx_dsp/arm/sad4d_neon.c | 33 +++++++++++++++++++++++++++++++++ vpx_dsp/vpx_dsp_rtcd_defs.pl | 4 ++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/test/sad_test.cc b/test/sad_test.cc index ef8b01cae..13eae70e4 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -678,6 +678,8 @@ const SadMxNx4Param x4d_neon_tests[] = { SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon), SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon), SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon), + SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon), + SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon), }; INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests)); #endif // HAVE_NEON diff --git a/vpx_dsp/arm/sad4d_neon.c b/vpx_dsp/arm/sad4d_neon.c index dc2039800..9c45ae1ab 100644 --- a/vpx_dsp/arm/sad4d_neon.c +++ b/vpx_dsp/arm/sad4d_neon.c @@ -13,6 +13,39 @@ #include "./vpx_config.h" #include "./vpx_dsp_rtcd.h" #include "vpx/vpx_integer.h" +#include "vpx_dsp/arm/mem_neon.h" +#include "vpx_dsp/arm/sum_neon.h" + +void vpx_sad4x4x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + int i; + const uint8x16_t src_u8 = load_unaligned_u8q(src, src_stride); + for (i = 0; i < 4; ++i) { + const uint8x16_t ref_u8 = load_unaligned_u8q(ref[i], ref_stride); + uint16x8_t abs = vabdl_u8(vget_low_u8(src_u8), vget_low_u8(ref_u8)); + abs = vabal_u8(abs, vget_high_u8(src_u8), vget_high_u8(ref_u8)); + res[i] = vget_lane_u32(horizontal_add_uint16x8(abs), 0); + } +} + +void vpx_sad4x8x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + int i; + const uint8x16_t src_0 = load_unaligned_u8q(src, src_stride); + const uint8x16_t src_1 = load_unaligned_u8q(src + 4 * src_stride, src_stride); + for (i = 0; i < 4; ++i) { + const uint8x16_t ref_0 = load_unaligned_u8q(ref[i], ref_stride); + const uint8x16_t ref_1 = + load_unaligned_u8q(ref[i] + 4 * ref_stride, ref_stride); + uint16x8_t abs = vabdl_u8(vget_low_u8(src_0), vget_low_u8(ref_0)); + abs = vabal_u8(abs, vget_high_u8(src_0), vget_high_u8(ref_0)); + abs = vabal_u8(abs, vget_low_u8(src_1), vget_low_u8(ref_1)); + abs = vabal_u8(abs, vget_high_u8(src_1), vget_high_u8(ref_1)); + res[i] = vget_lane_u32(horizontal_add_uint16x8(abs), 0); + } +} static INLINE unsigned int horizontal_long_add_16x8(const uint16x8_t vec_lo, const uint16x8_t vec_hi) { diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl index 4a7859237..57c6a1e35 100644 --- a/vpx_dsp/vpx_dsp_rtcd_defs.pl +++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl @@ -890,10 +890,10 @@ add_proto qw/void vpx_sad8x4x4d/, "const uint8_t *src_ptr, int src_stride, const specialize qw/vpx_sad8x4x4d msa sse2/; add_proto qw/void vpx_sad4x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad4x8x4d msa sse2/; +specialize qw/vpx_sad4x8x4d neon msa sse2/; add_proto qw/void vpx_sad4x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad4x4x4d msa sse2/; +specialize qw/vpx_sad4x4x4d neon msa sse2/; add_proto qw/uint64_t vpx_sum_squares_2d_i16/, "const int16_t *src, int stride, int size"; specialize qw/vpx_sum_squares_2d_i16 sse2 msa/; From 8152b0904d60edd4cb5fd71144354698c3083cbd Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 11 Jul 2017 07:01:12 -0700 Subject: [PATCH 2/4] sad4d neon: 8x[4,8,16] BUG=webm:1425 Change-Id: I7de2500cca4b621f21478c4b0333c56d76dbc9a4 --- test/sad_test.cc | 3 +++ vpx_dsp/arm/sad4d_neon.c | 41 ++++++++++++++++++++++++++++++++++++ vpx_dsp/vpx_dsp_rtcd_defs.pl | 6 +++--- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/test/sad_test.cc b/test/sad_test.cc index 13eae70e4..e53ba54a1 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -678,6 +678,9 @@ const SadMxNx4Param x4d_neon_tests[] = { SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon), SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon), SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon), + SadMxNx4Param(8, 16, &vpx_sad8x16x4d_neon), + SadMxNx4Param(8, 8, &vpx_sad8x8x4d_neon), + SadMxNx4Param(8, 4, &vpx_sad8x4x4d_neon), SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon), SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon), }; diff --git a/vpx_dsp/arm/sad4d_neon.c b/vpx_dsp/arm/sad4d_neon.c index 9c45ae1ab..420169ed3 100644 --- a/vpx_dsp/arm/sad4d_neon.c +++ b/vpx_dsp/arm/sad4d_neon.c @@ -47,6 +47,47 @@ void vpx_sad4x8x4d_neon(const uint8_t *src, int src_stride, } } +static INLINE void sad8x_4d(const uint8_t *a, int a_stride, + const uint8_t *const b[4], int b_stride, + uint32_t *result, const int height) { + int i, j; + uint16x8_t sum[4] = { vdupq_n_u16(0), vdupq_n_u16(0), vdupq_n_u16(0), + vdupq_n_u16(0) }; + const uint8_t *b_loop[4] = { b[0], b[1], b[2], b[3] }; + + for (i = 0; i < height; ++i) { + const uint8x8_t a_u8 = vld1_u8(a); + a += a_stride; + for (j = 0; j < 4; ++j) { + const uint8x8_t b_u8 = vld1_u8(b_loop[j]); + b_loop[j] += b_stride; + sum[j] = vabal_u8(sum[j], a_u8, b_u8); + } + } + + for (j = 0; j < 4; ++j) { + result[j] = vget_lane_u32(horizontal_add_uint16x8(sum[j]), 0); + } +} + +void vpx_sad8x4x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad8x_4d(src, src_stride, ref, ref_stride, res, 4); +} + +void vpx_sad8x8x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad8x_4d(src, src_stride, ref, ref_stride, res, 8); +} + +void vpx_sad8x16x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad8x_4d(src, src_stride, ref, ref_stride, res, 16); +} + static INLINE unsigned int horizontal_long_add_16x8(const uint16x8_t vec_lo, const uint16x8_t vec_hi) { const uint32x4_t vec_l_lo = diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl index 57c6a1e35..8dfd2c0cc 100644 --- a/vpx_dsp/vpx_dsp_rtcd_defs.pl +++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl @@ -881,13 +881,13 @@ add_proto qw/void vpx_sad16x8x4d/, "const uint8_t *src_ptr, int src_stride, cons specialize qw/vpx_sad16x8x4d msa sse2 vsx/; add_proto qw/void vpx_sad8x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad8x16x4d msa sse2/; +specialize qw/vpx_sad8x16x4d neon msa sse2/; add_proto qw/void vpx_sad8x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad8x8x4d msa sse2/; +specialize qw/vpx_sad8x8x4d neon msa sse2/; add_proto qw/void vpx_sad8x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad8x4x4d msa sse2/; +specialize qw/vpx_sad8x4x4d neon msa sse2/; add_proto qw/void vpx_sad4x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; specialize qw/vpx_sad4x8x4d neon msa sse2/; From 807ce8fb1e97d35bc9743c4b02d721c044725fa5 Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 11 Jul 2017 07:22:26 -0700 Subject: [PATCH 3/4] sad4d neon: 16x[8,16,32] Rewrite 16x16. Use half the accumulator registers. BUG=webm:1425 Change-Id: I44b48512b1e3629505d83c2645e800f53878ccc2 --- test/sad_test.cc | 2 + vpx_dsp/arm/sad4d_neon.c | 97 ++++++++++++++++-------------------- vpx_dsp/vpx_dsp_rtcd_defs.pl | 4 +- 3 files changed, 46 insertions(+), 57 deletions(-) diff --git a/test/sad_test.cc b/test/sad_test.cc index e53ba54a1..345178d4f 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -677,7 +677,9 @@ INSTANTIATE_TEST_CASE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests)); const SadMxNx4Param x4d_neon_tests[] = { SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon), SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon), + SadMxNx4Param(16, 32, &vpx_sad16x32x4d_neon), SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon), + SadMxNx4Param(16, 8, &vpx_sad16x8x4d_neon), SadMxNx4Param(8, 16, &vpx_sad8x16x4d_neon), SadMxNx4Param(8, 8, &vpx_sad8x8x4d_neon), SadMxNx4Param(8, 4, &vpx_sad8x4x4d_neon), diff --git a/vpx_dsp/arm/sad4d_neon.c b/vpx_dsp/arm/sad4d_neon.c index 420169ed3..6b7cc83a9 100644 --- a/vpx_dsp/arm/sad4d_neon.c +++ b/vpx_dsp/arm/sad4d_neon.c @@ -88,6 +88,48 @@ void vpx_sad8x16x4d_neon(const uint8_t *src, int src_stride, sad8x_4d(src, src_stride, ref, ref_stride, res, 16); } +static INLINE void sad16x_4d(const uint8_t *a, int a_stride, + const uint8_t *const b[4], int b_stride, + uint32_t *result, const int height) { + int i, j; + uint16x8_t sum[4] = { vdupq_n_u16(0), vdupq_n_u16(0), vdupq_n_u16(0), + vdupq_n_u16(0) }; + const uint8_t *b_loop[4] = { b[0], b[1], b[2], b[3] }; + + for (i = 0; i < height; ++i) { + const uint8x16_t a_u8 = vld1q_u8(a); + a += a_stride; + for (j = 0; j < 4; ++j) { + const uint8x16_t b_u8 = vld1q_u8(b_loop[j]); + b_loop[j] += b_stride; + sum[j] = vabal_u8(sum[j], vget_low_u8(a_u8), vget_low_u8(b_u8)); + sum[j] = vabal_u8(sum[j], vget_high_u8(a_u8), vget_high_u8(b_u8)); + } + } + + for (j = 0; j < 4; ++j) { + result[j] = vget_lane_u32(horizontal_add_uint16x8(sum[j]), 0); + } +} + +void vpx_sad16x8x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad16x_4d(src, src_stride, ref, ref_stride, res, 8); +} + +void vpx_sad16x16x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad16x_4d(src, src_stride, ref, ref_stride, res, 16); +} + +void vpx_sad16x32x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad16x_4d(src, src_stride, ref, ref_stride, res, 32); +} + static INLINE unsigned int horizontal_long_add_16x8(const uint16x8_t vec_lo, const uint16x8_t vec_hi) { const uint32x4_t vec_l_lo = @@ -241,58 +283,3 @@ void vpx_sad32x32x4d_neon(const uint8_t *src, int src_stride, res[2] = horizontal_long_add_16x8(vec_sum_ref2_lo, vec_sum_ref2_hi); res[3] = horizontal_long_add_16x8(vec_sum_ref3_lo, vec_sum_ref3_hi); } - -void vpx_sad16x16x4d_neon(const uint8_t *src, int src_stride, - const uint8_t *const ref[4], int ref_stride, - uint32_t *res) { - int i; - uint16x8_t vec_sum_ref0_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref0_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref1_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref1_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref2_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref2_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref3_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref3_hi = vdupq_n_u16(0); - const uint8_t *ref0, *ref1, *ref2, *ref3; - ref0 = ref[0]; - ref1 = ref[1]; - ref2 = ref[2]; - ref3 = ref[3]; - - for (i = 0; i < 16; ++i) { - const uint8x16_t vec_src = vld1q_u8(src); - const uint8x16_t vec_ref0 = vld1q_u8(ref0); - const uint8x16_t vec_ref1 = vld1q_u8(ref1); - const uint8x16_t vec_ref2 = vld1q_u8(ref2); - const uint8x16_t vec_ref3 = vld1q_u8(ref3); - - vec_sum_ref0_lo = - vabal_u8(vec_sum_ref0_lo, vget_low_u8(vec_src), vget_low_u8(vec_ref0)); - vec_sum_ref0_hi = vabal_u8(vec_sum_ref0_hi, vget_high_u8(vec_src), - vget_high_u8(vec_ref0)); - vec_sum_ref1_lo = - vabal_u8(vec_sum_ref1_lo, vget_low_u8(vec_src), vget_low_u8(vec_ref1)); - vec_sum_ref1_hi = vabal_u8(vec_sum_ref1_hi, vget_high_u8(vec_src), - vget_high_u8(vec_ref1)); - vec_sum_ref2_lo = - vabal_u8(vec_sum_ref2_lo, vget_low_u8(vec_src), vget_low_u8(vec_ref2)); - vec_sum_ref2_hi = vabal_u8(vec_sum_ref2_hi, vget_high_u8(vec_src), - vget_high_u8(vec_ref2)); - vec_sum_ref3_lo = - vabal_u8(vec_sum_ref3_lo, vget_low_u8(vec_src), vget_low_u8(vec_ref3)); - vec_sum_ref3_hi = vabal_u8(vec_sum_ref3_hi, vget_high_u8(vec_src), - vget_high_u8(vec_ref3)); - - src += src_stride; - ref0 += ref_stride; - ref1 += ref_stride; - ref2 += ref_stride; - ref3 += ref_stride; - } - - res[0] = horizontal_long_add_16x8(vec_sum_ref0_lo, vec_sum_ref0_hi); - res[1] = horizontal_long_add_16x8(vec_sum_ref1_lo, vec_sum_ref1_hi); - res[2] = horizontal_long_add_16x8(vec_sum_ref2_lo, vec_sum_ref2_hi); - res[3] = horizontal_long_add_16x8(vec_sum_ref3_lo, vec_sum_ref3_hi); -} diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl index 8dfd2c0cc..4fe37b76b 100644 --- a/vpx_dsp/vpx_dsp_rtcd_defs.pl +++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl @@ -872,13 +872,13 @@ add_proto qw/void vpx_sad32x16x4d/, "const uint8_t *src_ptr, int src_stride, con specialize qw/vpx_sad32x16x4d msa sse2 vsx/; add_proto qw/void vpx_sad16x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad16x32x4d msa sse2 vsx/; +specialize qw/vpx_sad16x32x4d neon msa sse2 vsx/; add_proto qw/void vpx_sad16x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; specialize qw/vpx_sad16x16x4d neon msa sse2 vsx/; add_proto qw/void vpx_sad16x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad16x8x4d msa sse2 vsx/; +specialize qw/vpx_sad16x8x4d neon msa sse2 vsx/; add_proto qw/void vpx_sad8x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; specialize qw/vpx_sad8x16x4d neon msa sse2/; From e1bde306c840585d1afb007a4c962256851c2061 Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 11 Jul 2017 07:39:28 -0700 Subject: [PATCH 4/4] sad4d neon: 32x[16,32,64] Rewrite 32x32. Use half the accumulator registers. BUG=webm:1425 Change-Id: Ibf5e61dc4ba15056102aef8495f4a02c668c5d13 --- test/sad_test.cc | 2 + vpx_dsp/arm/sad4d_neon.c | 109 +++++++++++++++-------------------- vpx_dsp/vpx_dsp_rtcd_defs.pl | 4 +- 3 files changed, 50 insertions(+), 65 deletions(-) diff --git a/test/sad_test.cc b/test/sad_test.cc index 345178d4f..e37356a68 100644 --- a/test/sad_test.cc +++ b/test/sad_test.cc @@ -676,7 +676,9 @@ INSTANTIATE_TEST_CASE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests)); const SadMxNx4Param x4d_neon_tests[] = { SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon), + SadMxNx4Param(32, 64, &vpx_sad32x64x4d_neon), SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon), + SadMxNx4Param(32, 16, &vpx_sad32x16x4d_neon), SadMxNx4Param(16, 32, &vpx_sad16x32x4d_neon), SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon), SadMxNx4Param(16, 8, &vpx_sad16x8x4d_neon), diff --git a/vpx_dsp/arm/sad4d_neon.c b/vpx_dsp/arm/sad4d_neon.c index 6b7cc83a9..afb320aca 100644 --- a/vpx_dsp/arm/sad4d_neon.c +++ b/vpx_dsp/arm/sad4d_neon.c @@ -130,6 +130,52 @@ void vpx_sad16x32x4d_neon(const uint8_t *src, int src_stride, sad16x_4d(src, src_stride, ref, ref_stride, res, 32); } +static INLINE void sad32x_4d(const uint8_t *a, int a_stride, + const uint8_t *const b[4], int b_stride, + uint32_t *result, const int height) { + int i, j; + uint16x8_t sum[4] = { vdupq_n_u16(0), vdupq_n_u16(0), vdupq_n_u16(0), + vdupq_n_u16(0) }; + const uint8_t *b_loop[4] = { b[0], b[1], b[2], b[3] }; + + for (i = 0; i < height; ++i) { + const uint8x16_t a_0 = vld1q_u8(a); + const uint8x16_t a_1 = vld1q_u8(a + 16); + a += a_stride; + for (j = 0; j < 4; ++j) { + const uint8x16_t b_0 = vld1q_u8(b_loop[j]); + const uint8x16_t b_1 = vld1q_u8(b_loop[j] + 16); + b_loop[j] += b_stride; + sum[j] = vabal_u8(sum[j], vget_low_u8(a_0), vget_low_u8(b_0)); + sum[j] = vabal_u8(sum[j], vget_high_u8(a_0), vget_high_u8(b_0)); + sum[j] = vabal_u8(sum[j], vget_low_u8(a_1), vget_low_u8(b_1)); + sum[j] = vabal_u8(sum[j], vget_high_u8(a_1), vget_high_u8(b_1)); + } + } + + for (j = 0; j < 4; ++j) { + result[j] = vget_lane_u32(horizontal_add_uint16x8(sum[j]), 0); + } +} + +void vpx_sad32x16x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad32x_4d(src, src_stride, ref, ref_stride, res, 16); +} + +void vpx_sad32x32x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad32x_4d(src, src_stride, ref, ref_stride, res, 32); +} + +void vpx_sad32x64x4d_neon(const uint8_t *src, int src_stride, + const uint8_t *const ref[4], int ref_stride, + uint32_t *res) { + sad32x_4d(src, src_stride, ref, ref_stride, res, 64); +} + static INLINE unsigned int horizontal_long_add_16x8(const uint16x8_t vec_lo, const uint16x8_t vec_hi) { const uint32x4_t vec_l_lo = @@ -175,25 +221,6 @@ static void sad_neon_64(const uint8x16_t vec_src_00, vget_high_u8(vec_ref_48)); } -// Calculate the absolute difference of 32 bytes from vec_src_00, vec_src_16, -// and ref. Accumulate partial sums in vec_sum_ref_lo and vec_sum_ref_hi. -static void sad_neon_32(const uint8x16_t vec_src_00, - const uint8x16_t vec_src_16, const uint8_t *ref, - uint16x8_t *vec_sum_ref_lo, - uint16x8_t *vec_sum_ref_hi) { - const uint8x16_t vec_ref_00 = vld1q_u8(ref); - const uint8x16_t vec_ref_16 = vld1q_u8(ref + 16); - - *vec_sum_ref_lo = vabal_u8(*vec_sum_ref_lo, vget_low_u8(vec_src_00), - vget_low_u8(vec_ref_00)); - *vec_sum_ref_hi = vabal_u8(*vec_sum_ref_hi, vget_high_u8(vec_src_00), - vget_high_u8(vec_ref_00)); - *vec_sum_ref_lo = vabal_u8(*vec_sum_ref_lo, vget_low_u8(vec_src_16), - vget_low_u8(vec_ref_16)); - *vec_sum_ref_hi = vabal_u8(*vec_sum_ref_hi, vget_high_u8(vec_src_16), - vget_high_u8(vec_ref_16)); -} - void vpx_sad64x64x4d_neon(const uint8_t *src, int src_stride, const uint8_t *const ref[4], int ref_stride, uint32_t *res) { @@ -239,47 +266,3 @@ void vpx_sad64x64x4d_neon(const uint8_t *src, int src_stride, res[2] = horizontal_long_add_16x8(vec_sum_ref2_lo, vec_sum_ref2_hi); res[3] = horizontal_long_add_16x8(vec_sum_ref3_lo, vec_sum_ref3_hi); } - -void vpx_sad32x32x4d_neon(const uint8_t *src, int src_stride, - const uint8_t *const ref[4], int ref_stride, - uint32_t *res) { - int i; - uint16x8_t vec_sum_ref0_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref0_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref1_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref1_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref2_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref2_hi = vdupq_n_u16(0); - uint16x8_t vec_sum_ref3_lo = vdupq_n_u16(0); - uint16x8_t vec_sum_ref3_hi = vdupq_n_u16(0); - const uint8_t *ref0, *ref1, *ref2, *ref3; - ref0 = ref[0]; - ref1 = ref[1]; - ref2 = ref[2]; - ref3 = ref[3]; - - for (i = 0; i < 32; ++i) { - const uint8x16_t vec_src_00 = vld1q_u8(src); - const uint8x16_t vec_src_16 = vld1q_u8(src + 16); - - sad_neon_32(vec_src_00, vec_src_16, ref0, &vec_sum_ref0_lo, - &vec_sum_ref0_hi); - sad_neon_32(vec_src_00, vec_src_16, ref1, &vec_sum_ref1_lo, - &vec_sum_ref1_hi); - sad_neon_32(vec_src_00, vec_src_16, ref2, &vec_sum_ref2_lo, - &vec_sum_ref2_hi); - sad_neon_32(vec_src_00, vec_src_16, ref3, &vec_sum_ref3_lo, - &vec_sum_ref3_hi); - - src += src_stride; - ref0 += ref_stride; - ref1 += ref_stride; - ref2 += ref_stride; - ref3 += ref_stride; - } - - res[0] = horizontal_long_add_16x8(vec_sum_ref0_lo, vec_sum_ref0_hi); - res[1] = horizontal_long_add_16x8(vec_sum_ref1_lo, vec_sum_ref1_hi); - res[2] = horizontal_long_add_16x8(vec_sum_ref2_lo, vec_sum_ref2_hi); - res[3] = horizontal_long_add_16x8(vec_sum_ref3_lo, vec_sum_ref3_hi); -} diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl index 4fe37b76b..44d6e4c71 100644 --- a/vpx_dsp/vpx_dsp_rtcd_defs.pl +++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl @@ -863,13 +863,13 @@ add_proto qw/void vpx_sad64x32x4d/, "const uint8_t *src_ptr, int src_stride, con specialize qw/vpx_sad64x32x4d msa sse2 vsx/; add_proto qw/void vpx_sad32x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad32x64x4d msa sse2 vsx/; +specialize qw/vpx_sad32x64x4d neon msa sse2 vsx/; add_proto qw/void vpx_sad32x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; specialize qw/vpx_sad32x32x4d avx2 neon msa sse2 vsx/; add_proto qw/void vpx_sad32x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; -specialize qw/vpx_sad32x16x4d msa sse2 vsx/; +specialize qw/vpx_sad32x16x4d neon msa sse2 vsx/; add_proto qw/void vpx_sad16x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array"; specialize qw/vpx_sad16x32x4d neon msa sse2 vsx/;