Miscellaneous changes split from https://codereview.webrtc.org/1230503003 .
These are mostly trivial changes and are separated out just to reduce the
diff on that change to the minimum possible.
Note explanatory comments on patch set 1.
BUG=none
TEST=none
Review URL: https://codereview.webrtc.org/1235643003
Cr-Commit-Position: refs/heads/master@{#9617}
diff --git a/webrtc/modules/audio_coding/neteq/dsp_helper.cc b/webrtc/modules/audio_coding/neteq/dsp_helper.cc
index 289e66d..3e5c61d 100644
--- a/webrtc/modules/audio_coding/neteq/dsp_helper.cc
+++ b/webrtc/modules/audio_coding/neteq/dsp_helper.cc
@@ -117,7 +117,7 @@
peak_index[i] = WebRtcSpl_MaxIndexW16(data, data_length - 1);
if (i != num_peaks - 1) {
- min_index = std::max(0, peak_index[i] - 2);
+ min_index = (peak_index[i] > 2) ? (peak_index[i] - 2) : 0;
max_index = std::min(data_length - 1, peak_index[i] + 2);
}
@@ -238,7 +238,7 @@
int DspHelper::MinDistortion(const int16_t* signal, int min_lag,
int max_lag, int length,
int32_t* distortion_value) {
- int best_index = -1;
+ int best_index = 0;
int32_t min_distortion = WEBRTC_SPL_WORD32_MAX;
for (int i = min_lag; i <= max_lag; i++) {
int32_t sum_diff = 0;