Mercurial > hg > qm-dsp
comparison dsp/chromagram/ConstantQ.cpp @ 64:6cb2b3cd5356
* Refactor FFT a little bit so as to separate construction and processing
rather than have a single static method -- will make it easier to use a
different implementation
* pull in KissFFT implementation (not hooked up yet)
author | cannam |
---|---|
date | Wed, 13 May 2009 09:19:12 +0000 |
parents | 114e833c07ac |
children | dcb555b90924 |
comparison
equal
deleted
inserted
replaced
63:0dcbce5d7dce | 64:6cb2b3cd5356 |
---|---|
101 // for each bin value K, calculate temporal kernel, take its fft to | 101 // for each bin value K, calculate temporal kernel, take its fft to |
102 //calculate the spectral kernel then threshold it to make it sparse and | 102 //calculate the spectral kernel then threshold it to make it sparse and |
103 //add it to the sparse kernels matrix | 103 //add it to the sparse kernels matrix |
104 double squareThreshold = m_CQThresh * m_CQThresh; | 104 double squareThreshold = m_CQThresh * m_CQThresh; |
105 | 105 |
106 FFT m_FFT; | 106 FFT m_FFT(m_FFTLength); |
107 | 107 |
108 for (unsigned k = m_uK; k--; ) | 108 for (unsigned k = m_uK; k--; ) |
109 { | 109 { |
110 for (unsigned u=0; u < m_FFTLength; u++) | 110 for (unsigned u=0; u < m_FFTLength; u++) |
111 { | 111 { |
136 hammingWindowIm[i] = hammingWindowIm[i + m_FFTLength/2]; | 136 hammingWindowIm[i] = hammingWindowIm[i + m_FFTLength/2]; |
137 hammingWindowIm[i + m_FFTLength/2] = temp; | 137 hammingWindowIm[i + m_FFTLength/2] = temp; |
138 } | 138 } |
139 | 139 |
140 //do fft of hammingWindow | 140 //do fft of hammingWindow |
141 m_FFT.process( m_FFTLength, 0, hammingWindowRe, hammingWindowIm, transfHammingWindowRe, transfHammingWindowIm ); | 141 m_FFT.process( 0, hammingWindowRe, hammingWindowIm, transfHammingWindowRe, transfHammingWindowIm ); |
142 | 142 |
143 | 143 |
144 for (unsigned j=0; j<( m_FFTLength ); j++) | 144 for (unsigned j=0; j<( m_FFTLength ); j++) |
145 { | 145 { |
146 // perform thresholding | 146 // perform thresholding |