Mercurial > hg > silvet
diff src/EM.cpp @ 86:6075e92d63ab timing
Reorder internal loops
author | Chris Cannam |
---|---|
date | Tue, 06 May 2014 12:43:59 +0100 |
parents | 64b08cc12da0 |
children | 97b77e7cb94c |
line wrap: on
line diff
--- a/src/EM.cpp Tue May 06 12:39:19 2014 +0100 +++ b/src/EM.cpp Tue May 06 12:43:59 2014 +0100 @@ -182,20 +182,22 @@ const float *w = templateFor(i, n, f); const double factor = pitch * source * shift; - for (int j = 0; j < m_binCount; ++j) { + if (n >= m_lowestPitch && n <= m_highestPitch) { - const double contribution = w[j] * m_q[j] * factor; - - if (n >= m_lowestPitch && n <= m_highestPitch) { - newPitches[n] += contribution; + for (int j = 0; j < m_binCount; ++j) { + newPitches[n] += w[j] * m_q[j] * factor; } - newShifts[f][n] += contribution; - if (inRange(i, n)) { - newSources[i][n] += contribution; + for (int j = 0; j < m_binCount; ++j) { + newSources[i][n] += w[j] * m_q[j] * factor; + } } } + + for (int j = 0; j < m_binCount; ++j) { + newShifts[f][n] += w[j] * m_q[j] * factor; + } } } }