audio_processing/nsx: Bug fix that could cause divide by zero

In the fixed point version of the Noise Suppression. At one place we subtract a value in the wrong Q-domain, which later may cause a divide by zero. Going through the floating point code that particular variable should be zero if this happens, which is what the old code tried to accomplish, but in an awkward way.

The bug has been there since development, so the likelihood of actually get a divide by zero is very small.

BUG=chromium:407812
R=ljubomir.papuga@gmail.com, tina.legrand@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7035 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2014-09-03 07:58:37 +00:00
parent d944a6887d
commit 48f2568d89
2 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,7 @@ void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
if (den > 0) {
besselTmpFX32 -= num / den; // Q11
} else {
besselTmpFX32 -= num; // Q11
besselTmpFX32 = 0;
}
// inst->logLrtTimeAvg[i] += LRT_TAVG * (besselTmp - log(snrLocPrior)

View File

@ -74,6 +74,7 @@ void WebRtcNsx_SpeechNoiseProb(NsxInst_t* inst,
"sra %[r7], %[r7], 19 \n\t"
"movz %[r3], %[r8], %[r6] \n\t"
"subu %[r0], %[r0], %[r3] \n\t"
"movn %[r0], $0, %[r6] \n\t"
"mul %[r1], %[r1], %[const_5412] \n\t"
"sra %[r1], %[r1], 12 \n\t"
"addu %[r7], %[r7], %[r1] \n\t"