diff options
Diffstat (limited to 'alc/mixer')
-rw-r--r-- | alc/mixer/defs.h | 10 | ||||
-rw-r--r-- | alc/mixer/hrtfbase.h | 27 | ||||
-rw-r--r-- | alc/mixer/mixer_c.cpp | 15 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 15 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 15 |
5 files changed, 27 insertions, 55 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h index b2535265..1e5b40d8 100644 --- a/alc/mixer/defs.h +++ b/alc/mixer/defs.h @@ -41,13 +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 float *InSamples, - float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, - const size_t BufferSize); +void MixHrtf_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, + MixHrtfFilter *hrtfparams, const size_t BufferSize); template<InstSetType InstTag> -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); +void MixHrtfBlend_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, + const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize); template<InstSetType InstTag> void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, diff --git a/alc/mixer/hrtfbase.h b/alc/mixer/hrtfbase.h index cbc885c5..4a6eab50 100644 --- a/alc/mixer/hrtfbase.h +++ b/alc/mixer/hrtfbase.h @@ -13,9 +13,8 @@ using ApplyCoeffsT = void(&)(float2 *RESTRICT Values, const ALuint irSize, const const float left, const float right); template<ApplyCoeffsT ApplyCoeffs> -inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, - const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) +inline void MixHrtfBase(const float *InSamples, float2 *RESTRICT AccumSamples, const ALuint IrSize, + MixHrtfFilter *hrtfparams, const size_t BufferSize) { ASSUME(BufferSize > 0); @@ -38,17 +37,11 @@ inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, stepcount += 1.0f; } - for(size_t i{0u};i < BufferSize;++i) - LeftOut[OutPos+i] += AccumSamples[i][0]; - for(size_t i{0u};i < BufferSize;++i) - RightOut[OutPos+i] += AccumSamples[i][1]; - hrtfparams->Gain = gain + gainstep*stepcount; } template<ApplyCoeffsT ApplyCoeffs> -inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, +inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSamples, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { @@ -89,11 +82,6 @@ inline void MixHrtfBlendBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut stepcount += 1.0f; } - for(size_t i{0u};i < BufferSize;++i) - LeftOut[OutPos+i] += AccumSamples[i][0]; - for(size_t i{0u};i < BufferSize;++i) - RightOut[OutPos+i] += AccumSamples[i][1]; - newparams->Gain = newGainStep*stepcount; } @@ -106,9 +94,6 @@ inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOu const ALuint IrSize{State->IrSize}; - auto accum_iter = std::copy_n(State->Values.begin(), State->Values.size(), AccumSamples); - std::fill_n(accum_iter, BufferSize, float2{}); - auto coeff_iter = State->Coeffs.begin(); for(const FloatBufferLine &input : InSamples) { @@ -124,7 +109,11 @@ inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOu for(size_t i{0u};i < BufferSize;++i) RightOut[i] += AccumSamples[i][1]; - std::copy_n(AccumSamples + BufferSize, State->Values.size(), State->Values.begin()); + /* Copy the new in-progress accumulation values to the front and clear the + * following samples for the next mix. + */ + auto accum_iter = std::copy_n(AccumSamples+BufferSize, HRIR_LENGTH, AccumSamples); + std::fill_n(accum_iter, BufferSize, float2{}); } #endif /* MIXER_HRTFBASE_H */ diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index 8d375de7..fad33746 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -136,21 +136,16 @@ const ALfloat *Resample_<FastBSincTag,CTag>(const InterpState *state, const ALfl template<> -void MixHrtf_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtf_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) -{ - MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - hrtfparams, BufferSize); -} +{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); } template<> -void MixHrtfBlend_<CTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtfBlend_<CTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { - MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - oldparams, newparams, BufferSize); + MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams, + BufferSize); } template<> diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index ae782897..67bf9c71 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -190,21 +190,16 @@ const ALfloat *Resample_<FastBSincTag,NEONTag>(const InterpState *state, template<> -void MixHrtf_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtf_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) -{ - MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - hrtfparams, BufferSize); -} +{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); } template<> -void MixHrtfBlend_<NEONTag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtfBlend_<NEONTag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { - MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - oldparams, newparams, BufferSize); + MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams, + BufferSize); } template<> diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 62ce5eab..aaf37df6 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -165,21 +165,16 @@ const ALfloat *Resample_<FastBSincTag,SSETag>(const InterpState *state, template<> -void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtf_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) -{ - MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - hrtfparams, BufferSize); -} +{ MixHrtfBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, hrtfparams, BufferSize); } template<> -void MixHrtfBlend_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const float *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, +void MixHrtfBlend_<SSETag>(const float *InSamples, float2 *AccumSamples, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { - MixHrtfBlendBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, - oldparams, newparams, BufferSize); + MixHrtfBlendBase<ApplyCoeffs>(InSamples, AccumSamples, IrSize, oldparams, newparams, + BufferSize); } template<> |