shithub: opus

Download patch

ref: 74f4e9f385f57bc869540abe60b386957ea56f31
parent: 32ec58cc3e80d63b26ff139fc8c4f4a27cd75d69
author: Jean-Marc Valin <[email protected]>
date: Sat May 2 05:57:50 EDT 2009

The intra decision is now made for the following frame, not the current one.
Also, setting transient shift to zero when not using short blocks (this causes a
failed assertion otherwise)

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -77,7 +77,7 @@
    
    int pitch_enabled;
    int pitch_available;
-
+   int delayedIntra;
    celt_word16_t * restrict preemph_memE; /* Input is 16-bit, so why bother with 32 */
    celt_sig_t    * restrict preemph_memD;
 
@@ -542,11 +542,11 @@
    compute_mdcts(st->mode, shortBlocks, in, freq);
    compute_band_energies(st->mode, freq, bandE);
 
+   intra_ener = st->delayedIntra;
    if (intra_decision(bandE, st->oldBandE, st->mode->nbEBands) || shortBlocks)
-      intra_ener = 1;
+      st->delayedIntra = 1;
    else
-      intra_ener = 0;
-
+      st->delayedIntra = 0;
    /* Pitch analysis: we do it early to save on the peak stack space */
    /* Don't use pitch if there isn't enough data available yet, or if we're using shortBlocks */
    has_pitch = st->pitch_enabled && (st->pitch_available >= MAX_PERIOD) && (!shortBlocks) && !intra_ener;
@@ -963,7 +963,7 @@
    
    CELT_MOVE(st->out_mem, st->out_mem+C*N, C*(MAX_PERIOD+st->mode->overlap-N));
    /* Compute inverse MDCTs */
-   compute_inv_mdcts(st->mode, 0, freq, -1, 1, st->out_mem);
+   compute_inv_mdcts(st->mode, 0, freq, -1, 0, st->out_mem);
 
    for (c=0;c<C;c++)
    {