ref: 0b15bf1e5444b7cfb473005217b1e4fdb007a51c
parent: a12ea1d5e90e460d68e38817978fe9d635fbd9bc
author: Alexandra Hájková <alexandra.khirnova@gmail.com>
date: Mon May 8 07:56:17 EDT 2017
ppc Add vpx_sad32x16/32/64_vsx Change-Id: I3c4f9d595275669580413a71b3c3c810e7ddcacd
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -924,8 +924,12 @@
// VSX functions
#if HAVE_VSX
const SadMxNParam vsx_tests[] = {
+ SadMxNParam(32, 64, &vpx_sad32x64_vsx),
+ SadMxNParam(32, 32, &vpx_sad32x32_vsx),
+ SadMxNParam(32, 16, &vpx_sad32x16_vsx),
SadMxNParam(16, 32, &vpx_sad16x32_vsx),
- SadMxNParam(16, 16, &vpx_sad16x16_vsx), SadMxNParam(16, 8, &vpx_sad16x8_vsx),
+ SadMxNParam(16, 16, &vpx_sad16x16_vsx),
+ SadMxNParam(16, 8, &vpx_sad16x8_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
#endif // HAVE_VSX
--- a/vpx_dsp/ppc/sad_vsx.c
+++ b/vpx_dsp/ppc/sad_vsx.c
@@ -48,6 +48,30 @@
return sad[3] + sad[2] + sad[1] + sad[0]; \
}
+#define SAD32(height) \
+ unsigned int vpx_sad32x##height##_vsx(const uint8_t *a, int a_stride, \
+ const uint8_t *b, int b_stride) { \
+ int y; \
+ unsigned int sad[4]; \
+ uint8x16_t v_a, v_b; \
+ int16x8_t v_ah, v_al, v_bh, v_bl, v_absh, v_absl, v_subh, v_subl; \
+ int32x4_t v_sad = vec_splat_s32(0); \
+ \
+ for (y = 0; y < height; y++) { \
+ PROCESS16(0); \
+ PROCESS16(16); \
+ \
+ a += a_stride; \
+ b += b_stride; \
+ } \
+ vec_vsx_st((uint32x4_t)v_sad, 0, sad); \
+ \
+ return sad[3] + sad[2] + sad[1] + sad[0]; \
+ }
+
SAD16(8);
SAD16(16);
SAD16(32);
+SAD32(16);
+SAD32(32);
+SAD32(64);
--- a/vpx_dsp/vpx_dsp_rtcd_defs.pl
+++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl
@@ -702,13 +702,13 @@
specialize qw/vpx_sad64x32 avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/vpx_sad32x64 avx2 msa sse2/;
+specialize qw/vpx_sad32x64 avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad32x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/vpx_sad32x32 avx2 neon msa sse2/;
+specialize qw/vpx_sad32x32 avx2 neon msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad32x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
-specialize qw/vpx_sad32x16 avx2 msa sse2/;
+specialize qw/vpx_sad32x16 avx2 msa sse2 vsx/;
add_proto qw/unsigned int vpx_sad16x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad16x32 msa sse2 vsx/;