From ff530e982ec7cd8eea7033ef7dd4451e81aa32e5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 5 Feb 2023 18:12:25 -0800 Subject: Improve performance calculating reverb panning --- alc/effects/reverb.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'alc/effects') 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(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(sum); + const float a{mtx1[k][i]}; + for(size_t j{0};j < mtx2.size();++j) + dst[j] += a * mtx2[j][k]; } } -- cgit v1.2.3