pcm/Normalizer: eliminate the local variable slot
This commit is contained in:
parent
2ea634c302
commit
f323fc48d7
@ -15,8 +15,6 @@ PcmNormalizer::ProcessS16(int16_t *gcc_restrict dest,
|
|||||||
constexpr SampleFormat format = SampleFormat::S16;
|
constexpr SampleFormat format = SampleFormat::S16;
|
||||||
using Traits = SampleTraits<format>;
|
using Traits = SampleTraits<format>;
|
||||||
|
|
||||||
const int slot = (pos + 1) % bufsz;
|
|
||||||
|
|
||||||
int peakVal = 1, peakPos = 0;
|
int peakVal = 1, peakPos = 0;
|
||||||
for (std::size_t i = 0; i < src.size(); i++) {
|
for (std::size_t i = 0; i < src.size(); i++) {
|
||||||
int val = src[i];
|
int val = src[i];
|
||||||
@ -28,7 +26,9 @@ PcmNormalizer::ProcessS16(int16_t *gcc_restrict dest,
|
|||||||
peakPos = i;
|
peakPos = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
peaks[slot] = peakVal;
|
|
||||||
|
pos = (pos + 1) % bufsz;
|
||||||
|
peaks[pos] = peakVal;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < bufsz; i++) {
|
for (std::size_t i = 0; i < bufsz; i++) {
|
||||||
if (peaks[i] > peakVal)
|
if (peaks[i] > peakVal)
|
||||||
@ -85,6 +85,4 @@ PcmNormalizer::ProcessS16(int16_t *gcc_restrict dest,
|
|||||||
//! Amplify the sample
|
//! Amplify the sample
|
||||||
*dest++ = PcmClamp<format>(sample * curGain >> 10);
|
*dest++ = PcmClamp<format>(sample * curGain >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = slot;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user