diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-06-16 20:24:52 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-06-16 20:24:52 -0400 |
commit | ee2506b2c7e9a0ef05eb489ed554d38d9b71a3e5 (patch) | |
tree | f1d8d49018a369b4d9bdf42a5ea5a94d90c40e90 /celt/bands.c | |
parent | 3afc6ffff068cd9696de7fc3b88a0cd3ab79940a (diff) | |
download | opus-ee2506b2c7e9a0ef05eb489ed554d38d9b71a3e5.tar.gz |
Moves log2Amp inside denormalise_bands() and get rid of bandE[]
Also get rid of the MSE measurement code which is outdated and no longer useful
Diffstat (limited to 'celt/bands.c')
-rw-r--r-- | celt/bands.c | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/celt/bands.c b/celt/bands.c index 62f0ee73..ae77ed71 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -40,6 +40,7 @@ #include "os_support.h" #include "mathops.h" #include "rate.h" +#include "quant_bands.h" int hysteresis_decision(opus_val16 val, const opus_val16 *thresholds, const opus_val16 *hysteresis, int N, int prev) { @@ -188,7 +189,7 @@ void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel /* De-normalise the energy to produce the synthesis from the unit-energy bands */ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, - celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int start, int end, int C, int M) + celt_sig * OPUS_RESTRICT freq, const opus_val16 *bandLogE, int start, int end, int C, int M) { int i, c, N; const opus_int16 *eBands = m->eBands; @@ -204,7 +205,12 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, for (i=start;i<end;i++) { int j, band_end; - opus_val32 g = SHR32(bandE[i+c*m->nbEBands],1); + celt_ener bandE; + opus_val32 g; + opus_val16 lg; + lg = ADD16(bandLogE[i+c*m->nbEBands], SHL16((opus_val16)eMeans[i],6)); + bandE = PSHR32(celt_exp2(lg),4); + g = SHR32(bandE,1); j=M*eBands[i]; band_end = M*eBands[i+1]; do { @@ -502,50 +508,6 @@ int spreading_decision(const CELTMode *m, celt_norm *X, int *average, return decision; } -#ifdef MEASURE_NORM_MSE - -float MSE[30] = {0}; -int nbMSEBands = 0; -int MSECount[30] = {0}; - -void dump_norm_mse(void) -{ - int i; - for (i=0;i<nbMSEBands;i++) - { - printf ("%g ", MSE[i]/MSECount[i]); - } - printf ("\n"); -} - -void measure_norm_mse(const CELTMode *m, float *X, float *X0, float *bandE, float *bandE0, int M, int N, int C) -{ - static int init = 0; - int i; - if (!init) - { - atexit(dump_norm_mse); - init = 1; - } - for (i=0;i<m->nbEBands;i++) - { - int j; - int c; - float g; - if (bandE0[i]<10 || (C==2 && bandE0[i+m->nbEBands]<1)) - continue; - c=0; do { - g = bandE[i+c*m->nbEBands]/(1e-15+bandE0[i+c*m->nbEBands]); - for (j=M*m->eBands[i];j<M*m->eBands[i+1];j++) - MSE[i] += (g*X[j+c*N]-X0[j+c*N])*(g*X[j+c*N]-X0[j+c*N]); - } while (++c<C); - MSECount[i]+=C; - } - nbMSEBands = m->nbEBands; -} - -#endif - /* Indexing table for converting from natural Hadamard to ordery Hadamard This is essentially a bit-reversed Gray, on top of which we've added an inversion of the order because we want the DC at the end rather than |