shithub: opus

Download patch

ref: d27e6e34a5f88f69a31a3b7c0624119d09255aa9
parent: ca53b7c91996ec88a3ec62afc100d33ce22b9413
author: Jean-Marc Valin <[email protected]>
date: Sun Mar 29 18:29:27 EDT 2009

Cleanup: getting rid of some old bits of stereo code that are no longer useful

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -282,7 +282,7 @@
    }
 }
 
-static void stereo_band_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, const int *stereo_mode, int bandID, int dir)
+static void stereo_band_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, int stereo_mode, int bandID, int dir)
 {
    int i = bandID;
    const celt_int16_t *eBands = m->eBands;
@@ -289,12 +289,12 @@
    const int C = CHANNELS(m);
    {
       int j;
-      if (stereo_mode[i] && dir <0)
+      if (stereo_mode && dir <0)
       {
          dup_band(X+C*eBands[i], eBands[i+1]-eBands[i]);
       } else {
          celt_word16_t a1, a2;
-         if (stereo_mode[i]==0)
+         if (stereo_mode==0)
          {
             /* Do mid-side when not doing intensity stereo */
             a1 = QCONST16(.70711f,14);
@@ -320,7 +320,7 @@
             X[j*C+1] = MULT16_16_Q14(a1,r) - MULT16_16_Q14(a2,l);
          }
       }
-      if (stereo_mode[i] && dir>0)
+      if (stereo_mode && dir>0)
       {
          intensity_band(X+C*eBands[i], eBands[i+1]-eBands[i]);
       }
@@ -398,20 +398,18 @@
 }
 
 /* Quantisation of the residual */
-void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
+void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
 {
    int i, j, remaining_bits, balance;
    const celt_int16_t * restrict eBands = m->eBands;
    celt_norm_t * restrict norm;
-   VARDECL(celt_norm_t, _norm);
-   const int C = CHANNELS(m);
-   const celt_int16_t *pBands = m->pBands;
+   VARDECL(celt_norm_t, _norm);   const celt_int16_t *pBands = m->pBands;
    int pband=-1;
    int B;
    SAVE_STACK;
 
    B = shortBlocks ? m->nbShortMdcts : 1;
-   ALLOC(_norm, C*eBands[m->nbEBands+1], celt_norm_t);
+   ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
    norm = _norm;
 
    balance = 0;
@@ -429,10 +427,7 @@
       
       int curr_balance, curr_bits;
       
-      if (C>1 && stereo_mode[i]==0)
-         BPbits = m->bits_stereo;
-      else
-         BPbits = m->bits;
+      BPbits = m->bits;
 
       tell = ec_enc_tell(enc, 4);
       if (i != 0)
@@ -454,7 +449,7 @@
       }
       balance += pulses[i] + tell;
       
-      n = SHL16(celt_sqrt(C*(eBands[i+1]-eBands[i])),11);
+      n = SHL16(celt_sqrt(eBands[i+1]-eBands[i]),11);
 
       /* If pitch is in use and this eBand begins a pitch band, encode the pitch gain flag */
       if (pitch_used && eBands[i]< m->pitchEnd && eBands[i] == pBands[pband+1])
@@ -475,39 +470,29 @@
       /* If pitch isn't available, use intra-frame prediction */
       if ((eBands[i] >= m->pitchEnd && fold) || q<=0)
       {
-         intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], eBands[i], B);
+         intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], q, norm, P+eBands[i], eBands[i], B);
       } else if (pitch_used && eBands[i] < m->pitchEnd) {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             P[j] = MULT16_16_Q15(pgains[pband], P[j]);
       } else {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             P[j] = 0;
       }
       
       if (q > 0)
       {
-         int ch=C;
-         if (C==2 && stereo_mode[i]==1)
-            ch = 1;
-         if (C==2)
-         {
-            stereo_band_mix(m, X, bandE, stereo_mode, i, 1);
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
-         }
-         alg_quant(X+C*eBands[i], W+C*eBands[i], ch*(eBands[i+1]-eBands[i]), q, P+C*eBands[i], enc);
-         if (C==2)
-            stereo_band_mix(m, X, bandE, stereo_mode, i, -1);
+         alg_quant(X+eBands[i], W+eBands[i], eBands[i+1]-eBands[i], q, P+eBands[i], enc);
       } else {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             X[j] = P[j];
       }
-      for (j=C*eBands[i];j<C*eBands[i+1];j++)
+      for (j=eBands[i];j<eBands[i+1];j++)
          norm[j] = MULT16_16_Q15(n,X[j]);
    }
    RESTORE_STACK;
 }
 
