# HG changeset patch # User Chris Cannam # Date 1411656135 -3600 # Node ID a908a5a5626763d9d4c1d82f447a2115a12bd0b7 # Parent 4cf2d163127befcc01146bd8204f2f4b776755cb Some unsigned -> int (while bug hunting) diff -r 4cf2d163127b -r a908a5a56267 AutocorrelationProcessor.cpp --- a/AutocorrelationProcessor.cpp Thu Sep 25 15:13:45 2014 +0100 +++ b/AutocorrelationProcessor.cpp Thu Sep 25 15:42:15 2014 +0100 @@ -16,7 +16,7 @@ using namespace std; #include -AutocorrelationProcessor::AutocorrelationProcessor(const size_t &windowLength, const unsigned int &hopSize) : +AutocorrelationProcessor::AutocorrelationProcessor(int windowLength, int hopSize) : m_windowLength(windowLength), m_hopSize(hopSize) { @@ -28,30 +28,29 @@ } -AutoCorrelation AutocorrelationProcessor::process(float * input, const size_t &inputLength) const +AutoCorrelation AutocorrelationProcessor::process(float * input, int inputLength) const { int readBlockPointerIndex = 0; AutoCorrelation autocorrelation; - while(readBlockPointerIndex <= (int)inputLength) { + while(readBlockPointerIndex <= inputLength) { vector autocorrelationBlock; - for (int lag = 0; lag < (int)m_windowLength; lag++){ + for (int lag = 0; lag < m_windowLength; lag++){ float sum = 0; int readPointer = readBlockPointerIndex - m_windowLength/2; for (int n = 0; n < (int)m_windowLength; n++){ - if (readPointer+lag >= (int)inputLength) break; - else if (readPointer >= 0) sum += input[readPointer]*input[readPointer+lag]; - //else cout << readPointer << " : "<< lag << "/" << m_windowLength << endl; - + if (readPointer+lag >= inputLength) break; + else if (readPointer >= 0) { + sum += input[readPointer]*input[readPointer+lag]; + } readPointer++; } autocorrelationBlock.push_back(sum/(2*m_windowLength + 1 - lag)); } - //autocorrelation.push_back(processBlock()); autocorrelation.push_back(autocorrelationBlock); readBlockPointerIndex += m_hopSize; } diff -r 4cf2d163127b -r a908a5a56267 AutocorrelationProcessor.h --- a/AutocorrelationProcessor.h Thu Sep 25 15:13:45 2014 +0100 +++ b/AutocorrelationProcessor.h Thu Sep 25 15:42:15 2014 +0100 @@ -22,12 +22,12 @@ class AutocorrelationProcessor{ public: - AutocorrelationProcessor(const size_t &windowLength, const unsigned int &hopSize); + AutocorrelationProcessor(int windowLength, int hopSize); ~AutocorrelationProcessor(); - AutoCorrelation process(float * input, const size_t &inputLength) const; + AutoCorrelation process(float * input, int inputLength) const; private: - size_t m_windowLength; - unsigned int m_hopSize; + int m_windowLength; + int m_hopSize; }; #endif /* defined(__Tempogram__Autocorrelation__) */ diff -r 4cf2d163127b -r a908a5a56267 TempogramPlugin.cpp --- a/TempogramPlugin.cpp Thu Sep 25 15:13:45 2014 +0100 +++ b/TempogramPlugin.cpp Thu Sep 25 15:42:15 2014 +0100 @@ -505,10 +505,14 @@ for (int block = 0; block < tempogramLength; block++){ Feature tempogramACTFeature; + +// cerr << "block = " << block << ", window length = " << m_tempogramWindowLength << ", max lag = " << m_tempogramMaxLag << ", min lag = " << m_tempogramMinLag << endl; for(int k = m_tempogramMaxLag; k >= (int)m_tempogramMinLag; k--){ +// cerr << "(" << block << "," << k << ") "; tempogramACTFeature.values.push_back(tempogramACT[block][k]); } +// cerr << endl; tempogramACTFeature.hasTimestamp = false; featureSet[2].push_back(tempogramACTFeature); }