aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mixer
diff options
context:
space:
mode:
Diffstat (limited to 'alc/mixer')
-rw-r--r--alc/mixer/mixer_c.cpp7
-rw-r--r--alc/mixer/mixer_neon.cpp12
-rw-r--r--alc/mixer/mixer_sse.cpp12
3 files changed, 18 insertions, 13 deletions
diff --git a/alc/mixer/mixer_c.cpp b/alc/mixer/mixer_c.cpp
index 7beab1a9..6e96e54e 100644
--- a/alc/mixer/mixer_c.cpp
+++ b/alc/mixer/mixer_c.cpp
@@ -188,13 +188,14 @@ void MixRow_<CTag>(const al::span<float> OutBuffer, const al::span<const float>
{
for(const float gain : Gains)
{
- const float *RESTRICT src{InSamples};
+ const float *RESTRICT input{InSamples};
InSamples += InStride;
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
continue;
- std::transform(OutBuffer.begin(), OutBuffer.end(), src, OutBuffer.begin(),
- [gain](const ALfloat cur, const ALfloat src) -> ALfloat { return cur + src*gain; });
+ auto do_mix = [gain](const float cur, const float src) noexcept -> float
+ { return cur + src*gain; };
+ std::transform(OutBuffer.begin(), OutBuffer.end(), input, OutBuffer.begin(), do_mix);
}
}
diff --git a/alc/mixer/mixer_neon.cpp b/alc/mixer/mixer_neon.cpp
index 2f11273a..e7313876 100644
--- a/alc/mixer/mixer_neon.cpp
+++ b/alc/mixer/mixer_neon.cpp
@@ -262,7 +262,7 @@ void MixRow_<NEONTag>(const al::span<float> OutBuffer, const al::span<const floa
{
for(const ALfloat gain : Gains)
{
- const ALfloat *RESTRICT src{InSamples};
+ const ALfloat *RESTRICT intput{InSamples};
InSamples += InStride;
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
@@ -273,14 +273,16 @@ void MixRow_<NEONTag>(const al::span<float> OutBuffer, const al::span<const floa
{
const float32x4_t gain4{vdupq_n_f32(gain)};
do {
- const float32x4_t val4 = vld1q_f32(src);
+ const float32x4_t val4 = vld1q_f32(intput);
float32x4_t dry4 = vld1q_f32(out_iter);
dry4 = vmlaq_f32(dry4, val4, gain4);
vst1q_f32(out_iter, dry4);
- out_iter += 4; src += 4;
+ out_iter += 4; intput += 4;
} while(--todo);
}
- std::transform(out_iter, OutBuffer.end(), src, out_iter,
- [gain](const ALfloat cur, const ALfloat src) -> ALfloat { return cur + src*gain; });
+
+ auto do_mix = [gain](const float cur, const float src) noexcept -> float
+ { return cur + src*gain; };
+ std::transform(out_iter, OutBuffer.end(), input, out_iter, do_mix);
}
}
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp
index 65eb0dee..d47a0e66 100644
--- a/alc/mixer/mixer_sse.cpp
+++ b/alc/mixer/mixer_sse.cpp
@@ -226,7 +226,7 @@ void MixRow_<SSETag>(const al::span<float> OutBuffer, const al::span<const float
{
for(const float gain : Gains)
{
- const float *RESTRICT src{InSamples};
+ const float *RESTRICT input{InSamples};
InSamples += InStride;
if(!(std::fabs(gain) > GAIN_SILENCE_THRESHOLD))
@@ -237,14 +237,16 @@ void MixRow_<SSETag>(const al::span<float> OutBuffer, const al::span<const float
{
const __m128 gain4 = _mm_set1_ps(gain);
do {
- const __m128 val4{_mm_load_ps(src)};
+ const __m128 val4{_mm_load_ps(input)};
__m128 dry4{_mm_load_ps(out_iter)};
dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain4));
_mm_store_ps(out_iter, dry4);
- out_iter += 4; src += 4;
+ out_iter += 4; input += 4;
} while(--todo);
}
- std::transform(out_iter, OutBuffer.end(), src, out_iter,
- [gain](const ALfloat cur, const ALfloat src) -> ALfloat { return cur + src*gain; });
+
+ auto do_mix = [gain](const float cur, const float src) noexcept -> float
+ { return cur + src*gain; };
+ std::transform(out_iter, OutBuffer.end(), input, out_iter, do_mix);
}
}