NetEq: Allow negative shift in BackgroundNoise::SaveParameters
This change allows a shift factor to be negative. This is the way it
was in the old (NetEq3) code; see
4d363ae305/webrtc/modules/audio_coding/neteq/bgn_update.c,
lines 183-188.
Some input signals can lead to negative shifts, and would then trigger
an assert. The assert is now removed.
BUG=webrtc:4840
R=minyue@webrtc.org
Review URL: https://codereview.webrtc.org/1315833003 .
Cr-Commit-Position: refs/heads/master@{#9816}
This commit is contained in:
@ -246,8 +246,7 @@ void BackgroundNoise::SaveParameters(size_t channel,
|
||||
if (norm_shift & 0x1) {
|
||||
norm_shift -= 1; // Even number of shifts required.
|
||||
}
|
||||
assert(norm_shift >= 0); // Should always be positive.
|
||||
residual_energy = residual_energy << norm_shift;
|
||||
residual_energy = WEBRTC_SPL_SHIFT_W32(residual_energy, norm_shift);
|
||||
|
||||
// Calculate scale and shift factor.
|
||||
parameters.scale = static_cast<int16_t>(WebRtcSpl_SqrtFloor(residual_energy));
|
||||
|
||||
Reference in New Issue
Block a user