]> granicus.if.org Git - libvpx/commitdiff
[VSX] Add support to Power9-only vec_absd
authorLuca Barbato <lu_zero@gentoo.org>
Sun, 8 Jul 2018 14:03:41 +0000 (16:03 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 8 Jul 2018 14:03:47 +0000 (16:03 +0200)
~5% gain for SAD.

Change-Id: Ief7d7691f837474f5b6b582129628276fdcce319

vpx_dsp/ppc/deblock_vsx.c
vpx_dsp/ppc/sad_vsx.c
vpx_dsp/ppc/types_vsx.h

index 4329081ee6333bae2da7302dfa81d7224729dd24..2129911696605e41b3d590b4c3bb768f04b27080 100644 (file)
@@ -23,17 +23,13 @@ static const uint8x16_t st8_perm = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
                                      0x06, 0x07, 0x18, 0x19, 0x1A, 0x1B,
                                      0x1C, 0x1D, 0x1E, 0x1F };
 
-static INLINE uint8x16_t vec_abd_s8(uint8x16_t a, uint8x16_t b) {
-  return vec_sub(vec_max(a, b), vec_min(a, b));
-}
-
 static INLINE uint8x16_t apply_filter(uint8x16_t ctx[4], uint8x16_t v,
                                       uint8x16_t filter) {
   const uint8x16_t k1 = vec_avg(ctx[0], ctx[1]);
   const uint8x16_t k2 = vec_avg(ctx[3], ctx[2]);
   const uint8x16_t k3 = vec_avg(k1, k2);
-  const uint8x16_t f_a = vec_max(vec_abd_s8(v, ctx[0]), vec_abd_s8(v, ctx[1]));
-  const uint8x16_t f_b = vec_max(vec_abd_s8(v, ctx[2]), vec_abd_s8(v, ctx[3]));
+  const uint8x16_t f_a = vec_max(vec_absd(v, ctx[0]), vec_absd(v, ctx[1]));
+  const uint8x16_t f_b = vec_max(vec_absd(v, ctx[2]), vec_absd(v, ctx[3]));
   const bool8x16_t mask = vec_cmplt(vec_max(f_a, f_b), filter);
   return vec_sel(v, vec_avg(k3, v), mask);
 }
index 18673f68215ee50eb54fcbc16b1053ba4b4c7507..cdee8f3d1c37ea486be38129351b47f54be9ce0e 100644 (file)
 #include "vpx/vpx_integer.h"
 #include "vpx_ports/mem.h"
 
-#define PROCESS16(offset)                                \
-  v_a = vec_vsx_ld(offset, a);                           \
-  v_b = vec_vsx_ld(offset, b);                           \
-  v_abs = vec_sub(vec_max(v_a, v_b), vec_min(v_a, v_b)); \
+#define PROCESS16(offset)      \
+  v_a = vec_vsx_ld(offset, a); \
+  v_b = vec_vsx_ld(offset, b); \
+  v_abs = vec_absd(v_a, v_b);  \
   v_sad = vec_sum4s(v_abs, v_sad);
 
 #define SAD8(height)                                                     \
index 2bbf665c34c6ed3234dc4a27cd27fd00072397d8..f8db6ca89c1ace9157685bb4f462ac44b6963bed 100644 (file)
@@ -75,6 +75,10 @@ static INLINE uint8x16_t read4x2(const uint8_t *a, int stride) {
   return (uint8x16_t)vec_mergeh(a0, a1);
 }
 
+#ifndef __POWER9_VECTOR__
+#define vec_absd(a, b) vec_sub(vec_max(a, b), vec_min(a, b))
+#endif
+
 static const uint8x16_t vec_zeros_u8 = { 0, 0, 0, 0, 0, 0, 0, 0,
                                          0, 0, 0, 0, 0, 0, 0, 0 };
 static const int16x8_t vec_zeros_s16 = { 0, 0, 0, 0, 0, 0, 0, 0 };