aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-07 08:38:49 -0800
committerChris Robinson <[email protected]>2019-02-07 08:38:49 -0800
commit69d8c6546d1468473f34092727b3ce776a5f89e5 (patch)
treebc335480f49b9caa71a0c67b28ec4693ee201f86 /Alc/mixer
parentb371862fb29c0b2fe0ad0b89370a055a1771ae0f (diff)
Use std::arrays for HRIR coeffs and values
Diffstat (limited to 'Alc/mixer')
-rw-r--r--Alc/mixer/hrtfbase.h15
-rw-r--r--Alc/mixer/mixer_c.cpp5
-rw-r--r--Alc/mixer/mixer_neon.cpp5
-rw-r--r--Alc/mixer/mixer_sse.cpp5
4 files changed, 13 insertions, 17 deletions
diff --git a/Alc/mixer/hrtfbase.h b/Alc/mixer/hrtfbase.h
index facb577f..388d9ba1 100644
--- a/Alc/mixer/hrtfbase.h
+++ b/Alc/mixer/hrtfbase.h
@@ -6,9 +6,8 @@
#include "opthelpers.h"
-using ApplyCoeffsT = void(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2],
- const ALsizei irSize, const ALfloat (&Coeffs)[HRIR_LENGTH][2],
- const ALfloat left, const ALfloat right);
+using ApplyCoeffsT = void(ALsizei Offset, HrirArray<ALfloat> &Values, const ALsizei irSize,
+ const HrirArray<ALfloat> &Coeffs, const ALfloat left, const ALfloat right);
template<ApplyCoeffsT ApplyCoeffs>
inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
@@ -19,7 +18,7 @@ inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, c
ASSUME(IrSize >= 4);
ASSUME(BufferSize > 0);
- const ALfloat (&Coeffs)[HRIR_LENGTH][2] = *hrtfparams->Coeffs;
+ const auto &Coeffs = *hrtfparams->Coeffs;
const ALfloat gainstep{hrtfparams->GainStep};
const ALfloat gain{hrtfparams->Gain};
ALfloat stepcount{0.0f};
@@ -79,10 +78,10 @@ inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightO
const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
const ALsizei BufferSize)
{
- const ALfloat (&OldCoeffs)[HRIR_LENGTH][2] = oldparams->Coeffs;
+ const auto OldCoeffs = oldparams->Coeffs;
const ALfloat oldGain{oldparams->Gain};
const ALfloat oldGainStep{-oldGain / (ALfloat)BufferSize};
- const ALfloat (&NewCoeffs)[HRIR_LENGTH][2] = *newparams->Coeffs;
+ const auto &NewCoeffs = *newparams->Coeffs;
const ALfloat newGainStep{newparams->GainStep};
ALfloat stepcount{0.0f};
@@ -162,8 +161,8 @@ inline void MixDirectHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT Right
for(ALsizei c{0};c < NumChans;++c)
{
const ALfloat (&input)[BUFFERSIZE] = data[c];
- const ALfloat (&Coeffs)[HRIR_LENGTH][2] = State->Chan[c].Coeffs;
- ALfloat (&Values)[HRIR_LENGTH][2] = State->Chan[c].Values;
+ const auto &Coeffs = State->Chan[c].Coeffs;
+ auto &Values = State->Chan[c].Values;
ALsizei Offset{State->Offset&HRIR_MASK};
ALsizei HeadOffset{(Offset+IrSize-1)&HRIR_MASK};
diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp
index 4ca7c84d..6ee22cfe 100644
--- a/Alc/mixer/mixer_c.cpp
+++ b/Alc/mixer/mixer_c.cpp
@@ -101,9 +101,8 @@ const ALfloat *Resample_<BSincTag,CTag>(const InterpState *state, const ALfloat
{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst, dstlen); }
-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)
+static inline void ApplyCoeffs(ALsizei Offset, HrirArray<ALfloat> &Values, const ALsizei IrSize,
+ const HrirArray<ALfloat> &Coeffs, const ALfloat left, const ALfloat right)
{
ASSUME(Offset >= 0 && Offset < HRIR_LENGTH);
ASSUME(IrSize >= 2);
diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp
index 649ff8d3..9e8324aa 100644
--- a/Alc/mixer/mixer_neon.cpp
+++ b/Alc/mixer/mixer_neon.cpp
@@ -136,9 +136,8 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo
}
-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)
+static inline void ApplyCoeffs(ALsizei Offset, HrirArray<ALfloat> &Values, const ALsizei IrSize,
+ const HrirArray<ALfloat> &Coeffs, const ALfloat left, const ALfloat right)
{
ASSUME(IrSize >= 2);
ASSUME(&Values != &Coeffs);
diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp
index 8d5660ed..69aeaa62 100644
--- a/Alc/mixer/mixer_sse.cpp
+++ b/Alc/mixer/mixer_sse.cpp
@@ -76,9 +76,8 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa
}
-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)
+static inline void ApplyCoeffs(ALsizei Offset, HrirArray<ALfloat> &Values, const ALsizei IrSize,
+ const HrirArray<ALfloat> &Coeffs, const ALfloat left, const ALfloat right)
{
const __m128 lrlr{_mm_setr_ps(left, right, left, right)};