Qualify cmath function calls
Use the C++-style stdlib headers, add `std::` prefix, in order to avoid implicit casts to double. Bug: None Change-Id: I78d9caaee715be341d2480c6d5e769068966d577 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133625 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Oleh Prypin <oprypin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27905}
This commit is contained in:
parent
fb0878197e
commit
199295882d
@ -34,7 +34,7 @@ float ProcessForRms(AudioFrameView<const float> frame) {
|
||||
for (const auto& x : frame.channel(0)) {
|
||||
rms += x * x;
|
||||
}
|
||||
return sqrt(rms / frame.samples_per_channel());
|
||||
return std::sqrt(rms / frame.samples_per_channel());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
|
||||
#include "modules/audio_processing/rms_level.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
@ -36,7 +36,7 @@ int ComputeRms(float mean_square) {
|
||||
const float mean_square_norm = mean_square / kMaxSquaredLevel;
|
||||
RTC_DCHECK_GT(mean_square_norm, kMinLevel);
|
||||
// 20log_10(x^0.5) = 10log_10(x)
|
||||
const float rms = 10.f * log10(mean_square_norm);
|
||||
const float rms = 10.f * std::log10(mean_square_norm);
|
||||
RTC_DCHECK_LE(rms, 0.f);
|
||||
RTC_DCHECK_GT(rms, -RmsLevel::kMinLevelDb);
|
||||
// Return the negated value.
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#include "modules/audio_processing/transient/transient_detector.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "modules/audio_processing/transient/common.h"
|
||||
#include "modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h"
|
||||
@ -125,9 +125,9 @@ float TransientDetector::Detect(const float* data,
|
||||
const float kVerticalScaling = 0.5f;
|
||||
const float kVerticalShift = 1.f;
|
||||
|
||||
result =
|
||||
(cos(result * horizontal_scaling + kHorizontalShift) + kVerticalShift) *
|
||||
kVerticalScaling;
|
||||
result = (std::cos(result * horizontal_scaling + kHorizontalShift) +
|
||||
kVerticalShift) *
|
||||
kVerticalScaling;
|
||||
result *= result;
|
||||
}
|
||||
|
||||
@ -161,9 +161,10 @@ float TransientDetector::ReferenceDetectionValue(const float* data,
|
||||
return 1.f;
|
||||
}
|
||||
RTC_DCHECK_NE(0, reference_energy_);
|
||||
float result = 1.f / (1.f + exp(kReferenceNonLinearity *
|
||||
(kEnergyRatioThreshold -
|
||||
reference_energy / reference_energy_)));
|
||||
float result =
|
||||
1.f / (1.f + std::exp(kReferenceNonLinearity *
|
||||
(kEnergyRatioThreshold -
|
||||
reference_energy / reference_energy_)));
|
||||
reference_energy_ =
|
||||
kMemory * reference_energy_ + (1.f - kMemory) * reference_energy;
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
#include "modules/audio_processing/transient/transient_suppressor.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
@ -139,9 +138,9 @@ int TransientSuppressor::Initialize(int sample_rate_hz,
|
||||
for (size_t i = 0; i < complex_analysis_length_; ++i) {
|
||||
mean_factor_[i] =
|
||||
kFactorHeight /
|
||||
(1.f + exp(kLowSlope * static_cast<int>(i - kMinVoiceBin))) +
|
||||
(1.f + std::exp(kLowSlope * static_cast<int>(i - kMinVoiceBin))) +
|
||||
kFactorHeight /
|
||||
(1.f + exp(kHighSlope * static_cast<int>(kMaxVoiceBin - i)));
|
||||
(1.f + std::exp(kHighSlope * static_cast<int>(kMaxVoiceBin - i)));
|
||||
}
|
||||
detector_smoothed_ = 0.f;
|
||||
keypress_counter_ = 0;
|
||||
@ -352,7 +351,8 @@ void TransientSuppressor::UpdateBuffers(float* data) {
|
||||
// If a restoration takes place, the |magnitudes_| are updated to the new value.
|
||||
void TransientSuppressor::HardRestoration(float* spectral_mean) {
|
||||
const float detector_result =
|
||||
1.f - pow(1.f - detector_smoothed_, using_reference_ ? 200.f : 50.f);
|
||||
1.f -
|
||||
std::pow(1.f - detector_smoothed_, using_reference_ ? 200.f : 50.f);
|
||||
// To restore, we get the peaks in the spectrum. If higher than the previous
|
||||
// spectral mean we adjust them.
|
||||
for (size_t i = 0; i < complex_analysis_length_; ++i) {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "modules/rtp_rtcp/source/receive_statistics_impl.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -329,7 +329,7 @@ bool StreamStatisticianImpl::IsRetransmitOfOldPacket(
|
||||
int64_t max_delay_ms = 0;
|
||||
|
||||
// Jitter standard deviation in samples.
|
||||
float jitter_std = sqrt(static_cast<float>(jitter_q4_ >> 4));
|
||||
float jitter_std = std::sqrt(static_cast<float>(jitter_q4_ >> 4));
|
||||
|
||||
// 2 times the standard deviation => 95% confidence.
|
||||
// And transform to milliseconds by dividing by the frequency in kHz.
|
||||
|
||||
@ -678,7 +678,7 @@ void SendStatisticsProxy::OnEncodedFrameTimeMeasured(int encode_time_ms,
|
||||
rtc::CritScope lock(&crit_);
|
||||
uma_container_->encode_time_counter_.Add(encode_time_ms);
|
||||
encode_time_.Apply(1.0f, encode_time_ms);
|
||||
stats_.avg_encode_time_ms = round(encode_time_.filtered());
|
||||
stats_.avg_encode_time_ms = std::round(encode_time_.filtered());
|
||||
stats_.total_encode_time_ms += encode_time_ms;
|
||||
stats_.encode_usage_percent = encode_usage_percent;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user