diff options
Diffstat (limited to 'alc/mixer')
-rw-r--r-- | alc/mixer/defs.h | 4 | ||||
-rw-r--r-- | alc/mixer/hrtfbase.h | 40 | ||||
-rw-r--r-- | alc/mixer/mixer_c.cpp | 48 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 18 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 20 |
5 files changed, 62 insertions, 68 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h index b72b2526..b2535265 100644 --- a/alc/mixer/defs.h +++ b/alc/mixer/defs.h @@ -41,11 +41,11 @@ void MixRow_(const al::span<float> OutBuffer, const al::span<const float> Gains, const float *InSamples, const size_t InStride); template<InstSetType InstTag> -void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, +void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize); template<InstSetType InstTag> -void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, +void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize); template<InstSetType InstTag> diff --git a/alc/mixer/hrtfbase.h b/alc/mixer/hrtfbase.h index af45a128..58d168ed 100644 --- a/alc/mixer/hrtfbase.h +++ b/alc/mixer/hrtfbase.h @@ -10,29 +10,29 @@ using ApplyCoeffsT = void(size_t Offset, float2 *RESTRICT Values, const ALuint irSize, - const HrirArray &Coeffs, const ALfloat left, const ALfloat right); + const HrirArray &Coeffs, const float left, const float right); template<ApplyCoeffsT &ApplyCoeffs> inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, + const float *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { ASSUME(BufferSize > 0); const HrirArray &Coeffs = *hrtfparams->Coeffs; - const ALfloat gainstep{hrtfparams->GainStep}; - const ALfloat gain{hrtfparams->Gain}; + const float gainstep{hrtfparams->GainStep}; + const float gain{hrtfparams->Gain}; ALsizei Delay[2]{ HRTF_HISTORY_LENGTH - hrtfparams->Delay[0], HRTF_HISTORY_LENGTH - hrtfparams->Delay[1] }; ASSUME(Delay[0] >= 0 && Delay[1] >= 0); - ALfloat stepcount{0.0f}; + float stepcount{0.0f}; for(size_t i{0u};i < BufferSize;++i) { - const ALfloat g{gain + gainstep*stepcount}; - const ALfloat left{InSamples[Delay[0]++] * g}; - const ALfloat right{InSamples[Delay[1]++] * g}; + const float g{gain + gainstep*stepcount}; + const float left{InSamples[Delay[0]++] * g}; + const float right{InSamples[Delay[1]++] * g}; ApplyCoeffs(i, AccumSamples+i, IrSize, Coeffs, left, right); stepcount += 1.0f; @@ -48,15 +48,15 @@ inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<ApplyCoeffsT &ApplyCoeffs> inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, + const float *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { const auto &OldCoeffs = oldparams->Coeffs; - const ALfloat oldGain{oldparams->Gain}; - const ALfloat oldGainStep{-oldGain / static_cast<ALfloat>(BufferSize)}; + const float oldGain{oldparams->Gain}; + const float oldGainStep{-oldGain / static_cast<float>(BufferSize)}; const auto &NewCoeffs = *newparams->Coeffs; - const ALfloat newGainStep{newparams->GainStep}; + const float newGainStep{newparams->GainStep}; ASSUME(BufferSize > 0); @@ -64,12 +64,12 @@ inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut HRTF_HISTORY_LENGTH - oldparams->Delay[0], HRTF_HISTORY_LENGTH - oldparams->Delay[1] }; ASSUME(Delay[0] >= 0 && Delay[1] >= 0); - ALfloat stepcount{0.0f}; + float stepcount{0.0f}; for(size_t i{0u};i < BufferSize;++i) { - const ALfloat g{oldGain + oldGainStep*stepcount}; - const ALfloat left{InSamples[Delay[0]++] * g}; - const ALfloat right{InSamples[Delay[1]++] * g}; + const float g{oldGain + oldGainStep*stepcount}; + const float left{InSamples[Delay[0]++] * g}; + const float right{InSamples[Delay[1]++] * g}; ApplyCoeffs(i, AccumSamples+i, IrSize, OldCoeffs, left, right); stepcount += 1.0f; @@ -81,9 +81,9 @@ inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut stepcount = 0.0f; for(size_t i{0u};i < BufferSize;++i) { - const ALfloat g{newGainStep*stepcount}; - const ALfloat left{InSamples[Delay[0]++] * g}; - const ALfloat right{InSamples[Delay[1]++] * g}; + const float g{newGainStep*stepcount}; + const float left{InSamples[Delay[0]++] * g}; + const float right{InSamples[Delay[1]++] * g}; ApplyCoeffs(i, AccumSamples+i, IrSize, NewCoeffs, left, right); stepcount += 1.0f; @@ -115,7 +115,7 @@ inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOu const auto &Coeffs = *(coeff_iter++); for(size_t i{0u};i < BufferSize;++i) { - const ALfloat insample{input[i]}; + const float insample{input[i]}; ApplyCoeffs(i, AccumSamples+i, IrSize, Coeffs, insample, insample); } } diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index f2164f53..8aa32e6b 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -13,64 +13,64 @@ namespace { -inline ALfloat do_point(const InterpState&, const ALfloat *RESTRICT vals, const ALuint) +inline float do_point(const InterpState&, const float *RESTRICT vals, const ALuint) { return vals[0]; } -inline ALfloat do_lerp(const InterpState&, const ALfloat *RESTRICT vals, const ALuint frac) +inline float do_lerp(const InterpState&, const float *RESTRICT vals, const ALuint frac) { return lerp(vals[0], vals[1], static_cast<float>(frac)*(1.0f/FRACTIONONE)); } -inline ALfloat do_cubic(const InterpState&, const ALfloat *RESTRICT vals, const ALuint frac) +inline float do_cubic(const InterpState&, const float *RESTRICT vals, const ALuint frac) { return cubic(vals[0], vals[1], vals[2], vals[3], static_cast<float>(frac)*(1.0f/FRACTIONONE)); } -inline ALfloat do_bsinc(const InterpState &istate, const ALfloat *RESTRICT vals, const ALuint frac) +inline float do_bsinc(const InterpState &istate, const float *RESTRICT vals, const ALuint frac) { const size_t m{istate.bsinc.m}; // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF - const ALfloat *fil{istate.bsinc.filter + m*pi*4}; - const ALfloat *phd{fil + m}; - const ALfloat *scd{phd + m}; - const ALfloat *spd{scd + m}; + const float *fil{istate.bsinc.filter + m*pi*4}; + const float *phd{fil + m}; + const float *scd{phd + m}; + const float *spd{scd + m}; // Apply the scale and phase interpolated filter. - ALfloat r{0.0f}; + float r{0.0f}; for(size_t j_f{0};j_f < m;j_f++) 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 ALfloat do_fastbsinc(const InterpState &istate, const ALfloat *RESTRICT vals, const ALuint frac) +inline float do_fastbsinc(const InterpState &istate, const float *RESTRICT vals, const ALuint frac) { const size_t m{istate.bsinc.m}; // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF - const ALfloat *fil{istate.bsinc.filter + m*pi*4}; - const ALfloat *phd{fil + m}; + const float *fil{istate.bsinc.filter + m*pi*4}; + const float *phd{fil + m}; // Apply the phase interpolated filter. - ALfloat r{0.0f}; + float r{0.0f}; for(size_t j_f{0};j_f < m;j_f++) r += (fil[j_f] + pf*phd[j_f]) * vals[j_f]; return r; } -using SamplerT = ALfloat(const InterpState&, const ALfloat*RESTRICT, const ALuint); +using SamplerT = float(const InterpState&, const float*RESTRICT, const ALuint); template<SamplerT &Sampler> -const ALfloat *DoResample(const InterpState *state, const ALfloat *RESTRICT src, - ALuint frac, ALuint increment, const al::span<float> dst) +const float *DoResample(const InterpState *state, const float *RESTRICT src, ALuint frac, + ALuint increment, const al::span<float> dst) { const InterpState istate{*state}; auto proc_sample = [&src,&frac,istate,increment]() -> ALfloat { - const ALfloat ret{Sampler(istate, src, frac)}; + const float ret{Sampler(istate, src, frac)}; frac += increment; src += frac>>FRACTIONBITS; @@ -125,7 +125,7 @@ const ALfloat *Resample_<FastBSincTag,CTag>(const InterpState *state, const ALfl static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALuint IrSize, - const HrirArray &Coeffs, const ALfloat left, const ALfloat right) + const HrirArray &Coeffs, const float left, const float right) { ASSUME(IrSize >= 4); for(ALuint c{0};c < IrSize;++c) @@ -137,7 +137,7 @@ static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const template<> void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -146,7 +146,7 @@ void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixHrtfBlend_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -157,9 +157,7 @@ template<> void MixDirectHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const size_t BufferSize) -{ - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); -} +{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } template<> diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 75faa61f..c0fc1651 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -72,7 +72,7 @@ template<> const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst) { - const ALfloat *const filter{state->bsinc.filter}; + const float *const filter{state->bsinc.filter}; const float32x4_t sf4{vdupq_n_f32(state->bsinc.sf)}; const size_t m{state->bsinc.m}; @@ -82,7 +82,7 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF @@ -122,7 +122,7 @@ template<> const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst) { - const ALfloat *const filter{state->bsinc.filter}; + const float *const filter{state->bsinc.filter}; const size_t m{state->bsinc.m}; src -= state->bsinc.l; @@ -131,7 +131,7 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state, // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF @@ -164,7 +164,7 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state, static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALuint IrSize, - const HrirArray &Coeffs, const ALfloat left, const ALfloat right) + const HrirArray &Coeffs, const float left, const float right) { ASSUME(IrSize >= 4); @@ -189,7 +189,7 @@ static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const template<> void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -198,7 +198,7 @@ void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixHrtfBlend_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -209,9 +209,7 @@ template<> void MixDirectHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const size_t BufferSize) -{ - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); -} +{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } template<> diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 84f651d1..0fb954aa 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -7,8 +7,8 @@ #include "AL/al.h" #include "AL/alc.h" #include "alcmain.h" -#include "alu.h" +#include "alu.h" #include "defs.h" #include "hrtfbase.h" @@ -17,7 +17,7 @@ template<> const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst) { - const ALfloat *const filter{state->bsinc.filter}; + const float *const filter{state->bsinc.filter}; const __m128 sf4{_mm_set1_ps(state->bsinc.sf)}; const size_t m{state->bsinc.m}; @@ -27,7 +27,7 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF @@ -70,7 +70,7 @@ template<> const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state, const ALfloat *RESTRICT src, ALuint frac, ALuint increment, const al::span<float> dst) { - const ALfloat *const filter{state->bsinc.filter}; + const float *const filter{state->bsinc.filter}; const size_t m{state->bsinc.m}; src -= state->bsinc.l; @@ -79,7 +79,7 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state, // Calculate the phase index and factor. #define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) const ALuint pi{frac >> FRAC_PHASE_BITDIFF}; - const ALfloat pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * + const float pf{static_cast<float>(frac & ((1<<FRAC_PHASE_BITDIFF)-1)) * (1.0f/(1<<FRAC_PHASE_BITDIFF))}; #undef FRAC_PHASE_BITDIFF @@ -115,7 +115,7 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state, static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALuint IrSize, - const HrirArray &Coeffs, const ALfloat left, const ALfloat right) + const HrirArray &Coeffs, const float left, const float right) { const __m128 lrlr{_mm_setr_ps(left, right, left, right)}; @@ -159,7 +159,7 @@ static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALu template<> void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -168,7 +168,7 @@ void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixHrtfBlend_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, + const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -179,9 +179,7 @@ template<> void MixDirectHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const size_t BufferSize) -{ - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); -} +{ MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } template<> |