summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelicia Lim <flim@google.com>2021-06-07 16:35:27 -0700
committerFelicia Lim <flim@google.com>2021-06-07 16:35:27 -0700
commit4b21ff9c5421ac563b57275b99665d721a0b5ed3 (patch)
tree9fafc1f597f374915f3f524be20c073744d14f9e
parentdfd6c88aaa54a03a61434c413e30c217eb98f1d5 (diff)
downloadopus-4b21ff9c5421ac563b57275b99665d721a0b5ed3.tar.gz
Relax comparison to 0 to avoid a floating point divide-by-zero error.
-rw-r--r--celt/celt_lpc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/celt/celt_lpc.c b/celt/celt_lpc.c
index 457e7ed0..5ac54b27 100644
--- a/celt/celt_lpc.c
+++ b/celt/celt_lpc.c
@@ -50,7 +50,11 @@ int p
#endif
OPUS_CLEAR(lpc, p);
- if (ac[0] != 0)
+#ifdef FIXED_POINT
+ if (ac[0] > QCONST32(0.001f, 31))
+#else
+ if (ac[0] > 1e-10f)
+#endif
{
for (i = 0; i < p; i++) {
/* Sum up this iteration's reflection coefficient */
@@ -73,10 +77,10 @@ int p
error = error - MULT32_32_Q31(MULT32_32_Q31(r,r),error);
/* Bail out once we get 30 dB gain */
#ifdef FIXED_POINT
- if (error<SHR32(ac[0],10))
+ if (error<=SHR32(ac[0],10))
break;
#else
- if (error<.001f*ac[0])
+ if (error<=.001f*ac[0])
break;
#endif
}