aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/mixer')
-rw-r--r--Alc/mixer/defs.h47
-rw-r--r--Alc/mixer/hrtf_inc.cpp31
-rw-r--r--Alc/mixer/mixer_c.cpp28
-rw-r--r--Alc/mixer/mixer_neon.cpp28
-rw-r--r--Alc/mixer/mixer_sse.cpp28
5 files changed, 97 insertions, 65 deletions
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h
index 03955b59..1aa6ba38 100644
--- a/Alc/mixer/defs.h
+++ b/Alc/mixer/defs.h
@@ -34,33 +34,12 @@ void Mix_(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFF
template<typename InstTag>
void MixRow_(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*data)[BUFFERSIZE], const ALsizei InChans, const ALsizei InPos, const ALsizei BufferSize);
-/* C mixers */
-void MixHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, MixHrtfParams *hrtfparams,
- HrtfState *hrtfstate, const ALsizei BufferSize);
-void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, const HrtfParams *oldparams,
- MixHrtfParams *newparams, HrtfState *hrtfstate,
- const ALsizei BufferSize);
-void MixDirectHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
- const ALsizei NumChans, const ALsizei BufferSize);
-
-/* SSE mixers */
-void MixHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, MixHrtfParams *hrtfparams,
- HrtfState *hrtfstate, const ALsizei BufferSize);
-void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, const HrtfParams *oldparams,
- MixHrtfParams *newparams, HrtfState *hrtfstate,
- const ALsizei BufferSize);
-void MixDirectHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
- const ALsizei NumChans, const ALsizei BufferSize);
+template<typename InstTag>
+void MixHrtf_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate, const ALsizei BufferSize);
+template<typename InstTag>
+void MixHrtfBlend_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate, const ALsizei BufferSize);
+template<typename InstTag>
+void MixDirectHrtf_(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans, const ALsizei BufferSize);
/* Vectorized resampler helpers */
inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size)
@@ -75,18 +54,4 @@ inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTR
}
}
-/* Neon mixers */
-void MixHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, MixHrtfParams *hrtfparams,
- HrtfState *hrtfstate, const ALsizei BufferSize);
-void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, const HrtfParams *oldparams,
- MixHrtfParams *newparams, HrtfState *hrtfstate,
- const ALsizei BufferSize);
-void MixDirectHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
- const ALsizei NumChans, const ALsizei BufferSize);
-
#endif /* MIXER_DEFS_H */
diff --git a/Alc/mixer/hrtf_inc.cpp b/Alc/mixer/hrtf_inc.cpp
index 594c6119..97065392 100644
--- a/Alc/mixer/hrtf_inc.cpp
+++ b/Alc/mixer/hrtf_inc.cpp
@@ -8,15 +8,15 @@
#include "defs.h"
-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);
+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);
-void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate,
- const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
+ ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams,
+ HrtfState *hrtfstate, const ALsizei BufferSize)
{
ASSUME(OutPos >= 0);
ASSUME(IrSize >= 4);
@@ -76,11 +76,11 @@ void MixHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
hrtfparams->Gain = gain + gainstep*stepcount;
}
-void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat *data, ALsizei Offset, const ALsizei OutPos,
- const ALsizei IrSize, const HrtfParams *oldparams,
- MixHrtfParams *newparams, HrtfState *hrtfstate,
- const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixHrtfBlendBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize,
+ const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
+ const ALsizei BufferSize)
{
const ALfloat (&OldCoeffs)[HRIR_LENGTH][2] = oldparams->Coeffs;
const ALfloat oldGain{oldparams->Gain};
@@ -151,9 +151,10 @@ void MixHrtfBlend(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
newparams->Gain = newGainStep*stepcount;
}
-void MixDirectHrtf(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
- const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State,
- const ALsizei NumChans, const ALsizei BufferSize)
+template<ApplyCoeffsT ApplyCoeffs>
+inline void MixDirectHrtfBase(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize)
{
ASSUME(NumChans > 0);
ASSUME(BufferSize > 0);
diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp
index 6b1cc495..fad08e74 100644
--- a/Alc/mixer/mixer_c.cpp
+++ b/Alc/mixer/mixer_c.cpp
@@ -125,11 +125,33 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
}
}
-#define MixHrtf MixHrtf_C
-#define MixHrtfBlend MixHrtfBlend_C
-#define MixDirectHrtf MixDirectHrtf_C
#include "hrtf_inc.cpp"
+template<>
+void MixHrtf_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
+ ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams,
+ HrtfState *hrtfstate, const ALsizei BufferSize)
+{
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, hrtfparams,
+ hrtfstate, BufferSize);
+}
+
+template<>
+void MixHrtfBlend_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize,
+ const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
+ const ALsizei BufferSize)
+{
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, oldparams,
+ newparams, hrtfstate, BufferSize);
+}
+
+template<>
+void MixDirectHrtf_<CTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize)
+{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, State, NumChans, BufferSize); }
+
template<>
void Mix_<CTag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp
index 978ea8d3..1c033bd3 100644
--- a/Alc/mixer/mixer_neon.cpp
+++ b/Alc/mixer/mixer_neon.cpp
@@ -164,11 +164,33 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
}
}
-#define MixHrtf MixHrtf_Neon
-#define MixHrtfBlend MixHrtfBlend_Neon
-#define MixDirectHrtf MixDirectHrtf_Neon
#include "hrtf_inc.cpp"
+template<>
+void MixHrtf_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
+ ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams,
+ HrtfState *hrtfstate, const ALsizei BufferSize)
+{
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, hrtfparams,
+ hrtfstate, BufferSize);
+}
+
+template<>
+void MixHrtfBlend_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize,
+ const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
+ const ALsizei BufferSize)
+{
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, oldparams,
+ newparams, hrtfstate, BufferSize);
+}
+
+template<>
+void MixDirectHrtf_<NEONTag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize)
+{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, State, NumChans, BufferSize); }
+
template<>
void Mix_<NEONTag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],
diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp
index adb0287d..3f756f2b 100644
--- a/Alc/mixer/mixer_sse.cpp
+++ b/Alc/mixer/mixer_sse.cpp
@@ -143,11 +143,33 @@ static inline void ApplyCoeffs(ALsizei Offset, ALfloat (&Values)[HRIR_LENGTH][2]
}
}
-#define MixHrtf MixHrtf_SSE
-#define MixHrtfBlend MixHrtfBlend_SSE
-#define MixDirectHrtf MixDirectHrtf_SSE
#include "hrtf_inc.cpp"
+template<>
+void MixHrtf_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data,
+ ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize, MixHrtfParams *hrtfparams,
+ HrtfState *hrtfstate, const ALsizei BufferSize)
+{
+ MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, hrtfparams,
+ hrtfstate, BufferSize);
+}
+
+template<>
+void MixHrtfBlend_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat *data, ALsizei Offset, const ALsizei OutPos, const ALsizei IrSize,
+ const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate,
+ const ALsizei BufferSize)
+{
+ MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, data, Offset, OutPos, IrSize, oldparams,
+ newparams, hrtfstate, BufferSize);
+}
+
+template<>
+void MixDirectHrtf_<SSETag>(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut,
+ const ALfloat (*data)[BUFFERSIZE], DirectHrtfState *State, const ALsizei NumChans,
+ const ALsizei BufferSize)
+{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, data, State, NumChans, BufferSize); }
+
template<>
void Mix_<SSETag>(const ALfloat *data, const ALsizei OutChans, ALfloat (*OutBuffer)[BUFFERSIZE],