diff --git a/libcelt/bands.c b/libcelt/bands.c index a3ce002c..1429ea29 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -289,7 +289,6 @@ void pitch_quant_bands(const CELTMode *m, celt_norm_t * restrict P, const celt_p P[i] = 0; } - /* Quantisation of the residual */ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int total_bits, ec_enc *enc) { @@ -409,6 +408,16 @@ void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, } #ifndef DISABLE_STEREO +void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len) +{ + int i; + for (i=0;iwindow = window; - compute_alloc_cache(mode); + mode->bits = (const celt_int16_t **)compute_alloc_cache(mode, mode->nbChannels); #ifndef SHORTCUTS psydecay_init(&mode->psy, MAX_PERIOD/2, mode->Fs); diff --git a/libcelt/rate.c b/libcelt/rate.c index efc2941f..66b21a20 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -97,19 +97,19 @@ static int log2_frac64(ec_uint64 val, int frac) return L; } -void compute_alloc_cache(CELTMode *m) +celt_int16_t **compute_alloc_cache(CELTMode *m, int C) { - int i, prevN, BC; + int i, prevN; celt_int16_t **bits; const celt_int16_t *eBands = m->eBands; bits = celt_alloc(m->nbEBands*sizeof(celt_int16_t*)); - BC = m->nbChannels; + C = m->nbChannels; prevN = -1; for (i=0;inbEBands;i++) { - int N = BC*(eBands[i+1]-eBands[i]); + int N = C*(eBands[i+1]-eBands[i]); if (N == prevN && eBands[i] < m->pitchEnd) { bits[i] = bits[i-1]; @@ -150,7 +150,7 @@ void compute_alloc_cache(CELTMode *m) RESTORE_STACK; } } - m->bits = (const celt_int16_t * const *)bits; + return bits; } #endif /* !STATIC_MODES */ diff --git a/libcelt/rate.h b/libcelt/rate.h index 0d693684..b0cd4cb1 100644 --- a/libcelt/rate.h +++ b/libcelt/rate.h @@ -36,7 +36,7 @@ #define LOG_MAX_PULSES 6 /** Computes a cache of the pulses->bits mapping in each band */ -void compute_alloc_cache(CELTMode *m); +celt_int16_t **compute_alloc_cache(CELTMode *m, int C); /** Compute the pulse allocation, i.e. how many pulses will go in each * band.