Reformat existing code. There should be no functional effects.
This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)
BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org
Review URL: https://codereview.webrtc.org/1172163004
Cr-Commit-Position: refs/heads/master@{#9420}
diff --git a/webrtc/modules/audio_coding/neteq/expand.cc b/webrtc/modules/audio_coding/neteq/expand.cc
index d5f0f9c..bde6559 100644
--- a/webrtc/modules/audio_coding/neteq/expand.cc
+++ b/webrtc/modules/audio_coding/neteq/expand.cc
@@ -214,24 +214,24 @@
// Create combined signal by shifting in more and more of unvoiced part.
temp_shift = 8 - temp_shift; // = getbits(mix_factor_increment).
- size_t temp_lenght = (parameters.current_voice_mix_factor -
+ size_t temp_length = (parameters.current_voice_mix_factor -
parameters.voice_mix_factor) >> temp_shift;
- temp_lenght = std::min(temp_lenght, current_lag);
- DspHelper::CrossFade(voiced_vector, unvoiced_vector, temp_lenght,
+ temp_length = std::min(temp_length, current_lag);
+ DspHelper::CrossFade(voiced_vector, unvoiced_vector, temp_length,
¶meters.current_voice_mix_factor,
mix_factor_increment, temp_data);
// End of cross-fading period was reached before end of expanded signal
// path. Mix the rest with a fixed mixing factor.
- if (temp_lenght < current_lag) {
+ if (temp_length < current_lag) {
if (mix_factor_increment != 0) {
parameters.current_voice_mix_factor = parameters.voice_mix_factor;
}
int16_t temp_scale = 16384 - parameters.current_voice_mix_factor;
WebRtcSpl_ScaleAndAddVectorsWithRound(
- voiced_vector + temp_lenght, parameters.current_voice_mix_factor,
- unvoiced_vector + temp_lenght, temp_scale, 14,
- temp_data + temp_lenght, static_cast<int>(current_lag - temp_lenght));
+ voiced_vector + temp_length, parameters.current_voice_mix_factor,
+ unvoiced_vector + temp_length, temp_scale, 14,
+ temp_data + temp_length, static_cast<int>(current_lag - temp_length));
}
// Select muting slope depending on how many consecutive expands we have
@@ -428,13 +428,12 @@
// Calculate the exact best correlation in the range between
// |correlation_lag| and |distortion_lag|.
- correlation_length = distortion_lag + 10;
- correlation_length = std::min(correlation_length, fs_mult_120);
- correlation_length = std::max(correlation_length, 60 * fs_mult);
+ correlation_length =
+ std::max(std::min(distortion_lag + 10, fs_mult_120), 60 * fs_mult);
int start_index = std::min(distortion_lag, correlation_lag);
- int correlation_lags = WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag))
- + 1;
+ int correlation_lags =
+ WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag)) + 1;
assert(correlation_lags <= 99 * fs_mult + 1); // Cannot be larger.
for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) {
@@ -753,8 +752,10 @@
memset(ar_filter_state, 0, sizeof(ar_filter_state));
}
-int16_t Expand::Correlation(const int16_t* input, size_t input_length,
- int16_t* output, int16_t* output_scale) const {
+void Expand::Correlation(const int16_t* input,
+ size_t input_length,
+ int16_t* output,
+ int16_t* output_scale) const {
// Set parameters depending on sample rate.
const int16_t* filter_coefficients;
int16_t num_coefficients;
@@ -818,7 +819,6 @@
norm_shift2);
// Total scale factor (right shifts) of correlation value.
*output_scale = 2 * norm_shift + kCorrelationShift + norm_shift2;
- return kNumCorrelationLags;
}
void Expand::UpdateLagIndex() {
@@ -850,7 +850,7 @@
int16_t* buffer) {
static const int kNoiseLpcOrder = BackgroundNoise::kMaxLpcOrder;
int16_t scaled_random_vector[kMaxSampleRate / 8000 * 125];
- assert(static_cast<size_t>(kMaxSampleRate / 8000 * 125) >= num_noise_samples);
+ assert(num_noise_samples <= static_cast<size_t>(kMaxSampleRate / 8000 * 125));
int16_t* noise_samples = &buffer[kNoiseLpcOrder];
if (background_noise_->initialized()) {
// Use background noise parameters.