/* * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "modules/audio_processing/rms_level.h" #include <algorithm> #include <cmath> #include <numeric> #include "rtc_base/checks.h" namespace webrtc { namespace { static constexpr float kMaxSquaredLevel = …; // kMinLevel is the level corresponding to kMinLevelDb, that is 10^(-127/10). static constexpr float kMinLevel = …; // Calculates the normalized RMS value from a mean square value. The input // should be the sum of squared samples divided by the number of samples. The // value will be normalized to full range before computing the RMS, wich is // returned as a negated dBfs. That is, 0 is full amplitude while 127 is very // faint. int ComputeRms(float mean_square) { … } } // namespace RmsLevel::RmsLevel() { … } RmsLevel::~RmsLevel() = default; void RmsLevel::Reset() { … } void RmsLevel::Analyze(rtc::ArrayView<const int16_t> data) { … } void RmsLevel::Analyze(rtc::ArrayView<const float> data) { … } void RmsLevel::AnalyzeMuted(size_t length) { … } int RmsLevel::Average() { … } RmsLevel::Levels RmsLevel::AverageAndPeak() { … } void RmsLevel::CheckBlockSize(size_t block_size) { … } } // namespace webrtc