[1/6] x86: sbrdsp: implement SSE2 qmf_pre_shuffle

Message ID CAPYFPM3nP77bUOLvy+yKH5UCGCrRTrV4UJQPYtJC7pYHBjuk1g@mail.gmail.com
State Superseded
Delegated to: Diego Biurrun
Headers show

Commit Message

Christophe Gisquet May 7, 2013, 8:31 p.m.
2013/4/13 Christophe Gisquet <christophe.gisquet@gmail.com>:
> I noticed I was using an extra register for nothing, so here's an
> updated patch for this.

And another patch after a recent pull.

--
Christophe

Comments

Justin Ruggles May 8, 2013, 7:32 p.m. | #1
On 05/07/2013 04:31 PM, Christophe Gisquet wrote:
> 2013/4/13 Christophe Gisquet <christophe.gisquet@gmail.com>:
>> I noticed I was using an extra register for nothing, so here's an
>> updated patch for this.
> 
> And another patch after a recent pull.

Looks fine to me.

-Justin

Patch

From f5bca1814c7db48c2b192d30fa2c87a8c2c08b66 Mon Sep 17 00:00:00 2001
From: Christophe Gisquet <christophe.gisquet@gmail.com>
Date: Sun, 25 Nov 2012 09:10:36 +0100
Subject: [PATCH 1/2] x86: sbrdsp: implement SSE2 qmf_pre_shuffle

From 253 to 51 cycles on Arrandale and Win64.
44 cycles on SandyBridge.
---
 libavcodec/x86/sbrdsp.asm    | 30 ++++++++++++++++++++++++++++++
 libavcodec/x86/sbrdsp_init.c |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index bfc37c2..36a0918 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -273,3 +273,33 @@  cglobal sbr_qmf_deint_bfly, 3,5,8, v,src0,src1,vrev,c
     sub               cq, 2*mmsize
     jge            .loop
     REP_RET
+
+INIT_XMM sse2
+cglobal sbr_qmf_pre_shuffle, 1,4,6,z
+%define OFFSET  (32*4-2*mmsize)
+    mov       r3q, OFFSET
+    lea       r1q, [zq + (32+1)*4]
+    lea       r2q, [zq + 64*4]
+    mova       m5, [ps_neg]
+.loop:
+    movu       m0, [r1q]
+    movu       m2, [r1q + mmsize]
+    movu       m1, [zq + r3q + 4 + mmsize]
+    movu       m3, [zq + r3q + 4]
+
+    pxor       m2, m5
+    pxor       m0, m5
+    pshufd     m2, m2, q0123
+    pshufd     m0, m0, q0123
+    SBUTTERFLY dq, 2, 3, 4
+    SBUTTERFLY dq, 0, 1, 4
+    mova  [r2q + 2*r3q + 0*mmsize], m2
+    mova  [r2q + 2*r3q + 1*mmsize], m3
+    mova  [r2q + 2*r3q + 2*mmsize], m0
+    mova  [r2q + 2*r3q + 3*mmsize], m1
+    add       r1q, 2*mmsize
+    sub       r3q, 2*mmsize
+    jge      .loop
+    movq       m2, [zq]
+    movq    [r2q], m2
+    REP_RET
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index f3f6c65..e2eaa70 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -35,6 +35,7 @@  void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2],
 void ff_sbr_neg_odd_64_sse(float *z);
 void ff_sbr_qmf_post_shuffle_sse(float W[32][2], const float *z);
 void ff_sbr_qmf_deint_bfly_sse2(float *v, const float *src0, const float *src1);
+void ff_sbr_qmf_pre_shuffle_sse2(float *z);
 
 av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 {
@@ -51,5 +52,6 @@  av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 
     if (EXTERNAL_SSE2(mm_flags)) {
         s->qmf_deint_bfly   = ff_sbr_qmf_deint_bfly_sse2;
+        s->qmf_pre_shuffle  = ff_sbr_qmf_pre_shuffle_sse2;
     }
 }
-- 
1.8.0.msysgit.0