diff options
author | Chris Robinson <[email protected]> | 2023-02-05 18:12:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-02-05 18:12:25 -0800 |
commit | ff530e982ec7cd8eea7033ef7dd4451e81aa32e5 (patch) | |
tree | bff15879e7b1d6e8abe914c885249ff9b1dbdd1e /alc/effects | |
parent | baa34182c048a71a39345e49455b1f1fe4d98f57 (diff) |
Improve performance calculating reverb panning
Diffstat (limited to 'alc/effects')
-rw-r--r-- | alc/effects/reverb.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index c5ca3ccc..c426b3c8 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1090,12 +1090,13 @@ void ReverbPipeline::update3DPanning(const float *ReflectionsPan, const float *L for(size_t i{0};i < mtx1[0].size();++i) { - for(size_t j{0};j < mtx2[0].size();++j) + float *RESTRICT dst{res[i].data()}; + for(size_t k{0};k < mtx1.size();++k) { - double sum{0.0}; - for(size_t k{0};k < mtx1.size();++k) - sum += double{mtx1[k][i]} * mtx2[k][j]; - res[i][j] = static_cast<float>(sum); + const float *RESTRICT src{mtx2[k].data()}; + const float a{mtx1[k][i]}; + for(size_t j{0};j < mtx2[0].size();++j) + dst[j] += a * src[j]; } } @@ -1122,12 +1123,12 @@ void ReverbPipeline::update3DPanning(const float *ReflectionsPan, const float *L for(size_t i{0};i < mtx1[0].size();++i) { - for(size_t j{0};j < mtx2.size();++j) + float *RESTRICT dst{res[i].data()}; + for(size_t k{0};k < mtx1.size();++k) { - double sum{0.0}; - for(size_t k{0};k < mtx1.size();++k) - sum += double{mtx1[k][i]} * mtx2[j][k]; - res[i][j] = static_cast<float>(sum); + const float a{mtx1[k][i]}; + for(size_t j{0};j < mtx2.size();++j) + dst[j] += a * mtx2[j][k]; } } |