audioconvert: fix unaligned writes

Avoid some optimizations that cause unaligned writes.

See #3572
This commit is contained in:
Wim Taymans 2023-10-15 20:52:54 +02:00
parent bdd577c360
commit b2c24f3435

View file

@ -889,10 +889,14 @@ conv_f32d_to_s16_avx2(struct convert *conv, void * SPA_RESTRICT dst[], const voi
int16_t *d = dst[0];
uint32_t i = 0, n_channels = conv->n_channels;
for(; i + 3 < n_channels; i += 4)
conv_f32d_to_s16_4s_avx2(conv, &d[i], &src[i], n_channels, n_samples);
for(; i + 1 < n_channels; i += 2)
conv_f32d_to_s16_2s_avx2(conv, &d[i], &src[i], n_channels, n_samples);
if ((n_channels & 0x3) == 0) {
for(; i + 3 < n_channels; i += 4)
conv_f32d_to_s16_4s_avx2(conv, &d[i], &src[i], n_channels, n_samples);
}
if ((n_channels & 0x1) == 0) {
for(; i + 1 < n_channels; i += 2)
conv_f32d_to_s16_2s_avx2(conv, &d[i], &src[i], n_channels, n_samples);
}
for(; i < n_channels; i++)
conv_f32d_to_s16_1s_avx2(conv, &d[i], &src[i], n_channels, n_samples);
}