diff options
author | Chris Robinson <[email protected]> | 2023-01-15 17:49:14 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-15 17:49:14 -0800 |
commit | eef886b0f215877a3888391122bac8bdb0b76ddf (patch) | |
tree | e30884590938213edc724906f6b3cd9536fbda79 | |
parent | 88796d2ad51f014f0ec236c0e1df624ac8224cb7 (diff) |
Precalculate reused scale factors
-rw-r--r-- | alc/alu.cpp | 2 | ||||
-rw-r--r-- | common/alcomplex.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index a171067a..207c7c84 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -866,7 +866,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con * scaling. */ std::transform(coeffs.begin(), coeffs.end(), coeffs.begin(), - [coverage, &scales](auto a){ return a * ((1.0f-coverage)*scales[0]); }); + [scale=(1.0f-coverage)*scales[0]](const float c){ return c * scale; }); if(!(coverage > 0.0f)) { diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp index 2e3e0a60..b6cac4cd 100644 --- a/common/alcomplex.cpp +++ b/common/alcomplex.cpp @@ -158,7 +158,7 @@ void complex_hilbert(const al::span<std::complex<double>> buffer) *bufiter *= inverse_size; ++bufiter; bufiter = std::transform(bufiter, halfiter, bufiter, - [inverse_size](auto a){ return a * (2.0 * inverse_size); }); + [scale=inverse_size*2.0](auto a){ return a * scale; }); *bufiter *= inverse_size; ++bufiter; std::fill(bufiter, buffer.end(), std::complex<double>{}); |