Mercurial > hg > qm-dsp
diff dsp/transforms/FFT.cpp @ 55:7fe29d8a7eaf
* Various fixes related to the bar estimator code
author | cannam |
---|---|
date | Tue, 10 Feb 2009 16:37:11 +0000 |
parents | a251fb0de594 |
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;