From 851f8033f6d3754a76adca225f06f4c573ea2ac2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Mon, 18 Feb 2013 01:43:43 -0500 Subject: [PATCH] Moves mono downmixing and upsampling to the compute_mdcts() --- celt/celt_encoder.c | 79 +++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 56 deletions(-) diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index 2946c7a9..fb33cb62 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -399,13 +399,14 @@ int patch_transient_decision(opus_val16 *new, opus_val16 *old, int nbEBands, /** Apply window and compute the MDCT for all sub-frames and 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) +static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * OPUS_RESTRICT in, + celt_sig * OPUS_RESTRICT out, int C, int CC, int LM, int upsample) { const int overlap = OVERLAP(mode); int N; int B; int shift; - int b, c; + int i, b, c; if (shortBlocks) { B = shortBlocks; @@ -422,7 +423,23 @@ static void compute_mdcts(const CELTMode *mode, int shortBlocks, celt_sig * OPUS /* Interleaving the sub-frames while doing the MDCTs */ clt_mdct_forward(&mode->mdct, in+c*(B*N+overlap)+b*N, &out[b+c*N*B], mode->window, overlap, shift, B); } - } while (++cupsample != 1) - { - c=0; do - { - int bound = N/st->upsample; - for (i=0;iupsample; - for (;iupsample); compute_band_energies(mode, freq, bandE, effEnd, C, M); amp2Log2(mode, effEnd, st->end, bandE, bandLogE2, C); for (i=0;iupsample != 1) - { - c=0; do - { - int bound = N/st->upsample; - for (i=0;iupsample; - for (;iupsample); compute_band_energies(mode, freq, bandE, effEnd, C, M); amp2Log2(mode, effEnd, st->end, bandE, bandLogE, C); @@ -1418,23 +1401,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, { isTransient = 1; shortBlocks = M; - compute_mdcts(mode, shortBlocks, in, freq, CC, LM); - if (CC==2&&C==1) - { - for (i=0;iupsample != 1) - { - c=0; do - { - int bound = N/st->upsample; - for (i=0;iupsample; - for (;iupsample); compute_band_energies(mode, freq, bandE, effEnd, C, M); amp2Log2(mode, effEnd, st->end, bandE, bandLogE, C); /* Compensate for the scaling of short vs long mdcts */