diff options
author | David Henningsson <david.henningsson@canonical.com> | 2010-10-08 18:47:00 +0200 |
---|---|---|
committer | Colin Guthrie <cguthrie@mandriva.org> | 2010-10-13 14:52:03 +0100 |
commit | 4d84a00b495c44a9e348534bf754ace823c9abe8 (patch) | |
tree | aa84e0c55c9e2959e11ead3ec158943399c7f468 /src/pulsecore/svolume_sse.c | |
parent | 489f50e2f4160f1368df38657bb91e77fd52c861 (diff) |
SSE/MMX/ARM: Fix high frequency noise with unusual number of channels
In the assembly optimized versions of SSE, a noise could occur when the
number of channels were 3,5,6 or 7. For MMX and ARM, this could occur
when the number of channels were 3.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Diffstat (limited to 'src/pulsecore/svolume_sse.c')
-rw-r--r-- | src/pulsecore/svolume_sse.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c index 620524fa..200482ec 100644 --- a/src/pulsecore/svolume_sse.c +++ b/src/pulsecore/svolume_sse.c @@ -76,14 +76,19 @@ " por %%xmm4, "#s1" \n\t" /* .. | l h | */ \ " por %%xmm5, "#s2" \n\t" + +static int channel_overread_table[8] = {8,8,8,12,8,10,12,14}; + static void pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length) { pa_reg_x86 channel, temp; - /* the max number of samples we process at a time, this is also the max amount - * we overread the volume array, which should have enough padding. */ - channels = PA_MAX (8U, channels); + /* Channels must be at least 8 and always a multiple of the original number. + * This is also the max amount we overread the volume array, which should + * have enough padding. */ + if (channels < 8) + channels = channel_overread_table[channels]; __asm__ __volatile__ ( " xor %3, %3 \n\t" @@ -161,9 +166,11 @@ pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns { pa_reg_x86 channel, temp; - /* the max number of samples we process at a time, this is also the max amount - * we overread the volume array, which should have enough padding. */ - channels = PA_MAX (8U, channels); + /* Channels must be at least 8 and always a multiple of the original number. + * This is also the max amount we overread the volume array, which should + * have enough padding. */ + if (channels < 8) + channels = channel_overread_table[channels]; __asm__ __volatile__ ( " xor %3, %3 \n\t" |