From 22ca468c7c55f76e71c29d0ebe8d9e01ba210fc0 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 8 Apr 2017 02:55:33 +0000 Subject: [PATCH] ppc: dc top and left predictor 32x32 6x faster. Change-Id: I717995b4056e5579c68191d11b495372971fe1ae --- test/test_intra_pred_speed.cc | 8 ++++---- vpx_dsp/ppc/intrapred_vsx.c | 28 ++++++++++++++++++++++++++++ vpx_dsp/vpx_dsp_rtcd_defs.pl | 4 ++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/test/test_intra_pred_speed.cc b/test/test_intra_pred_speed.cc index 533ca7198..53c3cfa7f 100644 --- a/test/test_intra_pred_speed.cc +++ b/test/test_intra_pred_speed.cc @@ -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 // ----------------------------------------------------------------------------- diff --git a/vpx_dsp/ppc/intrapred_vsx.c b/vpx_dsp/ppc/intrapred_vsx.c index 71c35e3e3..5347872ba 100644 --- a/vpx_dsp/ppc/intrapred_vsx.c +++ b/vpx_dsp/ppc/intrapred_vsx.c @@ -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)); +} diff --git a/vpx_dsp/vpx_dsp_rtcd_defs.pl b/vpx_dsp/vpx_dsp_rtcd_defs.pl index c6e8ae577..d84e461d3 100644 --- a/vpx_dsp/vpx_dsp_rtcd_defs.pl +++ b/vpx_dsp/vpx_dsp_rtcd_defs.pl @@ -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/; -- 2.40.0