# HG changeset patch # User cannam # Date 1201784508 0 # Node ID 3dff6e3e2121eeec3b1b14bb943b375ecb6b27f8 # Parent c964f60a7e7a60bffe91b52f484700e208ce3dd7 * Ouch! We overrun the FFTRe/Im vectors with the very first dereference I assume the kernel matrix column values are supposed to index the FFT bins from the end, not from the end plus one diff -r c964f60a7e7a -r 3dff6e3e2121 dsp/chromagram/ConstantQ.cpp --- a/dsp/chromagram/ConstantQ.cpp Thu Jan 31 10:39:51 2008 +0000 +++ b/dsp/chromagram/ConstantQ.cpp Thu Jan 31 13:01:48 2008 +0000 @@ -148,8 +148,8 @@ const unsigned col = fftbin[i]; const double & r1 = real[i]; const double & i1 = imag[i]; - const double & r2 = fftdata[ (2*m_FFTLength) - 2*col]; - const double & i2 = fftdata[ (2*m_FFTLength) - 2*col+1]; + const double & r2 = fftdata[ (2*m_FFTLength) - 2*col - 2 ]; + const double & i2 = fftdata[ (2*m_FFTLength) - 2*col - 2 + 1 ]; // add the multiplication m_CQdata[ 2*row ] += (r1*r2 - i1*i2); m_CQdata[ 2*row+1] += (r1*i2 + i1*r2); @@ -209,8 +209,8 @@ const unsigned col = fftbin[i]; const double & r1 = real[i]; const double & i1 = imag[i]; - const double & r2 = FFTRe[ m_FFTLength - col]; - const double & i2 = FFTIm[ m_FFTLength - col]; + const double & r2 = FFTRe[ m_FFTLength - col - 1 ]; + const double & i2 = FFTIm[ m_FFTLength - col - 1 ]; // add the multiplication CQRe[ row ] += (r1*r2 - i1*i2); CQIm[ row ] += (r1*i2 + i1*r2);