shithub: opus

Download patch

ref: c9d5bea13e3cb7381bfa897a45d8bab4e7b767a7
parent: e4a74ddeb9788eab84d10660e958fe706619892f
author: Jean-Marc Valin <[email protected]>
date: Wed Jul 13 15:20:06 EDT 2022

Fix NORM_ALIASING_HACK

We need to move the history out of the way before we write to the
shape array X, or else we get corruption of the audio.

Signed-off-by: Jean-Marc Valin <[email protected]>

--- a/celt/celt_decoder.c
+++ b/celt/celt_decoder.c
@@ -557,6 +557,10 @@
 #else
       ALLOC(X, C*N, celt_norm);   /**< Interleaved normalised MDCTs */
 #endif
+      c=0; do {
+         OPUS_MOVE(decode_mem[c], decode_mem[c]+N,
+               DECODE_BUFFER_SIZE-N+(overlap>>1));
+      } while (++c<C);
 
       /* Energy decay */
       decay = loss_duration==0 ? QCONST16(1.5f, DB_SHIFT) : QCONST16(.5f, DB_SHIFT);
@@ -584,11 +588,6 @@
          }
       }
       st->rng = seed;
-
-      c=0; do {
-         OPUS_MOVE(decode_mem[c], decode_mem[c]+N,
-               DECODE_BUFFER_SIZE-N+(overlap>>1));
-      } while (++c<C);
 
       celt_synthesis(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsample, 0, st->arch);
    } else {