# HG changeset patch # User Chris Cannam # Date 1201784508 0 # Node ID 715b0a6bcdc0a721a65b8a8af2ee922b66987488 # Parent bbb66c990e0621a9f15302b71c3cb08925aa286f * 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 bbb66c990e06 -r 715b0a6bcdc0 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);