From b66e20d2aab58689f33af38a3ef5570c99f86295 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 2 May 2012 16:32:08 -0400 Subject: [PATCH] lavr: x86: optimized 2-channel fltp to flt conversion --- libavresample/x86/audio_convert.asm | 37 ++++++++++++++++++++++++++ libavresample/x86/audio_convert_init.c | 7 +++++ 2 files changed, 44 insertions(+) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index acc6bb0dc1..48508af81c 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -695,6 +695,43 @@ INIT_XMM avx CONV_FLTP_TO_S16_6CH %endif +;------------------------------------------------------------------------------ +; 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, src0, len, src1 + mov src1q, [src0q+gprsize] + mov src0q, [src0q] + lea lenq, [4*lend] + add src0q, lenq + add src1q, lenq + lea dstq, [dstq+2*lenq] + neg lenq +.loop + mova m0, [src0q+lenq ] + mova m1, [src1q+lenq ] + mova m2, [src0q+lenq+mmsize] + mova m3, [src1q+lenq+mmsize] + SBUTTERFLYPS 0, 1, 4 + SBUTTERFLYPS 2, 3, 4 + mova [dstq+2*lenq+0*mmsize], m0 + mova [dstq+2*lenq+1*mmsize], m1 + mova [dstq+2*lenq+2*mmsize], m2 + mova [dstq+2*lenq+3*mmsize], m3 + add lenq, 2*mmsize + jl .loop + REP_RET +%endmacro + +INIT_XMM sse +CONV_FLTP_TO_FLT_2CH +%if HAVE_AVX +INIT_XMM 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 51e51f5762..6e78338059 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -78,6 +78,11 @@ extern void ff_conv_fltp_to_s16_6ch_sse2(int16_t *dst, float *const *src, extern void ff_conv_fltp_to_s16_6ch_avx (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, @@ -99,6 +104,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)) {