Mercurial > hg > match-vamp
changeset 43:6a5d165e5ea4 refactors
refactor: m_ prefix
author | Chris Cannam |
---|---|
date | Thu, 13 Nov 2014 13:53:52 +0000 |
parents | 8dd16749c3c3 |
children | c1112adfd270 |
files | src/Finder.cpp src/MatchFeatureFeeder.cpp src/MatchFeeder.cpp src/Matcher.cpp src/Matcher.h |
diffstat | 5 files changed, 172 insertions(+), 179 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Finder.cpp Thu Nov 13 13:43:37 2014 +0000 +++ b/src/Finder.cpp Thu Nov 13 13:53:52 2014 +0000 @@ -23,7 +23,7 @@ Finder::Finder(Matcher *p1, Matcher *p2) { - if (!p1->firstPM) + if (!p1->m_firstPM) std::cerr << "Warning: wrong args in Finder()" << std::endl; pm1 = p1; pm2 = p2; @@ -44,23 +44,23 @@ { if (i1 >= 0) { index1 = i1; - index2 = i2 - pm1->first[i1]; + index2 = i2 - pm1->m_first[i1]; } - return (i1 >= 0) && (i2 >= pm1->first[i1]) && (i2 < pm1->last[i1]); + return (i1 >= 0) && (i2 >= pm1->m_first[i1]) && (i2 < pm1->m_last[i1]); } // find() void Finder::getColRange(int row, int *range) { - range[0] = pm1->first[row]; - range[1] = pm1->last[row]; + range[0] = pm1->m_first[row]; + range[1] = pm1->m_last[row]; } // getColRange() void Finder::getRowRange(int col, int *range) { - range[0] = pm2->first[col]; - range[1] = pm2->last[col]; + range[0] = pm2->m_first[col]; + range[1] = pm2->m_last[col]; } // getRowRange() int @@ -114,7 +114,7 @@ Finder::getDistance(int row, int col) { if (find(row, col)) { - return pm1->distance[row][col - pm1->first[row]]; + return pm1->m_distance[row][col - pm1->m_first[row]]; } std::cerr << "getDistance(" << row << "," << col << "): out of bounds" << std::endl; throw "getDistance index out of bounds"; @@ -124,7 +124,7 @@ Finder::setDistance(int row, int col, unsigned char b) { if (find(row, col)) { - pm1->distance[row][col - pm1->first[row]] = b; + pm1->m_distance[row][col - pm1->m_first[row]] = b; return; } std::cerr << "setDistance(" << row << "," << col << "," << b << "): out of bounds" << std::endl; @@ -135,7 +135,7 @@ Finder::getPathCost(int row, int col) { if (find(row, col)) // "1" avoids div by 0 below - return pm1->bestPathCost[row][col - pm1->first[row]]*100/ (1+row+col); + return pm1->m_bestPathCost[row][col - pm1->m_first[row]]*100/ (1+row+col); std::cerr << "getPathCost(" << row << "," << col << "): out of bounds" << std::endl; throw "getPathCost index out of bounds"; } // getPathCost() @@ -144,7 +144,7 @@ Finder::getRawPathCost(int row, int col) { if (find(row, col)) - return pm1->bestPathCost[row][col - pm1->first[row]]; + return pm1->m_bestPathCost[row][col - pm1->m_first[row]]; std::cerr << "getRawPathCost(" << row << "," << col << "): out of bounds" << std::endl; throw "getRawPathCost index out of bounds"; } // getRawPathCost() @@ -153,7 +153,7 @@ Finder::setPathCost(int row, int col, int i) { if (find(row, col)) { - pm1->bestPathCost[row][col - pm1->first[row]] = i; + pm1->m_bestPathCost[row][col - pm1->m_first[row]] = i; return; } std::cerr << "setPathCost(" << row << "," << col << "," << i << "): out of bounds" << std::endl; @@ -163,25 +163,25 @@ unsigned char Finder::getDistance() { - return pm1->distance[index1][index2]; + return pm1->m_distance[index1][index2]; } // getDistance()/0 void Finder::setDistance(int b) { - pm1->distance[index1][index2] = (unsigned char)b; + pm1->m_distance[index1][index2] = (unsigned char)b; } // setDistance() int Finder::getPathCost() { - return pm1->bestPathCost[index1][index2]; + return pm1->m_bestPathCost[index1][index2]; } // getPathCost() void Finder::setPathCost(int i) { - pm1->bestPathCost[index1][index2] = i; + pm1->m_bestPathCost[index1][index2] = i; } // setPathCost() void @@ -194,25 +194,25 @@ int thisRowStart, c; int prevRowStart = 0, prevRowStop = 0; for (int r = r1; r <= r2; r++) { - thisRowStart = pm1->first[r]; + thisRowStart = pm1->m_first[r]; if (thisRowStart < c1) thisRowStart = c1; for (c = thisRowStart; c <= c2; c++) { if (find(r,c)) { int i2 = index2; - int newCost = pm1->distance[r][i2]; + int newCost = pm1->m_distance[r][i2]; int dir = 0; if (r > r1) { // not first row int min = -1; if ((c > prevRowStart) && (c <= prevRowStop)) { // diagonal from (r-1,c-1) - min = pm1->bestPathCost[r-1][c-pm1->first[r-1]-1] + + min = pm1->m_bestPathCost[r-1][c-pm1->m_first[r-1]-1] + newCost * 2; dir = ADVANCE_BOTH; } if ((c >= prevRowStart) && (c < prevRowStop)) { // vertical from (r-1,c) - int cost = pm1->bestPathCost[r-1][c-pm1->first[r-1]] + + int cost = pm1->m_bestPathCost[r-1][c-pm1->m_first[r-1]] + newCost; if ((min == -1) || (cost < min)) { min = cost; @@ -221,22 +221,22 @@ } if (c > thisRowStart) { // horizontal from (r,c-1) - int cost =pm1->bestPathCost[r][i2-1]+newCost; + int cost =pm1->m_bestPathCost[r][i2-1]+newCost; if ((min == -1) || (cost < min)) { min = cost; dir = ADVANCE_OTHER; } } - pm1->bestPathCost[r][i2] = min; + pm1->m_bestPathCost[r][i2] = min; } else if (c > thisRowStart) { // first row // horizontal from (r,c-1) - pm1->bestPathCost[r][i2] = pm1->bestPathCost[r][i2-1] + + pm1->m_bestPathCost[r][i2] = pm1->m_bestPathCost[r][i2-1] + newCost; dir = ADVANCE_OTHER; } if ((r != r1) || (c != c1)) { - pm1->distance[r][i2] = (unsigned char) - ((pm1->distance[r][i2] & MASK) | dir); + pm1->m_distance[r][i2] = (unsigned char) + ((pm1->m_distance[r][i2] & MASK) | dir); } } else break; // end of row
--- a/src/MatchFeatureFeeder.cpp Thu Nov 13 13:43:37 2014 +0000 +++ b/src/MatchFeatureFeeder.cpp Thu Nov 13 13:53:52 2014 +0000 @@ -43,17 +43,17 @@ void MatchFeatureFeeder::feedBlock() { - if (pm1->frameCount < pm1->blockSize) { // fill initial block + if (pm1->m_frameCount < pm1->m_blockSize) { // fill initial block feed1(); feed2(); } - else if (pm1->runCount >= pm1->params.maxRunCount) { // slope constraints + else if (pm1->m_runCount >= pm1->m_params.maxRunCount) { // slope constraints feed2(); - } else if (pm2->runCount >= pm2->params.maxRunCount) { + } else if (pm2->m_runCount >= pm2->m_params.maxRunCount) { feed1(); } else { switch (finder->getExpandDirection - (pm1->frameCount-1, pm2->frameCount-1)) { + (pm1->m_frameCount-1, pm2->m_frameCount-1)) { case ADVANCE_THIS: feed1(); break;
--- a/src/MatchFeeder.cpp Thu Nov 13 13:43:37 2014 +0000 +++ b/src/MatchFeeder.cpp Thu Nov 13 13:53:52 2014 +0000 @@ -21,7 +21,7 @@ MatchFeeder::MatchFeeder(Matcher *m1, Matcher *m2) : pm1(m1), pm2(m2) { - fftSize = m1->params.fftSize; + fftSize = m1->m_params.fftSize; finder = new Finder(m1, m2); reBuffer = new double[fftSize/2+1]; imBuffer = new double[fftSize/2+1]; @@ -97,7 +97,7 @@ Features ff; vector<double> f1, f2; - if (pm1->frameCount < pm1->blockSize) { // fill initial block + if (pm1->m_frameCount < pm1->m_blockSize) { // fill initial block // std::cerr << "feeding initial block" << std::endl; f1 = feed1(); f2 = feed2(); @@ -106,15 +106,15 @@ // feed2(); //!!! } else if (pm2->atEnd) // feed1(); - else if (pm1->runCount >= pm1->params.maxRunCount) { // slope constraints + else if (pm1->m_runCount >= pm1->m_params.maxRunCount) { // slope constraints // std::cerr << "pm1 too slopey" << std::endl; f2 = feed2(); - } else if (pm2->runCount >= pm2->params.maxRunCount) { + } else if (pm2->m_runCount >= pm2->m_params.maxRunCount) { // std::cerr << "pm2 too slopey" << std::endl; f1 = feed1(); } else { switch (finder->getExpandDirection - (pm1->frameCount-1, pm2->frameCount-1)) { + (pm1->m_frameCount-1, pm2->m_frameCount-1)) { case ADVANCE_THIS: // std::cerr << "finder says ADVANCE_THIS" << std::endl; f1 = feed1();
--- a/src/Matcher.cpp Thu Nov 13 13:43:37 2014 +0000 +++ b/src/Matcher.cpp Thu Nov 13 13:53:52 2014 +0000 @@ -21,58 +21,56 @@ #include <cstdlib> #include <cassert> -bool Matcher::silent = true; - //#define DEBUG_MATCHER 1 Matcher::Matcher(Parameters parameters, FeatureExtractor::Parameters feParams, Matcher *p) : - params(parameters), - featureExtractor(feParams), - metric(parameters.distanceNorm) + m_params(parameters), + m_featureExtractor(feParams), + m_metric(parameters.distanceNorm) { #ifdef DEBUG_MATCHER - cerr << "Matcher::Matcher(" << params.sampleRate << ", " << p << ")" << endl; + cerr << "Matcher::Matcher(" << m_params.sampleRate << ", " << p << ")" << endl; #endif - otherMatcher = p; // the first matcher will need this to be set later - firstPM = (!p); - frameCount = 0; - runCount = 0; - featureSize = featureExtractor.getFeatureSize(); - blockSize = 0; + m_otherMatcher = p; // the first matcher will need this to be set later + m_firstPM = (!p); + m_frameCount = 0; + m_runCount = 0; + m_featureSize = m_featureExtractor.getFeatureSize(); + m_blockSize = 0; - blockSize = lrint(params.blockTime / params.hopTime); + m_blockSize = lrint(m_params.blockTime / m_params.hopTime); #ifdef DEBUG_MATCHER - cerr << "Matcher: blockSize = " << blockSize << endl; + cerr << "Matcher: m_blockSize = " << m_blockSize << endl; #endif - initialised = false; + m_initialised = false; } -Matcher::Matcher(Parameters parameters, Matcher *p, int featureSize_) : - params(parameters), - featureSize(featureSize_), - featureExtractor(FeatureExtractor::Parameters(params.sampleRate, params.fftSize)), // unused default config - metric(parameters.distanceNorm) +Matcher::Matcher(Parameters parameters, Matcher *p, int m_featureSize_) : + m_params(parameters), + m_featureSize(m_featureSize_), + m_featureExtractor(FeatureExtractor::Parameters(m_params.sampleRate, m_params.fftSize)), // unused default config + m_metric(parameters.distanceNorm) { #ifdef DEBUG_MATCHER - cerr << "Matcher::Matcher(" << params.sampleRate << ", " << p << ", " << featureSize << ")" << endl; + cerr << "Matcher::Matcher(" << m_params.sampleRate << ", " << p << ", " << m_featureSize << ")" << endl; #endif - otherMatcher = p; // the first matcher will need this to be set later - firstPM = (!p); - frameCount = 0; - runCount = 0; - blockSize = 0; + m_otherMatcher = p; // the first matcher will need this to be set later + m_firstPM = (!p); + m_frameCount = 0; + m_runCount = 0; + m_blockSize = 0; - blockSize = lrint(params.blockTime / params.hopTime); + m_blockSize = lrint(m_params.blockTime / m_params.hopTime); #ifdef DEBUG_MATCHER - cerr << "Matcher: blockSize = " << blockSize << endl; + cerr << "Matcher: m_blockSize = " << m_blockSize << endl; #endif - initialised = false; + m_initialised = false; } Matcher::~Matcher() @@ -85,41 +83,41 @@ void Matcher::init() { - if (initialised) return; + if (m_initialised) return; - frames = vector<vector<double> > - (blockSize, vector<double>(featureSize, 0)); + m_frames = vector<vector<double> > + (m_blockSize, vector<double>(m_featureSize, 0)); - distXSize = blockSize * 2; + m_distXSize = m_blockSize * 2; size(); - frameCount = 0; - runCount = 0; + m_frameCount = 0; + m_runCount = 0; - initialised = true; + m_initialised = true; } void Matcher::size() { - int distSize = (params.maxRunCount + 1) * blockSize; - bestPathCost.resize(distXSize, vector<int>(distSize, 0)); - distance.resize(distXSize, vector<unsigned char>(distSize, 0)); - distYSizes.resize(distXSize, distSize); - first.resize(distXSize, 0); - last.resize(distXSize, 0); + int distSize = (m_params.maxRunCount + 1) * m_blockSize; + m_bestPathCost.resize(m_distXSize, vector<int>(distSize, 0)); + m_distance.resize(m_distXSize, vector<unsigned char>(distSize, 0)); + m_distYSizes.resize(m_distXSize, distSize); + m_first.resize(m_distXSize, 0); + m_last.resize(m_distXSize, 0); } vector<double> Matcher::consumeFrame(double *reBuffer, double *imBuffer) { - if (!initialised) init(); + if (!m_initialised) init(); - vector<double> real(reBuffer, reBuffer + params.fftSize/2 + 1); - vector<double> imag(imBuffer, imBuffer + params.fftSize/2 + 1); - vector<double> feature = featureExtractor.process(real, imag); - int frameIndex = frameCount % blockSize; - frames[frameIndex] = feature; + vector<double> real(reBuffer, reBuffer + m_params.fftSize/2 + 1); + vector<double> imag(imBuffer, imBuffer + m_params.fftSize/2 + 1); + vector<double> feature = m_featureExtractor.process(real, imag); + int frameIndex = m_frameCount % m_blockSize; + m_frames[frameIndex] = feature; calcAdvance(); return feature; @@ -128,70 +126,70 @@ void Matcher::consumeFeatureVector(std::vector<double> feature) { - if (!initialised) init(); - int frameIndex = frameCount % blockSize; - frames[frameIndex] = feature; + if (!m_initialised) init(); + int frameIndex = m_frameCount % m_blockSize; + m_frames[frameIndex] = feature; calcAdvance(); } void Matcher::calcAdvance() { - int frameIndex = frameCount % blockSize; + int frameIndex = m_frameCount % m_blockSize; - if (frameCount >= distXSize) { - distXSize *= 2; + if (m_frameCount >= m_distXSize) { + m_distXSize *= 2; size(); } - if (firstPM && (frameCount >= blockSize)) { + if (m_firstPM && (m_frameCount >= m_blockSize)) { - int len = last[frameCount - blockSize] - - first[frameCount - blockSize]; + int len = m_last[m_frameCount - m_blockSize] - + m_first[m_frameCount - m_blockSize]; - // We need to copy distance[frameCount-blockSize] to - // distance[frameCount], and then truncate - // distance[frameCount-blockSize] to its first len elements. + // We need to copy distance[m_frameCount-m_blockSize] to + // distance[m_frameCount], and then truncate + // distance[m_frameCount-m_blockSize] to its first len elements. // Same for bestPathCost. /* - std::cerr << "Matcher(" << this << "): moving " << distYSizes[frameCount - blockSize] << " from " << frameCount - blockSize << " to " - << frameCount << ", allocating " << len << " for " - << frameCount - blockSize << std::endl; + std::cerr << "Matcher(" << this << "): moving " << distYSizes[m_frameCount - m_blockSize] << " from " << m_frameCount - m_blockSize << " to " + << m_frameCount << ", allocating " << len << " for " + << m_frameCount - m_blockSize << std::endl; */ - distance[frameCount] = distance[frameCount - blockSize]; - distance[frameCount - blockSize].resize(len, 0); + m_distance[m_frameCount] = m_distance[m_frameCount - m_blockSize]; + m_distance[m_frameCount - m_blockSize].resize(len, 0); for (int i = 0; i < len; ++i) { - distance[frameCount - blockSize][i] = - distance[frameCount][i]; + m_distance[m_frameCount - m_blockSize][i] = + m_distance[m_frameCount][i]; } - bestPathCost[frameCount] = bestPathCost[frameCount - blockSize]; - bestPathCost[frameCount - blockSize].resize(len, 0); + m_bestPathCost[m_frameCount] = m_bestPathCost[m_frameCount - m_blockSize]; + m_bestPathCost[m_frameCount - m_blockSize].resize(len, 0); for (int i = 0; i < len; ++i) { - bestPathCost[frameCount - blockSize][i] = - bestPathCost[frameCount][i]; + m_bestPathCost[m_frameCount - m_blockSize][i] = + m_bestPathCost[m_frameCount][i]; } - distYSizes[frameCount] = distYSizes[frameCount - blockSize]; - distYSizes[frameCount - blockSize] = len; + m_distYSizes[m_frameCount] = m_distYSizes[m_frameCount - m_blockSize]; + m_distYSizes[m_frameCount - m_blockSize] = len; } - int stop = otherMatcher->frameCount; - int index = stop - blockSize; + int stop = m_otherMatcher->m_frameCount; + int index = stop - m_blockSize; if (index < 0) index = 0; - first[frameCount] = index; - last[frameCount] = stop; + m_first[m_frameCount] = index; + m_last[m_frameCount] = stop; bool overflow = false; int mn= -1; int mx= -1; for ( ; index < stop; index++) { - int dMN = metric.calcDistanceScaled - (frames[frameIndex], - otherMatcher->frames[index % blockSize], - params.distanceScale); + int dMN = m_metric.calcDistanceScaled + (m_frames[frameIndex], + m_otherMatcher->m_frames[index % m_blockSize], + m_params.distanceScale); if (mx<0) mx = mn = dMN; @@ -204,95 +202,93 @@ dMN = 255; } - if ((frameCount == 0) && (index == 0)) // first element + if ((m_frameCount == 0) && (index == 0)) // first element setValue(0, 0, 0, 0, dMN); - else if (frameCount == 0) // first row + else if (m_frameCount == 0) // first row setValue(0, index, ADVANCE_OTHER, getValue(0, index-1, true), dMN); else if (index == 0) // first column - setValue(frameCount, index, ADVANCE_THIS, - getValue(frameCount - 1, 0, true), dMN); - else if (index == otherMatcher->frameCount - blockSize) { + setValue(m_frameCount, index, ADVANCE_THIS, + getValue(m_frameCount - 1, 0, true), dMN); + else if (index == m_otherMatcher->m_frameCount - m_blockSize) { // missing value(s) due to cutoff // - no previous value in current row (resp. column) // - no diagonal value if prev. dir. == curr. dirn - int min2 = getValue(frameCount - 1, index, true); - // if ((firstPM && (first[frameCount - 1] == index)) || - // (!firstPM && (last[index-1] < frameCount))) - if (first[frameCount - 1] == index) - setValue(frameCount, index, ADVANCE_THIS, min2, dMN); + int min2 = getValue(m_frameCount - 1, index, true); + // if ((m_firstPM && (first[m_frameCount - 1] == index)) || + // (!m_firstPM && (m_last[index-1] < m_frameCount))) + if (m_first[m_frameCount - 1] == index) + setValue(m_frameCount, index, ADVANCE_THIS, min2, dMN); else { - int min1 = getValue(frameCount - 1, index - 1, true); + int min1 = getValue(m_frameCount - 1, index - 1, true); if (min1 + dMN <= min2) - setValue(frameCount, index, ADVANCE_BOTH, min1,dMN); + setValue(m_frameCount, index, ADVANCE_BOTH, min1,dMN); else - setValue(frameCount, index, ADVANCE_THIS, min2,dMN); + setValue(m_frameCount, index, ADVANCE_THIS, min2,dMN); } } else { - int min1 = getValue(frameCount, index-1, true); - int min2 = getValue(frameCount - 1, index, true); - int min3 = getValue(frameCount - 1, index-1, true); + int min1 = getValue(m_frameCount, index-1, true); + int min2 = getValue(m_frameCount - 1, index, true); + int min3 = getValue(m_frameCount - 1, index-1, true); if (min1 <= min2) { if (min3 + dMN <= min1) - setValue(frameCount, index, ADVANCE_BOTH, min3,dMN); + setValue(m_frameCount, index, ADVANCE_BOTH, min3,dMN); else - setValue(frameCount, index, ADVANCE_OTHER,min1,dMN); + setValue(m_frameCount, index, ADVANCE_OTHER,min1,dMN); } else { if (min3 + dMN <= min2) - setValue(frameCount, index, ADVANCE_BOTH, min3,dMN); + setValue(m_frameCount, index, ADVANCE_BOTH, min3,dMN); else - setValue(frameCount, index, ADVANCE_THIS, min2,dMN); + setValue(m_frameCount, index, ADVANCE_THIS, min2,dMN); } } - otherMatcher->last[index]++; + m_otherMatcher->m_last[index]++; } // loop for row (resp. column) - frameCount++; - runCount++; + m_frameCount++; + m_runCount++; - otherMatcher->runCount = 0; + m_otherMatcher->m_runCount = 0; - if (overflow && !silent) + if (overflow) { cerr << "WARNING: overflow in distance metric: " - << "frame " << frameCount << ", val = " << mx << endl; - - if (!silent) - std::cerr << "Frame " << frameCount << ", d = " << (mx-mn) << std::endl; + << "frame " << m_frameCount << ", val = " << mx << endl; + } } int Matcher::getValue(int i, int j, bool firstAttempt) { - if (firstPM) - return bestPathCost[i][j - first[i]]; + if (m_firstPM) + return m_bestPathCost[i][j - m_first[i]]; else - return otherMatcher->bestPathCost[j][i - otherMatcher->first[j]]; + return m_otherMatcher->m_bestPathCost[j][i - m_otherMatcher->m_first[j]]; } // getValue() void Matcher::setValue(int i, int j, int dir, int value, int dMN) { - if (firstPM) { - distance[i][j - first[i]] = (unsigned char)((dMN & MASK) | dir); - bestPathCost[i][j - first[i]] = + if (m_firstPM) { + m_distance[i][j - m_first[i]] = (unsigned char)((dMN & MASK) | dir); + m_bestPathCost[i][j - m_first[i]] = (value + (dir==ADVANCE_BOTH? dMN*2: dMN)); } else { if (dir == ADVANCE_THIS) dir = ADVANCE_OTHER; else if (dir == ADVANCE_OTHER) dir = ADVANCE_THIS; - int idx = i - otherMatcher->first[j]; - if (idx == (int)otherMatcher->distYSizes[j]) { + int idx = i - m_otherMatcher->m_first[j]; + if (idx == (int)m_otherMatcher->m_distYSizes[j]) { // This should never happen, but if we allow arbitrary // pauses in either direction, and arbitrary lengths at // end, it is better than a segmentation fault. std::cerr << "Emergency resize: " << idx << " -> " << idx * 2 << std::endl; - otherMatcher->distYSizes[j] = idx * 2; - otherMatcher->bestPathCost[j].resize(idx * 2, 0); - otherMatcher->distance[j].resize(idx * 2, 0); + m_otherMatcher->m_distYSizes[j] = idx * 2; + m_otherMatcher->m_bestPathCost[j].resize(idx * 2, 0); + m_otherMatcher->m_distance[j].resize(idx * 2, 0); } - otherMatcher->distance[j][idx] = (unsigned char)((dMN & MASK) | dir); - otherMatcher->bestPathCost[j][idx] = + m_otherMatcher->m_distance[j][idx] = (unsigned char)((dMN & MASK) | dir); + m_otherMatcher->m_bestPathCost[j][idx] = (value + (dir==ADVANCE_BOTH? dMN*2: dMN)); } } // setValue()
--- a/src/Matcher.h Thu Nov 13 13:43:37 2014 +0000 +++ b/src/Matcher.h Thu Nov 13 13:53:52 2014 +0000 @@ -132,11 +132,11 @@ * @param p the Matcher representing the other performance */ void setOtherMatcher(Matcher *p) { - otherMatcher = p; + m_otherMatcher = p; } // setOtherMatcher() int getFrameCount() { - return frameCount; + return m_frameCount; } protected: @@ -201,30 +201,30 @@ * original version, only one of the two performance matchers * contained the distance metric. (See <code>first</code>) */ - Matcher *otherMatcher; + Matcher *m_otherMatcher; /** Indicates which performance is considered primary (the * score). This is the performance shown on the vertical axis, * and referred to as "this" in the codes for the direction of * DTW steps. */ - bool firstPM; + bool m_firstPM; /** Configuration parameters */ - Parameters params; + Parameters m_params; /** Width of the search band in FFT frames (see <code>blockTime</code>) */ - int blockSize; + int m_blockSize; /** The number of frames of audio data which have been read. */ - int frameCount; + int m_frameCount; /** The number of frames sequentially processed by this matcher, * without a frame of the other matcher being processed. */ - int runCount; + int m_runCount; /** The number of values in a feature vector. */ - int featureSize; + int m_featureSize; /** A block of previously seen frames are stored in this structure * for calculation of the distance matrix as the new frames are @@ -233,31 +233,28 @@ * applicable processing applied (e.g. spectral difference, * normalisation), unlike prevFrame and newFrame. The total * energy of frames[i] is stored in totalEnergies[i]. */ - vector<vector<double> > frames; + vector<vector<double> > m_frames; /** The best path cost matrix. */ - vector<vector<int> > bestPathCost; + vector<vector<int> > m_bestPathCost; /** The distance matrix. */ - vector<vector<unsigned char> > distance; + vector<vector<unsigned char> > m_distance; /** The bounds of each row of data in the distance and path cost matrices.*/ - vector<int> first; - vector<int> last; + vector<int> m_first; + vector<int> m_last; /** Height of each column in distance and bestPathCost matrices */ - vector<int> distYSizes; + vector<int> m_distYSizes; /** Width of distance and bestPathCost matrices and first and last vectors */ - int distXSize; + int m_distXSize; - bool initialised; + bool m_initialised; - /** Disable or enable debugging output */ - static bool silent; - - FeatureExtractor featureExtractor; - DistanceMetric metric; + FeatureExtractor m_featureExtractor; + DistanceMetric m_metric; friend class MatchFeeder; friend class MatchFeatureFeeder;