From 8152b0904d60edd4cb5fd71144354698c3083cbd Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 11 Jul 2017 07:01:12 -0700 Subject: [PATCH] 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 13eae70..e53ba54 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 9c45ae1..420169e 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 57c6a1e..8dfd2c0 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/; -- 2.7.4