infrastructure changes for upcoming stereo improvements
This commit is contained in:
parent
21f2666155
commit
fe0b8e8db4
5 changed files with 19 additions and 8 deletions
|
@ -289,7 +289,6 @@ void pitch_quant_bands(const CELTMode *m, celt_norm_t * restrict P, const celt_p
|
||||||
P[i] = 0;
|
P[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Quantisation of the residual */
|
/* 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)
|
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
|
#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)
|
void stereo_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, int dir)
|
||||||
{
|
{
|
||||||
int i;
|
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 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);
|
void stereo_mix(const CELTMode *m, celt_norm_t *X, const celt_ener_t *bank, int dir);
|
||||||
|
|
||||||
#endif /* BANDS_H */
|
#endif /* BANDS_H */
|
||||||
|
|
|
@ -364,7 +364,7 @@ CELTMode EXPORT *celt_mode_create(celt_int32_t Fs, int channels, int frame_size,
|
||||||
#endif
|
#endif
|
||||||
mode->window = window;
|
mode->window = window;
|
||||||
|
|
||||||
compute_alloc_cache(mode);
|
mode->bits = (const celt_int16_t **)compute_alloc_cache(mode, mode->nbChannels);
|
||||||
|
|
||||||
#ifndef SHORTCUTS
|
#ifndef SHORTCUTS
|
||||||
psydecay_init(&mode->psy, MAX_PERIOD/2, mode->Fs);
|
psydecay_init(&mode->psy, MAX_PERIOD/2, mode->Fs);
|
||||||
|
|
|
@ -97,19 +97,19 @@ static int log2_frac64(ec_uint64 val, int frac)
|
||||||
return L;
|
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;
|
celt_int16_t **bits;
|
||||||
const celt_int16_t *eBands = m->eBands;
|
const celt_int16_t *eBands = m->eBands;
|
||||||
|
|
||||||
bits = celt_alloc(m->nbEBands*sizeof(celt_int16_t*));
|
bits = celt_alloc(m->nbEBands*sizeof(celt_int16_t*));
|
||||||
|
|
||||||
BC = m->nbChannels;
|
C = m->nbChannels;
|
||||||
prevN = -1;
|
prevN = -1;
|
||||||
for (i=0;i<m->nbEBands;i++)
|
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)
|
if (N == prevN && eBands[i] < m->pitchEnd)
|
||||||
{
|
{
|
||||||
bits[i] = bits[i-1];
|
bits[i] = bits[i-1];
|
||||||
|
@ -150,7 +150,7 @@ void compute_alloc_cache(CELTMode *m)
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m->bits = (const celt_int16_t * const *)bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !STATIC_MODES */
|
#endif /* !STATIC_MODES */
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#define LOG_MAX_PULSES 6
|
#define LOG_MAX_PULSES 6
|
||||||
|
|
||||||
/** Computes a cache of the pulses->bits mapping in each band */
|
/** 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
|
/** Compute the pulse allocation, i.e. how many pulses will go in each
|
||||||
* band.
|
* band.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue