diff options
author | Chris Robinson <[email protected]> | 2012-09-16 06:19:39 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-16 06:19:39 -0700 |
commit | dd9d30e2489d938d5ec0d75702c82b943a1b3efa (patch) | |
tree | 351af51fc6711afbd48165da6eb402a0d3d2b876 /Alc | |
parent | 95535ce99eb7b0664fff4172764c4272fd3ddd15 (diff) |
Implement an SSE MixSend method
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer_sse.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 84884de3..c7898ce8 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -10,6 +10,7 @@ #include "alu.h" #include "alSource.h" +#include "alAuxEffectSlot.h" #include "mixer_defs.h" static __inline ALfloat lerp32(const ALfloat *vals, ALint step, ALuint frac) @@ -311,6 +312,34 @@ void MixDirect_SSE(ALsource *Source, ALCdevice *Device, DirectParams *params, } #define NO_MIXDIRECT +void MixSend_SSE(SendParams *params, const ALfloat *RESTRICT data, + ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize) +{ + ALeffectslot *Slot = params->Slot; + ALfloat *RESTRICT WetBuffer = Slot->WetBuffer; + ALfloat *RESTRICT WetClickRemoval = Slot->ClickRemoval; + ALfloat *RESTRICT WetPendingClicks = Slot->PendingClicks; + const ALfloat WetGain = params->Gain; + const __m128 gain = _mm_set1_ps(WetGain); + ALuint pos; + + pos = 0; + if(OutPos == 0) + WetClickRemoval[0] -= data[pos] * WetGain; + for(pos = 0;pos < BufferSize-3;pos+=4) + { + const __m128 val4 = _mm_load_ps(&data[pos]); + __m128 wet4 = _mm_load_ps(&WetBuffer[OutPos+pos]); + wet4 = _mm_add_ps(wet4, _mm_mul_ps(val4, gain)); + _mm_store_ps(&WetBuffer[OutPos+pos], wet4); + } + for(;pos < BufferSize;pos++) + WetBuffer[OutPos+pos] += data[pos] * WetGain; + if(OutPos == SamplesToDo) + WetPendingClicks[0] += data[pos] * WetGain; +} +#define NO_MIXSEND + #define SUFFIX SSE #include "mixer_inc.c" |