Fix for folding_decision() in stereo mode and more cleaning up of the code

now that we no longer do normalized pitch
This commit is contained in:
Jean-Marc Valin 2009-09-30 20:50:41 -04:00
parent 7013db7ca4
commit d5e5436e07
6 changed files with 50 additions and 73 deletions

View file

@ -377,23 +377,26 @@ void deinterleave(celt_norm_t *x, int N)
int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average, int *last_decision) int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average, int *last_decision)
{ {
int i; int i, c;
int NR=0; int NR=0;
celt_word32_t ratio = EPSILON; celt_word32_t ratio = EPSILON;
const int C = CHANNELS(m);
const celt_int16_t * restrict eBands = m->eBands; const celt_int16_t * restrict eBands = m->eBands;
for (c=0;c<C;c++)
{
for (i=0;i<m->nbEBands;i++) for (i=0;i<m->nbEBands;i++)
{ {
int j, N; int j, N;
int max_i=0; int max_i=0;
celt_word16_t max_val=EPSILON; celt_word16_t max_val=EPSILON;
celt_word32_t floor_ener=EPSILON; celt_word32_t floor_ener=EPSILON;
celt_norm_t * restrict x = X+eBands[i]; celt_norm_t * restrict x = X+C*eBands[i]+c;
N = eBands[i+1]-eBands[i]; N = eBands[i+1]-eBands[i];
for (j=0;j<N;j++) for (j=0;j<N;j++)
{ {
if (ABS16(x[j])>max_val) if (ABS16(x[C*j])>max_val)
{ {
max_val = ABS16(x[j]); max_val = ABS16(x[C*j]);
max_i = j; max_i = j;
} }
} }
@ -406,13 +409,13 @@ int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average,
#else #else
floor_ener = QCONST32(1.,28)-MULT16_16(max_val,max_val); floor_ener = QCONST32(1.,28)-MULT16_16(max_val,max_val);
if (max_i < N-1) if (max_i < N-1)
floor_ener -= MULT16_16(x[max_i+1], x[max_i+1]); floor_ener -= MULT16_16(x[C*(max_i+1)], x[C*(max_i+1)]);
if (max_i < N-2) if (max_i < N-2)
floor_ener -= MULT16_16(x[max_i+2], x[max_i+2]); floor_ener -= MULT16_16(x[C*(max_i+2)], x[C*(max_i+2)]);
if (max_i > 0) if (max_i > 0)
floor_ener -= MULT16_16(x[max_i-1], x[max_i-1]); floor_ener -= MULT16_16(x[C*(max_i-1)], x[C*(max_i-1)]);
if (max_i > 1) if (max_i > 1)
floor_ener -= MULT16_16(x[max_i-2], x[max_i-2]); floor_ener -= MULT16_16(x[C*(max_i-2)], x[C*(max_i-2)]);
floor_ener = MAX32(floor_ener, EPSILON); floor_ener = MAX32(floor_ener, EPSILON);
#endif #endif
if (N>7) if (N>7)
@ -425,6 +428,7 @@ int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average,
NR++; NR++;
} }
} }
}
if (NR>0) if (NR>0)
ratio = DIV32_16(ratio, NR); ratio = DIV32_16(ratio, NR);
ratio = ADD32(HALF32(ratio), HALF32(*average)); ratio = ADD32(HALF32(ratio), HALF32(*average));
@ -439,7 +443,7 @@ int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average,
} }
/* Quantisation of the residual */ /* Quantisation of the residual */
void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc) void quant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
{ {
int i, j, remaining_bits, balance; int i, j, remaining_bits, balance;
const celt_int16_t * restrict eBands = m->eBands; const celt_int16_t * restrict eBands = m->eBands;
@ -493,7 +497,7 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, co
int spread = fold ? B : 0; int spread = fold ? B : 0;
alg_quant(X+eBands[i], eBands[i+1]-eBands[i], q, spread, enc); alg_quant(X+eBands[i], eBands[i+1]-eBands[i], q, spread, enc);
} else { } else {
intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], norm, X+eBands[i], eBands[i], B); intra_fold(m, eBands[i+1]-eBands[i], norm, X+eBands[i], eBands[i], B);
} }
for (j=eBands[i];j<eBands[i+1];j++) for (j=eBands[i];j<eBands[i+1];j++)
norm[j] = MULT16_16_Q15(n,X[j]); norm[j] = MULT16_16_Q15(n,X[j]);
@ -503,7 +507,7 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, co
#ifndef DISABLE_STEREO #ifndef DISABLE_STEREO
void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc) void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_enc *enc)
{ {
int i, j, remaining_bits, balance; int i, j, remaining_bits, balance;
const celt_int16_t * restrict eBands = m->eBands; const celt_int16_t * restrict eBands = m->eBands;
@ -515,7 +519,7 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
SAVE_STACK; SAVE_STACK;
B = shortBlocks ? m->nbShortMdcts : 1; B = shortBlocks ? m->nbShortMdcts : 1;
ALLOC(_norm, C*eBands[m->nbEBands+1], celt_norm_t); ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
norm = _norm; norm = _norm;
balance = 0; balance = 0;
@ -680,19 +684,13 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
remaining_bits -= curr_bits; remaining_bits -= curr_bits;
} }
/* If pitch isn't available, use intra-frame prediction */
if (q1==0)
{
intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], B);
deinterleave(P+C*eBands[i], C*N);
}
deinterleave(X+C*eBands[i], C*N); deinterleave(X+C*eBands[i], C*N);
if (q1 > 0) { if (q1 > 0) {
int spread = fold ? B : 0; int spread = fold ? B : 0;
alg_quant(X+C*eBands[i], N, q1, spread, enc); alg_quant(X+C*eBands[i], N, q1, spread, enc);
} else } else {
for (j=C*eBands[i];j<C*eBands[i]+N;j++) intra_fold(m, eBands[i+1]-eBands[i], norm, X+C*eBands[i], eBands[i], B);
X[j] = P[j]; }
if (q2 > 0) { if (q2 > 0) {
int spread = fold ? B : 0; int spread = fold ? B : 0;
alg_quant(X+C*eBands[i]+N, N, q2, spread, enc); alg_quant(X+C*eBands[i]+N, N, q2, spread, enc);
@ -710,9 +708,8 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
mid = (1./32768)*imid; mid = (1./32768)*imid;
side = (1./32768)*iside; side = (1./32768)*iside;
#endif #endif
for (c=0;c<C;c++)
for (j=0;j<N;j++) for (j=0;j<N;j++)
norm[C*(eBands[i]+j)+c] = MULT16_16_Q15(n,X[C*eBands[i]+c*N+j]); norm[eBands[i]+j] = MULT16_16_Q15(n,X[C*eBands[i]+j]);
for (j=0;j<N;j++) for (j=0;j<N;j++)
X[C*eBands[i]+j] = MULT16_16_Q15(X[C*eBands[i]+j], mid); X[C*eBands[i]+j] = MULT16_16_Q15(X[C*eBands[i]+j], mid);
@ -731,7 +728,7 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
#endif /* DISABLE_STEREO */ #endif /* DISABLE_STEREO */
/* Decoding of the residual */ /* Decoding of the residual */
void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec) void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
{ {
int i, j, remaining_bits, balance; int i, j, remaining_bits, balance;
const celt_int16_t * restrict eBands = m->eBands; const celt_int16_t * restrict eBands = m->eBands;
@ -785,7 +782,7 @@ void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P,
int spread = fold ? B : 0; int spread = fold ? B : 0;
alg_unquant(X+eBands[i], eBands[i+1]-eBands[i], q, spread, dec); alg_unquant(X+eBands[i], eBands[i+1]-eBands[i], q, spread, dec);
} else { } else {
intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], norm, X+eBands[i], eBands[i], B); intra_fold(m, eBands[i+1]-eBands[i], norm, X+eBands[i], eBands[i], B);
} }
for (j=eBands[i];j<eBands[i+1];j++) for (j=eBands[i];j<eBands[i+1];j++)
norm[j] = MULT16_16_Q15(n,X[j]); norm[j] = MULT16_16_Q15(n,X[j]);
@ -795,7 +792,7 @@ void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P,
#ifndef DISABLE_STEREO #ifndef DISABLE_STEREO
void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec) void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int shortBlocks, int fold, int total_bits, ec_dec *dec)
{ {
int i, j, remaining_bits, balance; int i, j, remaining_bits, balance;
const celt_int16_t * restrict eBands = m->eBands; const celt_int16_t * restrict eBands = m->eBands;
@ -807,7 +804,7 @@ void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm
SAVE_STACK; SAVE_STACK;
B = shortBlocks ? m->nbShortMdcts : 1; B = shortBlocks ? m->nbShortMdcts : 1;
ALLOC(_norm, C*eBands[m->nbEBands+1], celt_norm_t); ALLOC(_norm, eBands[m->nbEBands+1], celt_norm_t);
norm = _norm; norm = _norm;
balance = 0; balance = 0;
@ -954,22 +951,13 @@ void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm
remaining_bits -= curr_bits; remaining_bits -= curr_bits;
} }
/* If pitch isn't available, use intra-frame prediction */
if (q1==0)
{
intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], B);
deinterleave(P+C*eBands[i], C*N);
}
deinterleave(X+C*eBands[i], C*N); deinterleave(X+C*eBands[i], C*N);
if (q1 > 0) if (q1 > 0)
{ {
int spread = fold ? B : 0; int spread = fold ? B : 0;
alg_unquant(X+C*eBands[i], N, q1, spread, dec); alg_unquant(X+C*eBands[i], N, q1, spread, dec);
} else } else
for (j=C*eBands[i];j<C*eBands[i]+N;j++) intra_fold(m, eBands[i+1]-eBands[i], norm, X+C*eBands[i], eBands[i], B);
X[j] = P[j];
if (q2 > 0) if (q2 > 0)
{ {
int spread = fold ? B : 0; int spread = fold ? B : 0;
@ -988,9 +976,8 @@ void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm
mid = (1./32768)*imid; mid = (1./32768)*imid;
side = (1./32768)*iside; side = (1./32768)*iside;
#endif #endif
for (c=0;c<C;c++)
for (j=0;j<N;j++) for (j=0;j<N;j++)
norm[C*(eBands[i]+j)+c] = MULT16_16_Q15(n,X[C*eBands[i]+c*N+j]); norm[eBands[i]+j] = MULT16_16_Q15(n,X[C*eBands[i]+j]);
for (j=0;j<N;j++) for (j=0;j<N;j++)
X[C*eBands[i]+j] = MULT16_16_Q15(X[C*eBands[i]+j], mid); X[C*eBands[i]+j] = MULT16_16_Q15(X[C*eBands[i]+j], mid);

View file

@ -87,9 +87,9 @@ int folding_decision(const CELTMode *m, celt_norm_t *X, celt_word16_t *average,
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent) * @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param enc Entropy encoder * @param enc Entropy encoder
*/ */
void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc); void quant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc); void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_enc *enc);
/** Decoding of the residual spectrum /** Decoding of the residual spectrum
* @param m Mode data * @param m Mode data
@ -98,9 +98,9 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
* @param total_bits Total number of bits that can be used for the frame (including the ones already spent) * @param total_bits Total number of bits that can be used for the frame (including the ones already spent)
* @param dec Entropy decoder * @param dec Entropy decoder
*/ */
void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec); void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec); void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, const celt_ener_t *bandE, int *pulses, int time_domain, int fold, int total_bits, ec_dec *dec);
void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len); void stereo_decision(const CELTMode *m, celt_norm_t * restrict X, int *stereo_mode, int len);

