Echo canceler: Saturate output to guarantee it'll be in the allowed range

r6138 (https://webrtc-codereview.appspot.com/18399005/) somewhat
ill-advisedly removed the saturation step at the end of
aec_core.c:NonLinearProcessing(); this patch restores it.

BUG=
R=andrew@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18479004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6263 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kwiberg@webrtc.org 2014-05-28 11:47:08 +00:00
parent c1a40a7b68
commit f15c14be22

View File

@ -1315,8 +1315,11 @@ static void NonLinearProcessing(AecCore* aec, float* output, float* outputH) {
fft[PART_LEN + i] *= scale; // fft scaling
aec->outBuf[i] = fft[PART_LEN + i] * sqrtHanning[PART_LEN - i];
// Saturate output to keep it in the allowed range.
output[i] = WEBRTC_SPL_SAT(
WEBRTC_SPL_WORD16_MAX, fft[i], WEBRTC_SPL_WORD16_MIN);
}
memcpy(output, fft, sizeof(*output) * PART_LEN);
// For H band
if (aec->sampFreq == 32000) {
@ -1349,7 +1352,9 @@ static void NonLinearProcessing(AecCore* aec, float* output, float* outputH) {
dtmp += cnScaleHband * fft[i];
}
outputH[i] = dtmp;
// Saturate output to keep it in the allowed range.
outputH[i] = WEBRTC_SPL_SAT(
WEBRTC_SPL_WORD16_MAX, dtmp, WEBRTC_SPL_WORD16_MIN);
}
}