diff dsp/transforms/FFT.cpp @ 280:9c403afdd9e9

* Various fixes related to the bar estimator code
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 10 Feb 2009 16:37:11 +0000
parents 9edaa3ce62e8
children 6cb2b3cd5356
line wrap: on
line diff
--- a/dsp/transforms/FFT.cpp	Tue Feb 10 12:52:43 2009 +0000
+++ b/dsp/transforms/FFT.cpp	Tue Feb 10 16:37:11 2009 +0000
@@ -8,8 +8,13 @@
 */
 
 #include "FFT.h"
+
+#include "maths/MathUtilities.h"
+
 #include <cmath>
 
+#include <iostream>
+
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -39,8 +44,11 @@
     double angle_numerator = 2.0 * M_PI;
     double tr, ti;
 
-    if( !isPowerOfTwo(p_nSamples) )
+    if( !MathUtilities::isPowerOfTwo(p_nSamples) )
     {
+        std::cerr << "ERROR: FFT::process: Non-power-of-two FFT size "
+                  << p_nSamples << " not supported in this implementation"
+                  << std::endl;
 	return;
     }
 
@@ -118,15 +126,6 @@
     }
 }
 
-bool FFT::isPowerOfTwo(unsigned int p_nX)
-{
-    if( p_nX < 2 ) return false;
-
-    if( p_nX & (p_nX-1) ) return false;
-
-    return true;
-}
-
 unsigned int FFT::numberOfBitsNeeded(unsigned int p_nSamples)
 {	
     int i;