diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-05-02 17:54:56 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-08-23 20:10:57 -0400 |
commit | 205ace88435386126ed9f590737d24cc2bf93507 (patch) | |
tree | e30881a515c083deefe0eefef55ca3da2aba4dba /libavresample/x86 | |
parent | 8eeffa8adaba69854f388c9cc19a6374409764a9 (diff) | |
download | ffmpeg-205ace88435386126ed9f590737d24cc2bf93507.tar.gz |
lavr: x86: optimized 6-channel s16 to s16p conversion
Diffstat (limited to 'libavresample/x86')
-rw-r--r-- | libavresample/x86/audio_convert.asm | 61 | ||||
-rw-r--r-- | libavresample/x86/audio_convert_init.c | 13 |
2 files changed, 74 insertions, 0 deletions
diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 567acf6f8f..e7d8fcad66 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -862,3 +862,64 @@ CONV_S16_TO_S16P_2CH INIT_XMM avx CONV_S16_TO_S16P_2CH %endif + +;------------------------------------------------------------------------------ +; void ff_conv_s16_to_s16p_6ch(int16_t *const *dst, int16_t *src, int len, +; int channels); +;------------------------------------------------------------------------------ + +%macro CONV_S16_TO_S16P_6CH 0 +%if ARCH_X86_64 +cglobal conv_s16_to_s16p_6ch, 3,8,5, dst, src, len, dst1, dst2, dst3, dst4, dst5 +%else +cglobal conv_s16_to_s16p_6ch, 2,7,5, dst, src, dst1, dst2, dst3, dst4, dst5 +%define lend dword r2m +%endif + mov dst1q, [dstq+ gprsize] + mov dst2q, [dstq+2*gprsize] + mov dst3q, [dstq+3*gprsize] + mov dst4q, [dstq+4*gprsize] + mov dst5q, [dstq+5*gprsize] + mov dstq, [dstq ] + sub dst1q, dstq + sub dst2q, dstq + sub dst3q, dstq + sub dst4q, dstq + sub dst5q, dstq +.loop: + mova m0, [srcq+0*mmsize] ; m0 = 0, 1, 2, 3, 4, 5, 6, 7 + mova m3, [srcq+1*mmsize] ; m3 = 8, 9, 10, 11, 12, 13, 14, 15 + mova m2, [srcq+2*mmsize] ; m2 = 16, 17, 18, 19, 20, 21, 22, 23 + PALIGNR m1, m3, m0, 12, m4 ; m1 = 6, 7, 8, 9, 10, 11, x, x + shufps m3, m2, q1032 ; m3 = 12, 13, 14, 15, 16, 17, 18, 19 + psrldq m2, 4 ; m2 = 18, 19, 20, 21, 22, 23, x, x + SBUTTERFLY2 wd, 0, 1, 4 ; m0 = 0, 6, 1, 7, 2, 8, 3, 9 + ; m1 = 4, 10, 5, 11, x, x, x, x + SBUTTERFLY2 wd, 3, 2, 4 ; m3 = 12, 18, 13, 19, 14, 20, 15, 21 + ; m2 = 16, 22, 17, 23, x, x, x, x + SBUTTERFLY2 dq, 0, 3, 4 ; m0 = 0, 6, 12, 18, 1, 7, 13, 19 + ; m3 = 2, 8, 14, 20, 3, 9, 15, 21 + punpckldq m1, m2 ; m1 = 4, 10, 16, 22, 5, 11, 17, 23 + movq [dstq ], m0 + movhps [dstq+dst1q], m0 + movq [dstq+dst2q], m3 + movhps [dstq+dst3q], m3 + movq [dstq+dst4q], m1 + movhps [dstq+dst5q], m1 + add srcq, mmsize*3 + add dstq, mmsize/2 + sub lend, mmsize/4 + jg .loop + REP_RET +%endmacro + +%define PALIGNR PALIGNR_MMX +INIT_XMM sse2 +CONV_S16_TO_S16P_6CH +%define PALIGNR PALIGNR_SSSE3 +INIT_XMM ssse3 +CONV_S16_TO_S16P_6CH +%if HAVE_AVX +INIT_XMM avx +CONV_S16_TO_S16P_6CH +%endif diff --git a/libavresample/x86/audio_convert_init.c b/libavresample/x86/audio_convert_init.c index 79d7f4d0d0..adb63f6098 100644 --- a/libavresample/x86/audio_convert_init.c +++ b/libavresample/x86/audio_convert_init.c @@ -99,6 +99,13 @@ extern void ff_conv_s16_to_s16p_2ch_ssse3(int16_t *const *dst, int16_t *src, extern void ff_conv_s16_to_s16p_2ch_avx (int16_t *const *dst, int16_t *src, int len, int channels); +extern void ff_conv_s16_to_s16p_6ch_sse2 (int16_t *const *dst, int16_t *src, + int len, int channels); +extern void ff_conv_s16_to_s16p_6ch_ssse3(int16_t *const *dst, int16_t *src, + int len, int channels); +extern void ff_conv_s16_to_s16p_6ch_avx (int16_t *const *dst, int16_t *src, + int len, int channels); + av_cold void ff_audio_convert_init_x86(AudioConvert *ac) { #if HAVE_YASM @@ -148,6 +155,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 2, 16, 4, "SSE2", ff_conv_fltp_to_s16_2ch_sse2); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSE2", ff_conv_s16_to_s16p_2ch_sse2); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, + 6, 16, 4, "SSE2", ff_conv_s16_to_s16p_6ch_sse2); } if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16P, @@ -156,6 +165,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 2, 16, 4, "SSSE3", ff_conv_fltp_to_s16_2ch_ssse3); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "SSSE3", ff_conv_s16_to_s16p_2ch_ssse3); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, + 6, 16, 4, "SSSE3", ff_conv_s16_to_s16p_6ch_ssse3); } if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) { ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, @@ -182,6 +193,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac) 6, 16, 4, "AVX", ff_conv_fltp_to_flt_6ch_avx); ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, 2, 16, 8, "AVX", ff_conv_s16_to_s16p_2ch_avx); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16, + 6, 16, 4, "AVX", ff_conv_s16_to_s16p_6ch_avx); } #endif } |