]> granicus.if.org Git - libvpx/commitdiff
ppc: dc predictor 8x8
authorLuca Barbato <lu_zero@gentoo.org>
Sun, 9 Apr 2017 13:05:09 +0000 (13:05 +0000)
committerJames Zern <jzern@google.com>
Thu, 20 Apr 2017 02:57:51 +0000 (19:57 -0700)
Slightly faster, the other dc predictors cannot be faster since
the computation speedup is overwhelmed by the time spent reading
dst to write just the 8x8 part.

Change-Id: I94a0b50500adf8b7b6bb919dbf5c7adf5b9fba66

test/test_intra_pred_speed.cc
vpx_dsp/ppc/intrapred_vsx.c
vpx_dsp/vpx_dsp_rtcd_defs.pl

index c9031a1977265cd0d96a9499fba17f2bfbc9f04f..4e9b1fa76b6521654661c8319632ffea81ca645b 100644 (file)
@@ -313,9 +313,9 @@ INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa,
 #endif  // HAVE_MSA
 
 #if HAVE_VSX
-INTRA_PRED_TEST(VSX, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL,
-                vpx_d45_predictor_8x8_vsx, NULL, NULL, NULL, NULL, NULL,
-                vpx_tm_predictor_8x8_vsx)
+INTRA_PRED_TEST(VSX, TestIntraPred8, vpx_dc_predictor_8x8_vsx, NULL, NULL, NULL,
+                NULL, NULL, vpx_d45_predictor_8x8_vsx, NULL, NULL, NULL, NULL,
+                NULL, vpx_tm_predictor_8x8_vsx)
 
 INTRA_PRED_TEST(VSX, TestIntraPred16, vpx_dc_predictor_16x16_vsx,
                 vpx_dc_left_predictor_16x16_vsx, vpx_dc_top_predictor_16x16_vsx,
index d4f55543369db0518ae357fd194b48c9289fd344..b3ff5a70e896d4501f17c69da49a0a6bb50196a7 100644 (file)
@@ -362,6 +362,16 @@ void vpx_tm_predictor_32x32_vsx(uint8_t *dst, ptrdiff_t stride,
   tm_predictor_32x8(dst, stride, unpack_to_s16_l(l1), a0, a1, tl);
 }
 
+static INLINE void dc_fill_predictor_8x8(uint8_t *dst, const ptrdiff_t stride,
+                                         const uint8x16_t val) {
+  int i;
+
+  for (i = 0; i < 8; i++, dst += stride) {
+    const uint8x16_t d = vec_vsx_ld(0, dst);
+    vec_vsx_st(xxpermdi(val, d, 1), 0, dst);
+  }
+}
+
 static INLINE void dc_fill_predictor_16x16(uint8_t *dst, const ptrdiff_t stride,
                                            const uint8x16_t val) {
   int i;
@@ -452,6 +462,19 @@ void vpx_dc_top_predictor_32x32_vsx(uint8_t *dst, ptrdiff_t stride,
   dc_fill_predictor_32x32(dst, stride, avg32(above));
 }
 
+static uint8x16_t dc_avg8(const uint8_t *above, const uint8_t *left) {
+  const uint8x16_t a0 = vec_vsx_ld(0, above);
+  const uint8x16_t l0 = vec_vsx_ld(0, left);
+  const int32x4_t sum4s =
+      (int32x4_t)vec_sum4s(l0, vec_sum4s(a0, vec_splat_u32(0)));
+  const int32x4_t sum4s8 = xxpermdi(sum4s, vec_splat_s32(0), 1);
+  const uint32x4_t sum = (uint32x4_t)vec_sums(sum4s8, vec_splat_s32(8));
+  const uint32x4_t avg = (uint32x4_t)vec_sr(sum, vec_splat_u32(4));
+
+  return vec_splat(vec_pack(vec_pack(avg, vec_splat_u32(0)), vec_splat_u16(0)),
+                   3);
+}
+
 static uint8x16_t dc_avg16(const uint8_t *above, const uint8_t *left) {
   const uint8x16_t a0 = vec_vsx_ld(0, above);
   const uint8x16_t l0 = vec_vsx_ld(0, left);
@@ -465,6 +488,11 @@ static uint8x16_t dc_avg16(const uint8_t *above, const uint8_t *left) {
                    3);
 }
 
+void vpx_dc_predictor_8x8_vsx(uint8_t *dst, ptrdiff_t stride,
+                              const uint8_t *above, const uint8_t *left) {
+  dc_fill_predictor_8x8(dst, stride, dc_avg8(above, left));
+}
+
 void vpx_dc_predictor_16x16_vsx(uint8_t *dst, ptrdiff_t stride,
                                 const uint8_t *above, const uint8_t *left) {
   dc_fill_predictor_16x16(dst, stride, dc_avg16(above, left));
index 833787dfd7287b43c6ce305d13a1b2495c239dd9..e96ff2a27c6427575182218e92879b213665399f 100644 (file)
@@ -98,7 +98,7 @@ add_proto qw/void vpx_tm_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, cons
 specialize qw/vpx_tm_predictor_8x8 neon dspr2 msa sse2 vsx/;
 
 add_proto qw/void vpx_dc_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vpx_dc_predictor_8x8 dspr2 neon msa sse2/;
+specialize qw/vpx_dc_predictor_8x8 dspr2 neon msa sse2 vsx/;
 
 add_proto qw/void vpx_dc_top_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
 specialize qw/vpx_dc_top_predictor_8x8 neon msa sse2/;