24 #define PROTO(pre, in, out, cap) void ff ## pre ## _ ##in## _to_ ##out## _a_ ##cap(uint8_t **dst, const uint8_t **src, int len);
25 #define PROTO2(pre, out, cap) PROTO(pre, int16, out, cap) PROTO(pre, int32, out, cap) PROTO(pre, float, out, cap)
26 #define PROTO3(pre, cap) PROTO2(pre, int16, cap) PROTO2(pre, int32, cap) PROTO2(pre, float, cap)
27 #define PROTO4(pre) PROTO3(pre, mmx) PROTO3(pre, sse) PROTO3(pre, sse2) PROTO3(pre, ssse3) PROTO3(pre, sse4) PROTO3(pre, avx)
43 #define MULTI_CAPS_FUNC(flag, cap) \
44 if (mm_flags & flag) {\
45 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)\
46 ac->simd_f = ff_int16_to_int32_a_ ## cap;\
47 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)\
48 ac->simd_f = ff_int32_to_int16_a_ ## cap;\
57 ac->simd_f = ff_pack_6ch_float_to_float_a_mmx;
63 ac->simd_f = ff_int32_to_float_a_sse2;
65 ac->simd_f = ff_int16_to_float_a_sse2;
67 ac->simd_f = ff_float_to_int32_a_sse2;
69 ac->simd_f = ff_float_to_int16_a_sse2;
73 ac->simd_f = ff_pack_2ch_int32_to_int32_a_sse2;
75 ac->simd_f = ff_pack_2ch_int16_to_int16_a_sse2;
77 ac->simd_f = ff_pack_2ch_int16_to_int32_a_sse2;
79 ac->simd_f = ff_pack_2ch_int32_to_int16_a_sse2;
82 ac->simd_f = ff_unpack_2ch_int32_to_int32_a_sse2;
84 ac->simd_f = ff_unpack_2ch_int16_to_int16_a_sse2;
86 ac->simd_f = ff_unpack_2ch_int16_to_int32_a_sse2;
88 ac->simd_f = ff_unpack_2ch_int32_to_int16_a_sse2;
91 ac->simd_f = ff_pack_2ch_int32_to_float_a_sse2;
93 ac->simd_f = ff_pack_2ch_float_to_int32_a_sse2;
95 ac->simd_f = ff_pack_2ch_int16_to_float_a_sse2;
97 ac->simd_f = ff_pack_2ch_float_to_int16_a_sse2;
99 ac->simd_f = ff_unpack_2ch_int32_to_float_a_sse2;
101 ac->simd_f = ff_unpack_2ch_float_to_int32_a_sse2;
103 ac->simd_f = ff_unpack_2ch_int16_to_float_a_sse2;
105 ac->simd_f = ff_unpack_2ch_float_to_int16_a_sse2;
111 ac->simd_f = ff_unpack_2ch_int16_to_int16_a_ssse3;
113 ac->simd_f = ff_unpack_2ch_int16_to_int32_a_ssse3;
115 ac->simd_f = ff_unpack_2ch_int16_to_float_a_ssse3;
121 ac->simd_f = ff_pack_6ch_float_to_float_a_sse4;
123 ac->simd_f = ff_pack_6ch_int32_to_float_a_sse4;
125 ac->simd_f = ff_pack_6ch_float_to_int32_a_sse4;
130 ac->simd_f = ff_int32_to_float_a_avx;
133 ac->simd_f = ff_pack_6ch_float_to_float_a_avx;
135 ac->simd_f = ff_pack_6ch_int32_to_float_a_avx;
137 ac->simd_f = ff_pack_6ch_float_to_int32_a_avx;
142 #define D(type, simd) \
143 mix_1_1_func_type ff_mix_1_1_a_## type ## _ ## simd;\
144 mix_2_1_func_type ff_mix_2_1_a_## type ## _ ## simd;
156 int num = nb_in * nb_out;
159 s->mix_1_1_simd =
NULL;
160 s->mix_2_1_simd =
NULL;
164 s->mix_1_1_simd = ff_mix_1_1_a_int16_mmx;
165 s->mix_2_1_simd = ff_mix_2_1_a_int16_mmx;
168 s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2;
169 s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2;
171 s->native_simd_matrix =
av_mallocz(2 * num *
sizeof(int16_t));
172 for(i=0; i<nb_out; i++){
174 for(j=0; j<nb_in; j++)
175 sh =
FFMAX(sh,
FFABS(((
int*)s->native_matrix)[i * nb_in + j]));
177 for(j=0; j<nb_in; j++) {
178 ((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)+1] = 15 - sh;
179 ((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)] =
180 ((((
int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh;
185 s->mix_1_1_simd = ff_mix_1_1_a_float_sse;
186 s->mix_2_1_simd = ff_mix_2_1_a_float_sse;
189 s->mix_1_1_simd = ff_mix_1_1_a_float_avx;
190 s->mix_2_1_simd = ff_mix_2_1_a_float_avx;
192 s->native_simd_matrix =
av_mallocz(num *
sizeof(
float));
193 memcpy(s->native_simd_matrix, s->native_matrix, num *
sizeof(
float));