From dcf0a3e475e55642639a65ac7ab97c038ba5a331 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Mar 2023 12:33:19 +0100 Subject: [PATCH] pcm/Normalizer: remove `clipped` (only written to, never read) --- src/pcm/Normalizer.cxx | 4 ---- src/pcm/Normalizer.hxx | 5 ----- 2 files changed, 9 deletions(-) diff --git a/src/pcm/Normalizer.cxx b/src/pcm/Normalizer.cxx index 64e484b8e..2b3f2af82 100644 --- a/src/pcm/Normalizer.cxx +++ b/src/pcm/Normalizer.cxx @@ -63,8 +63,6 @@ PcmNormalizer::ProcessS16(int16_t *audio, std::size_t count) noexcept curGain = 1 << 10; const int delta = (newGain - curGain) / (int)ramp; - auto &clipped_ = clipped[slot]; - clipped_ = 0; for (std::size_t i = 0; i < count; i++) { int sample; @@ -72,11 +70,9 @@ PcmNormalizer::ProcessS16(int16_t *audio, std::size_t count) noexcept sample = audio[i] * curGain >> 10; if (sample < -32768) { - clipped_ += -32768 - sample; sample = -32768; } else if (sample > 32767) { - clipped_ += sample - 32767; sample = 32767; } audio[i] = sample; diff --git a/src/pcm/Normalizer.hxx b/src/pcm/Normalizer.hxx index 2191809f3..507df73be 100644 --- a/src/pcm/Normalizer.hxx +++ b/src/pcm/Normalizer.hxx @@ -23,9 +23,6 @@ class PcmNormalizer { //! History of the gain values int *const gain; - //! History of clip amounts - int *const clipped; - std::size_t pos = 0; const std::size_t bufsz; @@ -33,7 +30,6 @@ public: PcmNormalizer(std::size_t history=400) noexcept :peaks(new int[history]{}), gain(new int[history]{}), - clipped(new int[history]{}), bufsz(history) { } @@ -41,7 +37,6 @@ public: ~PcmNormalizer() noexcept { delete[] peaks; delete[] gain; - delete[] clipped; } //! Process 16-bit signed data