Mercurial > hg > svcore
comparison data/model/WaveformOversampler.cpp @ 1745:074b860a7828 by-id
Use reference rather than bare pointer
author | Chris Cannam |
---|---|
date | Tue, 02 Jul 2019 14:08:25 +0100 |
parents | ca43af0dcab7 |
children |
comparison
equal
deleted
inserted
replaced
1744:b92bdcd4954b | 1745:074b860a7828 |
---|---|
17 #include "base/Profiler.h" | 17 #include "base/Profiler.h" |
18 | 18 |
19 #include "data/model/DenseTimeValueModel.h" | 19 #include "data/model/DenseTimeValueModel.h" |
20 | 20 |
21 floatvec_t | 21 floatvec_t |
22 WaveformOversampler::getOversampledData(const DenseTimeValueModel *source, | 22 WaveformOversampler::getOversampledData(const DenseTimeValueModel &source, |
23 int channel, | 23 int channel, |
24 sv_frame_t sourceStartFrame, | 24 sv_frame_t sourceStartFrame, |
25 sv_frame_t sourceFrameCount, | 25 sv_frame_t sourceFrameCount, |
26 int oversampleBy) | 26 int oversampleBy) |
27 { | 27 { |
51 | 51 |
52 return result; | 52 return result; |
53 } | 53 } |
54 | 54 |
55 floatvec_t | 55 floatvec_t |
56 WaveformOversampler::getFixedRatioData(const DenseTimeValueModel *source, | 56 WaveformOversampler::getFixedRatioData(const DenseTimeValueModel &source, |
57 int channel, | 57 int channel, |
58 sv_frame_t sourceStartFrame, | 58 sv_frame_t sourceStartFrame, |
59 sv_frame_t sourceFrameCount) | 59 sv_frame_t sourceFrameCount) |
60 { | 60 { |
61 Profiler profiler("WaveformOversampler::getFixedRatioData"); | 61 Profiler profiler("WaveformOversampler::getFixedRatioData"); |
62 | 62 |
63 sv_frame_t sourceLength = source->getEndFrame(); | 63 sv_frame_t sourceLength = source.getEndFrame(); |
64 | 64 |
65 if (sourceStartFrame + sourceFrameCount > sourceLength) { | 65 if (sourceStartFrame + sourceFrameCount > sourceLength) { |
66 sourceFrameCount = sourceLength - sourceStartFrame; | 66 sourceFrameCount = sourceLength - sourceStartFrame; |
67 if (sourceFrameCount <= 0) return {}; | 67 if (sourceFrameCount <= 0) return {}; |
68 } | 68 } |
82 sv_frame_t i1 = sourceStartFrame + sourceFrameCount + filterTailIn; | 82 sv_frame_t i1 = sourceStartFrame + sourceFrameCount + filterTailIn; |
83 if (i1 > sourceLength) { | 83 if (i1 > sourceLength) { |
84 i1 = sourceLength; | 84 i1 = sourceLength; |
85 } | 85 } |
86 | 86 |
87 floatvec_t sourceData = source->getData(channel, i0, i1 - i0); | 87 floatvec_t sourceData = source.getData(channel, i0, i1 - i0); |
88 | 88 |
89 for (sv_frame_t i = i0; i < i1; ++i) { | 89 for (sv_frame_t i = i0; i < i1; ++i) { |
90 float v = sourceData[i - i0]; | 90 float v = sourceData[i - i0]; |
91 sv_frame_t outOffset = | 91 sv_frame_t outOffset = |
92 (i - sourceStartFrame) * m_filterRatio - filterTailOut; | 92 (i - sourceStartFrame) * m_filterRatio - filterTailOut; |