From 458f22d21483fd070641f9fe91b219bb5dc65a17 Mon Sep 17 00:00:00 2001 From: Ziemas Date: Wed, 17 Feb 2021 21:10:26 +0100 Subject: [PATCH] SPU2: Optimize reverb downsampling. Skip multiplying the 0's --- pcsx2/SPU2/Reverb.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pcsx2/SPU2/Reverb.cpp b/pcsx2/SPU2/Reverb.cpp index bee1340b01..7181d61dd9 100644 --- a/pcsx2/SPU2/Reverb.cpp +++ b/pcsx2/SPU2/Reverb.cpp @@ -96,11 +96,15 @@ s32 __forceinline V_Core::ReverbDownsample(bool right) { s32 out = 0; - for (u32 i = 0; i < NUM_TAPS; i++) + // Skipping the 0 coefs. + for (u32 i = 0; i < NUM_TAPS; i += 2) { out += RevbDownBuf[right][((RevbSampleBufPos - NUM_TAPS) + i) & 63] * filter_coefs[i]; } + // We also skipped the middle so add that in. + out += RevbDownBuf[right][((RevbSampleBufPos - NUM_TAPS) + 19) & 63] * filter_coefs[19]; + out >>= 15; Clampify(out, INT16_MIN, INT16_MAX);