Further simplifications to the forward mdct

This commit is contained in:
Jean-Marc Valin 2008-04-22 09:49:22 +10:00
parent 41880805ab
commit ef0d5f15c7
5 changed files with 28 additions and 32 deletions

View file

@ -153,29 +153,26 @@ static inline celt_int16_t SIG2INT16(celt_sig_t x)
/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
static void compute_mdcts(const CELTMode *mode, const celt_word16_t * restrict window, celt_sig_t * restrict in, celt_sig_t * restrict out)
{
int c, N4;
const mdct_lookup *lookup = MDCT(mode);
const int N = FRAMESIZE(mode);
const int C = CHANNELS(mode);
const int overlap = OVERLAP(mode);
N4 = (N-overlap)>>1;
if (C==1)
{
mdct_forward(lookup, in, out, window, overlap);
} else {
int c;
VARDECL(celt_word32_t, x);
VARDECL(celt_word32_t, tmp);
SAVE_STACK;
ALLOC(x, 2*N, celt_word32_t);
ALLOC(x, N+overlap, celt_word32_t);
ALLOC(tmp, N, celt_word32_t);
for (c=0;c<C;c++)
{
int j;
for (j=0;j<2*N-2*N4;j++)
x[j+N4] = in[C*j+c];
CELT_MEMSET(x, 0, N4);
CELT_MEMSET(x+2*N-N4, 0, N4);
mdct_forward(lookup, x+N4, tmp, window, overlap);
for (j=0;j<N+overlap;j++)
x[j] = in[C*j+c];
mdct_forward(lookup, x, tmp, window, overlap);
/* Interleaving the sub-frames */
for (j=0;j<N;j++)
out[C*j+c] = tmp[j];