shithub: opus

Download patch

ref: 6888403bde5aff396a2d733a939dc583daa27c69
parent: e12a7a445b1011ac2d46ec9031d67879343ac720
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Fri Dec 2 10:33:48 EST 2022

DRED: Fix infinite loop on "impossible" symbols

--- a/silk/dred_coding.c
+++ b/silk/dred_coding.c
@@ -77,6 +77,8 @@
         xq = x[i]*scale[i]*(1.f/256.f);
         xq = xq - delta*tanh(xq/(delta+eps));
         q = (int)floor(.5f+xq);
+        /* Make the impossible actually impossible. */
+        if (r[i] == 0 || p0[i] >= 32768) q = 0;
         ec_laplace_encode_p0(enc, q, p0[i], r[i]);
     }
 }
@@ -190,4 +192,4 @@
         printf("\n");
     }
 }
-#endif
\ No newline at end of file
+#endif
--