---
 libavresample/x86/audio_convert.asm    |   52 ++++++++++++++++++++++++++++++++
 libavresample/x86/audio_convert_init.c |    9 +++++
 libavutil/x86/x86util.asm              |    6 ++++
 3 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/libavresample/x86/audio_convert.asm 
b/libavresample/x86/audio_convert.asm
index 17c9f22..34449c9 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -589,6 +589,58 @@ CONV_FLTP_TO_S16_6CH
 INIT_XMM sse2
 CONV_FLTP_TO_S16_6CH
 
+;------------------------------------------------------------------------------
+; void ff_conv_fltp_to_flt_2ch(float *dst, float *const *src, int len,
+;                              int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_FLTP_TO_FLT_2CH 0
+cglobal conv_fltp_to_flt_2ch, 3,4,5, dst, src, len, src1
+    mov  src1q, [srcq+gprsize]
+    mov   srcq, [srcq        ]
+    sub  src1q, srcq
+    ALIGN 16
+.loop
+    mova    m0, [srcq             ]
+    mova    m1, [srcq+src1q       ]
+    mova    m2, [srcq      +mmsize]
+    mova    m3, [srcq+src1q+mmsize]
+    SBUTTERFLYPS2 0, 1, 4
+    SBUTTERFLYPS2 2, 3, 4
+%if cpuflag(avx)
+    vextractf128 [dstq    ], m0, 0
+    vextractf128 [dstq+ 16], m1, 0
+    vextractf128 [dstq+ 32], m0, 1
+    vextractf128 [dstq+ 48], m1, 1
+    vextractf128 [dstq+ 64], m2, 0
+    vextractf128 [dstq+ 80], m3, 0
+    vextractf128 [dstq+ 96], m2, 1
+    vextractf128 [dstq+112], m3, 1
+%else
+    mova  [dstq         ], m0
+    mova  [dstq+1*mmsize], m1
+    mova  [dstq+2*mmsize], m2
+    mova  [dstq+3*mmsize], m3
+%endif
+    add   srcq, mmsize*2
+    add   dstq, mmsize*4
+    sub   lend, mmsize/2
+    jg .loop
+%if mmsize == 32
+    vzeroupper
+    RET
+%else
+    REP_RET
+%endif
+%endmacro
+
+INIT_XMM sse
+CONV_FLTP_TO_FLT_2CH
+%if HAVE_AVX
+INIT_YMM avx
+CONV_FLTP_TO_FLT_2CH
+%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 72c78bd..6544678 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -62,6 +62,11 @@ extern void ff_conv_fltp_to_s16_6ch_sse (int16_t *dst, float 
*const *src,
 extern void ff_conv_fltp_to_s16_6ch_sse2(int16_t *dst, float *const *src,
                                          int len, int channels);
 
+extern void ff_conv_fltp_to_flt_2ch_sse(float *dst, float *const *src, int len,
+                                        int channels);
+extern void ff_conv_fltp_to_flt_2ch_avx(float *dst, float *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,
@@ -83,6 +88,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
     if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) {
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP,
                                   6, 1, 2, "SSE", ff_conv_fltp_to_s16_6ch_sse);
+        ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+                                  2, 16, 8, "SSE", 
ff_conv_fltp_to_flt_2ch_sse);
     }
     if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) {
         if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
@@ -124,6 +131,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
                                   0, 32, 32, "AVX", ff_conv_flt_to_s32_avx);
         ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+                                  2, 32, 16, "AVX", 
ff_conv_fltp_to_flt_2ch_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);
     }
 #endif
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index 066384b..26a92bc 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -47,6 +47,12 @@
     SWAP %1, %3, %2
 %endmacro
 
+%macro SBUTTERFLYPS2 3
+    unpcklps m%3, m%1, m%2
+    unpckhps m%1, m%1, m%2
+    SWAP %1, %3, %2
+%endmacro
+
 %macro TRANSPOSE4x4B 5
     SBUTTERFLY bw, %1, %2, %5
     SBUTTERFLY bw, %3, %4, %5
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to