diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-05 15:31:06 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-05 18:32:34 +0200 |
commit | 47055b8913c96a1c41a3bbdf30205255c8453f25 (patch) | |
tree | aead4a059b9d199ab0dd5f7aad19a93d92b90de2 /libswresample/x86/swresample_x86.c | |
parent | fec3700dcd8c7cba7b85c5ce6f9c5f3092c1bc17 (diff) | |
download | ffmpeg-47055b8913c96a1c41a3bbdf30205255c8453f25.tar.gz |
swr: implement stereo S16/S32/FLT->S16/S32/FLT planar->packed in SSE/SSE2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/x86/swresample_x86.c')
-rw-r--r-- | libswresample/x86/swresample_x86.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libswresample/x86/swresample_x86.c b/libswresample/x86/swresample_x86.c index dc6ade5709..9370221513 100644 --- a/libswresample/x86/swresample_x86.c +++ b/libswresample/x86/swresample_x86.c @@ -35,6 +35,16 @@ void ff_float_to_int16_a_sse2(uint8_t **dst, const uint8_t **src, int len); void ff_int32_to_float_a_avx(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_int16_to_int16_a_sse(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_int32_to_int32_a_sse(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_int16_to_int32_a_sse(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_int32_to_int16_a_sse(uint8_t **dst, const uint8_t **src, int len); + +void ff_pack_2ch_int32_to_float_a_sse2(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_float_to_int32_a_sse2(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_int16_to_float_a_sse2(uint8_t **dst, const uint8_t **src, int len); +void ff_pack_2ch_float_to_int16_a_sse2(uint8_t **dst, const uint8_t **src, int len); + void swri_audio_convert_init_x86(struct AudioConvert *ac, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, @@ -56,6 +66,19 @@ void swri_audio_convert_init_x86(struct AudioConvert *ac, MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx) MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE, sse) + if(mm_flags & AV_CPU_FLAG_SSE) { + if(channels == 2) { + if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_FLTP || out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S32P) + ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse; + if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S16P) + ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse; + if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16P) + ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse; + if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32P) + ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse; + } + } + if(mm_flags & AV_CPU_FLAG_SSE2) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) ac->simd_f = ff_int32_to_float_a_sse2; @@ -65,6 +88,17 @@ MULTI_CAPS_FUNC(AV_CPU_FLAG_SSE, sse) ac->simd_f = ff_float_to_int32_a_sse2; if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLT || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_FLTP) ac->simd_f = ff_float_to_int16_a_sse2; + + if(channels == 2) { + if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32P) + ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2; + if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_FLTP) + ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2; + if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S16P) + ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2; + if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_FLTP) + ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2; + } } if(HAVE_AVX && mm_flags & AV_CPU_FLAG_AVX) { if( out_fmt == AV_SAMPLE_FMT_FLT && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_FLTP && in_fmt == AV_SAMPLE_FMT_S32P) |