From 4883091f5de278b7469790efa466df5d93d465b0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Aug 2019 01:24:02 -0700 Subject: Rename the Mix function input for clarity --- alc/mixer/defs.h | 4 +++- alc/mixer/mixer_c.cpp | 8 ++++---- alc/mixer/mixer_neon.cpp | 14 +++++++------- alc/mixer/mixer_sse.cpp | 14 +++++++------- 4 files changed, 21 insertions(+), 19 deletions(-) (limited to 'alc/mixer') diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h index adaed8f5..1e5e68bb 100644 --- a/alc/mixer/defs.h +++ b/alc/mixer/defs.h @@ -30,7 +30,9 @@ template const ALfloat *Resample_(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen); template -void Mix_(const ALfloat *data, const al::span OutBuffer, ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize); +void Mix_(const float *InSamples, const al::span OutBuffer, float *CurrentGains, + const float *TargetGains, const ALsizei Counter, const ALsizei OutPos, + const ALsizei BufferSize); template void MixRow_(const al::span OutBuffer, const al::span Gains, const float *InSamples, const size_t InStride); diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp index dd094040..8b5c0f41 100644 --- a/alc/mixer/mixer_c.cpp +++ b/alc/mixer/mixer_c.cpp @@ -142,8 +142,8 @@ void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> -void Mix_(const ALfloat *data, const al::span OutBuffer, - ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, +void Mix_(const float *InSamples, const al::span OutBuffer, + float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize) { ASSUME(BufferSize > 0); @@ -163,7 +163,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer, ALfloat step_count{0.0f}; for(;pos < minsize;pos++) { - dst[pos] += data[pos] * (gain + step*step_count); + dst[pos] += InSamples[pos] * (gain + step*step_count); step_count += 1.0f; } if(pos == Counter) @@ -178,7 +178,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer, if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD)) continue; for(;pos < BufferSize;pos++) - dst[pos] += data[pos]*gain; + dst[pos] += InSamples[pos]*gain; } } diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp index 829d4ea1..b80f8cf8 100644 --- a/alc/mixer/mixer_neon.cpp +++ b/alc/mixer/mixer_neon.cpp @@ -189,8 +189,8 @@ void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut template<> -void Mix_(const ALfloat *data, const al::span OutBuffer, - ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, +void Mix_(const float *InSamples, const al::span OutBuffer, + float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize) { ASSUME(BufferSize > 0); @@ -223,7 +223,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffe ALsizei todo{minsize >> 2}; do { - const float32x4_t val4 = vld1q_f32(&data[pos]); + const float32x4_t val4 = vld1q_f32(&InSamples[pos]); float32x4_t dry4 = vld1q_f32(&dst[pos]); dry4 = vmlaq_f32(dry4, val4, vmlaq_f32(gain4, step4, step_count4)); step_count4 = vaddq_f32(step_count4, four4); @@ -239,7 +239,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffe /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ for(;pos < minsize;pos++) { - dst[pos] += data[pos]*(gain + step*step_count); + dst[pos] += InSamples[pos]*(gain + step*step_count); step_count += 1.0f; } if(pos == Counter) @@ -251,7 +251,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffe /* Mix until pos is aligned with 4 or the mix is done. */ minsize = mini(BufferSize, (pos+3)&~3); for(;pos < minsize;pos++) - dst[pos] += data[pos]*gain; + dst[pos] += InSamples[pos]*gain; } ++CurrentGains; ++TargetGains; @@ -263,7 +263,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffe ALsizei todo{(BufferSize-pos) >> 2}; const float32x4_t gain4 = vdupq_n_f32(gain); do { - const float32x4_t val4 = vld1q_f32(&data[pos]); + const float32x4_t val4 = vld1q_f32(&InSamples[pos]); float32x4_t dry4 = vld1q_f32(&dst[pos]); dry4 = vmlaq_f32(dry4, val4, gain4); vst1q_f32(&dst[pos], dry4); @@ -271,7 +271,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffe } while(--todo); } for(;pos < BufferSize;pos++) - dst[pos] += data[pos]*gain; + dst[pos] += InSamples[pos]*gain; } } diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index b3454898..bd0042a1 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -145,8 +145,8 @@ void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut, template<> -void Mix_(const ALfloat *data, const al::span OutBuffer, - ALfloat *CurrentGains, const ALfloat *TargetGains, const ALsizei Counter, const ALsizei OutPos, +void Mix_(const float *InSamples, const al::span OutBuffer, + float *CurrentGains, const float *TargetGains, const ALsizei Counter, const ALsizei OutPos, const ALsizei BufferSize) { ASSUME(BufferSize > 0); @@ -173,7 +173,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer __m128 step_count4{_mm_setr_ps(0.0f, 1.0f, 2.0f, 3.0f)}; ALsizei todo{minsize >> 2}; do { - const __m128 val4{_mm_load_ps(&data[pos])}; + const __m128 val4{_mm_load_ps(&InSamples[pos])}; __m128 dry4{_mm_load_ps(&dst[pos])}; #define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z)) /* dry += val * (gain + step*step_count) */ @@ -192,7 +192,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ for(;pos < minsize;pos++) { - dst[pos] += data[pos]*(gain + step*step_count); + dst[pos] += InSamples[pos]*(gain + step*step_count); step_count += 1.0f; } if(pos == Counter) @@ -204,7 +204,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer /* Mix until pos is aligned with 4 or the mix is done. */ minsize = mini(BufferSize, (pos+3)&~3); for(;pos < minsize;pos++) - dst[pos] += data[pos]*gain; + dst[pos] += InSamples[pos]*gain; } ++CurrentGains; ++TargetGains; @@ -216,7 +216,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer ALsizei todo{(BufferSize-pos) >> 2}; const __m128 gain4{_mm_set1_ps(gain)}; do { - const __m128 val4{_mm_load_ps(&data[pos])}; + const __m128 val4{_mm_load_ps(&InSamples[pos])}; __m128 dry4{_mm_load_ps(&dst[pos])}; dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain4)); _mm_store_ps(&dst[pos], dry4); @@ -224,7 +224,7 @@ void Mix_(const ALfloat *data, const al::span OutBuffer } while(--todo); } for(;pos < BufferSize;pos++) - dst[pos] += data[pos]*gain; + dst[pos] += InSamples[pos]*gain; } } -- cgit v1.2.3