View file

@ -506,7 +506,6 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
VARDECL(celt_sig_t, freq); VARDECL(celt_sig_t, freq);
VARDECL(celt_sig_t, pitch_freq); VARDECL(celt_sig_t, pitch_freq);
VARDECL(celt_norm_t, X); VARDECL(celt_norm_t, X);
VARDECL(celt_norm_t, P);
VARDECL(celt_ener_t, bandE); VARDECL(celt_ener_t, bandE);
VARDECL(celt_word16_t, bandLogE); VARDECL(celt_word16_t, bandLogE);
VARDECL(int, fine_quant); VARDECL(int, fine_quant);
@ -674,7 +673,6 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
/* Deferred allocation after find_spectral_pitch() to reduce /* Deferred allocation after find_spectral_pitch() to reduce
the peak memory usage */ the peak memory usage */
ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */ ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
ALLOC(P, C*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
ALLOC(pitch_freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */ ALLOC(pitch_freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
if (has_pitch) if (has_pitch)
@ -709,9 +707,6 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
{ {
ec_enc_uint(&enc, pitch_index, MAX_PERIOD-(2*N-2*N4)); ec_enc_uint(&enc, pitch_index, MAX_PERIOD-(2*N-2*N4));
ec_enc_uint(&enc, gain_id, 16); ec_enc_uint(&enc, gain_id, 16);
} else {
for (i=0;i<C*N;i++)
P[i] = 0;
} }
if (shortBlocks) if (shortBlocks)
{ {
@ -769,10 +764,10 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
/* Residual quantisation */ /* Residual quantisation */
if (C==1) if (C==1)
quant_bands(st->mode, X, P, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc); quant_bands(st->mode, X, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
#ifndef DISABLE_STEREO #ifndef DISABLE_STEREO
else else
quant_bands_stereo(st->mode, X, P, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc); quant_bands_stereo(st->mode, X, bandE, pulses, shortBlocks, has_fold, nbCompressedBytes*8, &enc);
#endif #endif
quant_energy_finalise(st->mode, bandE, st->oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_enc_tell(&enc, 0), &enc); quant_energy_finalise(st->mode, bandE, st->oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_enc_tell(&enc, 0), &enc);
@ -1205,7 +1200,6 @@ int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int
VARDECL(celt_sig_t, freq); VARDECL(celt_sig_t, freq);
VARDECL(celt_sig_t, pitch_freq); VARDECL(celt_sig_t, pitch_freq);
VARDECL(celt_norm_t, X); VARDECL(celt_norm_t, X);
VARDECL(celt_norm_t, P);
VARDECL(celt_ener_t, bandE); VARDECL(celt_ener_t, bandE);
VARDECL(int, fine_quant); VARDECL(int, fine_quant);
VARDECL(int, pulses); VARDECL(int, pulses);
@ -1236,7 +1230,6 @@ int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int
ALLOC(freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */ ALLOC(freq, C*N, celt_sig_t); /**< Interleaved signal MDCTs */
ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */ ALLOC(X, C*N, celt_norm_t); /**< Interleaved normalised MDCTs */
ALLOC(P, C*N, celt_norm_t); /**< Interleaved normalised pitch MDCTs*/
ALLOC(bandE, st->mode->nbEBands*C, celt_ener_t); ALLOC(bandE, st->mode->nbEBands*C, celt_ener_t);
if (data == NULL) if (data == NULL)
@ -1309,10 +1302,10 @@ int celt_decode_float(CELTDecoder * restrict st, const unsigned char *data, int
/* Decode fixed codebook and merge with pitch */ /* Decode fixed codebook and merge with pitch */
if (C==1) if (C==1)
unquant_bands(st->mode, X, P, bandE, pulses, shortBlocks, has_fold, len*8, &dec); unquant_bands(st->mode, X, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
#ifndef DISABLE_STEREO #ifndef DISABLE_STEREO
else else
unquant_bands_stereo(st->mode, X, P, bandE, pulses, shortBlocks, has_fold, len*8, &dec); unquant_bands_stereo(st->mode, X, bandE, pulses, shortBlocks, has_fold, len*8, &dec);
#endif #endif
unquant_energy_finalise(st->mode, bandE, st->oldBandE, fine_quant, fine_priority, len*8-ec_dec_tell(&dec, 0), &dec); unquant_energy_finalise(st->mode, bandE, st->oldBandE, fine_quant, fine_priority, len*8-ec_dec_tell(&dec, 0), &dec);

View file

@ -124,8 +124,8 @@ static celt_int16_t *compute_ebands(celt_int32_t Fs, int frame_size, int nbShort
celt_int16_t *eBands; celt_int16_t *eBands;
int i, res, min_width, lin, low, high, nBark; int i, res, min_width, lin, low, high, nBark;
//if (min_bins < nbShortMdcts) /*if (min_bins < nbShortMdcts)
// min_bins = nbShortMdcts; min_bins = nbShortMdcts;*/
res = (Fs+frame_size)/(2*frame_size); res = (Fs+frame_size)/(2*frame_size);
min_width = min_bins*res; min_width = min_bins*res;

View file

@ -40,6 +40,10 @@
#include "os_support.h" #include "os_support.h"
#include "rate.h" #include "rate.h"
#ifndef M_PI
#define M_PI 3.141592653
#endif
static void exp_rotation(celt_norm_t *X, int len, int dir, int stride, int K) static void exp_rotation(celt_norm_t *X, int len, int dir, int stride, int K)
{ {
int i, k, iter; int i, k, iter;
@ -339,11 +343,10 @@ celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int
return rE; return rE;
} }
static void fold(const CELTMode *m, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B) static void fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B)
{ {
int j; int j;
const int C = CHANNELS(m); int id = N0 % B;
int id = (N0*C) % (C*B);
/* Here, we assume that id will never be greater than N0, i.e. that /* Here, we assume that id will never be greater than N0, i.e. that
no band is wider than N0. In the unlikely case it happens, we set no band is wider than N0. In the unlikely case it happens, we set
everything to zero */ everything to zero */
@ -357,23 +360,17 @@ static void fold(const CELTMode *m, int N, celt_norm_t *Y, celt_norm_t * restric
//printf ("%d\n", offset); //printf ("%d\n", offset);
id += offset; id += offset;
}*/ }*/
if (id+C*N>N0*C) if (id+N>N0)
for (j=0;j<C*N;j++) for (j=0;j<N;j++)
P[j] = 0; P[j] = 0;
else else
for (j=0;j<C*N;j++) for (j=0;j<N;j++)
P[j] = Y[id++]; P[j] = Y[id++];
} }
void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B) void intra_fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B)
{ {
int c;
const int C = CHANNELS(m);
fold(m, N, Y, P, N0, B); fold(m, N, Y, P, N0, B);
c=0; renormalise_vector(P, Q15ONE, N, 1);
do {
renormalise_vector(P+c, Q15ONE, N, C);
} while (++c < C);
} }

View file

@ -74,6 +74,6 @@ celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int
* @param B Stride (number of channels multiplied by the number of MDCTs per frame) * @param B Stride (number of channels multiplied by the number of MDCTs per frame)
* @param N0 Number of valid offsets * @param N0 Number of valid offsets
*/ */
void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B); void intra_fold(const CELTMode *m, int N, const celt_norm_t * restrict Y, celt_norm_t * restrict P, int N0, int B);
#endif /* VQ_H */ #endif /* VQ_H */