History

swr: int32_to_int16_mmx/sse

Michael Niedermayer committed 14 years ago

Commit 65722e71 parent 755667e2 files · +36 −1Browse files

Unified · Split

2 files
  1. libswresample/x86/audio_convert.asm +31 −0
  2. libswresample/x86/swresample_x86.c +5 −1
libswresample/x86/audio_convert.asm+31−0
@@ -194,14 +194,45 @@ float_to_int16_u_int %+ SUFFIX · 193 unmodified lines
194 REP_RET194 REP_RET
195%endmacro195%endmacro
196 196
197%macro INT32_TO_INT16 1
198cglobal int32_to_int16_%1, 3, 3, 2, dst, src, len
199 mov srcq, [srcq]
200 mov dstq, [dstq]
201%ifidn %1, a
202 test dstq, mmsize-1
203 jne int32_to_int16_u_int %+ SUFFIX
204 test srcq, mmsize-1
205 jne int32_to_int16_u_int %+ SUFFIX
206%else
207int32_to_int16_u_int %+ SUFFIX
208%endif
209 lea srcq, [srcq + 2*lenq]
210 add dstq, lenq
211 neg lenq
212.next:
213 mov%1 m0, [ srcq+2*lenq]
214 mov%1 m1, [mmsize + srcq+2*lenq]
215 psrad m0, 16
216 psrad m1, 16
217 packssdw m0, m1
218 mov%1 [ dstq+lenq], m0
219 add lenq, mmsize
220 jl .next
221 REP_RET
222%endmacro
223
197 224
198INIT_MMX mmx225INIT_MMX mmx
199INT16_TO_INT32 u226INT16_TO_INT32 u
200INT16_TO_INT32 a227INT16_TO_INT32 a
228INT32_TO_INT16 u
229INT32_TO_INT16 a
201 230
202INIT_XMM sse231INIT_XMM sse
203INT16_TO_INT32 u232INT16_TO_INT32 u
204INT16_TO_INT32 a233INT16_TO_INT32 a
234INT32_TO_INT16 u
235INT32_TO_INT16 a
205 236
206INIT_XMM sse2237INIT_XMM sse2
207INT32_TO_FLOAT u238INT32_TO_FLOAT u
libswresample/x86/swresample_x86.c+5−1
@@ -22,7 +22,9 @@ · 21 unmodified lines
22#include "libswresample/audioconvert.h"22#include "libswresample/audioconvert.h"
23 23
24#define MULTI_CAPS_FUNC_DECL(cap) \24#define MULTI_CAPS_FUNC_DECL(cap) \
25 void ff_int16_to_int32_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);25 void ff_int16_to_int32_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);\
26 void ff_int32_to_int16_a_ ## cap(uint8_t **dst, const uint8_t **src, int len);\
27
26MULTI_CAPS_FUNC_DECL(mmx)28MULTI_CAPS_FUNC_DECL(mmx)
27MULTI_CAPS_FUNC_DECL(sse)29MULTI_CAPS_FUNC_DECL(sse)
28 30
@@ -45,6 +47,8 @@ void swri_audio_convert_init_x86(struct AudioConvert *ac, · 16 unmodified lines
45 if (mm_flags & flag) {\47 if (mm_flags & flag) {\
46 if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\48 if( out_fmt == AV_SAMPLE_FMT_S32 && in_fmt == AV_SAMPLE_FMT_S16 || out_fmt == AV_SAMPLE_FMT_S32P && in_fmt == AV_SAMPLE_FMT_S16P)\
47 ac->simd_f = ff_int16_to_int32_a_ ## cap;\49 ac->simd_f = ff_int16_to_int32_a_ ## cap;\
50 if( out_fmt == AV_SAMPLE_FMT_S16 && in_fmt == AV_SAMPLE_FMT_S32 || out_fmt == AV_SAMPLE_FMT_S16P && in_fmt == AV_SAMPLE_FMT_S32P)\
51 ac->simd_f = ff_int32_to_int16_a_ ## cap;\
48 }52 }
49 53
50MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx)54MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t