shithub: opus

Download patch

ref: b30dd9e1bf847b8b72fdbe4b91ea35bfbf810e47
parent: 2805a14ecac4a42fbae742b95f87047c7500032e
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 26 15:32:24 EST 2008

fixed-point: got stereo to work again by fixing renormalise_bands()

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -112,14 +112,28 @@
       X[i] = 0;
 }
 
+#ifdef FIXED_POINT
 void renormalise_bands(const CELTMode *m, celt_norm_t *X)
 {
+   int i;
    VARDECL(celt_ener_t *tmpE);
+   VARDECL(celt_sig_t *freq);
    ALLOC(tmpE, m->nbEBands*m->nbChannels, celt_ener_t);
+   ALLOC(freq, m->nbMdctBlocks*m->nbChannels*m->eBands[m->nbEBands+1], celt_sig_t);
+   for (i=0;i<m->nbMdctBlocks*m->nbChannels*m->eBands[m->nbEBands+1];i++)
+      freq[i] = SHL32(EXTEND32(X[i]), 10);
+   compute_band_energies(m, freq, tmpE);
+   normalise_bands(m, freq, X, tmpE);
+}
+#else
+void renormalise_bands(const CELTMode *m, celt_norm_t *X)
+{
+   VARDECL(celt_ener_t *tmpE);
+   ALLOC(tmpE, m->nbEBands*m->nbChannels, celt_ener_t);
    compute_band_energies(m, X, tmpE);
-   /* FIXME: This isn't right */
    normalise_bands(m, X, X, tmpE);
 }
+#endif
 
 /* De-normalise the energy to produce the synthesis from the unit-energy bands */
 void denormalise_bands(const CELTMode *m, celt_norm_t *X, celt_sig_t *freq, celt_ener_t *bank)