diff options
author | Chris Robinson <[email protected]> | 2019-05-29 17:32:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-05-29 17:32:16 -0700 |
commit | ba449d2b087f791ad84394c22b4d4ec528da390b (patch) | |
tree | ec077a8dd6e4581ec2965e66d3801fb4cf2fc9c7 /Alc/mixer | |
parent | d0f0a5fdca87f74ef46ad26cb79975e1c6cda8f0 (diff) |
Pass a span to MixDirectHrtf instead of a pointer+size
Diffstat (limited to 'Alc/mixer')
-rw-r--r-- | Alc/mixer/defs.h | 4 | ||||
-rw-r--r-- | Alc/mixer/hrtfbase.h | 20 | ||||
-rw-r--r-- | Alc/mixer/mixer_c.cpp | 7 | ||||
-rw-r--r-- | Alc/mixer/mixer_neon.cpp | 7 | ||||
-rw-r--r-- | Alc/mixer/mixer_sse.cpp | 7 |
5 files changed, 22 insertions, 23 deletions
diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h index a6131958..3de6b01e 100644 --- a/Alc/mixer/defs.h +++ b/Alc/mixer/defs.h @@ -6,6 +6,8 @@ #include "alMain.h" #include "alu.h" +#include "alspan.h" + struct MixGains; struct MixHrtfParams; @@ -39,7 +41,7 @@ void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat template<typename InstTag> void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, MixHrtfParams *newparams, const ALsizei BufferSize); template<typename InstTag> -void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State, const ALsizei NumChans, const ALsizei BufferSize); +void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, const ALsizei BufferSize); /* Vectorized resampler helpers */ inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *RESTRICT frac_arr, ALsizei *RESTRICT pos_arr, ALsizei size) diff --git a/Alc/mixer/hrtfbase.h b/Alc/mixer/hrtfbase.h index 571cdc89..bce9e573 100644 --- a/Alc/mixer/hrtfbase.h +++ b/Alc/mixer/hrtfbase.h @@ -102,22 +102,21 @@ inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut template<ApplyCoeffsT &ApplyCoeffs> inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const FloatBufferLine *InSamples, float2 *RESTRICT AccumSamples, DirectHrtfState *State, - const ALsizei NumChans, const ALsizei BufferSize) + const al::span<const FloatBufferLine> InSamples, float2 *RESTRICT AccumSamples, + DirectHrtfState *State, const ALsizei BufferSize) { - ASSUME(NumChans > 0); ASSUME(BufferSize > 0); const ALsizei IrSize{State->IrSize}; ASSUME(IrSize >= 4); - for(ALsizei c{0};c < NumChans;++c) + auto chanstate = State->Chan.begin(); + for(const FloatBufferLine &input : InSamples) { - const FloatBufferLine &input = InSamples[c]; - const auto &Coeffs = State->Chan[c].Coeffs; + const auto &Coeffs = chanstate->Coeffs; - auto accum_iter = std::copy_n(State->Chan[c].Values.begin(), - State->Chan[c].Values.size(), AccumSamples); + auto accum_iter = std::copy_n(chanstate->Values.begin(), + chanstate->Values.size(), AccumSamples); std::fill_n(accum_iter, BufferSize, float2{}); for(ALsizei i{0};i < BufferSize;++i) @@ -130,8 +129,9 @@ inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOu for(ALsizei i{0};i < BufferSize;++i) RightOut[i] += AccumSamples[i][1]; - std::copy_n(AccumSamples + BufferSize, State->Chan[c].Values.size(), - State->Chan[c].Values.begin()); + std::copy_n(AccumSamples + BufferSize, chanstate->Values.size(), + chanstate->Values.begin()); + ++chanstate; } } diff --git a/Alc/mixer/mixer_c.cpp b/Alc/mixer/mixer_c.cpp index 79ee305b..8ad3aca3 100644 --- a/Alc/mixer/mixer_c.cpp +++ b/Alc/mixer/mixer_c.cpp @@ -136,11 +136,10 @@ void MixHrtfBlend_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixDirectHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State, - const ALsizei NumChans, const ALsizei BufferSize) + const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, + const ALsizei BufferSize) { - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans, - BufferSize); + MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } diff --git a/Alc/mixer/mixer_neon.cpp b/Alc/mixer/mixer_neon.cpp index e6f257fd..6f4af98b 100644 --- a/Alc/mixer/mixer_neon.cpp +++ b/Alc/mixer/mixer_neon.cpp @@ -182,11 +182,10 @@ void MixHrtfBlend_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixDirectHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State, - const ALsizei NumChans, const ALsizei BufferSize) + const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, + const ALsizei BufferSize) { - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans, - BufferSize); + MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } diff --git a/Alc/mixer/mixer_sse.cpp b/Alc/mixer/mixer_sse.cpp index a4e80256..156b3dab 100644 --- a/Alc/mixer/mixer_sse.cpp +++ b/Alc/mixer/mixer_sse.cpp @@ -139,11 +139,10 @@ void MixHrtfBlend_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> void MixDirectHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const FloatBufferLine *InSamples, float2 *AccumSamples, DirectHrtfState *State, - const ALsizei NumChans, const ALsizei BufferSize) + const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, + const ALsizei BufferSize) { - MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, NumChans, - BufferSize); + MixDirectHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, State, BufferSize); } |