pcm/Normalizer: remove `clipped` (only written to, never read)
This commit is contained in:
parent
e990d6eecc
commit
dcf0a3e475
|
@ -63,8 +63,6 @@ PcmNormalizer::ProcessS16(int16_t *audio, std::size_t count) noexcept
|
||||||
curGain = 1 << 10;
|
curGain = 1 << 10;
|
||||||
const int delta = (newGain - curGain) / (int)ramp;
|
const int delta = (newGain - curGain) / (int)ramp;
|
||||||
|
|
||||||
auto &clipped_ = clipped[slot];
|
|
||||||
clipped_ = 0;
|
|
||||||
for (std::size_t i = 0; i < count; i++) {
|
for (std::size_t i = 0; i < count; i++) {
|
||||||
int sample;
|
int sample;
|
||||||
|
|
||||||
|
@ -72,11 +70,9 @@ PcmNormalizer::ProcessS16(int16_t *audio, std::size_t count) noexcept
|
||||||
sample = audio[i] * curGain >> 10;
|
sample = audio[i] * curGain >> 10;
|
||||||
if (sample < -32768)
|
if (sample < -32768)
|
||||||
{
|
{
|
||||||
clipped_ += -32768 - sample;
|
|
||||||
sample = -32768;
|
sample = -32768;
|
||||||
} else if (sample > 32767)
|
} else if (sample > 32767)
|
||||||
{
|
{
|
||||||
clipped_ += sample - 32767;
|
|
||||||
sample = 32767;
|
sample = 32767;
|
||||||
}
|
}
|
||||||
audio[i] = sample;
|
audio[i] = sample;
|
||||||
|
|
|
@ -23,9 +23,6 @@ class PcmNormalizer {
|
||||||
//! History of the gain values
|
//! History of the gain values
|
||||||
int *const gain;
|
int *const gain;
|
||||||
|
|
||||||
//! History of clip amounts
|
|
||||||
int *const clipped;
|
|
||||||
|
|
||||||
std::size_t pos = 0;
|
std::size_t pos = 0;
|
||||||
const std::size_t bufsz;
|
const std::size_t bufsz;
|
||||||
|
|
||||||
|
@ -33,7 +30,6 @@ public:
|
||||||
PcmNormalizer(std::size_t history=400) noexcept
|
PcmNormalizer(std::size_t history=400) noexcept
|
||||||
:peaks(new int[history]{}),
|
:peaks(new int[history]{}),
|
||||||
gain(new int[history]{}),
|
gain(new int[history]{}),
|
||||||
clipped(new int[history]{}),
|
|
||||||
bufsz(history)
|
bufsz(history)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -41,7 +37,6 @@ public:
|
||||||
~PcmNormalizer() noexcept {
|
~PcmNormalizer() noexcept {
|
||||||
delete[] peaks;
|
delete[] peaks;
|
||||||
delete[] gain;
|
delete[] gain;
|
||||||
delete[] clipped;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Process 16-bit signed data
|
//! Process 16-bit signed data
|
||||||
|
|
Loading…
Reference in New Issue