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:
@ -17,6 +17,7 @@
|
||||
|
||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/cross_correlation.h"
|
||||
#include "webrtc/modules/audio_coding/neteq/post_decode_vad.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -169,15 +170,10 @@ int16_t BackgroundNoise::ScaleShift(size_t channel) const {
|
||||
|
||||
int32_t BackgroundNoise::CalculateAutoCorrelation(
|
||||
const int16_t* signal, size_t length, int32_t* auto_correlation) const {
|
||||
int16_t signal_max = WebRtcSpl_MaxAbsValueW16(signal, length);
|
||||
int correlation_scale = kLogVecLen -
|
||||
WebRtcSpl_NormW32(signal_max * signal_max);
|
||||
correlation_scale = std::max(0, correlation_scale);
|
||||
|
||||
static const int kCorrelationStep = -1;
|
||||
WebRtcSpl_CrossCorrelation(auto_correlation, signal, signal, length,
|
||||
kMaxLpcOrder + 1, correlation_scale,
|
||||
kCorrelationStep);
|
||||
const int correlation_scale =
|
||||
CrossCorrelationWithAutoShift(signal, signal, length, kMaxLpcOrder + 1,
|
||||
kCorrelationStep, auto_correlation);
|
||||
|
||||
// Number of shifts to normalize energy to energy/sample.
|
||||
int energy_sample_shift = kLogVecLen - correlation_scale;
|
||||
|
||||
Reference in New Issue
Block a user