shithub: opus

Download patch

ref: ea93c01a246af155654c069e12f0fd0b22860fd4
parent: 57854e816a261415b07fa032af81bc6673401b04
author: Jean-Marc Valin <[email protected]>
date: Thu Feb 3 01:42:54 EST 2011

Renormalize in anti-collapse only when needed

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -251,6 +251,7 @@
          celt_word16 prev2;
          celt_word16 Ediff;
          celt_word16 r;
+         int renormalize=0;
          prev1 = prev1logE[c*m->nbEBands+i];
          prev2 = prev2logE[c*m->nbEBands+i];
          if (C<CC)
@@ -291,10 +292,12 @@
                   seed = lcg_rand(seed);
                   X[(j<<LM)+k] = (seed&0x8000 ? r : -r);
                }
+               renormalize = 1;
             }
          }
          /* We just added some energy, so we need to renormalise */
-         renormalise_vector(X, N0<<LM, Q15ONE);
+         if (renormalize)
+            renormalise_vector(X, N0<<LM, Q15ONE);
       } while (++c<C);
    }