shithub: opus

Download patch

ref: 97252d036569c112efa4e46f988c442ca8de0b00
parent: e84962bcd969d20d736eb5851013b1ddd2c5c45a
author: Jean-Marc Valin <[email protected]>
date: Sun Dec 30 15:39:14 EST 2007

Spreading function inside quant_bands()

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -209,8 +209,13 @@
       int q;
       q = m->nbPulses[i];
       if (q>0) {
-         float n = sqrt(B*(eBands[i+1]-eBands[i]));
+         float theta, n;
+         n = sqrt(B*(eBands[i+1]-eBands[i]));
+         theta = .007*(B*(eBands[i+1]-eBands[i]))/(.1f+abs(m->nbPulses[i]));
+         exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, -1, B, 8);
+         exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, -1, B, 8);
          alg_quant(X+B*eBands[i], W+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i], 0.7, enc);
+         exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, 1, B, 8);
          for (j=B*eBands[i];j<B*eBands[i+1];j++)
             norm[j] = X[j] * n;
          //printf ("%f ", log2(ncwrs64(B*(eBands[i+1]-eBands[i]), q))/(B*(eBands[i+1]-eBands[i])));
@@ -241,8 +246,12 @@
       int q;
       q = m->nbPulses[i];
       if (q>0) {
-         float n = sqrt(B*(eBands[i+1]-eBands[i]));
+         float theta, n;
+         n = sqrt(B*(eBands[i+1]-eBands[i]));
+         theta = .007*(B*(eBands[i+1]-eBands[i]))/(.1f+abs(m->nbPulses[i]));
+         exp_rotation(P+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, -1, B, 8);
          alg_unquant(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), q, P+B*eBands[i], 0.7, dec);
+         exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, 1, B, 8);
          for (j=B*eBands[i];j<B*eBands[i+1];j++)
             norm[j] = X[j] * n;
       } else {
@@ -260,6 +269,7 @@
 
 void band_rotation(const CELTMode *m, float *X, int dir)
 {
+   return;
    int i, B;
    const int *eBands = m->eBands;
    B = m->nbMdctBlocks*m->nbChannels;
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -296,8 +296,8 @@
       normalise_bands(st->mode, P, bandEp);
    }
    
-   band_rotation(st->mode, X, -1);
-   band_rotation(st->mode, P, -1);
+   //band_rotation(st->mode, X, -1);
+   //band_rotation(st->mode, P, -1);
    
    quant_energy(st->mode, bandE, st->oldBandE, &st->enc);
    
@@ -328,7 +328,7 @@
       //printf ("\n");
    }
    
-   band_rotation(st->mode, X, 1);
+   //band_rotation(st->mode, X, 1);
 
    /* Synthesis */
    denormalise_bands(st->mode, X, bandE);
@@ -532,7 +532,7 @@
       compute_band_energies(st->mode, P, bandEp);
       normalise_bands(st->mode, P, bandEp);
    }
-   band_rotation(st->mode, P, -1);
+   //band_rotation(st->mode, P, -1);
 
    /* Get the pitch gains */
    unquant_pitch(gains, st->mode->nbPBands, &dec);
@@ -543,7 +543,7 @@
    /* Decode fixed codebook and merge with pitch */
    unquant_bands(st->mode, X, P, &dec);
 
-   band_rotation(st->mode, X, 1);
+   //band_rotation(st->mode, X, 1);
    
    /* Synthesis */
    denormalise_bands(st->mode, X, bandE);