shithub: opus

Download patch

ref: cf89d2a60cfed1b30a377340637ef1ae1b9d83b1
parent: 1111db3163be985d03fd048bf2761c16792445db
author: Jean-Marc Valin <[email protected]>
date: Thu Feb 10 05:50:26 EST 2011

Adding a tiny amount of noise when folding to prevent/reduce numerical issues

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -1084,7 +1084,14 @@
                } else {
                   /* Folded spectrum */
                   for (j=0;j<N;j++)
-                     X[j] = lowband[j];
+                  {
+                     celt_word16 tmp;
+                     *seed = lcg_rand(*seed);
+                     /* About 48 dB below the "normal" folding level */
+                     tmp = QCONST16(1.0f/256, 10);
+                     tmp = (*seed)&0x8000 ? tmp : -tmp;
+                     X[j] = lowband[j]+tmp;
+                  }
                   cm = fill;
                }
                renormalise_vector(X, N, gain);