---
 libavresample/x86/audio_convert.asm    |   83 ++++++++++++++++++++++++++++++++
 libavresample/x86/audio_convert_init.c |    9 ++++
 2 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index 52528fa..ba6cb60 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -380,6 +380,89 @@ INIT_XMM avx
 CONV_S16P_TO_FLT_2CH
 %endif
 
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_flt_6ch(float *dst, int16_t *const *src, int len,
+;                              int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_FLT_6CH 0
+cglobal conv_s16p_to_flt_6ch, 2,8,8, dst, src, src1, src2, src3, src4, src5, 
len
+%if ARCH_X86_64
+    mov     lend, r2d
+%else
+    %define lend dword r2m
+%endif
+    mov     src1q, [srcq+1*gprsize]
+    mov     src2q, [srcq+2*gprsize]
+    mov     src3q, [srcq+3*gprsize]
+    mov     src4q, [srcq+4*gprsize]
+    mov     src5q, [srcq+5*gprsize]
+    mov      srcq, [srcq]
+    sub     src1q, srcq
+    sub     src2q, srcq
+    sub     src3q, srcq
+    sub     src4q, srcq
+    sub     src5q, srcq
+    mova       m7, [pf_s32_inv_scale]
+.loop:
+    movq       m0, [srcq      ]  ; m0 =  0,  6, 12, 18,  x,  x,  x,  x
+    movq       m1, [srcq+src1q]  ; m1 =  1,  7, 13, 19,  x,  x,  x,  x
+    movq       m2, [srcq+src2q]  ; m2 =  2,  8, 14, 20,  x,  x,  x,  x
+    movq       m3, [srcq+src3q]  ; m3 =  3,  9, 15, 21,  x,  x,  x,  x
+    movq       m4, [srcq+src4q]  ; m4 =  4, 10, 16, 22,  x,  x,  x,  x
+    movq       m5, [srcq+src5q]  ; m5 =  5, 11, 17, 23,  x,  x,  x,  x
+                                 ; unpack words:
+    punpcklwd  m0, m1            ; m0 =  0,  1,  6,  7, 12, 13, 18, 19
+    punpcklwd  m2, m3            ; m2 =  4,  5, 10, 11, 16, 17, 22, 23
+    punpcklwd  m4, m5            ; m4 =  2,  3,  8,  9, 14, 15, 20, 21
+                                 ; blend dwords
+    shufps     m1, m0, m2, q2020 ; m1 =  0,  1, 12, 13,  2,  3, 14, 15
+    shufps     m0, m4, q2031     ; m0 =  6,  7, 18, 19,  4,  5, 16, 17
+    shufps     m2, m4, q3131     ; m2 =  8,  9, 20, 21, 10, 11, 22, 23
+                                 ; shuffle dwords
+    pshufd     m0, m0, q1302     ; m0 =  4,  5,  6,  7, 16, 17, 18, 19
+    pshufd     m1, m1, q3120     ; m1 =  0,  1,  2,  3, 12, 13, 14, 15
+    pshufd     m2, m2, q3120     ; m2 =  8,  9, 10, 11, 20, 21, 22, 23
+    pxor       m6, m6            ; convert s16 in m0-m2 to s32 in m0-m5
+    punpcklwd  m3, m6, m0
+    punpckhwd  m4, m6, m0
+    punpcklwd  m0, m6, m1
+    punpckhwd  m5, m6, m1
+    punpcklwd  m1, m6, m2
+    punpckhwd  m6, m2
+    SWAP 6,2,1,3,5               ; swap registers 0,3,1,5,4,6 to 0,1,2,3,4,5
+    cvtdq2ps   m0, m0            ; convert s32 to float
+    cvtdq2ps   m1, m1
+    cvtdq2ps   m2, m2
+    cvtdq2ps   m3, m3
+    cvtdq2ps   m4, m4
+    cvtdq2ps   m5, m5
+    mulps      m0, m7            ; scale float from s32 range to [-1.0,1.0]
+    mulps      m1, m7
+    mulps      m2, m7
+    mulps      m3, m7
+    mulps      m4, m7
+    mulps      m5, m7
+    mova  [dstq         ], m0
+    mova  [dstq+  mmsize], m1
+    mova  [dstq+2*mmsize], m2
+    mova  [dstq+3*mmsize], m3
+    mova  [dstq+4*mmsize], m4
+    mova  [dstq+5*mmsize], m5
+    add      srcq, mmsize/2
+    add      dstq, mmsize*6
+    sub      lend, mmsize/4
+    jg .loop
+    REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_FLT_6CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_S16P_TO_FLT_6CH
+%endif
+
 ;-----------------------------------------------------------------------------
 ; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len,
 ;                              int channels);
diff --git a/libavresample/x86/audio_convert_init.c 
b/libavresample/x86/audio_convert_init.c
index 56d00bb..103da68 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -57,6 +57,11 @@ extern void ff_conv_s16p_to_flt_2ch_sse2(float *dst, int16_t 
*const *src,
 extern void ff_conv_s16p_to_flt_2ch_avx (float *dst, int16_t *const *src,
                                          int len, int channels);
 
+extern void ff_conv_s16p_to_flt_6ch_sse2(float *dst, int16_t *const *src,
+                                         int len, int channels);
+extern void ff_conv_s16p_to_flt_6ch_avx (float *dst, int16_t *const *src,
+                                         int len, int channels);
+
 extern void ff_conv_fltp_to_flt_6ch_mmx (float *dst, float *const *src, int 
len,
                                          int channels);
 extern void ff_conv_fltp_to_flt_6ch_sse4(float *dst, float *const *src, int 
len,
@@ -96,6 +101,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
                                   6, 16, 8, "SSE2", 
ff_conv_s16p_to_s16_6ch_sse2);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
                                   2, 16, 8, "SSE2", 
ff_conv_s16p_to_flt_2ch_sse2);
+        ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+                                  6, 16, 4, "SSE2", 
ff_conv_s16p_to_flt_6ch_sse2);
     }
     if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,
@@ -114,6 +121,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
                                   6, 16, 8, "AVX", 
ff_conv_s16p_to_s16_6ch_avx);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
                                   2, 16, 8, "AVX", 
ff_conv_s16p_to_flt_2ch_avx);
+        ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P,
+                                  6, 16, 4, "AVX", 
ff_conv_s16p_to_flt_6ch_avx);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
                                   6, 16, 4, "AVX", 
ff_conv_fltp_to_flt_6ch_avx);
     }
-- 
1.7.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to