[FFmpeg-cvslog] x86: sbrdsp: implement SSE qmf_deint_bfly

Christophe Gisquet git at videolan.org
Mon Apr 8 02:37:27 CEST 2013


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Sun Apr  7 20:20:33 2013 +0000| [e2946e5c3482ab78913bfa5527a6fa9ea4e70bb4] | committer: Michael Niedermayer

x86: sbrdsp: implement SSE qmf_deint_bfly

>From 312 to 89/68 (sse/sse2) cycles on Arrandale and Win64.
Sandybridge: 68/47 cycles.

Having a loop counter is a 7 cycle gain.
Unrolling is another 7 cycle gain.
Working in reverse scan is another 6 cycles.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2946e5c3482ab78913bfa5527a6fa9ea4e70bb4
---

 libavcodec/x86/sbrdsp.asm    |   42 ++++++++++++++++++++++++++++++++++++++++++
 libavcodec/x86/sbrdsp_init.c |    7 +++++++
 2 files changed, 49 insertions(+)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 2900469..273e950 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -242,3 +242,45 @@ cglobal sbr_neg_odd_64, 1,2,4,z
     cmp         zq, r1q
     jne      .loop
     REP_RET
+
+; sbr_qmf_deint_bfly(float *v, const float *src0, const float *src1)
+%macro SBR_QMF_DEINT_BFLY  0
+cglobal sbr_qmf_deint_bfly, 3,5,8, v,src0,src1,vrev,c
+    mov        cq, 64*4-2*mmsize
+    lea     vrevq, [vq + 64*4]
+.loop:
+    mova       m0, [src0q+cq]
+    mova       m1, [src1q]
+    mova       m4, [src0q+cq+mmsize]
+    mova       m5, [src1q+mmsize]
+%if cpuflag(sse2)
+    pshufd     m2, m0, q0123
+    pshufd     m3, m1, q0123
+    pshufd     m6, m4, q0123
+    pshufd     m7, m5, q0123
+%else
+    shufps     m2, m0, m0, q0123
+    shufps     m3, m1, m1, q0123
+    shufps     m6, m4, m4, q0123
+    shufps     m7, m5, m5, q0123
+%endif
+    addps      m5, m2
+    subps      m0, m7
+    addps      m1, m6
+    subps      m4, m3
+    mova  [vrevq], m1
+    mova  [vrevq+mmsize], m5
+    mova  [vq+cq], m0
+    mova  [vq+cq+mmsize], m4
+    add     src1q, 2*mmsize
+    add     vrevq, 2*mmsize
+    sub        cq, 2*mmsize
+    jge     .loop
+    REP_RET
+%endmacro
+
+INIT_XMM sse
+SBR_QMF_DEINT_BFLY
+
+INIT_XMM sse2
+SBR_QMF_DEINT_BFLY
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index cb65a23..8cc37dd 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -34,6 +34,8 @@ void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2],
                        float bw, int start, int end);
 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_sse(float *v, const float *src0, const float *src1);
+void ff_sbr_qmf_deint_bfly_sse2(float *v, const float *src0, const float *src1);
 
 av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 {
@@ -46,5 +48,10 @@ av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
         s->hf_g_filt  = ff_sbr_hf_g_filt_sse;
         s->hf_gen     = ff_sbr_hf_gen_sse;
         s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_sse;
+        s->qmf_deint_bfly   = ff_sbr_qmf_deint_bfly_sse;
+    }
+
+    if (EXTERNAL_SSE2(mm_flags)) {
+        s->qmf_deint_bfly   = ff_sbr_qmf_deint_bfly_sse2;
     }
 }



More information about the ffmpeg-cvslog mailing list