]> granicus.if.org Git - libvpx/commitdiff
ppc: dc top and left predictor 32x32
authorLuca Barbato <lu_zero@gentoo.org>
Sat, 8 Apr 2017 02:55:33 +0000 (02:55 +0000)
committerJames Zern <jzern@google.com>
Thu, 20 Apr 2017 02:49:31 +0000 (19:49 -0700)
6x faster.

Change-Id: I717995b4056e5579c68191d11b495372971fe1ae

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

index 533ca719858cb577c3936472da46172ecd76647e..53c3cfa7fd843209ddfb27ba7e71a2a5856eef55 100644 (file)
@@ -321,10 +321,10 @@ INTRA_PRED_TEST(VSX, TestIntraPred16, NULL, vpx_dc_left_predictor_16x16_vsx,
                 vpx_v_predictor_16x16_vsx, vpx_h_predictor_16x16_vsx, NULL,
                 NULL, NULL, NULL, NULL, NULL, vpx_tm_predictor_16x16_vsx)
 
-INTRA_PRED_TEST(VSX, TestIntraPred32, NULL, NULL, NULL,
-                vpx_dc_128_predictor_32x32_vsx, vpx_v_predictor_32x32_vsx,
-                vpx_h_predictor_32x32_vsx, NULL, NULL, NULL, NULL, NULL, NULL,
-                vpx_tm_predictor_32x32_vsx)
+INTRA_PRED_TEST(VSX, TestIntraPred32, NULL, vpx_dc_left_predictor_32x32_vsx,
+                vpx_dc_top_predictor_32x32_vsx, vpx_dc_128_predictor_32x32_vsx,
+                vpx_v_predictor_32x32_vsx, vpx_h_predictor_32x32_vsx, NULL,
+                NULL, NULL, NULL, NULL, NULL, vpx_tm_predictor_32x32_vsx)
 #endif  // HAVE_VSX
 
 // -----------------------------------------------------------------------------
index 71c35e3e358e0cbb0d23949ffe39a5abc772ceb5..5347872bae1402ade29608dfd993ceeb0d1dbc21 100644 (file)
@@ -423,3 +423,31 @@ void vpx_dc_top_predictor_16x16_vsx(uint8_t *dst, ptrdiff_t stride,
 
   dc_fill_predictor_16x16(dst, stride, avg16(above));
 }
+
+static uint8x16_t avg32(const uint8_t *values) {
+  const uint8x16_t v0 = vec_vsx_ld(0, values);
+  const uint8x16_t v1 = vec_vsx_ld(16, values);
+  const int32x4_t v16 = vec_sl(vec_splat_s32(1), vec_splat_u32(4));
+  const int32x4_t sum4s =
+      (int32x4_t)vec_sum4s(v0, vec_sum4s(v1, vec_splat_u32(0)));
+  const uint32x4_t sum = (uint32x4_t)vec_sums(sum4s, v16);
+  const uint32x4_t avg = (uint32x4_t)vec_sr(sum, vec_splat_u32(5));
+
+  return vec_splat(vec_pack(vec_pack(avg, vec_splat_u32(0)), vec_splat_u16(0)),
+                   3);
+}
+
+void vpx_dc_left_predictor_32x32_vsx(uint8_t *dst, ptrdiff_t stride,
+                                     const uint8_t *above,
+                                     const uint8_t *left) {
+  (void)above;
+
+  dc_fill_predictor_32x32(dst, stride, avg32(left));
+}
+
+void vpx_dc_top_predictor_32x32_vsx(uint8_t *dst, ptrdiff_t stride,
+                                    const uint8_t *above, const uint8_t *left) {
+  (void)left;
+
+  dc_fill_predictor_32x32(dst, stride, avg32(above));
+}
index c6e8ae577982ba8783d361685e2c64f5c8368ab6..d84e461d358bc1fe4bff20240a8c8a2ce6cbdbd4 100644 (file)
@@ -177,10 +177,10 @@ add_proto qw/void vpx_dc_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, co
 specialize qw/vpx_dc_predictor_32x32 msa neon sse2/;
 
 add_proto qw/void vpx_dc_top_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vpx_dc_top_predictor_32x32 msa neon sse2/;
+specialize qw/vpx_dc_top_predictor_32x32 msa neon sse2 vsx/;
 
 add_proto qw/void vpx_dc_left_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
-specialize qw/vpx_dc_left_predictor_32x32 msa neon sse2/;
+specialize qw/vpx_dc_left_predictor_32x32 msa neon sse2 vsx/;
 
 add_proto qw/void vpx_dc_128_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
 specialize qw/vpx_dc_128_predictor_32x32 msa neon sse2 vsx/;