aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mixer
diff options
context:
space:
mode:
Diffstat (limited to 'alc/mixer')
-rw-r--r--alc/mixer/defs.h17
-rw-r--r--alc/mixer/hrtfbase.h6
-rw-r--r--alc/mixer/mixer_c.cpp40
-rw-r--r--alc/mixer/mixer_neon.cpp26
-rw-r--r--alc/mixer/mixer_sse.cpp16
-rw-r--r--alc/mixer/mixer_sse2.cpp10
-rw-r--r--alc/mixer/mixer_sse41.cpp10
7 files changed, 63 insertions, 62 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h
index 762355d2..bb59b867 100644
--- a/alc/mixer/defs.h
+++ b/alc/mixer/defs.h
@@ -1,8 +1,6 @@
#ifndef MIXER_DEFS_H
#define MIXER_DEFS_H
-#include "AL/al.h"
-
#include "alcmain.h"
#include "alspan.h"
#include "alu.h"
@@ -11,20 +9,22 @@
union InterpState;
struct MixHrtfFilter;
+using uint = unsigned int;
+
template<typename TypeTag, typename InstTag>
-const float *Resample_(const InterpState *state, const float *RESTRICT src, ALuint frac,
- ALuint increment, const al::span<float> dst);
+const float *Resample_(const InterpState *state, const float *RESTRICT src, uint frac,
+ uint increment, const al::span<float> dst);
template<typename InstTag>
void Mix_(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos);
template<typename InstTag>
-void MixHrtf_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtf_(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize);
template<typename InstTag>
-void MixHrtfBlend_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtfBlend_(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize);
template<typename InstTag>
void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
@@ -32,14 +32,13 @@ void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
const size_t BufferSize);
/* Vectorized resampler helpers */
-inline void InitPosArrays(ALuint frac, ALuint increment, ALuint *frac_arr, ALuint *pos_arr,
- size_t size)
+inline void InitPosArrays(uint frac, uint increment, uint *frac_arr, uint *pos_arr, size_t size)
{
pos_arr[0] = 0;
frac_arr[0] = frac;
for(size_t i{1};i < size;i++)
{
- const ALuint frac_tmp{frac_arr[i-1] + increment};
+ const uint frac_tmp{frac_arr[i-1] + increment};
pos_arr[i] = pos_arr[i-1] + (frac_tmp>>MixerFracBits);
frac_arr[i] = frac_tmp&MixerFracMask;
}
diff --git a/alc/mixer/hrtfbase.h b/alc/mixer/hrtfbase.h
index 1b76e66d..96cc1c98 100644
--- a/alc/mixer/hrtfbase.h
+++ b/alc/mixer/hrtfbase.h
@@ -9,11 +9,13 @@
#include "voice.h"
+using uint = unsigned int;
+
using ApplyCoeffsT = void(&)(float2 *RESTRICT Values, const uint_fast32_t irSize,
const HrirArray &Coeffs, const float left, const float right);
template<ApplyCoeffsT ApplyCoeffs>
-inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, const ALuint IrSize,
+inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, const uint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{
ASSUME(BufferSize > 0);
@@ -38,7 +40,7 @@ inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, c
template<ApplyCoeffsT ApplyCoeffs>
inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSamples,
- const ALuint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams,
+ const uint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams,
const size_t BufferSize)
{
ASSUME(BufferSize > 0);
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index 2be60892..c292235a 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -21,21 +21,21 @@ struct FastBSincTag;
namespace {
-constexpr ALuint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
-constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff};
+constexpr uint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
+constexpr uint FracPhaseDiffOne{1 << FracPhaseBitDiff};
-inline float do_point(const InterpState&, const float *RESTRICT vals, const ALuint)
+inline float do_point(const InterpState&, const float *RESTRICT vals, const uint)
{ return vals[0]; }
-inline float do_lerp(const InterpState&, const float *RESTRICT vals, const ALuint frac)
+inline float do_lerp(const InterpState&, const float *RESTRICT vals, const uint frac)
{ return lerp(vals[0], vals[1], static_cast<float>(frac)*(1.0f/MixerFracOne)); }
-inline float do_cubic(const InterpState&, const float *RESTRICT vals, const ALuint frac)
+inline float do_cubic(const InterpState&, const float *RESTRICT vals, const uint frac)
{ return cubic(vals[0], vals[1], vals[2], vals[3], static_cast<float>(frac)*(1.0f/MixerFracOne)); }
-inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, const ALuint frac)
+inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, const uint frac)
{
const size_t m{istate.bsinc.m};
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
const float *fil{istate.bsinc.filter + m*pi*4};
@@ -49,12 +49,12 @@ inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, con
r += (fil[j_f] + istate.bsinc.sf*scd[j_f] + pf*(phd[j_f] + istate.bsinc.sf*spd[j_f])) * vals[j_f];
return r;
}
-inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const ALuint frac)
+inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const uint frac)
{
const size_t m{istate.bsinc.m};
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
const float *fil{istate.bsinc.filter + m*pi*4};
@@ -67,10 +67,10 @@ inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals,
return r;
}
-using SamplerT = float(&)(const InterpState&, const float*RESTRICT, const ALuint);
+using SamplerT = float(&)(const InterpState&, const float*RESTRICT, const uint);
template<SamplerT Sampler>
-const float *DoResample(const InterpState *state, const float *RESTRICT src, ALuint frac,
- ALuint increment, const al::span<float> dst)
+const float *DoResample(const InterpState *state, const float *RESTRICT src, uint frac,
+ uint increment, const al::span<float> dst)
{
const InterpState istate{*state};
for(float &out : dst)
@@ -98,7 +98,7 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const uint_fast32_t IrSize,
} // namespace
template<>
-const float *Resample_<CopyTag,CTag>(const InterpState*, const float *RESTRICT src, ALuint, ALuint,
+const float *Resample_<CopyTag,CTag>(const InterpState*, const float *RESTRICT src, uint, uint,
const al::span<float> dst)
{
#if defined(HAVE_SSE) || defined(HAVE_NEON)
@@ -112,37 +112,37 @@ const float *Resample_<CopyTag,CTag>(const InterpState*, const float *RESTRICT s
template<>
const float *Resample_<PointTag,CTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{ return DoResample<do_point>(state, src, frac, increment, dst); }
template<>
const float *Resample_<LerpTag,CTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{ return DoResample<do_lerp>(state, src, frac, increment, dst); }
template<>
const float *Resample_<CubicTag,CTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{ return DoResample<do_cubic>(state, src-1, frac, increment, dst); }
template<>
const float *Resample_<BSincTag,CTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{ return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst); }
template<>
const float *Resample_<FastBSincTag,CTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{ return DoResample<do_fastbsinc>(state, src-state->bsinc.l, frac, increment, dst); }
template<>
-void MixHrtf_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtf_<CTag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
-void MixHrtfBlend_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtfBlend_<CTag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp
index fa7c142a..e9b47b33 100644
--- a/alc/mixer/mixer_neon.cpp
+++ b/alc/mixer/mixer_neon.cpp
@@ -31,8 +31,8 @@ inline float32x4_t set_f4(float l0, float l1, float l2, float l3)
return ret;
}
-constexpr ALuint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
-constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff};
+constexpr uint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
+constexpr uint FracPhaseDiffOne{1 << FracPhaseBitDiff};
inline void ApplyCoeffs(float2 *RESTRICT Values, const uint_fast32_t IrSize,
const HrirArray &Coeffs, const float left, const float right)
@@ -60,13 +60,13 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const uint_fast32_t IrSize,
} // namespace
template<>
-const float *Resample_<LerpTag,NEONTag>(const InterpState*, const float *RESTRICT src, ALuint frac,
- ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,NEONTag>(const InterpState*, const float *RESTRICT src, uint frac,
+ uint increment, const al::span<float> dst)
{
const int32x4_t increment4 = vdupq_n_s32(static_cast<int>(increment*4));
const float32x4_t fracOne4 = vdupq_n_f32(1.0f/MixerFracOne);
const int32x4_t fracMask4 = vdupq_n_s32(MixerFracMask);
- alignas(16) ALuint pos_[4], frac_[4];
+ alignas(16) uint pos_[4], frac_[4];
int32x4_t pos4, frac4;
InitPosArrays(frac, increment, frac_, pos_, 4);
@@ -98,8 +98,8 @@ const float *Resample_<LerpTag,NEONTag>(const InterpState*, const float *RESTRIC
if(size_t todo{dst.size()&3})
{
- src += static_cast<ALuint>(vgetq_lane_s32(pos4, 0));
- frac = static_cast<ALuint>(vgetq_lane_s32(frac4, 0));
+ src += static_cast<uint>(vgetq_lane_s32(pos4, 0));
+ frac = static_cast<uint>(vgetq_lane_s32(frac4, 0));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
@@ -114,7 +114,7 @@ const float *Resample_<LerpTag,NEONTag>(const InterpState*, const float *RESTRIC
template<>
const float *Resample_<BSincTag,NEONTag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const float32x4_t sf4{vdupq_n_f32(state->bsinc.sf)};
@@ -124,7 +124,7 @@ const float *Resample_<BSincTag,NEONTag>(const InterpState *state, const float *
for(float &out_sample : dst)
{
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
// Apply the scale and phase interpolated filter.
@@ -160,7 +160,7 @@ const float *Resample_<BSincTag,NEONTag>(const InterpState *state, const float *
template<>
const float *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
- const float *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst)
+ const float *RESTRICT src, uint frac, uint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const size_t m{state->bsinc.m};
@@ -169,7 +169,7 @@ const float *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
for(float &out_sample : dst)
{
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
// Apply the phase interpolated filter.
@@ -201,12 +201,12 @@ const float *Resample_<FastBSincTag,NEONTag>(const InterpState *state,
template<>
-void MixHrtf_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtf_<NEONTag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
-void MixHrtfBlend_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtfBlend_<NEONTag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp
index 6c0e5762..4946bdf8 100644
--- a/alc/mixer/mixer_sse.cpp
+++ b/alc/mixer/mixer_sse.cpp
@@ -20,8 +20,8 @@ struct FastBSincTag;
namespace {
-constexpr ALuint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
-constexpr ALuint FracPhaseDiffOne{1 << FracPhaseBitDiff};
+constexpr uint FracPhaseBitDiff{MixerFracBits - BSincPhaseBits};
+constexpr uint FracPhaseDiffOne{1 << FracPhaseBitDiff};
#define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z))
@@ -76,7 +76,7 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const uint_fast32_t IrSize,
template<>
const float *Resample_<BSincTag,SSETag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const __m128 sf4{_mm_set1_ps(state->bsinc.sf)};
@@ -86,7 +86,7 @@ const float *Resample_<BSincTag,SSETag>(const InterpState *state, const float *R
for(float &out_sample : dst)
{
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
// Apply the scale and phase interpolated filter.
@@ -123,7 +123,7 @@ const float *Resample_<BSincTag,SSETag>(const InterpState *state, const float *R
template<>
const float *Resample_<FastBSincTag,SSETag>(const InterpState *state, const float *RESTRICT src,
- ALuint frac, ALuint increment, const al::span<float> dst)
+ uint frac, uint increment, const al::span<float> dst)
{
const float *const filter{state->bsinc.filter};
const size_t m{state->bsinc.m};
@@ -132,7 +132,7 @@ const float *Resample_<FastBSincTag,SSETag>(const InterpState *state, const floa
for(float &out_sample : dst)
{
// Calculate the phase index and factor.
- const ALuint pi{frac >> FracPhaseBitDiff};
+ const uint pi{frac >> FracPhaseBitDiff};
const float pf{static_cast<float>(frac & (FracPhaseDiffOne-1)) * (1.0f/FracPhaseDiffOne)};
// Apply the phase interpolated filter.
@@ -165,12 +165,12 @@ const float *Resample_<FastBSincTag,SSETag>(const InterpState *state, const floa
template<>
-void MixHrtf_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtf_<SSETag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize)
{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); }
template<>
-void MixHrtfBlend_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
+void MixHrtfBlend_<SSETag>(const float *InSamples, float2 *AccumSamples, const uint IrSize,
const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize)
{
MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams,
diff --git a/alc/mixer/mixer_sse2.cpp b/alc/mixer/mixer_sse2.cpp
index 892e0758..f40f6ac5 100644
--- a/alc/mixer/mixer_sse2.cpp
+++ b/alc/mixer/mixer_sse2.cpp
@@ -31,14 +31,14 @@ struct LerpTag;
template<>
-const float *Resample_<LerpTag,SSE2Tag>(const InterpState*, const float *RESTRICT src, ALuint frac,
- ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,SSE2Tag>(const InterpState*, const float *RESTRICT src, uint frac,
+ uint increment, const al::span<float> dst)
{
const __m128i increment4{_mm_set1_epi32(static_cast<int>(increment*4))};
const __m128 fracOne4{_mm_set1_ps(1.0f/MixerFracOne)};
const __m128i fracMask4{_mm_set1_epi32(MixerFracMask)};
- alignas(16) ALuint pos_[4], frac_[4];
+ alignas(16) uint pos_[4], frac_[4];
InitPosArrays(frac, increment, frac_, pos_, 4);
__m128i frac4{_mm_setr_epi32(static_cast<int>(frac_[0]), static_cast<int>(frac_[1]),
static_cast<int>(frac_[2]), static_cast<int>(frac_[3]))};
@@ -70,8 +70,8 @@ const float *Resample_<LerpTag,SSE2Tag>(const InterpState*, const float *RESTRIC
if(size_t todo{dst.size()&3})
{
- src += static_cast<ALuint>(_mm_cvtsi128_si32(pos4));
- frac = static_cast<ALuint>(_mm_cvtsi128_si32(frac4));
+ src += static_cast<uint>(_mm_cvtsi128_si32(pos4));
+ frac = static_cast<uint>(_mm_cvtsi128_si32(frac4));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));
diff --git a/alc/mixer/mixer_sse41.cpp b/alc/mixer/mixer_sse41.cpp
index 19391ea3..d3839cb2 100644
--- a/alc/mixer/mixer_sse41.cpp
+++ b/alc/mixer/mixer_sse41.cpp
@@ -32,14 +32,14 @@ struct LerpTag;
template<>
-const float *Resample_<LerpTag,SSE4Tag>(const InterpState*, const float *RESTRICT src, ALuint frac,
- ALuint increment, const al::span<float> dst)
+const float *Resample_<LerpTag,SSE4Tag>(const InterpState*, const float *RESTRICT src, uint frac,
+ uint increment, const al::span<float> dst)
{
const __m128i increment4{_mm_set1_epi32(static_cast<int>(increment*4))};
const __m128 fracOne4{_mm_set1_ps(1.0f/MixerFracOne)};
const __m128i fracMask4{_mm_set1_epi32(MixerFracMask)};
- alignas(16) ALuint pos_[4], frac_[4];
+ alignas(16) uint pos_[4], frac_[4];
InitPosArrays(frac, increment, frac_, pos_, 4);
__m128i frac4{_mm_setr_epi32(static_cast<int>(frac_[0]), static_cast<int>(frac_[1]),
static_cast<int>(frac_[2]), static_cast<int>(frac_[3]))};
@@ -75,8 +75,8 @@ const float *Resample_<LerpTag,SSE4Tag>(const InterpState*, const float *RESTRIC
* four samples, so the lowest element is the next position to
* resample.
*/
- src += static_cast<ALuint>(_mm_cvtsi128_si32(pos4));
- frac = static_cast<ALuint>(_mm_cvtsi128_si32(frac4));
+ src += static_cast<uint>(_mm_cvtsi128_si32(pos4));
+ frac = static_cast<uint>(_mm_cvtsi128_si32(frac4));
do {
*(dst_iter++) = lerp(src[0], src[1], static_cast<float>(frac) * (1.0f/MixerFracOne));