Optimize audio_mix_volume_SSE

This commit is contained in:
twinaphex 2020-01-04 14:40:37 +01:00
parent 96395f7d39
commit 3d950b2324

View File

@ -48,7 +48,7 @@ void audio_mix_volume_C(float *out, const float *in, float vol, size_t samples)
#ifdef __SSE2__
void audio_mix_volume_SSE2(float *out, const float *in, float vol, size_t samples)
{
size_t i;
size_t i, remaining_samples;
__m128 volume = _mm_set1_ps(vol);
for (i = 0; i + 16 <= samples; i += 16, out += 16, in += 16)
@ -71,7 +71,10 @@ void audio_mix_volume_SSE2(float *out, const float *in, float vol, size_t sample
_mm_storeu_ps(out + 4 * j, _mm_add_ps(input[j], additive[j]));
}
audio_mix_volume_C(out, in, vol, samples - i);
remaining_samples = samples - i;
for (i = 0; i < remaining_samples; i++)
out[i] += in[i] * vol;
}
#endif