diff --git a/celt/celt.c b/celt/celt.c index 576ccb92..69b7a693 100644 --- a/celt/celt.c +++ b/celt/celt.c @@ -446,28 +446,28 @@ static int transient_analysis(const opus_val32 * OPUS_RESTRICT in, int len, int all channels in a frame */ static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * OPUS_RESTRICT in, celt_sig * OPUS_RESTRICT out, int C, int LM) { - if (C==1 && !shortBlocks) + const int overlap = OVERLAP(mode); + int N; + int B; + int shift; + int b, c; + if (shortBlocks) { - const int overlap = OVERLAP(mode); - clt_mdct_forward(&mode->mdct, in, out, mode->window, overlap, mode->maxLM-LM, 1); + B = shortBlocks; + N = mode->shortMdctSize; + shift = mode->maxLM; } else { - const int overlap = OVERLAP(mode); - int N = mode->shortMdctSize<shortMdctSize; - B = shortBlocks; - } - c=0; do { - for (b=0;bmdct, in+c*(B*N+overlap)+b*N, &out[b+c*N*B], mode->window, overlap, shortBlocks ? mode->maxLM : mode->maxLM-LM, B); - } - } while (++cshortMdctSize<maxLM-LM; } + c=0; do { + for (b=0;bmdct, in+c*(B*N+overlap)+b*N, &out[b+c*N*B], mode->window, overlap, shift, B); + } + } while (++cshortMdctSize<shortMdctSize; + shift = mode->maxLM; + } else { + B = 1; + N = mode->shortMdctSize<maxLM-LM; + } c=0; do { - int b; - int N2 = N; - int B = 1; - - if (shortBlocks) - { - N2 = mode->shortMdctSize; - B = shortBlocks; - } - /* The imdct does the overlap-add */ - OPUS_COPY(out_mem[c], out_mem[c]+N, overlap); - + /* IMDCT on the interleaved the sub-frames, overlap-add is performed by the IMDCT */ for (b=0;bmdct, &X[b+c*N2*B], out_mem[c]+N2*b, mode->window, overlap, shortBlocks ? mode->maxLM : mode->maxLM-LM, B); - } + clt_mdct_backward(&mode->mdct, &X[b+c*N*B], out_mem[c]+N*b, mode->window, overlap, shift, B); } while (++csyn_mem[0], st->syn_mem[0]+N, 2*MAX_PERIOD-N); - if (CC==2) - OPUS_MOVE(st->syn_mem[1], st->syn_mem[1]+N, 2*MAX_PERIOD-N); + c=0; do { + OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap); + } while (++cstart];i++) @@ -2011,9 +2007,9 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, freq[N+i] = freq[i]; } - out_mem[0] = st->syn_mem[0]+2*MAX_PERIOD-N; - if (CC==2) - out_mem[1] = st->syn_mem[1]+2*MAX_PERIOD-N; + c=0; do { + out_mem[c] = st->syn_mem[c]+2*MAX_PERIOD-N; + } while (++cstart];i++) @@ -3022,9 +3021,9 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat freq[c*N+i] = 0; } while (++c