Unified · Split
| @@ -194,14 +194,45 @@ float_to_int16_u_int %+ SUFFIX · 193 unmodified lines | ||
| 194 | 194 | REP_RET |
| 195 | 195 | %endmacro |
| 196 | 196 | |
| 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 | + | |
| 197 | 224 | |
| 198 | 225 | INIT_MMX mmx |
| 199 | 226 | INT16_TO_INT32 u |
| 200 | 227 | INT16_TO_INT32 a |
| 228 | +INT32_TO_INT16 u | |
| 229 | +INT32_TO_INT16 a | |
| 201 | 230 | |
| 202 | 231 | INIT_XMM sse |
| 203 | 232 | INT16_TO_INT32 u |
| 204 | 233 | INT16_TO_INT32 a |
| 234 | +INT32_TO_INT16 u | |
| 235 | +INT32_TO_INT16 a | |
| 205 | 236 | |
| 206 | 237 | INIT_XMM sse2 |
| 207 | 238 | INT32_TO_FLOAT u |
| @@ -22,7 +22,9 @@ · 21 unmodified lines | ||
| 22 | 22 | #include "libswresample/audioconvert.h" |
| 23 | 23 | |
| 24 | 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 | + | |
| 26 | 28 | MULTI_CAPS_FUNC_DECL(mmx) |
| 27 | 29 | MULTI_CAPS_FUNC_DECL(sse) |
| 28 | 30 | |
| @@ -45,6 +47,8 @@ void swri_audio_convert_init_x86(struct AudioConvert *ac, · 16 unmodified lines | ||
| 45 | 47 | if (mm_flags & flag) {\ |
| 46 | 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 | 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 | |
| 50 | 54 | MULTI_CAPS_FUNC(AV_CPU_FLAG_MMX, mmx) |