Add new fast mode for NetEq's Accelerate operation
This change instroduces a mode where the Accelerate operation will be
more aggressive. When enabled, it will allow acceleration at lower
correlation levels, and possibly remove multiple pitch periods at
once.
The feature is enabled through NetEq::Config, and is off by
default. This means that bit-exactness tests are currently not
affected.
A unit test was added for the Accelerate class, with and without fast
mode enabled.
BUG=4691
R=minyue@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/50039004
Cr-Commit-Position: refs/heads/master@{#9295}
diff --git a/webrtc/modules/audio_coding/neteq/time_stretch.cc b/webrtc/modules/audio_coding/neteq/time_stretch.cc
index 02305c8..5577cd2 100644
--- a/webrtc/modules/audio_coding/neteq/time_stretch.cc
+++ b/webrtc/modules/audio_coding/neteq/time_stretch.cc
@@ -19,12 +19,11 @@
namespace webrtc {
-TimeStretch::ReturnCodes TimeStretch::Process(
- const int16_t* input,
- size_t input_len,
- AudioMultiVector* output,
- int16_t* length_change_samples) {
-
+TimeStretch::ReturnCodes TimeStretch::Process(const int16_t* input,
+ size_t input_len,
+ bool fast_mode,
+ AudioMultiVector* output,
+ int16_t* length_change_samples) {
// Pre-calculate common multiplication with |fs_mult_|.
int fs_mult_120 = fs_mult_ * 120; // Corresponds to 15 ms.
@@ -140,8 +139,9 @@
// Check accelerate criteria and stretch the signal.
- ReturnCodes return_value = CheckCriteriaAndStretch(
- input, input_len, peak_index, best_correlation, active_speech, output);
+ ReturnCodes return_value =
+ CheckCriteriaAndStretch(input, input_len, peak_index, best_correlation,
+ active_speech, fast_mode, output);
switch (return_value) {
case kSuccess:
*length_change_samples = peak_index;