Use backticks not vertical bars to denote variables in comments for /modules/audio_processing
Bug: webrtc:12338 Change-Id: I85bff694dd2ead83c939c4d1945eff82e1296001 No-Presubmit: True Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227161 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34690}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
dc6801c618
commit
0b489303d2
@ -15,7 +15,7 @@
|
||||
namespace webrtc {
|
||||
|
||||
// Transposed direct form I implementation of a bi-quad filter applied to an
|
||||
// input signal |x| to produce an output signal |y|.
|
||||
// input signal `x` to produce an output signal `y`.
|
||||
void BiQuadFilter::Process(rtc::ArrayView<const float> x,
|
||||
rtc::ArrayView<float> y) {
|
||||
for (size_t k = 0; k < x.size(); ++k) {
|
||||
|
||||
@ -64,7 +64,7 @@ void ExpectNearRelative(rtc::ArrayView<const float> expected,
|
||||
rtc::ArrayView<const float> computed,
|
||||
const float tolerance) {
|
||||
// The relative error is undefined when the expected value is 0.
|
||||
// When that happens, check the absolute error instead. |safe_den| is used
|
||||
// When that happens, check the absolute error instead. `safe_den` is used
|
||||
// below to implement such logic.
|
||||
auto safe_den = [](float x) { return (x == 0.f) ? 1.f : std::fabs(x); };
|
||||
ASSERT_EQ(expected.size(), computed.size());
|
||||
|
||||
@ -105,7 +105,7 @@ std::vector<double> SampleLimiterRegion(const LimiterDbGainCurve* limiter) {
|
||||
const auto interval = q.top();
|
||||
q.pop();
|
||||
|
||||
// Split |interval| and enqueue.
|
||||
// Split `interval` and enqueue.
|
||||
double x_split = (interval.x0 + interval.x1) / 2.0;
|
||||
q.emplace(interval.x0, x_split,
|
||||
LimiterUnderApproximationNegativeError(limiter, interval.x0,
|
||||
@ -135,7 +135,7 @@ std::vector<double> SampleLimiterRegion(const LimiterDbGainCurve* limiter) {
|
||||
void PrecomputeKneeApproxParams(const LimiterDbGainCurve* limiter,
|
||||
test::InterpolatedParameters* parameters) {
|
||||
static_assert(kInterpolatedGainCurveKneePoints > 2, "");
|
||||
// Get |kInterpolatedGainCurveKneePoints| - 1 equally spaced points.
|
||||
// Get `kInterpolatedGainCurveKneePoints` - 1 equally spaced points.
|
||||
const std::vector<double> points = test::LinSpace(
|
||||
limiter->knee_start_linear(), limiter->limiter_start_linear(),
|
||||
kInterpolatedGainCurveKneePoints - 1);
|
||||
|
||||
@ -29,8 +29,8 @@ namespace test {
|
||||
|
||||
// Knee and beyond-knee regions approximation parameters.
|
||||
// The gain curve is approximated as a piece-wise linear function.
|
||||
// |approx_params_x_| are the boundaries between adjacent linear pieces,
|
||||
// |approx_params_m_| and |approx_params_q_| are the slope and the y-intercept
|
||||
// `approx_params_x_` are the boundaries between adjacent linear pieces,
|
||||
// `approx_params_m_` and `approx_params_q_` are the slope and the y-intercept
|
||||
// values of each piece.
|
||||
struct InterpolatedParameters {
|
||||
std::array<float, kInterpolatedGainCurveTotalPoints>
|
||||
|
||||
@ -26,7 +26,7 @@ constexpr float kInitialFilterStateLevel = 0.f;
|
||||
constexpr float kAttackFilterConstant = 0.f;
|
||||
// This is computed from kDecayMs by
|
||||
// 10 ** (-1/20 * subframe_duration / kDecayMs).
|
||||
// |subframe_duration| is |kFrameDurationMs / kSubFramesInFrame|.
|
||||
// `subframe_duration` is |kFrameDurationMs / kSubFramesInFrame|.
|
||||
// kDecayMs is defined in agc2_testing_common.h
|
||||
constexpr float kDecayFilterConstant = 0.9998848773724686f;
|
||||
|
||||
|
||||
@ -151,11 +151,11 @@ void InterpolatedGainCurve::UpdateStats(float input_level) const {
|
||||
}
|
||||
|
||||
// Looks up a gain to apply given a non-negative input level.
|
||||
// The cost of this operation depends on the region in which |input_level|
|
||||
// The cost of this operation depends on the region in which `input_level`
|
||||
// falls.
|
||||
// For the identity and the saturation regions the cost is O(1).
|
||||
// For the other regions, namely knee and limiter, the cost is
|
||||
// O(2 + log2(|LightkInterpolatedGainCurveTotalPoints|), plus O(1) for the
|
||||
// O(2 + log2(`LightkInterpolatedGainCurveTotalPoints`), plus O(1) for the
|
||||
// linear interpolation (one product and one sum).
|
||||
float InterpolatedGainCurve::LookUpGainToApply(float input_level) const {
|
||||
UpdateStats(input_level);
|
||||
|
||||
@ -31,7 +31,7 @@ class Limiter {
|
||||
Limiter& operator=(const Limiter& limiter) = delete;
|
||||
~Limiter();
|
||||
|
||||
// Applies limiter and hard-clipping to |signal|.
|
||||
// Applies limiter and hard-clipping to `signal`.
|
||||
void Process(AudioFrameView<float> signal);
|
||||
InterpolatedGainCurve::Stats GetGainCurveStats() const;
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ double LimiterDbGainCurve::GetGainLinear(double input_level_linear) const {
|
||||
input_level_linear;
|
||||
}
|
||||
|
||||
// Computes the first derivative of GetGainLinear() in |x|.
|
||||
// Computes the first derivative of GetGainLinear() in `x`.
|
||||
double LimiterDbGainCurve::GetGainFirstDerivativeLinear(double x) const {
|
||||
// Beyond-knee region only.
|
||||
RTC_CHECK_GE(x, limiter_start_linear_ - 1e-7 * kMaxAbsFloatS16Value);
|
||||
|
||||
@ -40,7 +40,7 @@ AutoCorrelationCalculator::~AutoCorrelationCalculator() = default;
|
||||
// [ y_{m-1} ]
|
||||
// x and y are sub-array of equal length; x is never moved, whereas y slides.
|
||||
// The cross-correlation between y_0 and x corresponds to the auto-correlation
|
||||
// for the maximum pitch period. Hence, the first value in |auto_corr| has an
|
||||
// for the maximum pitch period. Hence, the first value in `auto_corr` has an
|
||||
// inverted lag equal to 0 that corresponds to a lag equal to the maximum
|
||||
// pitch period.
|
||||
void AutoCorrelationCalculator::ComputeOnPitchBuffer(
|
||||
|
||||
@ -31,7 +31,7 @@ class AutoCorrelationCalculator {
|
||||
~AutoCorrelationCalculator();
|
||||
|
||||
// Computes the auto-correlation coefficients for a target pitch interval.
|
||||
// |auto_corr| indexes are inverted lags.
|
||||
// `auto_corr` indexes are inverted lags.
|
||||
void ComputeOnPitchBuffer(
|
||||
rtc::ArrayView<const float, kBufSize12kHz> pitch_buf,
|
||||
rtc::ArrayView<float, kNumLags12kHz> auto_corr);
|
||||
|
||||
@ -52,8 +52,8 @@ constexpr int kBufSize12kHz = kBufSize24kHz / 2;
|
||||
constexpr int kInitialMinPitch12kHz = kInitialMinPitch24kHz / 2;
|
||||
constexpr int kMaxPitch12kHz = kMaxPitch24kHz / 2;
|
||||
static_assert(kMaxPitch12kHz > kInitialMinPitch12kHz, "");
|
||||
// The inverted lags for the pitch interval [|kInitialMinPitch12kHz|,
|
||||
// |kMaxPitch12kHz|] are in the range [0, |kNumLags12kHz|].
|
||||
// The inverted lags for the pitch interval [`kInitialMinPitch12kHz`,
|
||||
// `kMaxPitch12kHz`] are in the range [0, `kNumLags12kHz`].
|
||||
constexpr int kNumLags12kHz = kMaxPitch12kHz - kInitialMinPitch12kHz;
|
||||
|
||||
// 48 kHz constants.
|
||||
|
||||
@ -55,10 +55,10 @@ bool FeaturesExtractor::CheckSilenceComputeFeatures(
|
||||
if (use_high_pass_filter_) {
|
||||
std::array<float, kFrameSize10ms24kHz> samples_filtered;
|
||||
hpf_.Process(samples, samples_filtered);
|
||||
// Feed buffer with the pre-processed version of |samples|.
|
||||
// Feed buffer with the pre-processed version of `samples`.
|
||||
pitch_buf_24kHz_.Push(samples_filtered);
|
||||
} else {
|
||||
// Feed buffer with |samples|.
|
||||
// Feed buffer with `samples`.
|
||||
pitch_buf_24kHz_.Push(samples);
|
||||
}
|
||||
// Extract the LP residual.
|
||||
|
||||
@ -33,7 +33,7 @@ class FeaturesExtractor {
|
||||
void Reset();
|
||||
// Analyzes the samples, computes the feature vector and returns true if
|
||||
// silence is detected (false if not). When silence is detected,
|
||||
// |feature_vector| is partially written and therefore must not be used to
|
||||
// `feature_vector` is partially written and therefore must not be used to
|
||||
// feed the VAD RNN.
|
||||
bool CheckSilenceComputeFeatures(
|
||||
rtc::ArrayView<const float, kFrameSize10ms24kHz> samples,
|
||||
|
||||
@ -29,7 +29,7 @@ constexpr int ceil(int n, int m) {
|
||||
}
|
||||
|
||||
// Number of 10 ms frames required to fill a pitch buffer having size
|
||||
// |kBufSize24kHz|.
|
||||
// `kBufSize24kHz`.
|
||||
constexpr int kNumTestDataFrames = ceil(kBufSize24kHz, kFrameSize10ms24kHz);
|
||||
// Number of samples for the test data.
|
||||
constexpr int kNumTestDataSize = kNumTestDataFrames * kFrameSize10ms24kHz;
|
||||
@ -47,8 +47,8 @@ void CreatePureTone(float amplitude, float freq_hz, rtc::ArrayView<float> dst) {
|
||||
}
|
||||
}
|
||||
|
||||
// Feeds |features_extractor| with |samples| splitting it in 10 ms frames.
|
||||
// For every frame, the output is written into |feature_vector|. Returns true
|
||||
// Feeds `features_extractor` with `samples` splitting it in 10 ms frames.
|
||||
// For every frame, the output is written into `feature_vector`. Returns true
|
||||
// if silence is detected in the last frame.
|
||||
bool FeedTestData(FeaturesExtractor& features_extractor,
|
||||
rtc::ArrayView<const float> samples,
|
||||
|
||||
@ -22,9 +22,9 @@ namespace webrtc {
|
||||
namespace rnn_vad {
|
||||
namespace {
|
||||
|
||||
// Computes auto-correlation coefficients for |x| and writes them in
|
||||
// |auto_corr|. The lag values are in {0, ..., max_lag - 1}, where max_lag
|
||||
// equals the size of |auto_corr|.
|
||||
// Computes auto-correlation coefficients for `x` and writes them in
|
||||
// `auto_corr`. The lag values are in {0, ..., max_lag - 1}, where max_lag
|
||||
// equals the size of `auto_corr`.
|
||||
void ComputeAutoCorrelation(
|
||||
rtc::ArrayView<const float> x,
|
||||
rtc::ArrayView<float, kNumLpcCoefficients> auto_corr) {
|
||||
|
||||
@ -21,14 +21,14 @@ namespace rnn_vad {
|
||||
// Linear predictive coding (LPC) inverse filter length.
|
||||
constexpr int kNumLpcCoefficients = 5;
|
||||
|
||||
// Given a frame |x|, computes a post-processed version of LPC coefficients
|
||||
// Given a frame `x`, computes a post-processed version of LPC coefficients
|
||||
// tailored for pitch estimation.
|
||||
void ComputeAndPostProcessLpcCoefficients(
|
||||
rtc::ArrayView<const float> x,
|
||||
rtc::ArrayView<float, kNumLpcCoefficients> lpc_coeffs);
|
||||
|
||||
// Computes the LP residual for the input frame |x| and the LPC coefficients
|
||||
// |lpc_coeffs|. |y| and |x| can point to the same array for in-place
|
||||
// Computes the LP residual for the input frame `x` and the LPC coefficients
|
||||
// `lpc_coeffs`. `y` and `x` can point to the same array for in-place
|
||||
// computation.
|
||||
void ComputeLpResidual(
|
||||
rtc::ArrayView<const float, kNumLpcCoefficients> lpc_coeffs,
|
||||
|
||||
@ -44,7 +44,7 @@ int PitchEstimator::Estimate(
|
||||
CandidatePitchPeriods pitch_periods = ComputePitchPeriod12kHz(
|
||||
pitch_buffer_12kHz_view, auto_correlation_12kHz_view, cpu_features_);
|
||||
// The refinement is done using the pitch buffer that contains 24 kHz samples.
|
||||
// Therefore, adapt the inverted lags in |pitch_candidates_inv_lags| from 12
|
||||
// Therefore, adapt the inverted lags in `pitch_candidates_inv_lags` from 12
|
||||
// to 24 kHz.
|
||||
pitch_periods.best *= 2;
|
||||
pitch_periods.second_best *= 2;
|
||||
|
||||
@ -54,18 +54,18 @@ int GetPitchPseudoInterpolationOffset(float prev_auto_correlation,
|
||||
float next_auto_correlation) {
|
||||
if ((next_auto_correlation - prev_auto_correlation) >
|
||||
0.7f * (curr_auto_correlation - prev_auto_correlation)) {
|
||||
return 1; // |next_auto_correlation| is the largest auto-correlation
|
||||
return 1; // `next_auto_correlation` is the largest auto-correlation
|
||||
// coefficient.
|
||||
} else if ((prev_auto_correlation - next_auto_correlation) >
|
||||
0.7f * (curr_auto_correlation - next_auto_correlation)) {
|
||||
return -1; // |prev_auto_correlation| is the largest auto-correlation
|
||||
return -1; // `prev_auto_correlation` is the largest auto-correlation
|
||||
// coefficient.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Refines a pitch period |lag| encoded as lag with pseudo-interpolation. The
|
||||
// output sample rate is twice as that of |lag|.
|
||||
// Refines a pitch period `lag` encoded as lag with pseudo-interpolation. The
|
||||
// output sample rate is twice as that of `lag`.
|
||||
int PitchPseudoInterpolationLagPitchBuf(
|
||||
int lag,
|
||||
rtc::ArrayView<const float, kBufSize24kHz> pitch_buffer,
|
||||
@ -217,8 +217,8 @@ int ComputePitchPeriod48kHz(
|
||||
auto_correlation[best_inverted_lag + 1],
|
||||
auto_correlation[best_inverted_lag],
|
||||
auto_correlation[best_inverted_lag - 1]);
|
||||
// TODO(bugs.webrtc.org/9076): When retraining, check if |offset| below should
|
||||
// be subtracted since |inverted_lag| is an inverted lag but offset is a lag.
|
||||
// TODO(bugs.webrtc.org/9076): When retraining, check if `offset` below should
|
||||
// be subtracted since `inverted_lag` is an inverted lag but offset is a lag.
|
||||
return 2 * best_inverted_lag + offset;
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ CandidatePitchPeriods ComputePitchPeriod12kHz(
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update |squared_energy_y| for the next inverted lag.
|
||||
// Update `squared_energy_y` for the next inverted lag.
|
||||
const float y_old = pitch_buffer[inverted_lag];
|
||||
const float y_new = pitch_buffer[inverted_lag + kFrameSize20ms12kHz];
|
||||
denominator -= y_old * y_old;
|
||||
@ -458,8 +458,8 @@ PitchInfo ComputeExtendedPitchPeriod48kHz(
|
||||
initial_pitch.period, /*multiplier=*/1, period_divisor);
|
||||
RTC_DCHECK_GE(alternative_pitch.period, kMinPitch24kHz);
|
||||
// When looking at |alternative_pitch.period|, we also look at one of its
|
||||
// sub-harmonics. |kSubHarmonicMultipliers| is used to know where to look.
|
||||
// |period_divisor| == 2 is a special case since |dual_alternative_period|
|
||||
// sub-harmonics. `kSubHarmonicMultipliers` is used to know where to look.
|
||||
// `period_divisor` == 2 is a special case since `dual_alternative_period`
|
||||
// might be greater than the maximum pitch period.
|
||||
int dual_alternative_period = GetAlternativePitchPeriod(
|
||||
initial_pitch.period, kSubHarmonicMultipliers[period_divisor - 2],
|
||||
@ -473,7 +473,7 @@ PitchInfo ComputeExtendedPitchPeriod48kHz(
|
||||
"coincide.";
|
||||
// Compute an auto-correlation score for the primary pitch candidate
|
||||
// |alternative_pitch.period| by also looking at its possible sub-harmonic
|
||||
// |dual_alternative_period|.
|
||||
// `dual_alternative_period`.
|
||||
const float xy_primary_period = ComputeAutoCorrelation(
|
||||
kMaxPitch24kHz - alternative_pitch.period, pitch_buffer, vector_math);
|
||||
// TODO(webrtc:10480): Copy `xy_primary_period` if the secondary period is
|
||||
|
||||
@ -35,7 +35,7 @@ class RingBuffer {
|
||||
~RingBuffer() = default;
|
||||
// Set the ring buffer values to zero.
|
||||
void Reset() { buffer_.fill(0); }
|
||||
// Replace the least recently pushed array in the buffer with |new_values|.
|
||||
// Replace the least recently pushed array in the buffer with `new_values`.
|
||||
void Push(rtc::ArrayView<const T, S> new_values) {
|
||||
std::memcpy(buffer_.data() + S * tail_, new_values.data(), S * sizeof(T));
|
||||
tail_ += 1;
|
||||
@ -43,7 +43,7 @@ class RingBuffer {
|
||||
tail_ = 0;
|
||||
}
|
||||
// Return an array view onto the array with a given delay. A view on the last
|
||||
// and least recently push array is returned when |delay| is 0 and N - 1
|
||||
// and least recently push array is returned when `delay` is 0 and N - 1
|
||||
// respectively.
|
||||
rtc::ArrayView<const T, S> GetArrayView(int delay) const {
|
||||
RTC_DCHECK_LE(0, delay);
|
||||
|
||||
@ -32,7 +32,7 @@ std::vector<float> GetScaledParams(rtc::ArrayView<const int8_t> params) {
|
||||
|
||||
// TODO(bugs.chromium.org/10480): Hard-code optimized layout and remove this
|
||||
// function to improve setup time.
|
||||
// Casts and scales |weights| and re-arranges the layout.
|
||||
// Casts and scales `weights` and re-arranges the layout.
|
||||
std::vector<float> PreprocessWeights(rtc::ArrayView<const int8_t> weights,
|
||||
int output_size) {
|
||||
if (output_size == 1) {
|
||||
|
||||
@ -24,7 +24,7 @@ constexpr int kNumGruGates = 3; // Update, reset, output.
|
||||
std::vector<float> PreprocessGruTensor(rtc::ArrayView<const int8_t> tensor_src,
|
||||
int output_size) {
|
||||
// Transpose, cast and scale.
|
||||
// |n| is the size of the first dimension of the 3-dim tensor |weights|.
|
||||
// `n` is the size of the first dimension of the 3-dim tensor `weights`.
|
||||
const int n = rtc::CheckedDivExact(rtc::dchecked_cast<int>(tensor_src.size()),
|
||||
output_size * kNumGruGates);
|
||||
const int stride_src = kNumGruGates * output_size;
|
||||
|
||||
@ -49,7 +49,7 @@ void DumpPerfStats(int num_samples,
|
||||
// constant below to true in order to write new expected output binary files.
|
||||
constexpr bool kWriteComputedOutputToFile = false;
|
||||
|
||||
// Avoids that one forgets to set |kWriteComputedOutputToFile| back to false
|
||||
// Avoids that one forgets to set `kWriteComputedOutputToFile` back to false
|
||||
// when the expected output files are re-exported.
|
||||
TEST(RnnVadTest, CheckWriteComputedOutputIsFalse) {
|
||||
ASSERT_FALSE(kWriteComputedOutputToFile)
|
||||
|
||||
@ -50,7 +50,7 @@ void TestSequenceBufferPushOp() {
|
||||
for (int i = 0; i < N; ++i)
|
||||
chunk[i] = static_cast<T>(i + 1);
|
||||
seq_buf.Push(chunk);
|
||||
// With the next Push(), |last| will be moved left by N positions.
|
||||
// With the next Push(), `last` will be moved left by N positions.
|
||||
const T last = chunk[N - 1];
|
||||
for (int i = 0; i < N; ++i)
|
||||
chunk[i] = static_cast<T>(last + i + 1);
|
||||
|
||||
@ -23,7 +23,7 @@ namespace {
|
||||
|
||||
// Weights for each FFT coefficient for each Opus band (Nyquist frequency
|
||||
// excluded). The size of each band is specified in
|
||||
// |kOpusScaleNumBins24kHz20ms|.
|
||||
// `kOpusScaleNumBins24kHz20ms`.
|
||||
constexpr std::array<float, kFrameSize20ms24kHz / 2> kOpusBandWeights24kHz20ms =
|
||||
{{
|
||||
0.f, 0.25f, 0.5f, 0.75f, // Band 0
|
||||
|
||||
@ -50,8 +50,8 @@ class SpectralCorrelator {
|
||||
~SpectralCorrelator();
|
||||
|
||||
// Computes the band-wise spectral auto-correlations.
|
||||
// |x| must:
|
||||
// - have size equal to |kFrameSize20ms24kHz|;
|
||||
// `x` must:
|
||||
// - have size equal to `kFrameSize20ms24kHz`;
|
||||
// - be encoded as vectors of interleaved real-complex FFT coefficients
|
||||
// where x[1] = y[1] = 0 (the Nyquist frequency coefficient is omitted).
|
||||
void ComputeAutoCorrelation(
|
||||
@ -59,8 +59,8 @@ class SpectralCorrelator {
|
||||
rtc::ArrayView<float, kOpusBands24kHz> auto_corr) const;
|
||||
|
||||
// Computes the band-wise spectral cross-correlations.
|
||||
// |x| and |y| must:
|
||||
// - have size equal to |kFrameSize20ms24kHz|;
|
||||
// `x` and `y` must:
|
||||
// - have size equal to `kFrameSize20ms24kHz`;
|
||||
// - be encoded as vectors of interleaved real-complex FFT coefficients where
|
||||
// x[1] = y[1] = 0 (the Nyquist frequency coefficient is omitted).
|
||||
void ComputeCrossCorrelation(
|
||||
@ -82,12 +82,12 @@ void ComputeSmoothedLogMagnitudeSpectrum(
|
||||
|
||||
// TODO(bugs.webrtc.org/10480): Move to anonymous namespace in
|
||||
// spectral_features.cc. Creates a DCT table for arrays having size equal to
|
||||
// |kNumBands|. Declared here for unit testing.
|
||||
// `kNumBands`. Declared here for unit testing.
|
||||
std::array<float, kNumBands * kNumBands> ComputeDctTable();
|
||||
|
||||
// TODO(bugs.webrtc.org/10480): Move to anonymous namespace in
|
||||
// spectral_features.cc. Computes DCT for |in| given a pre-computed DCT table.
|
||||
// In-place computation is not allowed and |out| can be smaller than |in| in
|
||||
// spectral_features.cc. Computes DCT for `in` given a pre-computed DCT table.
|
||||
// In-place computation is not allowed and `out` can be smaller than `in` in
|
||||
// order to only compute the first DCT coefficients. Declared here for unit
|
||||
// testing.
|
||||
void ComputeDct(rtc::ArrayView<const float> in,
|
||||
|
||||
@ -28,7 +28,7 @@ namespace webrtc {
|
||||
namespace rnn_vad {
|
||||
namespace {
|
||||
|
||||
// Generates the values for the array named |kOpusBandWeights24kHz20ms| in the
|
||||
// Generates the values for the array named `kOpusBandWeights24kHz20ms` in the
|
||||
// anonymous namespace of the .cc file, which is the array of FFT coefficient
|
||||
// weights for the Opus scale triangular filters.
|
||||
std::vector<float> ComputeTriangularFiltersWeights() {
|
||||
@ -66,7 +66,7 @@ TEST(RnnVadTest, TestOpusScaleBoundaries) {
|
||||
|
||||
// Checks that the computed triangular filters weights for the Opus scale are
|
||||
// monotonic withing each Opus band. This test should only be enabled when
|
||||
// ComputeTriangularFiltersWeights() is changed and |kOpusBandWeights24kHz20ms|
|
||||
// ComputeTriangularFiltersWeights() is changed and `kOpusBandWeights24kHz20ms`
|
||||
// is updated accordingly.
|
||||
TEST(RnnVadTest, DISABLED_TestOpusScaleWeights) {
|
||||
auto weights = ComputeTriangularFiltersWeights();
|
||||
|
||||
@ -46,9 +46,9 @@ class SymmetricMatrixBuffer {
|
||||
buf_.fill(0);
|
||||
}
|
||||
// Pushes the results from the comparison between the most recent item and
|
||||
// those that are still in the ring buffer. The first element in |values| must
|
||||
// those that are still in the ring buffer. The first element in `values` must
|
||||
// correspond to the comparison between the most recent item and the second
|
||||
// most recent one in the ring buffer, whereas the last element in |values|
|
||||
// most recent one in the ring buffer, whereas the last element in `values`
|
||||
// must correspond to the comparison between the most recent item and the
|
||||
// oldest one in the ring buffer.
|
||||
void Push(rtc::ArrayView<T, S - 1> values) {
|
||||
@ -64,7 +64,7 @@ class SymmetricMatrixBuffer {
|
||||
}
|
||||
}
|
||||
// Reads the value that corresponds to comparison of two items in the ring
|
||||
// buffer having delay |delay1| and |delay2|. The two arguments must not be
|
||||
// buffer having delay `delay1` and `delay2`. The two arguments must not be
|
||||
// equal and both must be in {0, ..., S - 1}.
|
||||
T GetValue(int delay1, int delay2) const {
|
||||
int row = S - 1 - delay1;
|
||||
|
||||
@ -58,17 +58,17 @@ TEST(RnnVadTest, SymmetricMatrixBufferUseCase) {
|
||||
SCOPED_TRACE(t);
|
||||
const int t_removed = ring_buf.GetArrayView(kRingBufSize - 1)[0];
|
||||
ring_buf.Push({&t, 1});
|
||||
// The head of the ring buffer is |t|.
|
||||
// The head of the ring buffer is `t`.
|
||||
ASSERT_EQ(t, ring_buf.GetArrayView(0)[0]);
|
||||
// Create the comparisons between |t| and the older elements in the ring
|
||||
// Create the comparisons between `t` and the older elements in the ring
|
||||
// buffer.
|
||||
std::array<PairType, kRingBufSize - 1> new_comparions;
|
||||
for (int i = 0; i < kRingBufSize - 1; ++i) {
|
||||
// Start comparing |t| to the second newest element in the ring buffer.
|
||||
// Start comparing `t` to the second newest element in the ring buffer.
|
||||
const int delay = i + 1;
|
||||
const auto t_prev = ring_buf.GetArrayView(delay)[0];
|
||||
ASSERT_EQ(std::max(0, t - delay), t_prev);
|
||||
// Compare the last element |t| with |t_prev|.
|
||||
// Compare the last element `t` with `t_prev`.
|
||||
new_comparions[i].first = t_prev;
|
||||
new_comparions[i].second = t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user