mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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>
This commit is contained in:
parent
a378c02ebb
commit
a8d76e99ff
3 changed files with 25 additions and 13 deletions
|
|
@ -47,7 +47,10 @@ pa_volume_s16ne_arm (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
{
|
{
|
||||||
int32_t *ve;
|
int32_t *ve;
|
||||||
|
|
||||||
channels = PA_MAX (4U, channels);
|
/* Channels must be at least 4, and always a multiple of the original number.
|
||||||
|
* This is also the max amount we overread the volume array, which should
|
||||||
|
* have enough padding. */
|
||||||
|
channels = channels == 3 ? 6 : PA_MAX (4U, channels);
|
||||||
ve = volumes + channels;
|
ve = volumes + channels;
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
|
|
|
||||||
|
|
@ -98,9 +98,10 @@ pa_volume_s16ne_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
{
|
{
|
||||||
pa_reg_x86 channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* Channels must be at least 4, and always a multiple of the original number.
|
||||||
* we overread the volume array, which should have enough padding. */
|
* This is also the max amount we overread the volume array, which should
|
||||||
channels = PA_MAX (4U, channels);
|
* have enough padding. */
|
||||||
|
channels = channels == 3 ? 6 : PA_MAX (4U, channels);
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" xor %3, %3 \n\t"
|
" xor %3, %3 \n\t"
|
||||||
|
|
@ -164,9 +165,10 @@ pa_volume_s16re_mmx (int16_t *samples, int32_t *volumes, unsigned channels, unsi
|
||||||
{
|
{
|
||||||
pa_reg_x86 channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* Channels must be at least 4, and always a multiple of the original number.
|
||||||
* we overread the volume array, which should have enough padding. */
|
* This is also the max amount we overread the volume array, which should
|
||||||
channels = PA_MAX (4U, channels);
|
* have enough padding. */
|
||||||
|
channels = channels == 3 ? 6 : PA_MAX (4U, channels);
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" xor %3, %3 \n\t"
|
" xor %3, %3 \n\t"
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,19 @@
|
||||||
" por %%xmm4, "#s1" \n\t" /* .. | l h | */ \
|
" por %%xmm4, "#s1" \n\t" /* .. | l h | */ \
|
||||||
" por %%xmm5, "#s2" \n\t"
|
" por %%xmm5, "#s2" \n\t"
|
||||||
|
|
||||||
|
|
||||||
|
static int channel_overread_table[8] = {8,8,8,12,8,10,12,14};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
pa_volume_s16ne_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, unsigned length)
|
||||||
{
|
{
|
||||||
pa_reg_x86 channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* Channels must be at least 8 and always a multiple of the original number.
|
||||||
* we overread the volume array, which should have enough padding. */
|
* This is also the max amount we overread the volume array, which should
|
||||||
channels = PA_MAX (8U, channels);
|
* have enough padding. */
|
||||||
|
if (channels < 8)
|
||||||
|
channels = channel_overread_table[channels];
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" xor %3, %3 \n\t"
|
" xor %3, %3 \n\t"
|
||||||
|
|
@ -159,9 +164,11 @@ pa_volume_s16re_sse2 (int16_t *samples, int32_t *volumes, unsigned channels, uns
|
||||||
{
|
{
|
||||||
pa_reg_x86 channel, temp;
|
pa_reg_x86 channel, temp;
|
||||||
|
|
||||||
/* the max number of samples we process at a time, this is also the max amount
|
/* Channels must be at least 8 and always a multiple of the original number.
|
||||||
* we overread the volume array, which should have enough padding. */
|
* This is also the max amount we overread the volume array, which should
|
||||||
channels = PA_MAX (8U, channels);
|
* have enough padding. */
|
||||||
|
if (channels < 8)
|
||||||
|
channels = channel_overread_table[channels];
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" xor %3, %3 \n\t"
|
" xor %3, %3 \n\t"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue