[FFmpeg-cvslog] swr: int32_to_int16_mmx/sse

Michael Niedermayer git at videolan.org
Sun Apr 29 14:26:21 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 29 14:10:34 2012 +0200| [65722e7fc5918644ca92d5cdfcb88a54b1b64d44] | committer: Michael Niedermayer

swr: int32_to_int16_mmx/sse

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

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

 libswresample/x86/audio_convert.asm |   31 +++++++++++++++++++++++++++++++
 libswresample/x86/swresample_x86.c  |    6 +++++-
 2 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/libswresample/x86/audio_convert.asm b/libswresample/x86/audio_convert.asm
index 1c70f6e..f220e2d 100644
--- a/libswresample/x86/audio_convert.asm
+++ b/libswresample/x86/audio_convert.asm
@@ -194,14 +194,45 @@ float_to_int16_u_int %+ SUFFIX
     REP_RET
 %endmacro
 
+%macro INT32_TO_INT16 1
+cglobal int32_to_int16_%1, 3, 3, 2, dst, src, len
+    mov srcq, [srcq]
+    mov dstq, [dstq]
+%ifidn %1, a
+    test dstq, mmsize-1
+        jne int32_to_int16_u_int %+ SUFFIX
+    test srcq, mmsize-1
+        jne int32_to_int16_u_int %+ SUFFIX
+%else
+int32_to_int16_u_int %+ SUFFIX
+%endif
+    lea     srcq, [srcq + 2*lenq]
+    add     dstq, lenq
+    neg     lenq
+.next:
+    mov%1     m0, [         srcq+2*lenq]
+    mov%1     m1, [mmsize + srcq+2*lenq]
+    psrad     m0, 16
+    psrad     m1, 16
+    packssdw  m0, m1
+    mov%1 [         dstq+lenq], m0
+    add lenq, mmsize
+        jl .next
+    REP_RET
+%endmacro
+
 
 INIT_MMX mmx
 INT16_TO_INT32 u
 INT16_TO_INT32 a
+INT32_TO_INT16 u
+INT32_TO_INT16 a
 
 INIT_XMM sse
 INT16_TO_INT32 u
 INT16_TO_INT32 a
+INT32_TO_INT16 u
+INT32_TO_INT16 a
 
 INIT_XMM sse2
 INT32_TO_FLOAT u
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c
index c1ffe43..9e5ac49 100644
--- a/libswresample/x86/swresample_x86.c
+++ b/libswresample/x86/swresample_x86.c
@@ -22,7 +22,9 @@
 #include "libswresample/audioconvert.h"
 
 #define MULTI_CAPS_FUNC_DECL(cap) \
-    void ff_int16_to_int32_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);
+    void ff_int16_to_int32_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);\
+    void ff_int32_to_int16_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);\
+
 MULTI_CAPS_FUNC_DECL(mmx)
 MULTI_CAPS_FUNC_DECL(sse)
 
@@ -45,6 +47,8 @@ void swri_audio_convert_init_x86(struct AudioConvert *ac,
     if (mm_flags & flag) {\
         if(   out_fmt == AV_SAMPLE_FMT_S32  && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\
             ac->simd_f =  ff_int16_to_int32_a_ ## cap;\
+        if(   out_fmt == AV_SAMPLE_FMT_S16  && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\
+            ac->simd_f =  ff_int32_to_int16_a_ ## cap;\
     }
 
 MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx)



More information about the ffmpeg-cvslog mailing list