From f1ce8a5cc28cecb7448ca786a6006618cd1c1ddf Mon Sep 17 00:00:00 2001 From: martynshaw99 Date: Mon, 17 Feb 2014 00:00:59 +0000 Subject: [PATCH] Optimisation for speed, due to some code I found in an FFT routine. --- src/effects/Equalization.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index 428063d12..3c189fe27 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -831,11 +831,21 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event)) freq = lin ? step*i : pow(10., loLog + i*step); //Hz if( ( lin ? step : (pow(10., loLog + (i+1)*step)-freq) ) < delta) { //not enough resolution in FFT - freq = M_PI*freq/mHiFreq; //radians, normalized + // set up for calculating cos using recurrance - faster than calculating it directly each time + double theta = M_PI*freq/mHiFreq; //radians, normalized + double wtemp = sin(0.5 * theta); + double wpr = -2.0 * wtemp * wtemp; + double wpi = -1.0 * sin(theta); + double wr = cos(theta*halfM); + double wi = sin(theta*halfM); + yF = 0.; for(int j=0;j