ref: 527e0c9b1c898360bb3cbf7cc7478a27395dbe58
parent: 3c18acf45234ea801b5f966467c6837e442ef4c0
author: Johann <johannkoenig@google.com>
date: Thu Jul 6 04:31:41 EDT 2017
sad neon: avg for 16x[8,16,32] BUG=webm:1425 Change-Id: Ia42e4f36547c5fe12114fb58379e34bce82eb2f2
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -658,6 +658,9 @@
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
const SadMxNAvgParam avg_neon_tests[] = {
+ SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_neon),
+ SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_neon),
+ SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_neon),
SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_neon),
SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_neon),
SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_neon),
--- a/vpx_dsp/arm/sad_neon.c
+++ b/vpx_dsp/arm/sad_neon.c
@@ -151,10 +151,38 @@
return abs;
}
+static INLINE uint16x8_t sad16x_avg(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride,
+ const uint8_t *c, const int height) {
+ int i;
+ uint16x8_t abs = vdupq_n_u16(0);
+
+ for (i = 0; i < height; ++i) {
+ const uint8x16_t a_u8 = vld1q_u8(a);
+ const uint8x16_t b_u8 = vld1q_u8(b);
+ const uint8x16_t c_u8 = vld1q_u8(c);
+ const uint8x16_t avg = vrhaddq_u8(b_u8, c_u8);
+ a += a_stride;
+ b += b_stride;
+ c += 16;
+ abs = vabal_u8(abs, vget_low_u8(a_u8), vget_low_u8(avg));
+ abs = vabal_u8(abs, vget_high_u8(a_u8), vget_high_u8(avg));
+ }
+ return abs;
+}
+
#define sad16xN(n) \
uint32_t vpx_sad16x##n##_neon(const uint8_t *src, int src_stride, \
const uint8_t *ref, int ref_stride) { \
const uint16x8_t abs = sad16x(src, src_stride, ref, ref_stride, n); \
+ return horizontal_add_16x8(abs); \
+ } \
+ \
+ uint32_t vpx_sad16x##n##_avg_neon(const uint8_t *src, int src_stride, \
+ const uint8_t *ref, int ref_stride, \
+ const uint8_t *second_pred) { \
+ const uint16x8_t abs = \
+ sad16x_avg(src, src_stride, ref, ref_stride, second_pred, n); \
return horizontal_add_16x8(abs); \
}
--- a/vpx_dsp/vpx_dsp_rtcd_defs.pl
+++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl
@@ -795,13 +795,13 @@
specialize qw/vpx_sad32x16_avg avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad16x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
-specialize qw/vpx_sad16x32_avg msa sse2 vsx/;
+specialize qw/vpx_sad16x32_avg neon msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad16x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
-specialize qw/vpx_sad16x16_avg msa sse2 vsx/;
+specialize qw/vpx_sad16x16_avg neon msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad16x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
-specialize qw/vpx_sad16x8_avg msa sse2 vsx/;
+specialize qw/vpx_sad16x8_avg neon msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad8x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad8x16_avg neon msa sse2/;