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
194194 REP_RET
195195 %endmacro
196196
197+%macro INT32_TO_INT16 1
198+cglobal 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
207+int32_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+
197224
198225 INIT_MMX mmx
199226 INT16_TO_INT32 u
200227 INT16_TO_INT32 a
228+INT32_TO_INT16 u
229+INT32_TO_INT16 a
201230
202231 INIT_XMM sse
203232 INT16_TO_INT32 u
204233 INT16_TO_INT32 a
234+INT32_TO_INT16 u
235+INT32_TO_INT16 a
205236
206237 INIT_XMM sse2
207238 INT32_TO_FLOAT u
libswresample/x86/swresample_x86.c+5−1
@@ -22,7 +22,9 @@ · 21 unmodified lines
2222 #include "libswresample/audioconvert.h"
2323
2424 #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+
2628 MULTI_CAPS_FUNC_DECL(mmx)
2729 MULTI_CAPS_FUNC_DECL(sse)
2830
@@ -45,6 +47,8 @@ void swri_audio_convert_init_x86(struct AudioConvert *ac, · 16 unmodified lines
4547 if (mm_flags & flag) {\
4648 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)\
4749 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;\
4852 }
4953
5054 MULTI_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