sad neon: avg for 8x[4,8,16]

BUG=webm:1425

Change-Id: If2ab51e3050e078b0011b174efe41fcb65a15f44
This commit is contained in:
Johann 2017-06-28 14:11:35 -07:00
parent 6bac3f80ee
commit 63bdc574e5
3 changed files with 49 additions and 3 deletions

View File

@ -658,6 +658,9 @@ const SadMxNParam neon_tests[] = {
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
const SadMxNAvgParam avg_neon_tests[] = {
SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_neon),
SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_neon),
SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_neon),
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
};

View File

@ -114,6 +114,49 @@ uint32_t vpx_sad8x16_neon(const uint8_t *src, int src_stride,
return horizontal_add_16x8(abs);
}
static INLINE uint16x8_t sad8x_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 uint8x8_t a_u8 = vld1_u8(a);
const uint8x8_t b_u8 = vld1_u8(b);
const uint8x8_t c_u8 = vld1_u8(c);
const uint8x8_t avg = vrhadd_u8(b_u8, c_u8);
a += a_stride;
b += b_stride;
c += 8;
abs = vabal_u8(abs, a_u8, avg);
}
return abs;
}
uint32_t vpx_sad8x4_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 =
sad8x_avg(src, src_stride, ref, ref_stride, second_pred, 4);
return horizontal_add_16x8(abs);
}
uint32_t vpx_sad8x8_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 =
sad8x_avg(src, src_stride, ref, ref_stride, second_pred, 8);
return horizontal_add_16x8(abs);
}
uint32_t vpx_sad8x16_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 =
sad8x_avg(src, src_stride, ref, ref_stride, second_pred, 16);
return horizontal_add_16x8(abs);
}
static INLINE uint16x8_t sad16x(const uint8_t *a, int a_stride,
const uint8_t *b, int b_stride,
const int height) {

View File

@ -804,13 +804,13 @@ add_proto qw/unsigned int vpx_sad16x8_avg/, "const uint8_t *src_ptr, int src_str
specialize qw/vpx_sad16x8_avg 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 msa sse2/;
specialize qw/vpx_sad8x16_avg neon msa sse2/;
add_proto qw/unsigned int vpx_sad8x8_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_sad8x8_avg msa sse2/;
specialize qw/vpx_sad8x8_avg neon msa sse2/;
add_proto qw/unsigned int vpx_sad8x4_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_sad8x4_avg msa sse2/;
specialize qw/vpx_sad8x4_avg neon msa sse2/;
add_proto qw/unsigned int vpx_sad4x8_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_sad4x8_avg neon msa sse2/;