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.


Review URL:

git-svn-id: 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_processing/ns/nsx_core_c.c b/webrtc/modules/audio_processing/ns/nsx_core_c.c
index b50d4f8..4472583 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core_c.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core_c.c
@@ -48,7 +48,7 @@
     if (den > 0) {
       besselTmpFX32 -= num / den;  // Q11
     } else {
-      besselTmpFX32 -= num; // Q11
+      besselTmpFX32 = 0;
     // inst->logLrtTimeAvg[i] += LRT_TAVG * (besselTmp - log(snrLocPrior)
diff --git a/webrtc/modules/audio_processing/ns/nsx_core_mips.c b/webrtc/modules/audio_processing/ns/nsx_core_mips.c
index 29abe93..0671627 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core_mips.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core_mips.c
@@ -74,6 +74,7 @@
       "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"