Add empty final step (which is when we plan the next block)
This commit is contained in:
parent
66fc9e8e22
commit
4c627c7568
38
cmd/main.cpp
38
cmd/main.cpp
@ -154,11 +154,22 @@ int main(int argc, char* argv[]) {
|
|||||||
// the `.flush()` call already handled foldback stuff at the end (since we asked for a shorter `tailSamples`)
|
// the `.flush()` call already handled foldback stuff at the end (since we asked for a shorter `tailSamples`)
|
||||||
}
|
}
|
||||||
|
|
||||||
signalsmith::plot::Plot2D plot(400, 150);
|
signalsmith::plot::Figure figure;
|
||||||
plot.x.major(0, "").label("step");
|
auto &plot = figure(0, 0).plot(400, 150);
|
||||||
plot.y.major(0).label("time spent");
|
plot.x.blank().label("step");
|
||||||
|
plot.y.major(0, "");
|
||||||
|
plot.title("computation time");
|
||||||
|
auto &cumulativePlot = figure(1, 0).plot(150, 150);
|
||||||
|
cumulativePlot.x.major(processStopwatches.size(), "");
|
||||||
|
cumulativePlot.y.major(0, "");
|
||||||
|
cumulativePlot.title("cumulative");
|
||||||
auto &line = plot.line().fillToY(0);
|
auto &line = plot.line().fillToY(0);
|
||||||
auto &extraLine = plot.line().fillToY(0);
|
auto &extraLine = plot.line().fillToY(0);
|
||||||
|
auto &cumulativeLine = cumulativePlot.line();
|
||||||
|
auto &flatLine = cumulativePlot.line();
|
||||||
|
double cumulativeTime = 0;
|
||||||
|
line.add(0, 0);
|
||||||
|
cumulativeLine.add(0, 0);
|
||||||
for (size_t i = 0; i < processStopwatches.size(); ++i) {
|
for (size_t i = 0; i < processStopwatches.size(); ++i) {
|
||||||
double time = processStopwatches[i].total();
|
double time = processStopwatches[i].total();
|
||||||
if (i%5 == 0) {
|
if (i%5 == 0) {
|
||||||
@ -168,16 +179,23 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
line.add(i, time);
|
line.add(i, time);
|
||||||
line.add(i + 1, time);
|
line.add(i + 1, time);
|
||||||
|
|
||||||
|
cumulativeTime += time;
|
||||||
|
cumulativeLine.add(i, cumulativeTime);
|
||||||
|
cumulativeLine.add(i + 1, cumulativeTime);
|
||||||
}
|
}
|
||||||
extraLine.add(-1, 0);
|
line.add(processStopwatches.size(), 0);
|
||||||
extraLine.add(-1, processStopwatchStart.total());
|
|
||||||
extraLine.add(0, processStopwatchStart.total());
|
|
||||||
extraLine.add(0, 0);
|
extraLine.add(0, 0);
|
||||||
extraLine.add(processStopwatches.size(), 0);
|
extraLine.add(0, processStopwatchStart.total());
|
||||||
|
extraLine.add(1, processStopwatchStart.total());
|
||||||
|
extraLine.add(1, 0);
|
||||||
|
extraLine.add(processStopwatches.size() - 1, 0);
|
||||||
|
extraLine.add(processStopwatches.size() - 1, processStopwatchEnd.total());
|
||||||
extraLine.add(processStopwatches.size(), processStopwatchEnd.total());
|
extraLine.add(processStopwatches.size(), processStopwatchEnd.total());
|
||||||
extraLine.add(processStopwatches.size() + 1, processStopwatchEnd.total());
|
extraLine.add(processStopwatches.size(), 0);
|
||||||
extraLine.add(processStopwatches.size() + 1, 0);
|
flatLine.add(0, 0);
|
||||||
plot.write("profile.svg");
|
flatLine.add(processStopwatches.size(), cumulativeTime);
|
||||||
|
figure.write("profile.svg");
|
||||||
|
|
||||||
if (!outWav.write(outputWav).warn()) args.errorExit("failed to write WAV");
|
if (!outWav.write(outputWav).warn()) args.errorExit("failed to write WAV");
|
||||||
|
|
||||||
|
|||||||
@ -287,8 +287,6 @@ struct SignalsmithStretch {
|
|||||||
stft.synthesiseStep(step);
|
stft.synthesiseStep(step);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// This should never happen - something has gone terribly wrong
|
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
if (processRatio >= 1) { // we *should* have just written a block, and are now ready to start a new one
|
if (processRatio >= 1) { // we *should* have just written a block, and are now ready to start a new one
|
||||||
blockProcess.step = 0;
|
blockProcess.step = 0;
|
||||||
@ -323,6 +321,7 @@ struct SignalsmithStretch {
|
|||||||
blockProcess.steps += processSpectrumSteps;
|
blockProcess.steps += processSpectrumSteps;
|
||||||
|
|
||||||
blockProcess.steps += stft.synthesiseSteps() + 1;
|
blockProcess.steps += stft.synthesiseSteps() + 1;
|
||||||
|
blockProcess.steps += 1; // planning the next block
|
||||||
}
|
}
|
||||||
#ifdef SIGNALSMITH_STRETCH_PROFILE_PROCESS_ENDSTEP
|
#ifdef SIGNALSMITH_STRETCH_PROFILE_PROCESS_ENDSTEP
|
||||||
SIGNALSMITH_STRETCH_PROFILE_PROCESS_ENDSTEP();
|
SIGNALSMITH_STRETCH_PROFILE_PROCESS_ENDSTEP();
|
||||||
@ -670,11 +669,13 @@ private:
|
|||||||
step -= splitMainPrediction;
|
step -= splitMainPrediction;
|
||||||
|
|
||||||
if (blockProcess.newSpectrum) {
|
if (blockProcess.newSpectrum) {
|
||||||
|
if (step-- == 0) {
|
||||||
for (auto &bin : channelBands) {
|
for (auto &bin : channelBands) {
|
||||||
bin.prevInput = bin.input;
|
bin.prevInput = bin.input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Produces smoothed energy across all channels
|
// Produces smoothed energy across all channels
|
||||||
static constexpr size_t smoothEnergySteps = 3;
|
static constexpr size_t smoothEnergySteps = 3;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user