summaryrefslogtreecommitdiff
path: root/vpx_dsp
diff options
context:
space:
mode:
authorJohann <johannkoenig@google.com>2017-07-06 08:55:05 -0700
committerJohann <johannkoenig@google.com>2017-07-07 07:04:04 -0700
commit67cffc1ef6cd15eaf8e4b319a7308d351c9d8177 (patch)
treed7a504a62825094e6dd8e81217b9f6d62515d64e /vpx_dsp
parentb0d15713beb8559d76eee9bf5c86ab70edbcdff4 (diff)
downloadlibvpx-67cffc1ef6cd15eaf8e4b319a7308d351c9d8177.tar
libvpx-67cffc1ef6cd15eaf8e4b319a7308d351c9d8177.tar.gz
libvpx-67cffc1ef6cd15eaf8e4b319a7308d351c9d8177.tar.bz2
libvpx-67cffc1ef6cd15eaf8e4b319a7308d351c9d8177.zip
sad neon: avg for 32x[16,32,64]
BUG=webm:1425 Change-Id: I3362e0dded3b46ca032caa7f44db42f324bc596d
Diffstat (limited to 'vpx_dsp')
-rw-r--r--vpx_dsp/arm/sad_neon.c34
-rw-r--r--vpx_dsp/vpx_dsp_rtcd_defs.pl6
2 files changed, 37 insertions, 3 deletions
diff --git a/vpx_dsp/arm/sad_neon.c b/vpx_dsp/arm/sad_neon.c
index 75352ef96..0c31a620b 100644
--- a/vpx_dsp/arm/sad_neon.c
+++ b/vpx_dsp/arm/sad_neon.c
@@ -211,11 +211,45 @@ static INLINE uint16x8_t sad32x(const uint8_t *a, int a_stride,
return abs;
}
+static INLINE uint16x8_t sad32x_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_lo = vld1q_u8(a);
+ const uint8x16_t a_hi = vld1q_u8(a + 16);
+ const uint8x16_t b_lo = vld1q_u8(b);
+ const uint8x16_t b_hi = vld1q_u8(b + 16);
+ const uint8x16_t c_lo = vld1q_u8(c);
+ const uint8x16_t c_hi = vld1q_u8(c + 16);
+ const uint8x16_t avg_lo = vrhaddq_u8(b_lo, c_lo);
+ const uint8x16_t avg_hi = vrhaddq_u8(b_hi, c_hi);
+ a += a_stride;
+ b += b_stride;
+ c += 32;
+ abs = vabal_u8(abs, vget_low_u8(a_lo), vget_low_u8(avg_lo));
+ abs = vabal_u8(abs, vget_high_u8(a_lo), vget_high_u8(avg_lo));
+ abs = vabal_u8(abs, vget_low_u8(a_hi), vget_low_u8(avg_hi));
+ abs = vabal_u8(abs, vget_high_u8(a_hi), vget_high_u8(avg_hi));
+ }
+ return abs;
+}
+
#define sad32xN(n) \
uint32_t vpx_sad32x##n##_neon(const uint8_t *src, int src_stride, \
const uint8_t *ref, int ref_stride) { \
const uint16x8_t abs = sad32x(src, src_stride, ref, ref_stride, n); \
return horizontal_add_16x8(abs); \
+ } \
+ \
+ uint32_t vpx_sad32x##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 = \
+ sad32x_avg(src, src_stride, ref, ref_stride, second_pred, n); \
+ return horizontal_add_16x8(abs); \
}
sad32xN(16);
diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl
index 4da050e76..e3a42d067 100644
--- a/vpx_dsp/vpx_dsp_rtcd_defs.pl
+++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl
@@ -786,13 +786,13 @@ add_proto qw/unsigned int vpx_sad64x32_avg/, "const uint8_t *src_ptr, int src_st
specialize qw/vpx_sad64x32_avg avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad32x64_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_sad32x64_avg avx2 msa sse2 vsx/;
+specialize qw/vpx_sad32x64_avg neon avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad32x32_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_sad32x32_avg avx2 msa sse2 vsx/;
+specialize qw/vpx_sad32x32_avg neon avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad32x16_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_sad32x16_avg avx2 msa sse2 vsx/;
+specialize qw/vpx_sad32x16_avg neon 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 neon msa sse2 vsx/;