diff options
author | Chris Robinson <[email protected]> | 2019-09-13 11:19:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-13 11:19:11 -0700 |
commit | f09734b707c3036345d602cc187cc21248a54abd (patch) | |
tree | 912e9f93b70ec9b633fc9ffba9ba92c47395fb89 /alc | |
parent | 42548885767fa1492886d87d17592e79bc00924e (diff) |
Pass IrSize to the HRTF mixers as unsigned
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.h | 4 | ||||
-rw-r--r-- | alc/mixer/defs.h | 4 | ||||
-rw-r--r-- | alc/mixer/hrtfbase.h | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_c.cpp | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_neon.cpp | 8 | ||||
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 10 | ||||
-rw-r--r-- | alc/mixvoice.cpp | 8 |
7 files changed, 25 insertions, 25 deletions
@@ -322,10 +322,10 @@ using MixerFunc = void(*)(const al::span<const float> InSamples, using RowMixerFunc = void(*)(const al::span<float> OutBuffer, const al::span<const float> Gains, const float *InSamples, const size_t InStride); using HrtfMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, + const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize); using HrtfMixerBlendFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, + const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize); using HrtfDirectMixerFunc = void(*)(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State, diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h index a6e07bd4..62e7d3ba 100644 --- a/alc/mixer/defs.h +++ b/alc/mixer/defs.h @@ -38,9 +38,9 @@ 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, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize); +void MixHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *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, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize); +void MixHrtfBlend_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, 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, const size_t BufferSize); diff --git a/alc/mixer/hrtfbase.h b/alc/mixer/hrtfbase.h index dd33ce2d..d2432e90 100644 --- a/alc/mixer/hrtfbase.h +++ b/alc/mixer/hrtfbase.h @@ -8,13 +8,13 @@ #include "opthelpers.h" -using ApplyCoeffsT = void(size_t Offset, float2 *RESTRICT Values, const ALsizei irSize, +using ApplyCoeffsT = void(size_t Offset, float2 *RESTRICT Values, const ALuint irSize, const HrirArray &Coeffs, const ALfloat left, const ALfloat right); template<ApplyCoeffsT &ApplyCoeffs> inline void MixHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, const ALfloat *InSamples, float2 *RESTRICT AccumSamples, const size_t OutPos, - const ALsizei IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) + const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { ASSUME(BufferSize > 0); @@ -48,7 +48,7 @@ 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 ALsizei IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, + const ALuint IrSize, const HrtfFilter *oldparams, MixHrtfFilter *newparams, const size_t BufferSize) { const auto &OldCoeffs = oldparams->Coeffs; @@ -103,7 +103,7 @@ inline void MixDirectHrtfBase(FloatBufferLine &LeftOut, FloatBufferLine &RightOu { ASSUME(BufferSize > 0); - const auto IrSize = static_cast<ALsizei>(State->IrSize); + 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{}); diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index c5e712f9..720b264b 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -98,11 +98,11 @@ const ALfloat *Resample_<BSincTag,CTag>(const InterpState *state, const ALfloat { return DoResample<do_bsinc>(state, src-state->bsinc.l, frac, increment, dst); } -static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALsizei IrSize, +static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALuint IrSize, const HrirArray &Coeffs, const ALfloat left, const ALfloat right) { ASSUME(IrSize >= 4); - for(ALsizei c{0};c < IrSize;++c) + for(ALuint c{0};c < IrSize;++c) { Values[c][0] += Coeffs[c][0] * left; Values[c][1] += Coeffs[c][1] * right; @@ -111,7 +111,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 ALsizei IrSize, + const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -120,7 +120,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 ALsizei IrSize, + const ALfloat *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, diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index c0a8e628..852bef38 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -121,7 +121,7 @@ const ALfloat *Resample_<BSincTag,NEONTag>(const InterpState *state, const ALflo } -static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALsizei IrSize, +static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const ALuint IrSize, const HrirArray &Coeffs, const ALfloat left, const ALfloat right) { ASSUME(IrSize >= 4); @@ -134,7 +134,7 @@ static inline void ApplyCoeffs(size_t /*Offset*/, float2 *RESTRICT Values, const leftright4 = vcombine_f32(leftright2, leftright2); } - for(ALsizei c{0};c < IrSize;c += 2) + for(ALuint c{0};c < IrSize;c += 2) { float32x4_t vals = vld1q_f32(&Values[c][0]); float32x4_t coefs = vld1q_f32(&Coeffs[c][0]); @@ -147,7 +147,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 ALsizei IrSize, + const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -156,7 +156,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 ALsizei IrSize, + const ALfloat *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, diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 82e2bfbe..368b8dfe 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -68,7 +68,7 @@ const ALfloat *Resample_<BSincTag,SSETag>(const InterpState *state, const ALfloa } -static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALsizei IrSize, +static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALuint IrSize, const HrirArray &Coeffs, const ALfloat left, const ALfloat right) { const __m128 lrlr{_mm_setr_ps(left, right, left, right)}; @@ -83,7 +83,7 @@ static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALs imp0 = _mm_mul_ps(lrlr, coeffs); vals = _mm_add_ps(imp0, vals); _mm_storel_pi(reinterpret_cast<__m64*>(&Values[0][0]), vals); - ALsizei i{1}; + ALuint i{1}; for(;i < IrSize-1;i += 2) { coeffs = _mm_load_ps(&Coeffs[i+1][0]); @@ -101,7 +101,7 @@ static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALs } else { - for(ALsizei i{0};i < IrSize;i += 2) + for(ALuint i{0};i < IrSize;i += 2) { __m128 coeffs{_mm_load_ps(&Coeffs[i][0])}; __m128 vals{_mm_load_ps(&Values[i][0])}; @@ -113,7 +113,7 @@ static inline void ApplyCoeffs(size_t Offset, float2 *RESTRICT Values, const ALs template<> void MixHrtf_<SSETag>(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, - const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALsizei IrSize, + const ALfloat *InSamples, float2 *AccumSamples, const size_t OutPos, const ALuint IrSize, MixHrtfFilter *hrtfparams, const size_t BufferSize) { MixHrtfBase<ApplyCoeffs>(LeftOut, RightOut, InSamples, AccumSamples, OutPos, IrSize, @@ -122,7 +122,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 ALsizei IrSize, + const ALfloat *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, diff --git a/alc/mixvoice.cpp b/alc/mixvoice.cpp index c3598612..7bdeea5e 100644 --- a/alc/mixvoice.cpp +++ b/alc/mixvoice.cpp @@ -698,8 +698,8 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo) hrtfparams.GainStep = gain / static_cast<ALfloat>(fademix); MixHrtfBlendSamples(mDirect.Buffer[OutLIdx], mDirect.Buffer[OutRIdx], - HrtfSamples, AccumSamples, OutPos, static_cast<ALsizei>(IrSize), - &parms.Hrtf.Old, &hrtfparams, fademix); + HrtfSamples, AccumSamples, OutPos, IrSize, &parms.Hrtf.Old, + &hrtfparams, fademix); /* Update the old parameters with the result. */ parms.Hrtf.Old = parms.Hrtf.Target; if(fademix < Counter) @@ -731,8 +731,8 @@ void ALvoice::mix(State vstate, ALCcontext *Context, const ALuint SamplesToDo) hrtfparams.GainStep = (gain - parms.Hrtf.Old.Gain) / static_cast<ALfloat>(todo); MixHrtfSamples(mDirect.Buffer[OutLIdx], mDirect.Buffer[OutRIdx], - HrtfSamples+fademix, AccumSamples+fademix, OutPos+fademix, - static_cast<ALsizei>(IrSize), &hrtfparams, todo); + HrtfSamples+fademix, AccumSamples+fademix, OutPos+fademix, IrSize, + &hrtfparams, todo); /* Store the interpolated gain or the final target gain * depending if the fade is done. */ |