# HG changeset patch # User Chris Cannam # Date 1524575631 -3600 # Node ID 0925b37a3ed12c330ff25c997a845ac6aaf91129 # Parent 904e031c9c7648409ef0c1f58f78fbea67686e9b Some messing around with profiling diff -r 904e031c9c76 -r 0925b37a3ed1 data/model/FFTModel.cpp --- a/data/model/FFTModel.cpp Tue Apr 24 10:01:34 2018 +0100 +++ b/data/model/FFTModel.cpp Tue Apr 24 14:13:51 2018 +0100 @@ -241,14 +241,20 @@ sv_frame_t discard = range.first - m_savedData.range.first; - fvec acc(m_savedData.data.begin() + discard, m_savedData.data.end()); + fvec data; + data.reserve(range.second - range.first); - fvec rest = getSourceDataUncached({ m_savedData.range.second, range.second }); + data.insert(data.end(), + m_savedData.data.begin() + discard, + m_savedData.data.end()); - acc.insert(acc.end(), rest.begin(), rest.end()); + fvec rest = getSourceDataUncached + ({ m_savedData.range.second, range.second }); + + data.insert(data.end(), rest.begin(), rest.end()); - m_savedData = { range, acc }; - return acc; + m_savedData = { range, data }; + return data; } else { @@ -263,6 +269,8 @@ FFTModel::fvec FFTModel::getSourceDataUncached(pair range) const { + Profiler profiler("FFTModel::getSourceDataUncached"); + decltype(range.first) pfx = 0; if (range.first < 0) { pfx = -range.first; diff -r 904e031c9c76 -r 0925b37a3ed1 data/model/ReadOnlyWaveFileModel.cpp --- a/data/model/ReadOnlyWaveFileModel.cpp Tue Apr 24 10:01:34 2018 +0100 +++ b/data/model/ReadOnlyWaveFileModel.cpp Tue Apr 24 14:13:51 2018 +0100 @@ -207,11 +207,17 @@ } floatvec_t -ReadOnlyWaveFileModel::getData(int channel, sv_frame_t start, sv_frame_t count) const +ReadOnlyWaveFileModel::getData(int channel, + sv_frame_t start, + sv_frame_t count) + const { - // Read directly from the file. This is used for e.g. audio - // playback or input to transforms. + // Read a single channel (if channel >= 0) or a mixdown of all + // channels (if channel == -1) directly from the file. This is + // used for e.g. audio playback or input to transforms. + Profiler profiler("ReadOnlyWaveFileModel::getData"); + #ifdef DEBUG_WAVE_FILE_MODEL cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << channel << ", " << start << ", " << count << endl; #endif @@ -268,8 +274,10 @@ ReadOnlyWaveFileModel::getMultiChannelData(int fromchannel, int tochannel, sv_frame_t start, sv_frame_t count) const { - // Read directly from the file. This is used for e.g. audio - // playback or input to transforms. + // Read a set of channels directly from the file. This is used + // for e.g. audio playback or input to transforms. + + Profiler profiler("ReadOnlyWaveFileModel::getMultiChannelData"); #ifdef DEBUG_WAVE_FILE_MODEL cout << "ReadOnlyWaveFileModel::getData[" << this << "]: " << fromchannel << "," << tochannel << ", " << start << ", " << count << endl; @@ -278,16 +286,18 @@ int channels = getChannelCount(); if (fromchannel > tochannel) { - SVCERR << "ERROR: ReadOnlyWaveFileModel::getData: fromchannel (" - << fromchannel << ") > tochannel (" << tochannel << ")" - << endl; + SVCERR << "ERROR: ReadOnlyWaveFileModel::getMultiChannelData: " + << "fromchannel (" << fromchannel + << ") > tochannel (" << tochannel << ")" + << endl; return {}; } if (tochannel >= channels) { - SVCERR << "ERROR: ReadOnlyWaveFileModel::getData: tochannel (" - << tochannel << ") >= channel count (" << channels << ")" - << endl; + SVCERR << "ERROR: ReadOnlyWaveFileModel::getMultiChannelData: " + << "tochannel (" << tochannel + << ") >= channel count (" << channels << ")" + << endl; return {}; }