X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fqm-dsp%2Fdsp%2Fchromagram%2FConstantQ.cpp;h=b764235fcd98d5bbfe656b0bfeb395a8c4389f27;hb=f68d2e06bcfb81efda107d3b4c3aa7dbc2d73bc2;hp=fa6c32c26b9b119ee7bb882f8aa8543b4f21d4d7;hpb=2a27cc475867612afd261e5bf3b2a1a42b9c75cc;p=ardour.git diff --git a/libs/qm-dsp/dsp/chromagram/ConstantQ.cpp b/libs/qm-dsp/dsp/chromagram/ConstantQ.cpp index fa6c32c26b..b764235fcd 100644 --- a/libs/qm-dsp/dsp/chromagram/ConstantQ.cpp +++ b/libs/qm-dsp/dsp/chromagram/ConstantQ.cpp @@ -96,7 +96,7 @@ void ConstantQ::sparsekernel() double* transfHammingWindowRe = new double [ m_FFTLength ]; double* transfHammingWindowIm = new double [ m_FFTLength ]; - for (unsigned u=0; u < m_FFTLength; u++) + for (unsigned u=0; u < m_FFTLength; u++) { hammingWindowRe[u] = 0; hammingWindowIm[u] = 0; @@ -109,28 +109,28 @@ void ConstantQ::sparsekernel() sk->js.reserve( m_FFTLength*2 ); sk->real.reserve( m_FFTLength*2 ); sk->imag.reserve( m_FFTLength*2 ); - + // for each bin value K, calculate temporal kernel, take its fft to - //calculate the spectral kernel then threshold it to make it sparse and + //calculate the spectral kernel then threshold it to make it sparse and //add it to the sparse kernels matrix double squareThreshold = m_CQThresh * m_CQThresh; FFT m_FFT(m_FFTLength); - - for (unsigned k = m_uK; k--; ) + + for (unsigned k = m_uK; k--; ) { - for (unsigned u=0; u < m_FFTLength; u++) + for (unsigned u=0; u < m_FFTLength; u++) { hammingWindowRe[u] = 0; hammingWindowIm[u] = 0; } - + // Computing a hamming window const unsigned hammingLength = (int) ceil( m_dQ * m_FS / ( m_FMin * pow(2,((double)(k))/(double)m_BPO))); unsigned origin = m_FFTLength/2 - hammingLength/2; - for (unsigned i=0; iis.push_back(j); sk->js.push_back(k); @@ -241,7 +241,7 @@ void ConstantQ::sparsekernel() cout << "}" << endl; */ // std::cerr << "done\n -> is: " << sk->is.size() << ", js: " << sk->js.size() << ", reals: " << sk->real.size() << ", imags: " << sk->imag.size() << std::endl; - + m_sparseKernel = sk; return; } @@ -256,7 +256,7 @@ double* ConstantQ::process( const double* fftdata ) SparseKernel *sk = m_sparseKernel; - for (unsigned row=0; row<2*m_uK; row++) + for (unsigned row=0; row<2*m_uK; row++) { m_CQdata[ row ] = 0; m_CQdata[ row+1 ] = 0; @@ -266,7 +266,7 @@ double* ConstantQ::process( const double* fftdata ) const double *real = &(sk->real[0]); const double *imag = &(sk->imag[0]); const unsigned int sparseCells = sk->real.size(); - + for (unsigned i = 0; ireal[0]); const double *imag = &(sk->imag[0]); const unsigned int sparseCells = sk->real.size(); - + for (unsigned i = 0; i