Changed some of the mode data from int to celt_int16_t to save memory.
[opus.git] / libcelt / mdct.c
index 8cc6997..f69dc80 100644 (file)
@@ -73,7 +73,7 @@ void mdct_init(mdct_lookup *l,int N)
       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));
+      l->trig[i] = TRIG_UPSCALE*celt_cos_norm(DIV32(ADD32(SHL32(EXTEND32(i),17),16386),N));
 #endif
 #else
    for (i=0;i<N2;i++)
@@ -104,8 +104,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
    {
       kiss_fft_scalar re, im;
       /* Real part arranged as -d-cR, Imag part arranged as -b+aR*/
-      re = -.5*(in[N2+N4+2*i] + in[N2+N4-2*i-1]);
-      im = -.5*(in[N4+2*i]    - in[N4-2*i-1]);
+      re = -HALF32(in[N2+N4+2*i] + in[N2+N4-2*i-1]);
+      im = -HALF32(in[N4+2*i]    - in[N4-2*i-1]);
       out[2*i]   = S_MUL(re,l->trig[i])  -  S_MUL(im,l->trig[i+N4]);
       out[2*i+1] = S_MUL(im,l->trig[i])  +  S_MUL(re,l->trig[i+N4]);
    }
@@ -113,8 +113,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
    {
       kiss_fft_scalar re, im;
       /* Real part arranged as a-bR, Imag part arranged as -c-dR */
-      re =  .5*(in[2*i-N4] - in[N2+N4-2*i-1]);
-      im = -.5*(in[N4+2*i] + in[N+N4-2*i-1]);
+      re =  HALF32(in[2*i-N4] - in[N2+N4-2*i-1]);
+      im = -HALF32(in[N4+2*i] + in[N+N4-2*i-1]);
       out[2*i]   = S_MUL(re,l->trig[i])  -  S_MUL(im,l->trig[i+N4]);
       out[2*i+1] = S_MUL(im,l->trig[i])  +  S_MUL(re,l->trig[i+N4]);
    }