More cleanup
This commit is contained in:
parent
663c0492bb
commit
6f1cbca519
3 changed files with 15 additions and 10 deletions
|
@ -363,7 +363,7 @@ static void stereo_band_mix(const CELTMode *m, celt_norm *X, celt_norm *Y, const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Decide whether we should spread the pulses in the current frame */
|
||||
int folding_decision(const CELTMode *m, celt_norm *X, celt_word16 *average, int *last_decision, int end, int _C, int M)
|
||||
{
|
||||
int i, c, N0;
|
||||
|
@ -803,6 +803,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
|
|||
if (lowband && !stereo)
|
||||
next_lowband2 = lowband+N; /* >32-bit split case */
|
||||
|
||||
/* Only stereo needs to pass on lowband_out. Otherwise, it's handled at the end */
|
||||
if (stereo)
|
||||
next_lowband_out1 = lowband_out;
|
||||
else
|
||||
|
@ -829,9 +830,9 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
|
|||
|
||||
/* Finally do the actual quantization */
|
||||
if (encode)
|
||||
alg_quant(X, N, q, spread ? B : 0, lowband, resynth, (ec_enc*)ec, seed);
|
||||
alg_quant(X, N, q, spread, B, lowband, resynth, (ec_enc*)ec, seed);
|
||||
else
|
||||
alg_unquant(X, N, q, spread ? B : 0, lowband, (ec_dec*)ec, seed);
|
||||
alg_unquant(X, N, q, spread, B, lowband, (ec_dec*)ec, seed);
|
||||
}
|
||||
|
||||
/* This code is used by the decoder and by the resynthesis-enabled encoder */
|
||||
|
@ -898,6 +899,8 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
|
|||
if (stereo)
|
||||
{
|
||||
stereo_band_mix(m, X, Y, bandE, 0, i, -1, N);
|
||||
/* We only need to renormalize because quantization may not
|
||||
have preserved orthogonality of mid and side */
|
||||
renormalise_vector(X, Q15ONE, N, 1);
|
||||
renormalise_vector(Y, Q15ONE, N, 1);
|
||||
}
|
||||
|
@ -953,6 +956,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end, celt_nor
|
|||
else
|
||||
tell = ec_dec_tell((ec_dec*)ec, BITRES);
|
||||
|
||||
/* Compute how many bits we want to allocate to this band */
|
||||
if (i != start)
|
||||
balance -= tell;
|
||||
remaining_bits = (total_bits<<BITRES)-tell-1;
|
||||
|
|
11
libcelt/vq.c
11
libcelt/vq.c
|
@ -154,7 +154,7 @@ static void normalise_residual(int * restrict iy, celt_norm * restrict X, int N,
|
|||
while (++i < N);
|
||||
}
|
||||
|
||||
void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int resynth, ec_enc *enc, celt_int32 *seed)
|
||||
void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband, int resynth, ec_enc *enc, celt_int32 *seed)
|
||||
{
|
||||
VARDECL(celt_norm, y);
|
||||
VARDECL(int, iy);
|
||||
|
@ -198,7 +198,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int r
|
|||
N_1 = 512/N;
|
||||
|
||||
if (spread)
|
||||
exp_rotation(X, N, 1, spread, K);
|
||||
exp_rotation(X, N, 1, B, K);
|
||||
|
||||
sum = 0;
|
||||
j=0; do {
|
||||
|
@ -332,7 +332,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int r
|
|||
{
|
||||
normalise_residual(iy, X, N, K, EXTRACT16(SHR32(yy,2*yshift)));
|
||||
if (spread)
|
||||
exp_rotation(X, N, -1, spread, K);
|
||||
exp_rotation(X, N, -1, B, K);
|
||||
}
|
||||
RESTORE_STACK;
|
||||
}
|
||||
|
@ -340,12 +340,13 @@ void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int r
|
|||
|
||||
/** Decode pulse vector and combine the result with the pitch vector to produce
|
||||
the final normalised signal in the current band. */
|
||||
void alg_unquant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, ec_dec *dec, celt_int32 *seed)
|
||||
void alg_unquant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband, ec_dec *dec, celt_int32 *seed)
|
||||
{
|
||||
int i;
|
||||
celt_word32 Ryy;
|
||||
VARDECL(int, iy);
|
||||
SAVE_STACK;
|
||||
|
||||
if (K==0)
|
||||
{
|
||||
if (lowband != NULL)
|
||||
|
@ -373,7 +374,7 @@ void alg_unquant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, ec_
|
|||
} while (++i < N);
|
||||
normalise_residual(iy, X, N, K, Ryy);
|
||||
if (spread)
|
||||
exp_rotation(X, N, -1, spread, K);
|
||||
exp_rotation(X, N, -1, B, K);
|
||||
RESTORE_STACK;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
* @param p Pitch vector (it is assumed that p+x is a unit vector)
|
||||
* @param enc Entropy encoder state
|
||||
*/
|
||||
void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int resynth, ec_enc *enc, celt_int32 *seed);
|
||||
void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband, int resynth, ec_enc *enc, celt_int32 *seed);
|
||||
|
||||
/** Algebraic pulse decoder
|
||||
* @param x Decoded normalised spectrum (returned)
|
||||
|
@ -60,7 +60,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, int r
|
|||
* @param p Pitch vector (automatically added to x)
|
||||
* @param dec Entropy decoder state
|
||||
*/
|
||||
void alg_unquant(celt_norm *X, int N, int K, int spread, celt_norm *lowband, ec_dec *dec, celt_int32 *seed);
|
||||
void alg_unquant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband, ec_dec *dec, celt_int32 *seed);
|
||||
|
||||
celt_word16 renormalise_vector(celt_norm *X, celt_word16 value, int N, int stride);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue