diff options
author | Felicia Lim <flim@google.com> | 2021-06-08 02:35:27 +0300 |
---|---|---|
committer | Felicia Lim <flim@google.com> | 2021-06-08 02:35:27 +0300 |
commit | 4b21ff9c5421ac563b57275b99665d721a0b5ed3 (patch) | |
tree | 9fafc1f597f374915f3f524be20c073744d14f9e /celt | |
parent | dfd6c88aaa54a03a61434c413e30c217eb98f1d5 (diff) |
Relax comparison to 0 to avoid a floating point divide-by-zero error.
Diffstat (limited to 'celt')
-rw-r--r-- | celt/celt_lpc.c | 10 |
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 } |