Commit bd43729e authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

MDCT is in fixed-point now

parent 2e8a3b20
......@@ -56,8 +56,6 @@
#define M_PI 3.14159263
#endif
#undef S_MUL
#define S_MUL(a,b) ((a)*(b))
void mdct_init(mdct_lookup *l,int N)
{
int i;
......@@ -68,8 +66,18 @@ void mdct_init(mdct_lookup *l,int N)
l->kfft = kiss_fft_alloc(N4, NULL, NULL);
l->trig = celt_alloc(N2*sizeof(float));
/* We have enough points that sine isn't necessary */
#if defined(FIXED_POINT)
#if defined(DOUBLE_PRECISION) & !defined(MIXED_PRECISION)
for (i=0;i<N2;i++)
l->trig[i] = SAMP_MAX*cos(2*M_PI*(i+1./8.)/N);
#else
for (i=0;i<N2;i++)
l->trig[i] = TRIG_UPSCALE*celt_cos_norm(DIV32(ADD32(SHL32(i,17),16386),N));
#endif
#else
for (i=0;i<N2;i++)
l->trig[i] = cos(2*M_PI*(i+1./8.)/N);
#endif
}
void mdct_clear(mdct_lookup *l)
......
......@@ -47,7 +47,7 @@
typedef struct {
int n;
kiss_fft_cfg kfft;
float *trig;
kiss_twiddle_scalar *trig;
} mdct_lookup;
void mdct_init(mdct_lookup *l,int N);
......
......@@ -78,12 +78,12 @@ void test1d(int nfft,int isinverse)
mdct_init(&cfg, nfft);
for (k=0;k<nfft;++k) {
in[k] = (rand() % 65536) - 32768;
in[k] = (rand() % 32768) - 16384;
}
#ifdef DOUBLE_PRECISION
for (k=0;k<nfft;++k) {
in[k] *= 32768;
in[k] *= 65536;
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment