[FFmpeg-devel] [PATCH 8/9] x86: sbrdsp: implement SSE neg_odd_64

Christophe Gisquet christophe.gisquet at gmail.com
Thu Apr 4 21:45:52 CEST 2013


Timing on Arrandale:
        C   SSE
Win32:  57   44
Win64:  47   38
Unrolling and not storing mask both save some cycles.
---
 libavcodec/x86/sbrdsp.asm    | 22 ++++++++++++++++++++++
 libavcodec/x86/sbrdsp_init.c |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index fdeaa2b..4e36cec 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -24,6 +24,7 @@
 SECTION_RODATA
 ; mask equivalent for multiply by -1.0 1.0
 ps_mask         times 2 dd 1<<31, 0
+ps_mask2        times 2 dd 0, 1<<31
 ps_neg          times 4 dd 1<<31
 ps_noise0       times 2 dd  1.0,  0.0,
 ps_noise2       times 2 dd -1.0,  0.0
@@ -401,3 +402,24 @@ apply_noise_main:
     add    count, 16
     jl      .loop
     RET
+
+INIT_XMM sse
+cglobal sbr_neg_odd_64, 1,2,4,z
+    lea       r1q, [zq+256]
+.loop:
+    mova       m0, [zq+ 0]
+    mova       m1, [zq+16]
+    mova       m2, [zq+32]
+    mova       m3, [zq+48]
+    xorps      m0, [ps_mask2]
+    xorps      m1, [ps_mask2]
+    xorps      m2, [ps_mask2]
+    xorps      m3, [ps_mask2]
+    mova  [zq+ 0], m0
+    mova  [zq+16], m1
+    mova  [zq+32], m2
+    mova  [zq+48], m3
+    add        zq, 64
+    cmp        zq, r1q
+    jne     .loop
+    REP_RET
diff --git a/libavcodec/x86/sbrdsp_init.c b/libavcodec/x86/sbrdsp_init.c
index 78c8f4c..9c80897 100644
--- a/libavcodec/x86/sbrdsp_init.c
+++ b/libavcodec/x86/sbrdsp_init.c
@@ -48,6 +48,7 @@ void ff_sbr_hf_apply_noise_2_sse(float (*Y)[2], const float *s_m,
 void ff_sbr_hf_apply_noise_3_sse(float (*Y)[2], const float *s_m,
                                  const float *q_filt, int noise,
                                  int kx, int m_max);
+void ff_sbr_neg_odd_64_sse(float *z);
 
 av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
 {
@@ -66,5 +67,6 @@ av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
         s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_sse;
         s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_sse;
         s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_sse;
+        s->neg_odd_64 = ff_sbr_neg_odd_64_sse;
     }
 }
-- 
1.8.0.msysgit.0



More information about the ffmpeg-devel mailing list