shithub: opus

Download patch

ref: 7353203b81e22be1dff48fa0cb61351b2dfb215e
parent: dcd580d7ab70e6c03006d4f0a543db1507b76fce
author: Jean-Marc Valin <[email protected]>
date: Tue Jun 2 16:07:25 EDT 2009

Updating DISABLE_STEREO to the new stereo code (i.e. disabling more stuff)

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -251,6 +251,8 @@
    return gain_sum > 5;
 }
 
+#ifndef DISABLE_STEREO
+
 static void intensity_band(celt_norm_t * restrict X, int len)
 {
    int j;
@@ -397,6 +399,8 @@
    RESTORE_STACK;
 }
 
+#endif /* DISABLE_STEREO */
+
 int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average, int *last_decision)
 {
    int i;
@@ -557,6 +561,8 @@
    RESTORE_STACK;
 }
 
+#ifndef DISABLE_STEREO
+
 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;
@@ -821,6 +827,7 @@
    }
    RESTORE_STACK;
 }
+#endif /* DISABLE_STEREO */
 
 /* 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, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
@@ -914,6 +921,8 @@
    RESTORE_STACK;
 }
 
+#ifndef DISABLE_STEREO
+
 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;
@@ -1159,3 +1168,5 @@
    }
    RESTORE_STACK;
 }
+
+#endif /* DISABLE_STEREO */
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -774,7 +774,9 @@
 
    ALLOC(offsets, st->mode->nbEBands, int);
    ALLOC(stereo_mode, st->mode->nbEBands, int);
+#ifndef DISABLE_STEREO
    stereo_decision(st->mode, X, stereo_mode, st->mode->nbEBands);
+#endif
 
    for (i=0;i<st->mode->nbEBands;i++)
       offsets[i] = 0;
@@ -790,9 +792,10 @@
    /* Residual quantisation */
    if (C==1)
       quant_bands(st->mode, X, P, NULL, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
+#ifndef DISABLE_STEREO
    else
       quant_bands_stereo(st->mode, X, P, NULL, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
-
+#endif
    /* Re-synthesis of the coded audio if required */
    if (st->pitch_available>0 || optional_synthesis!=NULL)
    {
@@ -1223,7 +1226,9 @@
    ALLOC(pulses, st->mode->nbEBands, int);
    ALLOC(offsets, st->mode->nbEBands, int);
    ALLOC(stereo_mode, st->mode->nbEBands, int);
+#ifndef DISABLE_STEREO
    stereo_decision(st->mode, X, stereo_mode, st->mode->nbEBands);
+#endif
 
    for (i=0;i<st->mode->nbEBands;i++)
       offsets[i] = 0;
@@ -1256,9 +1261,10 @@
    /* Decode fixed codebook and merge with pitch */
    if (C==1)
       unquant_bands(st->mode, X, P, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
+#ifndef DISABLE_STEREO
    else
       unquant_bands_stereo(st->mode, X, P, has_pitch, gains, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
-
+#endif
    /* Synthesis */
    denormalise_bands(st->mode, X, freq, bandE);