comparison data/model/WaveformOversampler.cpp @ 1544:ca43af0dcab7 zoom

Profiler
author Chris Cannam
date Fri, 28 Sep 2018 18:08:04 +0100
parents fa67fbbff8fc
children 074b860a7828
comparison
equal deleted inserted replaced
1543:1f72a44f5638 1544:ca43af0dcab7
12 COPYING included with this distribution for more information. 12 COPYING included with this distribution for more information.
13 */ 13 */
14 14
15 #include "WaveformOversampler.h" 15 #include "WaveformOversampler.h"
16 16
17 #include "base/Profiler.h"
18
17 #include "data/model/DenseTimeValueModel.h" 19 #include "data/model/DenseTimeValueModel.h"
18 20
19 floatvec_t 21 floatvec_t
20 WaveformOversampler::getOversampledData(const DenseTimeValueModel *source, 22 WaveformOversampler::getOversampledData(const DenseTimeValueModel *source,
21 int channel, 23 int channel,
22 sv_frame_t sourceStartFrame, 24 sv_frame_t sourceStartFrame,
23 sv_frame_t sourceFrameCount, 25 sv_frame_t sourceFrameCount,
24 int oversampleBy) 26 int oversampleBy)
25 { 27 {
28 Profiler profiler("WaveformOversampler::getOversampledData");
29
26 // Oversampled at a fixed ratio of m_filterRatio 30 // Oversampled at a fixed ratio of m_filterRatio
27 floatvec_t fixedRatio = getFixedRatioData(source, channel, 31 floatvec_t fixedRatio = getFixedRatioData(source, channel,
28 sourceStartFrame, 32 sourceStartFrame,
29 sourceFrameCount); 33 sourceFrameCount);
30 sv_frame_t fixedCount = fixedRatio.size(); 34 sv_frame_t fixedCount = fixedRatio.size();
52 WaveformOversampler::getFixedRatioData(const DenseTimeValueModel *source, 56 WaveformOversampler::getFixedRatioData(const DenseTimeValueModel *source,
53 int channel, 57 int channel,
54 sv_frame_t sourceStartFrame, 58 sv_frame_t sourceStartFrame,
55 sv_frame_t sourceFrameCount) 59 sv_frame_t sourceFrameCount)
56 { 60 {
61 Profiler profiler("WaveformOversampler::getFixedRatioData");
62
57 sv_frame_t sourceLength = source->getEndFrame(); 63 sv_frame_t sourceLength = source->getEndFrame();
58 64
59 if (sourceStartFrame + sourceFrameCount > sourceLength) { 65 if (sourceStartFrame + sourceFrameCount > sourceLength) {
60 sourceFrameCount = sourceLength - sourceStartFrame; 66 sourceFrameCount = sourceLength - sourceStartFrame;
61 if (sourceFrameCount <= 0) return {}; 67 if (sourceFrameCount <= 0) return {};