-void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
+void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
 {
    int i, j, remaining_bits, balance;
    const celt_int16_t * restrict eBands = m->eBands;
@@ -627,7 +612,7 @@
       if (qb==0)
          point_stereo_mix(m, X, bandE, i, 1);
       else
-         stereo_band_mix(m, X, bandE, stereo_mode, i, 1);
+         stereo_band_mix(m, X, bandE, 0, i, 1);
       
       mid = renormalise_vector(X+C*eBands[i], Q15ONE, N, C);
       side = renormalise_vector(X+C*eBands[i]+1, Q15ONE, N, C);
@@ -713,7 +698,7 @@
          if (qb==0)
             point_stereo_mix(m, P, bandE, i, 1);
          else
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
+            stereo_band_mix(m, P, bandE, 0, i, 1);
          deinterleave(P+C*eBands[i], C*N);
 
          /*for (j=C*eBands[i];j<C*eBands[i+1];j++)
@@ -722,7 +707,7 @@
          if (qb==0)
             point_stereo_mix(m, P, bandE, i, 1);
          else
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
+            stereo_band_mix(m, P, bandE, 0, i, 1);
          renormalise_vector(P+C*eBands[i], Q15ONE, N, C);
          renormalise_vector(P+C*eBands[i]+1, Q15ONE, N, C);
          deinterleave(P+C*eBands[i], C*N);
@@ -760,7 +745,7 @@
 
       interleave(X+C*eBands[i], C*N);
 
-      stereo_band_mix(m, X, bandE, stereo_mode, i, -1);
+      stereo_band_mix(m, X, bandE, 0, i, -1);
       renormalise_vector(X+C*eBands[i], Q15ONE, N, C);
       renormalise_vector(X+C*eBands[i]+1, Q15ONE, N, C);
       for (j=0;j<C*N;j++)
@@ -771,13 +756,12 @@
 }
 
 /* Decoding of the residual */
-void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
+void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
 {
    int i, j, remaining_bits, balance;
    const celt_int16_t * restrict eBands = m->eBands;
    celt_norm_t * restrict norm;
    VARDECL(celt_norm_t, _norm);
-   const int C = CHANNELS(m);
    const celt_int16_t *pBands = m->pBands;
    int pband=-1;
    int B;
@@ -784,7 +768,7 @@
    SAVE_STACK;
 
    B = shortBlocks ? m->nbShortMdcts : 1;
-   ALLOC(_norm, C*eBands[m->nbEBands+1], celt_norm_t);
+   ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
    norm = _norm;
 
    balance = 0;
@@ -797,10 +781,7 @@
       
       int curr_balance, curr_bits;
       
-      if (C>1 && stereo_mode[i]==0)
-         BPbits = m->bits_stereo;
-      else
-         BPbits = m->bits;
+      BPbits = m->bits;
 
       tell = ec_dec_tell(dec, 4);
       if (i != 0)
@@ -822,7 +803,7 @@
       }
       balance += pulses[i] + tell;
 
-      n = SHL16(celt_sqrt(C*(eBands[i+1]-eBands[i])),11);
+      n = SHL16(celt_sqrt(eBands[i+1]-eBands[i]),11);
 
       /* If pitch is in use and this eBand begins a pitch band, encode the pitch gain flag */
       if (pitch_used && eBands[i] < m->pitchEnd && eBands[i] == pBands[pband+1])
@@ -842,36 +823,29 @@
       /* If pitch isn't available, use intra-frame prediction */
       if ((eBands[i] >= m->pitchEnd && fold) || q<=0)
       {
-         intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], q, norm, P+C*eBands[i], eBands[i], B);
+         intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], q, norm, P+eBands[i], eBands[i], B);
       } else if (pitch_used && eBands[i] < m->pitchEnd) {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             P[j] = MULT16_16_Q15(pgains[pband], P[j]);
       } else {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             P[j] = 0;
       }
       
       if (q > 0)
       {
-         int ch=C;
-         if (C==2 && stereo_mode[i]==1)
-            ch = 1;
-         if (C==2)
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
-         alg_unquant(X+C*eBands[i], ch*(eBands[i+1]-eBands[i]), q, P+C*eBands[i], dec);
-         if (C==2)
-            stereo_band_mix(m, X, bandE, stereo_mode, i, -1);
+         alg_unquant(X+eBands[i], eBands[i+1]-eBands[i], q, P+eBands[i], dec);
       } else {
-         for (j=C*eBands[i];j<C*eBands[i+1];j++)
+         for (j=eBands[i];j<eBands[i+1];j++)
             X[j] = P[j];
       }
-      for (j=C*eBands[i];j<C*eBands[i+1];j++)
+      for (j=eBands[i];j<eBands[i+1];j++)
          norm[j] = MULT16_16_Q15(n,X[j]);
    }
    RESTORE_STACK;
 }
 
