shithub: opus

Download patch

ref: 6d454d8dadeaee62d92edf7589a81fbf89302f09
parent: 02428d6c5342a8cfebd7ac11100b44bffb1ae816
author: Jean-Marc Valin <[email protected]>
date: Tue Jun 30 06:31:00 EDT 2009

This fixes a potential assertion failure with some very weak signals

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -147,9 +147,17 @@
       j=0; do {
          sum += X[j];
       }  while (++j<N);
-      if (sum == 0)
+
+#ifdef FIXED_POINT
+      if (sum <= K)
+#else
+      if (sum <= EPSILON)
+#endif
       {
          X[0] = 16384;
+         j=1; do
+            X[j]=0;
+         while (++j<N);
          sum = 16384;
       }
       /* Do we have sufficient accuracy here? */