Mercurial > hg > qm-dsp
changeset 38:3dff6e3e2121
* 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
author | cannam |
---|---|
date | Thu, 31 Jan 2008 13:01:48 +0000 |
parents | c964f60a7e7a |
children | 200677638f5b |
files | dsp/chromagram/ConstantQ.cpp |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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);