Implement MixDirect_SSE separately from the C and Neon versions

This commit is contained in:
Chris Robinson
2012-09-09 00:53:54 -07:00
parent 2bf1979d4a
commit f56dddfa73
4 changed files with 58 additions and 23 deletions
-8
View File
@@ -36,14 +36,6 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2],
}
static __inline void ApplyValue(ALfloat *RESTRICT Output, ALfloat value, const ALfloat *DrySend)
{
ALuint c;
for(c = 0;c < MaxChannels;c++)
Output[c] += value*DrySend[c];
}
#define SUFFIX C
#include "mixer_inc.c"
#undef SUFFIX
+13 -7
View File
@@ -30,10 +30,9 @@ static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*RESTRICT Values)[2
static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2],
ALfloat (*RESTRICT Coeffs)[2],
ALfloat left, ALfloat right);
static __inline void ApplyValue(ALfloat *RESTRICT Output, ALfloat value,
const ALfloat *DrySend);
#ifndef NO_MIXDIRECT_HRTF
void MixDirect_Hrtf(ALsource *Source, ALCdevice *Device, DirectParams *params,
const ALfloat *RESTRICT data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
@@ -149,8 +148,9 @@ void MixDirect_Hrtf(ALsource *Source, ALCdevice *Device, DirectParams *params,
Coeffs[0][1] * right;
}
}
#endif
#ifndef NO_MIXDIRECT
void MixDirect(ALsource *Source, ALCdevice *Device, DirectParams *params,
const ALfloat *RESTRICT data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
@@ -176,22 +176,26 @@ void MixDirect(ALsource *Source, ALCdevice *Device, DirectParams *params,
if(OutPos == 0)
{
value = lpFilter2PC(DryFilter, srcchan, data[pos]);
ApplyValue(ClickRemoval, -value, DrySend);
for(c = 0;c < MaxChannels;c++)
ClickRemoval[c] -= value*DrySend[c];
}
for(pos = 0;pos < BufferSize;pos++)
{
value = lpFilter2P(DryFilter, srcchan, data[pos]);
ApplyValue(DryBuffer[OutPos], value, DrySend);
for(c = 0;c < MaxChannels;c++)
DryBuffer[OutPos][c] += value*DrySend[c];
OutPos++;
}
if(OutPos == SamplesToDo)
{
value = lpFilter2PC(DryFilter, srcchan, data[pos]);
ApplyValue(PendingClicks, value, DrySend);
for(c = 0;c < MaxChannels;c++)
PendingClicks[c] += value*DrySend[c];
}
}
#endif
#ifndef NO_MIXSEND
void MixSend(SendParams *params, const ALfloat *RESTRICT data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
@@ -229,6 +233,8 @@ void MixSend(SendParams *params, const ALfloat *RESTRICT data, ALuint srcchan,
WetPendingClicks[0] += value * WetSend;
}
}
#endif
#undef MixSend
#undef MixDirect
-8
View File
@@ -54,14 +54,6 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2],
}
static __inline void ApplyValue(ALfloat *RESTRICT Output, ALfloat value, const ALfloat *DrySend)
{
ALuint c;
for(c = 0;c < MaxChannels;c++)
Output[c] += value*DrySend[c];
}
#define SUFFIX Neon
#include "mixer_inc.c"
#undef SUFFIX
+45
View File
@@ -9,6 +9,9 @@
#include "alMain.h"
#include "alu.h"
#include "alSource.h"
#include "mixer_defs.h"
static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*RESTRICT Values)[2],
ALfloat (*RESTRICT Coeffs)[2],
@@ -76,6 +79,48 @@ static __inline void ApplyValue(ALfloat *RESTRICT Output, ALfloat value, const A
}
void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params,
const ALfloat *RESTRICT data, ALuint srcchan,
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize)
{
ALfloat (*RESTRICT DryBuffer)[MaxChannels];
ALfloat *RESTRICT ClickRemoval, *RESTRICT PendingClicks;
ALIGN(16) ALfloat DrySend[MaxChannels];
FILTER *DryFilter;
ALuint pos;
ALfloat value;
ALuint c;
(void)Source;
DryBuffer = Device->DryBuffer;
ClickRemoval = Device->ClickRemoval;
PendingClicks = Device->PendingClicks;
DryFilter = &params->iirFilter;
for(c = 0;c < MaxChannels;c++)
DrySend[c] = params->Gains[srcchan][c];
pos = 0;
if(OutPos == 0)
{
value = lpFilter2PC(DryFilter, srcchan, data[pos]);
ApplyValue(ClickRemoval, -value, DrySend);
}
for(pos = 0;pos < BufferSize;pos++)
{
value = lpFilter2P(DryFilter, srcchan, data[pos]);
ApplyValue(DryBuffer[OutPos], value, DrySend);
OutPos++;
}
if(OutPos == SamplesToDo)
{
value = lpFilter2PC(DryFilter, srcchan, data[pos]);
ApplyValue(PendingClicks, value, DrySend);
}
}
#define NO_MIXDIRECT
#define SUFFIX SSE
#include "mixer_inc.c"
#undef SUFFIX