Qualify cmath functions.
Use std:: qualified std::log10, std::log, std::floor and std::sin. Bug: None Change-Id: Ia78463f1505fcc5941f4c5ef66fc9346d9523cd4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128080 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27141}
This commit is contained in:
committed by
Commit Bot
parent
bfe49481f8
commit
dbce09003d
@ -19,6 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
@ -446,8 +447,8 @@ static void UpdateLogRatioMetric(Stats* metric,
|
||||
RTC_CHECK(numerator >= 0);
|
||||
RTC_CHECK(denominator >= 0);
|
||||
|
||||
const float log_numerator = log10(numerator + 1e-10f);
|
||||
const float log_denominator = log10(denominator + 1e-10f);
|
||||
const float log_numerator = std::log10(numerator + 1e-10f);
|
||||
const float log_denominator = std::log10(denominator + 1e-10f);
|
||||
metric->instant = 10.0f * (log_numerator - log_denominator);
|
||||
|
||||
// Max.
|
||||
@ -1110,10 +1111,10 @@ static void FormSuppressionGain(AecCore* aec,
|
||||
// preferred.
|
||||
memcpy(hNlPref, &hNl[minPrefBand], sizeof(float) * prefBandSize);
|
||||
qsort(hNlPref, prefBandSize, sizeof(float), CmpFloat);
|
||||
hNlFb =
|
||||
hNlPref[static_cast<int>(floor(prefBandQuant * (prefBandSize - 1)))];
|
||||
hNlFb = hNlPref[static_cast<int>(
|
||||
std::floor(prefBandQuant * (prefBandSize - 1)))];
|
||||
hNlFbLow = hNlPref[static_cast<int>(
|
||||
floor(prefBandQuantLow * (prefBandSize - 1)))];
|
||||
std::floor(prefBandQuantLow * (prefBandSize - 1)))];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1136,7 +1137,7 @@ static void FormSuppressionGain(AecCore* aec,
|
||||
aec->hNlMinCtr = 0;
|
||||
aec->overDrive = WEBRTC_SPL_MAX(
|
||||
kTargetSupp[aec->nlp_mode] /
|
||||
static_cast<float>(log(aec->hNlFbMin + 1e-10f) + 1e-10f),
|
||||
static_cast<float>(std::log(aec->hNlFbMin + 1e-10f) + 1e-10f),
|
||||
min_overdrive[aec->nlp_mode]);
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -46,8 +47,8 @@ void ProduceDecimatedSinusoidalOutputPower(int sample_rate_hz,
|
||||
|
||||
// Produce a sinusoid of the specified frequency.
|
||||
for (size_t k = 0; k < kBlockSize * kNumBlocks; ++k) {
|
||||
input[k] =
|
||||
32767.f * sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
input[k] = 32767.f * std::sin(2.f * kPi * sinusoidal_frequency_hz * k /
|
||||
sample_rate_hz);
|
||||
}
|
||||
|
||||
Decimator decimator(down_sampling_factor);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <stddef.h>
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
|
||||
#include "api/array_view.h"
|
||||
@ -171,7 +172,7 @@ EchoRemoverImpl::~EchoRemoverImpl() = default;
|
||||
|
||||
void EchoRemoverImpl::GetMetrics(EchoControl::Metrics* metrics) const {
|
||||
// Echo return loss (ERL) is inverted to go from gain to attenuation.
|
||||
metrics->echo_return_loss = -10.0 * log10(aec_state_.ErlTimeDomain());
|
||||
metrics->echo_return_loss = -10.0 * std::log10(aec_state_.ErlTimeDomain());
|
||||
metrics->echo_return_loss_enhancement =
|
||||
Log2TodB(aec_state_.FullBandErleLog2());
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
@ -314,7 +315,7 @@ int TransformDbMetricForReporting(bool negate,
|
||||
float offset,
|
||||
float scaling,
|
||||
float value) {
|
||||
float new_value = 10.f * log10(value * scaling + 1e-10f) + offset;
|
||||
float new_value = 10.f * std::log10(value * scaling + 1e-10f) + offset;
|
||||
if (negate) {
|
||||
new_value = -new_value;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "modules/audio_processing/aec3/echo_remover_metrics.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "modules/audio_processing/aec3/aec3_fft.h"
|
||||
#include "modules/audio_processing/aec3/aec_state.h"
|
||||
@ -67,7 +68,7 @@ TEST(TransformDbMetricForReporting, DbFsScaling) {
|
||||
fft.ZeroPaddedFft(x, Aec3Fft::Window::kRectangular, &X);
|
||||
X.Spectrum(Aec3Optimization::kNone, X2);
|
||||
|
||||
float offset = -10.f * log10(32768.f * 32768.f);
|
||||
float offset = -10.f * std::log10(32768.f * 32768.f);
|
||||
EXPECT_NEAR(offset, -90.3f, 0.1f);
|
||||
EXPECT_EQ(
|
||||
static_cast<int>(30.3f),
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "api/array_view.h"
|
||||
@ -35,8 +36,8 @@ void ProduceSinusoid(int sample_rate_hz,
|
||||
// Produce a sinusoid of the specified frequency.
|
||||
for (size_t k = *sample_counter, j = 0; k < (*sample_counter + kBlockSize);
|
||||
++k, ++j) {
|
||||
x[j] =
|
||||
32767.f * sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
x[j] = 32767.f *
|
||||
std::sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
}
|
||||
*sample_counter = *sample_counter + kBlockSize;
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ class ReverbModelEstimatorTest {
|
||||
void RunEstimator();
|
||||
float GetDecay() { return estimated_decay_; }
|
||||
float GetTrueDecay() { return kTruePowerDecay; }
|
||||
float GetPowerTailDb() { return 10.f * log10(estimated_power_tail_); }
|
||||
float GetTruePowerTailDb() { return 10.f * log10(true_power_tail_); }
|
||||
float GetPowerTailDb() { return 10.f * std::log10(estimated_power_tail_); }
|
||||
float GetTruePowerTailDb() { return 10.f * std::log10(true_power_tail_); }
|
||||
|
||||
private:
|
||||
void CreateImpulseResponseWithDecay();
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
|
||||
#include "test/gtest.h"
|
||||
@ -28,8 +29,8 @@ void ProduceSinusoid(int sample_rate_hz,
|
||||
// Produce a sinusoid of the specified frequency.
|
||||
for (size_t k = *sample_counter, j = 0; k < (*sample_counter + kBlockSize);
|
||||
++k, ++j) {
|
||||
x[j] =
|
||||
32767.f * sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
x[j] = 32767.f *
|
||||
std::sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
}
|
||||
*sample_counter = *sample_counter + kBlockSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user