summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-09-16 06:19:39 -0700
committerChris Robinson <[email protected]>2012-09-16 06:19:39 -0700
commitdd9d30e2489d938d5ec0d75702c82b943a1b3efa (patch)
tree351af51fc6711afbd48165da6eb402a0d3d2b876
parent95535ce99eb7b0664fff4172764c4272fd3ddd15 (diff)
Implement an SSE MixSend method
-rw-r--r--Alc/mixer_sse.c29
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h2
2 files changed, 30 insertions, 1 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"
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index f025118f..cfa61a5f 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -26,7 +26,7 @@ typedef struct ALeffectslot
volatile ALenum NeedsUpdate;
ALeffectState *EffectState;
- ALfloat WetBuffer[BUFFERSIZE];
+ ALIGN(16) ALfloat WetBuffer[BUFFERSIZE];
ALfloat ClickRemoval[1];
ALfloat PendingClicks[1];