diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-01-05 05:32:32 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-01-05 05:32:32 +0300 |
commit | 2875f6bf8d24dbce0e736d2c521791e218d13875 (patch) | |
tree | 2ca39b25de30f8e4c7d01bb4021fba71a9274ff3 /libcelt/bands.c | |
parent | a5431bfb090b3b3d31744265a86a1d8684c1e34d (diff) |
Now using 8 bands for the pitch gain, with a 128-entry codebook.
Diffstat (limited to 'libcelt/bands.c')
-rw-r--r-- | libcelt/bands.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c index 1219c0c..7db4bad 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -170,13 +170,21 @@ void compute_pitch_gain(const CELTMode *m, float *X, float *P, float *gains, flo //gain = Sxy/(2*(pbank[i+1]-pbank[i])); //if (i<3) //gain *= 1+.02*gain; - if (gain > .90) - gain = .90; - if (gain < 0.0) - gain = 0.0; - + if (gain > 1.f) + gain = 1.f; + if (gain < 0.0f) + gain = 0.0f; + /* We need to be a bit conservative, otherwise residual doesn't quantise well */ + gain *= .9f; gains[i] = gain; + //printf ("%f ", 1-sqrt(1-gain*gain)); } + /*if(rand()%10==0) + { + for (i=0;i<m->nbPBands;i++) + printf ("%f ", 1-sqrt(1-gains[i]*gains[i])); + printf ("\n"); + }*/ for (i=B*pBands[m->nbPBands];i<B*pBands[m->nbPBands+1];i++) P[i] = 0; } |