Skip to content
Snippets Groups Projects
Commit fe0b8e8d authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

infrastructure changes for upcoming stereo improvements

parent 21f26661
No related branches found
No related tags found
No related merge requests found
......@@ -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;i<len-5;i++)
stereo_mode[i] = 0;
for (;i<len;i++)
stereo_mode[i] = 1;
}
void stereo_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, int dir)
{
int i;
......
......@@ -97,6 +97,8 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, ce
*/
void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int total_bits, ec_dec *dec);
void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len);
void stereo_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, int dir);
#endif /* BANDS_H */
......@@ -364,7 +364,7 @@ CELTMode EXPORT *celt_mode_create(celt_int32_t Fs, int channels, int frame_size,
#endif
mode->window = 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);
......
......@@ -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;i<m->nbEBands;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 */
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment