sad neon: avg for 4x4 and 4x8
BUG=webm:1425 Change-Id: Ifc685a96cb34f7fd9243b4c674027480564b84fb
This commit is contained in:
parent
af3cab7b24
commit
6bac3f80ee
@ -657,6 +657,12 @@ const SadMxNParam neon_tests[] = {
|
||||
};
|
||||
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
|
||||
|
||||
const SadMxNAvgParam avg_neon_tests[] = {
|
||||
SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
|
||||
SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
|
||||
};
|
||||
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),
|
||||
|
@ -33,6 +33,18 @@ uint32_t vpx_sad4x4_neon(const uint8_t *src_ptr, int src_stride,
|
||||
return horizontal_add_16x8(abs);
|
||||
}
|
||||
|
||||
uint32_t vpx_sad4x4_avg_neon(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride,
|
||||
const uint8_t *second_pred) {
|
||||
const uint8x16_t src_u8 = load_unaligned_u8q(src_ptr, src_stride);
|
||||
const uint8x16_t ref_u8 = load_unaligned_u8q(ref_ptr, ref_stride);
|
||||
const uint8x16_t second_pred_u8 = vld1q_u8(second_pred);
|
||||
const uint8x16_t avg = vrhaddq_u8(ref_u8, second_pred_u8);
|
||||
uint16x8_t abs = vabdl_u8(vget_low_u8(src_u8), vget_low_u8(avg));
|
||||
abs = vabal_u8(abs, vget_high_u8(src_u8), vget_high_u8(avg));
|
||||
return horizontal_add_16x8(abs);
|
||||
}
|
||||
|
||||
uint32_t vpx_sad4x8_neon(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride) {
|
||||
int i;
|
||||
@ -49,6 +61,26 @@ uint32_t vpx_sad4x8_neon(const uint8_t *src_ptr, int src_stride,
|
||||
return horizontal_add_16x8(abs);
|
||||
}
|
||||
|
||||
uint32_t vpx_sad4x8_avg_neon(const uint8_t *src_ptr, int src_stride,
|
||||
const uint8_t *ref_ptr, int ref_stride,
|
||||
const uint8_t *second_pred) {
|
||||
int i;
|
||||
uint16x8_t abs = vdupq_n_u16(0);
|
||||
for (i = 0; i < 8; i += 4) {
|
||||
const uint8x16_t src_u8 = load_unaligned_u8q(src_ptr, src_stride);
|
||||
const uint8x16_t ref_u8 = load_unaligned_u8q(ref_ptr, ref_stride);
|
||||
const uint8x16_t second_pred_u8 = vld1q_u8(second_pred);
|
||||
const uint8x16_t avg = vrhaddq_u8(ref_u8, second_pred_u8);
|
||||
src_ptr += 4 * src_stride;
|
||||
ref_ptr += 4 * ref_stride;
|
||||
second_pred += 16;
|
||||
abs = vabal_u8(abs, vget_low_u8(src_u8), vget_low_u8(avg));
|
||||
abs = vabal_u8(abs, vget_high_u8(src_u8), vget_high_u8(avg));
|
||||
}
|
||||
|
||||
return horizontal_add_16x8(abs);
|
||||
}
|
||||
|
||||
static INLINE uint16x8_t sad8x(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, const int height) {
|
||||
int i;
|
||||
|
@ -813,10 +813,10 @@ add_proto qw/unsigned int vpx_sad8x4_avg/, "const uint8_t *src_ptr, int src_stri
|
||||
specialize qw/vpx_sad8x4_avg 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 msa sse2/;
|
||||
specialize qw/vpx_sad4x8_avg neon msa sse2/;
|
||||
|
||||
add_proto qw/unsigned int vpx_sad4x4_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_sad4x4_avg msa sse2/;
|
||||
specialize qw/vpx_sad4x4_avg neon msa sse2/;
|
||||
|
||||
#
|
||||
# Multi-block SAD, comparing a reference to N blocks 1 pixel apart horizontally
|
||||
|
Loading…
Reference in New Issue
Block a user