I would kindly ask for comments for this patch before applying, just
double-check that I thought the right way when fixing this one.
BugLink: https://launchpad.net/bugs/445849
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 <[email protected]>
--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
>From a7a099463370c1f49e470597fb7a70a6ac72d685 Mon Sep 17 00:00:00 2001
From: David Henningsson <[email protected]>
Date: Fri, 8 Oct 2010 18:47:00 +0200
Subject: [PATCH] SSE/MMX/ARM: Fix high frequency noise with unusual number of channels
BugLink: https://launchpad.net/bugs/445849
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 <[email protected]>
---
src/pulsecore/svolume_arm.c | 2 +-
src/pulsecore/svolume_mmx.c | 4 ++--
src/pulsecore/svolume_sse.c | 9 +++++++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index 5bd1448..ec9c08a 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -47,7 +47,7 @@ pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsi
{
int32_t *ve;
- channels = PA_MAX (4U, channels);
+ channels = channels == 3 ? 6 : PA_MAX (4U, channels);
ve = volumes + channels;
__asm__ __volatile__ (
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index e50ebee..5141d6c 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -100,7 +100,7 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
/* 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 (4U, channels);
+ channels = channels == 3 ? 6 : PA_MAX (4U, channels);
__asm__ __volatile__ (
" xor %3, %3 \n\t"
@@ -166,7 +166,7 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
/* 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 (4U, channels);
+ channels = channels == 3 ? 6 : PA_MAX (4U, channels);
__asm__ __volatile__ (
" xor %3, %3 \n\t"
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c
index 1cc4e0a..afba877 100644
--- a/src/pulsecore/svolume_sse.c
+++ b/src/pulsecore/svolume_sse.c
@@ -74,6 +74,9 @@
" 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)
{
@@ -81,7 +84,8 @@ pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
/* 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);
+ if (channels < 8)
+ channels = channel_overread_table[channels];
__asm__ __volatile__ (
" xor %3, %3 \n\t"
@@ -161,7 +165,8 @@ pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
/* 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);
+ if (channels < 8)
+ channels = channel_overread_table[channels];
__asm__ __volatile__ (
" xor %3, %3 \n\t"
--
1.7.1
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss