From 5055cf8c1329dee30d5c633060fb872b53d7f40a Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Wed, 7 Nov 2012 01:14:29 -0500 Subject: Removes the need for lowband_scratch in quant_all_bands() --- celt/bands.c | 11 ++++++++--- celt/celt.c | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'celt') diff --git a/celt/bands.c b/celt/bands.c index 531d3118..f4b6a471 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -716,7 +716,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c recombine = tf_change; /* Band recombining to increase frequency resolution */ - if (lowband && (recombine || ((N_B&1) == 0 && tf_change<0) || B0>1)) + if (lowband_scratch && lowband && (recombine || ((N_B&1) == 0 && tf_change<0) || B0>1)) { int j; for (j=0;jeBands; celt_norm * OPUS_RESTRICT norm, * OPUS_RESTRICT norm2; VARDECL(celt_norm, _norm); - VARDECL(celt_norm, lowband_scratch); + celt_norm *lowband_scratch; int B; int M; int lowband_offset; @@ -1209,9 +1209,11 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end, M = 1<nbEBands], celt_norm); - ALLOC(lowband_scratch, M*(eBands[m->nbEBands]-eBands[m->nbEBands-1]), celt_norm); norm = _norm; norm2 = norm + M*eBands[m->nbEBands]; + /* We can use the last band as scratch space because we don't need that + scratch space for the last band */ + lowband_scratch = X_+M*eBands[m->nbEBands-1]; lowband_offset = 0; for (i=start;idownsample; } - ALLOC(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */ - - c=0; do - for (i=0;istart];i++) - X[c*N+i] = 0; - while (++cstart];i++) + X[c*N+i] = 0; + while (++cstart, st->end, X, C==2 ? X+N : NULL, collapse_masks, NULL, pulses, shortBlocks, spread_decision, dual_stereo, intensity, tf_res, len*(8<rng); -- cgit v1.2.3