shithub: opus

Download patch

ref: d6b79eeb7a22813756a91457fc8deb0d4b68b26f
parent: 281a63eae82ae0fe6dd7d42ab011e95cf10dcc20
author: Jean-Marc Valin <[email protected]>
date: Tue Apr 20 13:31:45 EDT 2010

Skipping transient shape renormalisation in the encoder because
our search can now work on vectors that don't have unit norm

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -529,7 +529,9 @@
    }
 }
 
-static void mdct_shape(const CELTMode *mode, celt_norm *X, int start, int end, int N, int nbShortMdcts, int mdct_weight_shift, int _C)
+static void mdct_shape(const CELTMode *mode, celt_norm *X, int start,
+                       int end, int N, int nbShortMdcts,
+                       int mdct_weight_shift, int _C, int renorm)
 {
    int m, i, c;
    const int C = CHANNELS(_C);
@@ -541,7 +543,8 @@
 #else
             X[i] = (1.f/(1<<mdct_weight_shift))*X[i];
 #endif
-   renormalise_bands(mode, X, C);
+   if (renorm)
+      renormalise_bands(mode, X, C);
 }
 
 
@@ -754,10 +757,7 @@
       } while (m<st->mode->nbShortMdcts-1);
 #endif
       if (mdct_weight_shift)
-      {
-         mdct_shape(st->mode, X, mdct_weight_pos+1, st->mode->nbShortMdcts, N, st->mode->nbShortMdcts, mdct_weight_shift, C);
-         renormalise_bands(st->mode, X, C);
-      }
+         mdct_shape(st->mode, X, mdct_weight_pos+1, st->mode->nbShortMdcts, N, st->mode->nbShortMdcts, mdct_weight_shift, C, 0);
    }
 
 
@@ -887,7 +887,7 @@
 
       if (mdct_weight_shift)
       {
-         mdct_shape(st->mode, X, 0, mdct_weight_pos+1, N, st->mode->nbShortMdcts, mdct_weight_shift, C);
+         mdct_shape(st->mode, X, 0, mdct_weight_pos+1, N, st->mode->nbShortMdcts, mdct_weight_shift, C, 1);
       }
 
       /* Synthesis */
@@ -1554,7 +1554,7 @@
    
    if (mdct_weight_shift)
    {
-      mdct_shape(st->mode, X, 0, mdct_weight_pos+1, N, st->mode->nbShortMdcts, mdct_weight_shift, C);
+      mdct_shape(st->mode, X, 0, mdct_weight_pos+1, N, st->mode->nbShortMdcts, mdct_weight_shift, C, 1);
    }
 
    /* Synthesis */