Reland "Avoiding overflow in cross correlation in NetEq."

The original CL is https://codereview.webrtc.org/1908623002/

An error was caused by that and this CL fix that problem and reland the CL.

BUG=

Review-Url: https://codereview.webrtc.org/1931933004
Cr-Commit-Position: refs/heads/master@{#12589}
This commit is contained in:
minyue
2016-05-02 01:50:30 -07:00
committed by Commit bot
parent a017b8ed2e
commit 53ff70f582
12 changed files with 186 additions and 105 deletions

View File

@ -69,11 +69,10 @@ class Merge {
// of samples that were taken from the |sync_buffer_|.
size_t GetExpandedSignal(size_t* old_length, size_t* expand_period);
// Analyzes |input| and |expanded_signal| to find maximum values. Returns
// a muting factor (Q14) to be used on the new data.
// Analyzes |input| and |expanded_signal| and returns muting factor (Q14) to
// be used on the new data.
int16_t SignalScaling(const int16_t* input, size_t input_length,
const int16_t* expanded_signal,
int16_t* expanded_max, int16_t* input_max) const;
const int16_t* expanded_signal) const;
// Downsamples |input| (|input_length| samples) and |expanded_signal| to
// 4 kHz sample rate. The downsampled signals are written to
@ -84,8 +83,7 @@ class Merge {
// Calculates cross-correlation between |input_downsampled_| and
// |expanded_downsampled_|, and finds the correlation maximum. The maximizing
// lag is returned.
size_t CorrelateAndPeakSearch(int16_t expanded_max, int16_t input_max,
size_t start_position, size_t input_length,
size_t CorrelateAndPeakSearch(size_t start_position, size_t input_length,
size_t expand_period) const;
const int fs_mult_; // fs_hz_ / 8000.