-void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
+void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
 {
    int i, j, remaining_bits, balance;
    const celt_int16_t * restrict eBands = m->eBands;
@@ -1062,13 +1036,13 @@
          if (qb==0)
             point_stereo_mix(m, P, bandE, i, 1);
          else
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
+            stereo_band_mix(m, P, bandE, 0, i, 1);
          deinterleave(P+C*eBands[i], C*N);
       } else if (pitch_used && eBands[i] < m->pitchEnd) {
          if (qb==0)
             point_stereo_mix(m, P, bandE, i, 1);
          else
-            stereo_band_mix(m, P, bandE, stereo_mode, i, 1);
+            stereo_band_mix(m, P, bandE, 0, i, 1);
          renormalise_vector(P+C*eBands[i], Q15ONE, N, C);
          renormalise_vector(P+C*eBands[i]+1, Q15ONE, N, C);
          deinterleave(P+C*eBands[i], C*N);
@@ -1105,7 +1079,7 @@
       
       interleave(X+C*eBands[i], C*N);
 
-      stereo_band_mix(m, X, bandE, stereo_mode, i, -1);
+      stereo_band_mix(m, X, bandE, 0, i, -1);
       renormalise_vector(X+C*eBands[i], Q15ONE, N, C);
       renormalise_vector(X+C*eBands[i]+1, Q15ONE, N, C);
       for (j=0;j<C*N;j++)
--- a/libcelt/bands.h
+++ b/libcelt/bands.h
@@ -81,9 +81,9 @@
  * @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
  * @param enc Entropy encoder
  */
-void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
+void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
 
-void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
+void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
 
 /** Decoding of the residual spectrum
  * @param m Mode data 
@@ -92,7 +92,9 @@
  * @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
  * @param dec Entropy decoder
 */
-void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, const int *stereo_mode, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
+void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
+
+void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int pitch_used, celt_pgain_t *pgains, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
 
 void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len);
 
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -625,9 +625,9 @@
 
    /* Residual quantisation */
    if (C==1)
