shithub: opus

Download patch

ref: 3afc6ffff068cd9696de7fc3b88a0cd3ab79940a
parent: ce15e6531932624387b5c49bb1fbfccd19710bca
author: Jean-Marc Valin <[email protected]>
date: Sun Jun 16 11:40:10 EDT 2013

Don't call denormalise_bands() on silence

--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -916,19 +916,18 @@
    ALLOC(bandE, nbEBands*C, celt_ener);
 
    log2Amp(mode, st->start, st->end, bandE, oldBandE, C);
+   ALLOC(freq, IMAX(CC,C)*N, celt_sig); /**< Interleaved signal MDCTs */
 
    if (silence)
    {
       for (i=0;i<C*nbEBands;i++)
-      {
-         bandE[i] = 0;
          oldBandE[i] = -QCONST16(28.f,DB_SHIFT);
-      }
+      for (i=0;i<C*N;i++)
+         freq[i] = 0;
+   } else {
+      /* Synthesis */
+      denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M);
    }
-   ALLOC(freq, IMAX(CC,C)*N, celt_sig); /**< Interleaved signal MDCTs */
-   /* Synthesis */
-   denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M);
-
    c=0; do {
       OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2);
    } while (++c<CC);
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1887,16 +1887,6 @@
    {
       celt_sig *out_mem[2];
 
-      log2Amp(mode, st->start, st->end, bandE, oldBandE, C);
-      if (silence)
-      {
-         for (i=0;i<C*nbEBands;i++)
-            bandE[i] = 0;
-      }
-
-#ifdef MEASURE_NORM_MSE
-      measure_norm_mse(mode, X, X0, bandE, bandE0, M, N, C);
-#endif
       if (anti_collapse_on)
       {
          anti_collapse(mode, X, collapse_masks, LM, C, N,
@@ -1903,8 +1893,18 @@
                st->start, st->end, oldBandE, oldLogE, oldLogE2, pulses, st->rng);
       }
 
-      /* Synthesis */
-      denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M);
+      log2Amp(mode, st->start, st->end, bandE, oldBandE, C);
+      if (silence)
+      {
+         for (i=0;i<C*N;i++)
+            freq[i] = 0;
+      } else {
+#ifdef MEASURE_NORM_MSE
+         measure_norm_mse(mode, X, X0, bandE, bandE0, M, N, C);
+#endif
+         /* Synthesis */
+         denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M);
+      }
 
       c=0; do {
          OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap/2);