shithub: opus

Download patch

ref: 5790fba762f46f83ee2698bf2fe6e8dc0f33a442
parent: 7fff572a8c24b49edf113b518ccb6a920bd54691
author: Jean-Marc Valin <[email protected]>
date: Mon Oct 18 13:27:56 EDT 2010

Simplifying transient_analysis() now that we don't care about the time window

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -822,11 +822,13 @@
          else
             alg_unquant(X, N, K, spread, B, lowband, (ec_dec*)ec, seed, gain);
       } else {
+         /* If there's no pulse, fill the band anyway */
          int j;
          if (lowband != NULL && resynth)
          {
             if (spread==2 && B<=1)
             {
+               /* Folded spectrum */
                for (j=0;j<N;j++)
                {
                   *seed = lcg_rand(*seed);
@@ -833,6 +835,7 @@
                   X[j] = (int)(*seed)>>20;
                }
             } else {
+               /* Noise */
                for (j=0;j<N;j++)
                   X[j] = lowband[j];
             }
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -173,7 +173,6 @@
                               celt_word32 *frame_max, int overlap)
 {
    int i, n;
-   celt_word32 ratio;
    celt_word32 threshold;
    VARDECL(celt_word32, begin);
    VARDECL(celt_word16, tmp);
@@ -228,13 +227,6 @@
             n=i;
       }
    }
-   if (n<32)
-   {
-      n = -1;
-      ratio = 0;
-   } else {
-      ratio = DIV32(begin[len],1+MAX32(*frame_max, begin[n-16]));
-   }
 
    *frame_max = begin[len-overlap];
    /* Only consider the last 7.5 ms for the next transient */
@@ -245,7 +237,7 @@
          *frame_max = MAX32(*frame_max, ABS32(tmp[i]));
    }
    RESTORE_STACK;
-   return ratio > 0;
+   return n>=32;
 }
 
 /** Apply window and compute the MDCT for all sub-frames and