Bug 147050

Summary: Spectrum average window can be larger than the data.
Product: [Applications] kst Reporter: Duncan Hanson <duncan.hanson>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Duncan Hanson 2007-06-21 18:52:36 UTC
Version:            (using KDE KDE 3.5.7)
OS:                Linux

There's currently no check that the FFT averaging length is smaller than the data length.
Particularly with Spectrograms, this leads to wasted memory if the FFT length isn't set to something reasonable.
Comment 1 Duncan Hanson 2007-06-21 18:54:20 UTC
SVN commit 678549 by dhanson:

CCBUG:147050 if averageLen is too large, ignore it.

 M  +1 -1      psdcalculator.cpp  


--- branches/work/kst/1.5/kst/src/libkstmath/psdcalculator.cpp #678548:678549
@@ -314,7 +314,7 @@
 int PSDCalculator::calculateOutputVectorLength(int inputLen, bool average, int averageLen) {
   int psdloglen;
 
-  if (average) {
+  if (average && pow(2.0, averageLen) < inputLen) {
     psdloglen = averageLen;
   } else {
     psdloglen = int(ceil(log(double(inputLen)) / log(2.0)));
Comment 2 Duncan Hanson 2007-06-21 18:54:56 UTC
*** Bug has been marked as fixed ***.