Bug 147050 - Spectrum average window can be larger than the data.
Summary: Spectrum average window can be larger than the data.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-21 18:52 UTC by Duncan Hanson
Modified: 2007-06-21 18:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***.