diff options
author | Chris Robinson <[email protected]> | 2012-09-16 08:14:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-16 08:14:26 -0700 |
commit | a240abb6c85189ab9099326e5301b1c640a6398d (patch) | |
tree | c7644d811d6b95008af730dcb899dc6b3de4335a | |
parent | dd9d30e2489d938d5ec0d75702c82b943a1b3efa (diff) |
Avoid building redundant mixers
-rw-r--r-- | Alc/ALu.c | 22 | ||||
-rw-r--r-- | Alc/mixer_c.c | 66 | ||||
-rw-r--r-- | Alc/mixer_defs.h | 2 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 72 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 12 |
5 files changed, 75 insertions, 99 deletions
@@ -80,32 +80,28 @@ static ResamplerFunc SelectResampler(enum Resampler Resampler, ALuint increment) } -static DryMixerFunc SelectDirectMixer(void) +static DryMixerFunc SelectHrtfMixer(void) { #ifdef HAVE_SSE if((CPUCapFlags&CPU_CAP_SSE)) - return MixDirect_SSE; + return MixDirect_Hrtf_SSE; #endif #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) - return MixDirect_Neon; + return MixDirect_Hrtf_Neon; #endif - return MixDirect_C; + return MixDirect_Hrtf_C; } -static DryMixerFunc SelectHrtfMixer(void) +static DryMixerFunc SelectDirectMixer(void) { #ifdef HAVE_SSE if((CPUCapFlags&CPU_CAP_SSE)) - return MixDirect_Hrtf_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixDirect_Hrtf_Neon; + return MixDirect_SSE; #endif - return MixDirect_Hrtf_C; + return MixDirect_C; } static WetMixerFunc SelectSendMixer(void) @@ -114,10 +110,6 @@ static WetMixerFunc SelectSendMixer(void) if((CPUCapFlags&CPU_CAP_SSE)) return MixSend_SSE; #endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixSend_Neon; -#endif return MixSend_C; } diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index f3e416a0..baef411d 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -1,9 +1,9 @@ #include "config.h" -#include "AL/al.h" -#include "AL/alc.h" #include "alMain.h" #include "alu.h" +#include "alSource.h" +#include "alAuxEffectSlot.h" static __inline ALfloat point32(const ALfloat *vals, ALint step, ALint frac) @@ -72,7 +72,67 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2], } } - #define SUFFIX C #include "mixer_inc.c" #undef SUFFIX + + +void MixDirect_C(ALsource *Source, ALCdevice *Device, DirectParams *params, + const ALfloat *RESTRICT data, ALuint srcchan, + ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) +{ + ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = Device->DryBuffer; + ALfloat *RESTRICT ClickRemoval = Device->ClickRemoval; + ALfloat *RESTRICT PendingClicks = Device->PendingClicks; + ALfloat DrySend[MaxChannels]; + ALuint pos; + ALuint c; + (void)Source; + + for(c = 0;c < MaxChannels;c++) + DrySend[c] = params->Gains[srcchan][c]; + + pos = 0; + if(OutPos == 0) + { + for(c = 0;c < MaxChannels;c++) + ClickRemoval[c] -= data[pos]*DrySend[c]; + } + for(c = 0;c < MaxChannels;c++) + { + for(pos = 0;pos < BufferSize;pos++) + DryBuffer[c][OutPos+pos] += data[pos]*DrySend[c]; + } + if(OutPos+pos == SamplesToDo) + { + for(c = 0;c < MaxChannels;c++) + PendingClicks[c] += data[pos]*DrySend[c]; + } +} + + +void MixSend_C(SendParams *params, const ALfloat *RESTRICT data, + ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) +{ + ALeffectslot *Slot = params->Slot; + ALfloat *WetBuffer = Slot->WetBuffer; + ALfloat *WetClickRemoval = Slot->ClickRemoval; + ALfloat *WetPendingClicks = Slot->PendingClicks; + ALfloat WetSend = params->Gain; + ALuint pos; + + pos = 0; + if(OutPos == 0) + { + WetClickRemoval[0] -= data[pos] * WetSend; + } + for(pos = 0;pos < BufferSize;pos++) + { + WetBuffer[OutPos] += data[pos] * WetSend; + OutPos++; + } + if(OutPos == SamplesToDo) + { + WetPendingClicks[0] += data[pos] * WetSend; + } +} diff --git a/Alc/mixer_defs.h b/Alc/mixer_defs.h index f9dbadbb..d9fda9be 100644 --- a/Alc/mixer_defs.h +++ b/Alc/mixer_defs.h @@ -32,7 +32,5 @@ void MixSend_SSE(struct SendParams*,const ALfloat*RESTRICT,ALuint,ALuint,ALuint) /* Neon mixers */ void MixDirect_Hrtf_Neon(struct ALsource*,ALCdevice*,struct DirectParams*,const ALfloat*RESTRICT,ALuint,ALuint,ALuint,ALuint); -void MixDirect_Neon(struct ALsource*,ALCdevice*,struct DirectParams*,const ALfloat*RESTRICT,ALuint,ALuint,ALuint,ALuint); -void MixSend_Neon(struct SendParams*,const ALfloat*RESTRICT,ALuint,ALuint,ALuint); #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index a7332714..1d9ac5cd 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -1,10 +1,7 @@ #include "config.h" -#include "AL/alc.h" -#include "AL/al.h" #include "alMain.h" #include "alSource.h" -#include "alAuxEffectSlot.h" #include "mixer_defs.h" #ifdef __GNUC__ @@ -19,8 +16,6 @@ #define MERGE2(a,b) REAL_MERGE2(a,b) #define MixDirect_Hrtf MERGE2(MixDirect_Hrtf_,SUFFIX) -#define MixDirect MERGE2(MixDirect_,SUFFIX) -#define MixSend MERGE2(MixSend_,SUFFIX) static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*RESTRICT Values)[2], @@ -34,7 +29,6 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2], ALfloat left, ALfloat right); -#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) @@ -137,74 +131,8 @@ 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) -{ - ALfloat (*RESTRICT DryBuffer)[BUFFERSIZE] = Device->DryBuffer; - ALfloat *RESTRICT ClickRemoval = Device->ClickRemoval; - ALfloat *RESTRICT PendingClicks = Device->PendingClicks; - ALfloat DrySend[MaxChannels]; - ALuint pos; - ALuint c; - (void)Source; - - for(c = 0;c < MaxChannels;c++) - DrySend[c] = params->Gains[srcchan][c]; - - pos = 0; - if(OutPos == 0) - { - for(c = 0;c < MaxChannels;c++) - ClickRemoval[c] -= data[pos]*DrySend[c]; - } - for(c = 0;c < MaxChannels;c++) - { - for(pos = 0;pos < BufferSize;pos++) - DryBuffer[c][OutPos+pos] += data[pos]*DrySend[c]; - } - if(OutPos+pos == SamplesToDo) - { - for(c = 0;c < MaxChannels;c++) - PendingClicks[c] += data[pos]*DrySend[c]; - } -} -#endif - -#ifndef NO_MIXSEND -void MixSend(SendParams *params, const ALfloat *RESTRICT data, - ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) -{ - ALeffectslot *Slot = params->Slot; - ALfloat *WetBuffer = Slot->WetBuffer; - ALfloat *WetClickRemoval = Slot->ClickRemoval; - ALfloat *WetPendingClicks = Slot->PendingClicks; - ALfloat WetSend = params->Gain; - ALuint pos; - - pos = 0; - if(OutPos == 0) - { - WetClickRemoval[0] -= data[pos] * WetSend; - } - for(pos = 0;pos < BufferSize;pos++) - { - WetBuffer[OutPos] += data[pos] * WetSend; - OutPos++; - } - if(OutPos == SamplesToDo) - { - WetPendingClicks[0] += data[pos] * WetSend; - } -} -#endif -#undef MixSend -#undef MixDirect #undef MixDirect_Hrtf #undef MERGE2 diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index c7898ce8..6a53115a 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -261,6 +261,10 @@ static __inline void ApplyCoeffs(ALuint Offset, ALfloat (*RESTRICT Values)[2], } } +#define SUFFIX SSE +#include "mixer_inc.c" +#undef SUFFIX + void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params, const ALfloat *RESTRICT data, ALuint srcchan, @@ -310,7 +314,7 @@ void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params, PendingClicks[c] += data[pos]*DrySend[c]; } } -#define NO_MIXDIRECT + void MixSend_SSE(SendParams *params, const ALfloat *RESTRICT data, ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) @@ -338,9 +342,3 @@ void MixSend_SSE(SendParams *params, const ALfloat *RESTRICT data, if(OutPos == SamplesToDo) WetPendingClicks[0] += data[pos] * WetGain; } -#define NO_MIXSEND - - -#define SUFFIX SSE -#include "mixer_inc.c" -#undef SUFFIX |