diff --git a/libcelt/celt.c b/libcelt/celt.c index dfe472a2..577272ef 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -79,9 +79,8 @@ struct CELTEncoder { int constrained_vbr; /* If zero, VBR can do whatever it likes with the rate */ /* Everything beyond this point gets cleared on a reset */ -#define ENCODER_RESET_START frame_max +#define ENCODER_RESET_START rng - celt_word32 frame_max; ec_uint32 rng; int spread_decision; int delayedIntra; @@ -202,7 +201,7 @@ static inline celt_word16 SIG2WORD16(celt_sig x) } static int transient_analysis(const celt_word32 * restrict in, int len, int C, - celt_word32 *frame_max, int overlap) + int overlap) { int i; VARDECL(celt_word16, tmp); @@ -645,7 +644,7 @@ static void tf_encode(int start, int end, int isTransient, int *tf_res, int LM, /*printf("%d %d ", isTransient, tf_select); for(i=0;imode, pitch_buf+(COMBFILTER_MAXPERIOD>>1), pitch_buf, N, - COMBFILTER_MAXPERIOD-COMBFILTER_MINPERIOD, &pitch_index, &tmp, 1<>1), pitch_buf, N, + COMBFILTER_MAXPERIOD-COMBFILTER_MINPERIOD, &pitch_index, &tmp); pitch_index = COMBFILTER_MAXPERIOD-pitch_index; gain1 = remove_doubling(pitch_buf, COMBFILTER_MAXPERIOD, COMBFILTER_MINPERIOD, @@ -1049,7 +1048,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i if (st->complexity > 1) { isTransient = transient_analysis(in, N+st->overlap, C, - &st->frame_max, st->overlap); + st->overlap); if (isTransient) shortBlocks = M; } @@ -1247,7 +1246,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i /* Always use MS for 2.5 ms frames until we can do a better analysis */ if (LM!=0) - dual_stereo = stereo_analysis(st->mode, X, st->mode->nbEBands, LM, C, N); + dual_stereo = stereo_analysis(st->mode, X, LM, N); /* Account for coarse energy */ effectiveRate = (8*effectiveBytes - 80)>>LM; @@ -1285,7 +1284,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i fine_priority, C, LM, enc, 1, st->lastCodedBands); st->lastCodedBands = codedBands; - quant_fine_energy(st->mode, st->start, st->end, bandE, oldBandE, error, fine_quant, enc, C); + quant_fine_energy(st->mode, st->start, st->end, oldBandE, error, fine_quant, enc, C); #ifdef MEASURE_NORM_MSE float X0[3000]; @@ -1309,7 +1308,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, i anti_collapse_on = st->consec_transient<2; ec_enc_bits(enc, anti_collapse_on, 1); } - quant_energy_finalise(st->mode, st->start, st->end, bandE, oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_enc_tell(enc, 0), enc, C); + quant_energy_finalise(st->mode, st->start, st->end, oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_enc_tell(enc, 0), enc, C); #ifdef RESYNTH /* Re-synthesis of the coded audio if required */ @@ -1771,8 +1770,8 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p len2 = MAX_PERIOD>>1; pitch_downsample(out_mem, pitch_buf, MAX_PERIOD, MAX_PERIOD, C, mem0, mem1); - pitch_search(st->mode, pitch_buf+((MAX_PERIOD-len2)>>1), pitch_buf, len2, - MAX_PERIOD-len2-100, &pitch_index, &tmp, 1<>1), pitch_buf, len2, + MAX_PERIOD-len2-100, &pitch_index, &tmp); pitch_index = MAX_PERIOD-len2-pitch_index; st->last_pitch_index = pitch_index; } else { @@ -2079,11 +2078,11 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da /* Decode the global flags (first symbols in the stream) */ intra_ener = tell+3<=total_bits ? ec_dec_bit_logp(dec, 3) : 0; /* Get band energies */ - unquant_coarse_energy(st->mode, st->start, st->end, bandE, oldBandE, + unquant_coarse_energy(st->mode, st->start, st->end, oldBandE, intra_ener, dec, C, LM); ALLOC(tf_res, st->mode->nbEBands, int); - tf_decode(st->start, st->end, C, isTransient, tf_res, LM, dec); + tf_decode(st->start, st->end, isTransient, tf_res, LM, dec); tell = ec_dec_tell(dec, 0); spread_decision = SPREAD_NORMAL; @@ -2137,7 +2136,7 @@ int celt_decode_with_ec_float(CELTDecoder * restrict st, const unsigned char *da alloc_trim, &intensity, &dual_stereo, bits, pulses, fine_quant, fine_priority, C, LM, dec, 0, 0); - unquant_fine_energy(st->mode, st->start, st->end, bandE, oldBandE, fine_quant, dec, C); + unquant_fine_energy(st->mode, st->start, st->end, oldBandE, fine_quant, dec, C); /* Decode fixed codebook */ ALLOC(collapse_masks, st->mode->nbEBands, unsigned char); diff --git a/libcelt/pitch.c b/libcelt/pitch.c index 92cdd272..c7f84eb4 100644 --- a/libcelt/pitch.c +++ b/libcelt/pitch.c @@ -151,8 +151,8 @@ void pitch_downsample(celt_sig * restrict x[], celt_word16 * restrict x_lp, int } -void pitch_search(const CELTMode *m, const celt_word16 * restrict x_lp, celt_word16 * restrict y, - int len, int max_pitch, int *pitch, celt_sig *xmem, int M) +void pitch_search(const celt_word16 * restrict x_lp, celt_word16 * restrict y, + int len, int max_pitch, int *pitch, celt_sig *xmem) { int i, j; int lag; diff --git a/libcelt/pitch.h b/libcelt/pitch.h index be3e1d48..c8c4f8bf 100644 --- a/libcelt/pitch.h +++ b/libcelt/pitch.h @@ -43,8 +43,8 @@ void pitch_downsample(celt_sig * restrict x[], celt_word16 * restrict x_lp, int len, int end, int _C, celt_sig * restrict xmem, celt_word16 * restrict filt_mem); -void pitch_search(const CELTMode *m, const celt_word16 * restrict x_lp, celt_word16 * restrict y, - int len, int max_pitch, int *pitch, celt_sig *xmem, int M); +void pitch_search(const celt_word16 * restrict x_lp, celt_word16 * restrict y, + int len, int max_pitch, int *pitch, celt_sig *xmem); celt_word16 remove_doubling(celt_word16 *x, int maxperiod, int minperiod, int N, int *T0, int prev_period, celt_word16 prev_gain); diff --git a/libcelt/quant_bands.c b/libcelt/quant_bands.c index 8a9fe8e1..0f8235f1 100644 --- a/libcelt/quant_bands.c +++ b/libcelt/quant_bands.c @@ -354,7 +354,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, RESTORE_STACK; } -void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C) +void quant_fine_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C) { int i, c; const int C = CHANNELS(_C); @@ -392,7 +392,7 @@ void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, } } -void quant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C) +void quant_energy_finalise(const CELTMode *m, int start, int end, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C) { int i, prio, c; const int C = CHANNELS(_C); @@ -422,7 +422,7 @@ void quant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBa } } -void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int intra, ec_dec *dec, int _C, int LM) +void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, int intra, ec_dec *dec, int _C, int LM) { const unsigned char *prob_model = e_prob_model[LM][intra]; int i, c; @@ -485,7 +485,7 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_ener *eBa } } -void unquant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C) +void unquant_fine_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C) { int i, c; const int C = CHANNELS(_C); diff --git a/libcelt/quant_bands.h b/libcelt/quant_bands.h index b26a1905..f074501f 100644 --- a/libcelt/quant_bands.h +++ b/libcelt/quant_bands.h @@ -53,13 +53,13 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd, celt_word16 *error, ec_enc *enc, int _C, int LM, int nbAvailableBytes, int force_intra, int *delayedIntra, int two_pass); -void quant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C); +void quant_fine_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, ec_enc *enc, int _C); -void quant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C); +void quant_energy_finalise(const CELTMode *m, int start, int end, celt_word16 *oldEBands, celt_word16 *error, int *fine_quant, int *fine_priority, int bits_left, ec_enc *enc, int _C); -void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int intra, ec_dec *dec, int _C, int LM); +void unquant_coarse_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, int intra, ec_dec *dec, int _C, int LM); -void unquant_fine_energy(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C); +void unquant_fine_energy(const CELTMode *m, int start, int end, celt_word16 *oldEBands, int *fine_quant, ec_dec *dec, int _C); void unquant_energy_finalise(const CELTMode *m, int start, int end, celt_ener *eBands, celt_word16 *oldEBands, int *fine_quant, int *fine_priority, int bits_left, ec_dec *dec, int _C); diff --git a/libcelt/rate.c b/libcelt/rate.c index 7578bafd..5d85f557 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -151,7 +151,7 @@ void compute_pulse_cache(CELTMode *m, int LM) static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, const int *bits1, const int *bits2, const int *thresh, int total, int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dual_stereo_rsv, int *bits, - int *ebits, int *fine_priority, int len, int _C, int LM, void *ec, int encode, int prev) + int *ebits, int *fine_priority, int _C, int LM, void *ec, int encode, int prev) { int psum; int lo, hi; @@ -509,7 +509,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets } codedBands = interp_bits2pulses(m, start, end, skip_start, bits1, bits2, thresh, total, skip_rsv, intensity, intensity_rsv, dual_stereo, dual_stereo_rsv, - pulses, ebits, fine_priority, len, C, LM, ec, encode, prev); + pulses, ebits, fine_priority, C, LM, ec, encode, prev); RESTORE_STACK; return codedBands; } diff --git a/libcelt/vq.c b/libcelt/vq.c index 02feafa8..a17b8e09 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -134,7 +134,7 @@ static void exp_rotation(celt_norm *X, int len, int dir, int stride, int K, int /** Takes the pitch vector and the decoded residual vector, computes the gain that will give ||p+g*y||=1 and mixes the residual with the pitch. */ static void normalise_residual(int * restrict iy, celt_norm * restrict X, - int N, int K, celt_word32 Ryy, celt_word16 gain) + int N, celt_word32 Ryy, celt_word16 gain) { int i; #ifdef FIXED_POINT @@ -328,7 +328,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, if (resynth) { - normalise_residual(iy, X, N, K, yy, gain); + normalise_residual(iy, X, N, yy, gain); exp_rotation(X, N, -1, B, K, spread); } collapse_mask = extract_collapse_mask(iy, N, B); @@ -356,7 +356,7 @@ unsigned alg_unquant(celt_norm *X, int N, int K, int spread, int B, do { Ryy = MAC16_16(Ryy, iy[i], iy[i]); } while (++i < N); - normalise_residual(iy, X, N, K, Ryy, gain); + normalise_residual(iy, X, N, Ryy, gain); exp_rotation(X, N, -1, B, K, spread); collapse_mask = extract_collapse_mask(iy, N, B); RESTORE_STACK;