-      quant_bands(st->mode, X, P, NULL, has_pitch, gains, bandE, stereo_mode, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
+      quant_bands(st->mode, X, P, NULL, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
    else
-      quant_bands_stereo(st->mode, X, P, NULL, has_pitch, gains, bandE, stereo_mode, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
+      quant_bands_stereo(st->mode, X, P, NULL, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
 
    /* Re-synthesis of the coded audio if required */
    if (st->pitch_available>0 || optional_synthesis!=NULL)
@@ -1043,9 +1043,9 @@
 
    /* Decode fixed codebook and merge with pitch */
    if (C==1)
-      unquant_bands(st->mode, X, P, has_pitch, gains, bandE, stereo_mode, pulses, shortBlocks, has_fold, len*8, &dec);
+      unquant_bands(st->mode, X, P, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
    else
-      unquant_bands_stereo(st->mode, X, P, has_pitch, gains, bandE, stereo_mode, pulses, shortBlocks, has_fold, len*8, &dec);
+      unquant_bands_stereo(st->mode, X, P, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
 
    /* Synthesis */
    denormalise_bands(st->mode, X, freq, bandE);
--- a/libcelt/dump_modes.c
+++ b/libcelt/dump_modes.c
@@ -116,20 +116,6 @@
       fprintf(file, "#endif\n");
       fprintf(file, "\n");
 
-      fprintf(file, "#ifndef DEF_ALLOC_ENERGY%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-      fprintf(file, "#define DEF_ALLOC_ENERGY%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-      fprintf (file, "static const celt_int16_t allocEnergy%d_%d_%d[%d] = {\n", mode->Fs, mode->mdctSize, mode->nbChannels, mode->nbEBands*mode->nbAllocVectors);
-      for (j=0;j<mode->nbAllocVectors;j++)
-      {
-         int k;
-         for (k=0;k<mode->nbEBands;k++)
-            fprintf (file, "%2d, ", mode->energy_alloc[j*mode->nbEBands+k]);
-         fprintf (file, "\n");
-      }
-      fprintf (file, "};\n");
-      fprintf(file, "#endif\n");
-      fprintf(file, "\n");
-
       fprintf(file, "#ifndef DEF_ALLOC_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
       fprintf(file, "#define DEF_ALLOC_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
       for (j=0;j<mode->nbEBands;j++)
@@ -155,34 +141,6 @@
       fprintf(file, "\n");
 
 
-      if (mode->bits_stereo)
-      {
-         fprintf(file, "#ifndef DEF_ALLOC_STEREO_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-         fprintf(file, "#define DEF_ALLOC_STEREO_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-         for (j=0;j<mode->nbEBands;j++)
-         {
-            int k;
-            if (j==0 || (mode->bits[j] != mode->bits_stereo[j-1]))
-            {
-               fprintf (file, "static const celt_int16_t allocStereoCache_band%d_%d_%d_%d[MAX_PULSES] = {\n", j, mode->Fs, mode->mdctSize, mode->nbChannels);
-               for (k=0;k<MAX_PULSES;k++)
-                  fprintf (file, "%2d, ", mode->bits_stereo[j][k]);
-               fprintf (file, "};\n");
-            } else {
-               fprintf (file, "#define allocStereoCache_band%d_%d_%d_%d allocStereoCache_band%d_%d_%d_%d\n", j, mode->Fs, mode->mdctSize, mode->nbChannels, j-1, mode->Fs, mode->mdctSize, mode->nbChannels);
-            }
-         }
-         fprintf (file, "static const celt_int16_t *allocStereoCache%d_%d_%d[%d] = {\n", mode->Fs, mode->mdctSize, mode->nbChannels, mode->nbEBands);
-         for (j=0;j<mode->nbEBands;j++)
-         {
-            fprintf (file, "allocStereoCache_band%d_%d_%d_%d, ", j, mode->Fs, mode->mdctSize, mode->nbChannels);
-         }
-         fprintf (file, "};\n");
-         fprintf(file, "#endif\n");
-         fprintf(file, "\n");
-      }
-
-
       fprintf(file, "static const CELTMode mode%d_%d_%d_%d = {\n", mode->Fs, mode->nbChannels, mode->mdctSize, mode->overlap);
       fprintf(file, "0x%x,\t/* marker */\n", 0xa110ca7e);
       fprintf(file, INT32 ",\t/* Fs */\n", mode->Fs);
@@ -198,10 +156,6 @@
       fprintf(file, "%d,\t/* nbAllocVectors */\n", mode->nbAllocVectors);
       fprintf(file, "allocVectors%d_%d_%d,\t/* allocVectors */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
       fprintf(file, "allocCache%d_%d_%d,\t/* bits */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-      if (mode->bits_stereo)
-         fprintf(file, "allocStereoCache%d_%d_%d,\t/* bits_stereo */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
-      else
-         fprintf(file, "0,\t/* bits_stereo */\n");
       fprintf(file, "{%d, 0, 0},\t/* mdct */\n", 2*mode->mdctSize);
       fprintf(file, "0,\t/* fft */\n");
       fprintf(file, "window%d,\t/* window */\n", mode->overlap);
@@ -211,7 +165,6 @@
       fprintf(file, "window%d,\t/* shortWindow */\n", mode->overlap);
       fprintf(file, "{psy_decayR_%d},\t/* psy */\n", mode->Fs);
       fprintf(file, "0,\t/* prob */\n");
-      fprintf(file, "allocEnergy%d_%d_%d,\t/* energy_alloc */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
       fprintf(file, "0x%x,\t/* marker */\n", 0xa110ca7e);
       fprintf(file, "};\n");
    }
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -253,7 +253,6 @@
       for (j=0;j<mode->nbEBands;j++)
          allocVectors[i*mode->nbEBands+j] += C;
    }*/
-   mode->energy_alloc = allocEnergy;
    mode->allocVectors = allocVectors;
 }
 
@@ -376,8 +375,6 @@
    mode->window = window;
 
    mode->bits = (const celt_int16_t **)compute_alloc_cache(mode, 1);
-   if (mode->nbChannels>=2)
-      mode->bits_stereo = (const celt_int16_t **)compute_alloc_cache(mode, mode->nbChannels);
 
 #ifndef SHORTCUTS
    psydecay_init(&mode->psy, MAX_PERIOD/2, mode->Fs);
@@ -414,24 +411,11 @@
       }
    }
    celt_free((int**)mode->bits);
-   if (mode->bits_stereo != NULL)
-   {
-      for (i=0;i<mode->nbEBands;i++)
-      {
-         if (mode->bits_stereo[i] != prevPtr)
-         {
-            prevPtr = mode->bits_stereo[i];
-            celt_free((int*)mode->bits_stereo[i]);
-         }
-      }
-      celt_free((int**)mode->bits_stereo);
-   }
    if (check_mode(mode) != CELT_OK)
       return;
    celt_free((int*)mode->eBands);
    celt_free((int*)mode->pBands);
    celt_free((int*)mode->allocVectors);
-   celt_free((celt_int16_t *)mode->energy_alloc);
 
    celt_free((celt_word16_t*)mode->window);
 
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -89,8 +89,6 @@
    
    const celt_int16_t * const *bits; /**< Cache for pulses->bits mapping in each band */
 
-   const celt_int16_t * const *bits_stereo; /**< Cache for pulses->bits mapping in each band */
-
    /* Stuff that could go in the {en,de}coder, but we save space this way */
    mdct_lookup mdct;
    kiss_fftr_cfg fft;
@@ -105,8 +103,6 @@
    struct PsyDecay psy;
 
    int *prob;
-   const celt_int16_t *energy_alloc;
-   
    celt_uint32_t marker_end;
 };