aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alu.cpp5
-rw-r--r--Alc/mixer/defs.h16
-rw-r--r--Alc/mixer/hrtf_inc.cpp23
-rw-r--r--Alc/mixer/mixer_c.cpp10
-rw-r--r--Alc/mixer/mixer_neon.cpp13
-rw-r--r--Alc/mixer/mixer_sse.cpp10
-rw-r--r--Alc/mixvoice.cpp4
-rw-r--r--OpenAL32/Include/alu.h5
8 files changed, 42 insertions, 44 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 2490f0cb..6655bd81 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -139,10 +139,7 @@ void ProcessHrtf(ALCdevice *device, ALsizei SamplesToDo)
const ALfloat (*Input)[BUFFERSIZE]{device->Dry.Buffer};
DirectHrtfState *state{device->mHrtfState.get()};
for(ALsizei c{0};c < num_chans;c++)
- {
- MixDirectHrtf(LeftOut, RightOut, Input[c], state->Offset, state->IrSize,
- state->Chan[c].Coeffs, state->Chan[c].Values, SamplesToDo);
- }
+ MixDirectHrtf(LeftOut, RightOut, Input[c], state, c, SamplesToDo);
state->Offset += SamplesToDo;
}
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h
index 5fa88773..5bdf6e30 100644
--- a/Alc/mixer/defs.h
+++ b/Alc/mixer/defs.h
@@ -10,6 +10,7 @@
struct MixGains;
struct MixHrtfParams;
struct HrtfState;
+struct DirectHrtfState;
/* C resamplers */
const ALfloat *Resample_copy_C(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen);
@@ -30,9 +31,8 @@ void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2], ALfloat (*RESTRICT Values)[2],
- ALsizei BufferSize);
+ const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
+ const ALsizei BufferSize);
void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
@@ -51,9 +51,8 @@ void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2], ALfloat (*RESTRICT Values)[2],
- ALsizei BufferSize);
+ const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
+ const ALsizei BufferSize);
void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
@@ -98,9 +97,8 @@ void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
void MixDirectHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2], ALfloat (*RESTRICT Values)[2],
- ALsizei BufferSize);
+ const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
+ const ALsizei BufferSize);
void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE],
ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos,
ALsizei BufferSize);
diff --git a/Alc/mixer/hrtf_inc.cpp b/Alc/mixer/hrtf_inc.cpp
index d811bd61..e82bad85 100644
--- a/Alc/mixer/hrtf_inc.cpp
+++ b/Alc/mixer/hrtf_inc.cpp
@@ -8,10 +8,9 @@
#include "defs.h"
-static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2],
- const ALsizei irSize,
- const ALfloat (*RESTRICT Coeffs)[2],
- ALfloat left, ALfloat right);
+static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
+ const ALsizei irSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
+ const ALfloat left, const ALfloat right);
void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
@@ -19,7 +18,7 @@ void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate,
ALsizei BufferSize)
{
- const ALfloat (*Coeffs)[2] = hrtfparams->Coeffs;
+ const ALfloat (&Coeffs)[HRIR_LENGTH][2] = *hrtfparams->Coeffs;
const ALsizei Delay[2] = { hrtfparams->Delay[0], hrtfparams->Delay[1] };
const ALfloat gainstep = hrtfparams->GainStep;
const ALfloat gain = hrtfparams->Gain;
@@ -59,11 +58,11 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize)
{
- const ALfloat (*OldCoeffs)[2] = oldparams->Coeffs;
+ const ALfloat (&OldCoeffs)[HRIR_LENGTH][2] = oldparams->Coeffs;
const ALsizei OldDelay[2] = { oldparams->Delay[0], oldparams->Delay[1] };
const ALfloat oldGain = oldparams->Gain;
const ALfloat oldGainStep = -oldGain / (ALfloat)BufferSize;
- const ALfloat (*NewCoeffs)[2] = newparams->Coeffs;
+ const ALfloat (&NewCoeffs)[HRIR_LENGTH][2] = *newparams->Coeffs;
const ALsizei NewDelay[2] = { newparams->Delay[0], newparams->Delay[1] };
const ALfloat newGain = newparams->Gain;
const ALfloat newGainStep = newparams->GainStep;
@@ -103,10 +102,14 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
}
void MixDirectHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2], ALfloat (*RESTRICT Values)[2],
- ALsizei BufferSize)
+ const ALfloat *data, DirectHrtfState *State, const ALsizei Chan,
+ const ALsizei BufferSize)
{
+ const ALsizei IrSize{State->IrSize};
+ ALsizei Offset{State->Offset};
+ ALfloat (&Values)[HRIR_LENGTH][2] = State->Chan[Chan].Values;
+ const ALfloat (&Coeffs)[HRIR_LENGTH][2] = State->Chan[Chan].Coeffs;
+
ASSUME(IrSize >= 4);
ASSUME(BufferSize > 0);
diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp
index bbf58325..d98b8e2e 100644
--- a/Alc/mixer/mixer_c.cpp
+++ b/Alc/mixer/mixer_c.cpp
@@ -103,15 +103,15 @@ const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *RESTRIC
{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst, numsamples); }
-static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2],
- const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2],
- ALfloat left, ALfloat right)
+static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
+ const ALsizei IrSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
+ const ALfloat left, const ALfloat right)
{
ALsizei off{Offset&HRIR_MASK};
ALsizei count{mini(IrSize, HRIR_LENGTH - off)};
- ASSUME(IrSize > 0);
+ ASSUME(IrSize >= 2);
+ ASSUME(&Values != &Coeffs);
ASSUME(count > 0);
for(ALsizei c{0};;)
diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp
index fa777eac..4843922f 100644
--- a/Alc/mixer/mixer_neon.cpp
+++ b/Alc/mixer/mixer_neon.cpp
@@ -133,12 +133,13 @@ const ALfloat *Resample_bsinc_Neon(const InterpState *state,
}
-static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2],
- const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2],
- ALfloat left, ALfloat right)
+static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
+ const ALsizei IrSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
+ const ALfloat left, const ALfloat right)
{
- ALsizei c;
+ ASSUME(IrSize >= 2);
+ ASSUME(&Values != &Coeffs);
+
float32x4_t leftright4;
{
float32x2_t leftright2 = vdup_n_f32(0.0);
@@ -147,7 +148,7 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2],
leftright4 = vcombine_f32(leftright2, leftright2);
}
- for(c = 0;c < IrSize;c += 2)
+ for(ALsizei c{0};c < IrSize;c += 2)
{
const ALsizei o0 = (Offset+c)&HRIR_MASK;
const ALsizei o1 = (o0+1)&HRIR_MASK;
diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp
index 09307697..5d82e5ae 100644
--- a/Alc/mixer/mixer_sse.cpp
+++ b/Alc/mixer/mixer_sse.cpp
@@ -79,16 +79,16 @@ const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *RESTR
}
-static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*RESTRICT Values)[2],
- const ALsizei IrSize,
- const ALfloat (*RESTRICT Coeffs)[2],
- ALfloat left, ALfloat right)
+static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
+ const ALsizei IrSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
+ const ALfloat left, const ALfloat right)
{
const __m128 lrlr = _mm_setr_ps(left, right, left, right);
__m128 vals = _mm_setzero_ps();
__m128 coeffs;
- ASSUME(IrSize > 1);
+ ASSUME(IrSize >= 2);
+ ASSUME(&Values != &Coeffs);
ALsizei off{Offset&HRIR_MASK};
if((Offset&1))
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index 5b18d547..b94f26be 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -605,7 +605,7 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context,
ALfloat gain{lerp(parms.Hrtf.Old.Gain, parms.Hrtf.Target.Gain,
minf(1.0f, (ALfloat)fademix/Counter))};
MixHrtfParams hrtfparams;
- hrtfparams.Coeffs = parms.Hrtf.Target.Coeffs;
+ hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs;
hrtfparams.Delay[0] = parms.Hrtf.Target.Delay[0];
hrtfparams.Delay[1] = parms.Hrtf.Target.Delay[1];
hrtfparams.Gain = 0.0f;
@@ -634,7 +634,7 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context,
(ALfloat)todo/(Counter-fademix));
MixHrtfParams hrtfparams;
- hrtfparams.Coeffs = parms.Hrtf.Target.Coeffs;
+ hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs;
hrtfparams.Delay[0] = parms.Hrtf.Target.Delay[0];
hrtfparams.Delay[1] = parms.Hrtf.Target.Delay[1];
hrtfparams.Gain = parms.Hrtf.Old.Gain;
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 42c754cc..775d34f6 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -108,7 +108,7 @@ enum {
struct MixHrtfParams {
- const ALfloat (*Coeffs)[2];
+ const ALfloat (*Coeffs)[HRIR_LENGTH][2];
ALsizei Delay[2];
ALfloat Gain;
ALfloat GainStep;
@@ -286,8 +286,7 @@ using HrtfMixerBlendFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT
const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
ALsizei BufferSize);
using HrtfDirectMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei IrSize, const ALfloat (*RESTRICT Coeffs)[2],
- ALfloat (*RESTRICT Values)[2], ALsizei BufferSize);
+ const ALfloat *data, DirectHrtfState *State, const ALsizei Chan, const ALsizei BufferSize);
#define GAIN_MIX_MAX (1000.0f) /* +60dB */