mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
lavr: Add x86-optimized function for flt to s32 conversion
This commit is contained in:
parent
6c63cbfe7a
commit
4e4dd71730
@ -27,6 +27,7 @@
|
||||
SECTION_RODATA 32
|
||||
|
||||
pf_s32_inv_scale: times 8 dd 0x30000000
|
||||
pf_s32_scale: times 8 dd 0x4f000000
|
||||
pf_s16_inv_scale: times 4 dd 0x38000000
|
||||
pf_s16_scale: times 4 dd 0x47000000
|
||||
|
||||
@ -191,6 +192,47 @@ cglobal conv_flt_to_s16, 3,3,5, dst, src, len
|
||||
jl .loop
|
||||
REP_RET
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; void ff_conv_flt_to_s32(int32_t *dst, const float *src, int len);
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
%macro CONV_FLT_TO_S32 0
|
||||
cglobal conv_flt_to_s32, 3,3,5, dst, src, len
|
||||
lea lenq, [lend*4]
|
||||
add srcq, lenq
|
||||
add dstq, lenq
|
||||
neg lenq
|
||||
mova m4, [pf_s32_scale]
|
||||
.loop:
|
||||
mulps m0, m4, [srcq+lenq ]
|
||||
mulps m1, m4, [srcq+lenq+1*mmsize]
|
||||
mulps m2, m4, [srcq+lenq+2*mmsize]
|
||||
mulps m3, m4, [srcq+lenq+3*mmsize]
|
||||
cvtps2dq m0, m0
|
||||
cvtps2dq m1, m1
|
||||
cvtps2dq m2, m2
|
||||
cvtps2dq m3, m3
|
||||
mova [dstq+lenq ], m0
|
||||
mova [dstq+lenq+1*mmsize], m1
|
||||
mova [dstq+lenq+2*mmsize], m2
|
||||
mova [dstq+lenq+3*mmsize], m3
|
||||
add lenq, mmsize*4
|
||||
jl .loop
|
||||
%if mmsize == 32
|
||||
vzeroupper
|
||||
RET
|
||||
%else
|
||||
REP_RET
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
INIT_XMM sse2
|
||||
CONV_FLT_TO_S32
|
||||
%if HAVE_AVX
|
||||
INIT_YMM avx
|
||||
CONV_FLT_TO_S32
|
||||
%endif
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; void ff_conv_fltp_to_flt_6ch(float *dst, float *const *src, int len,
|
||||
; int channels);
|
||||
|
@ -35,6 +35,9 @@ extern void ff_conv_s32_to_flt_avx (float *dst, const int32_t *src, int len);
|
||||
|
||||
extern void ff_conv_flt_to_s16_sse2(int16_t *dst, const float *src, int len);
|
||||
|
||||
extern void ff_conv_flt_to_s32_sse2(int32_t *dst, const float *src, int len);
|
||||
extern void ff_conv_flt_to_s32_avx (int32_t *dst, const float *src, int len);
|
||||
|
||||
extern void ff_conv_fltp_to_flt_6ch_mmx (float *dst, float *const *src, int len);
|
||||
extern void ff_conv_fltp_to_flt_6ch_sse4(float *dst, float *const *src, int len);
|
||||
extern void ff_conv_fltp_to_flt_6ch_avx (float *dst, float *const *src, int len);
|
||||
@ -71,6 +74,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
|
||||
0, 16, 8, "SSE2", ff_conv_s32_to_flt_sse2);
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT,
|
||||
0, 16, 16, "SSE2", ff_conv_flt_to_s16_sse2);
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
|
||||
0, 16, 16, "SSE2", ff_conv_flt_to_s32_sse2);
|
||||
}
|
||||
if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16,
|
||||
@ -79,6 +84,8 @@ av_cold void ff_audio_convert_init_x86(AudioConvert *ac)
|
||||
if (mm_flags & AV_CPU_FLAG_AVX && HAVE_AVX) {
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32,
|
||||
0, 32, 16, "AVX", ff_conv_s32_to_flt_avx);
|
||||
ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT,
|
||||
0, 32, 32, "AVX", ff_conv_flt_to_s32_avx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user