summaryrefslogtreecommitdiff
path: root/libavresample
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-05-02 15:38:11 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-08-23 20:10:56 -0400
commit46f929adada92a87fd3e5362b8ed8b4696e09dcd (patch)
treefa4be83cce5142d23ac9b0edd362413544e9d626 /libavresample
parent13df7d2d40237152a00a98a40c8e844a026ee5fa (diff)
downloadffmpeg-46f929adada92a87fd3e5362b8ed8b4696e09dcd.tar.gz
lavr: x86: optimized 2-channel s16p to flt conversion
Diffstat (limited to 'libavresample')
-rw-r--r--libavresample/x86/audio_convert.asm49
-rw-r--r--libavresample/x86/audio_convert_init.c9
2 files changed, 58 insertions, 0 deletions
diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm
index ee05efcdb2..c3cc76fe01 100644
--- a/libavresample/x86/audio_convert.asm
+++ b/libavresample/x86/audio_convert.asm
@@ -383,6 +383,55 @@ INIT_XMM avx
CONV_S16P_TO_S16_6CH
%endif
+;------------------------------------------------------------------------------
+; void ff_conv_s16p_to_flt_2ch(float *dst, int16_t *const *src, int len,
+; int channels);
+;------------------------------------------------------------------------------
+
+%macro CONV_S16P_TO_FLT_2CH 0
+cglobal conv_s16p_to_flt_2ch, 3,4,6, dst, src0, len, src1
+ lea lenq, [2*lend]
+ mov src1q, [src0q+gprsize]
+ mov src0q, [src0q ]
+ lea dstq, [dstq+4*lenq]
+ add src0q, lenq
+ add src1q, lenq
+ neg lenq
+ mova m5, [pf_s32_inv_scale]
+.loop:
+ mova m2, [src0q+lenq] ; m2 = 0, 2, 4, 6, 8, 10, 12, 14
+ mova m4, [src1q+lenq] ; m4 = 1, 3, 5, 7, 9, 11, 13, 15
+ SBUTTERFLY2 wd, 2, 4, 3 ; m2 = 0, 1, 2, 3, 4, 5, 6, 7
+ ; m4 = 8, 9, 10, 11, 12, 13, 14, 15
+ pxor m3, m3
+ punpcklwd m0, m3, m2 ; m0 = 0, 1, 2, 3
+ punpckhwd m1, m3, m2 ; m1 = 4, 5, 6, 7
+ punpcklwd m2, m3, m4 ; m2 = 8, 9, 10, 11
+ punpckhwd m3, m4 ; m3 = 12, 13, 14, 15
+ cvtdq2ps m0, m0
+ cvtdq2ps m1, m1
+ cvtdq2ps m2, m2
+ cvtdq2ps m3, m3
+ mulps m0, m5
+ mulps m1, m5
+ mulps m2, m5
+ mulps m3, m5
+ mova [dstq+4*lenq ], m0
+ mova [dstq+4*lenq+ mmsize], m1
+ mova [dstq+4*lenq+2*mmsize], m2
+ mova [dstq+4*lenq+3*mmsize], m3
+ add lenq, mmsize
+ jl .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+CONV_S16P_TO_FLT_2CH
+%if HAVE_AVX
+INIT_XMM avx
+CONV_S16P_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 d9d471487d..9706c71d10 100644
--- a/libavresample/x86/audio_convert_init.c
+++ b/libavresample/x86/audio_convert_init.c
@@ -54,6 +54,11 @@ extern void ff_conv_s16p_to_s16_6ch_sse2slow(int16_t *dst, int16_t *const *src,
extern void ff_conv_s16p_to_s16_6ch_avx (int16_t *dst, int16_t *const *src,
int len, int channels);
+extern void ff_conv_s16p_to_flt_2ch_sse2(float *dst, int16_t *const *src,
+ int len, int channels);
+extern void ff_conv_s16p_to_flt_2ch_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,
@@ -94,6 +99,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2);
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
2, 16, 16, "SSE2", ff_conv_s16p_to_s16_2ch_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);
}
if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,
@@ -110,6 +117,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
2, 16, 16, "AVX", ff_conv_s16p_to_s16_2ch_avx);
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
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_FLTP,
6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx);
}