diff --git a/libcelt/celt.c b/libcelt/celt.c index 29454d9e..336647c3 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -258,7 +258,6 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i } } find_spectral_pitch(st->fft, &st->psy, in, st->out_mem, MAX_PERIOD, (B+1)*N, C, &pitch_index); - ec_enc_uint(&st->enc, pitch_index, MAX_PERIOD-(B+1)*N); /* Compute MDCTs of the pitch part */ compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, P, N, B, C); @@ -298,6 +297,9 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i /* Pitch prediction */ compute_pitch_gain(st->mode, X, P, gains, bandE); quant_pitch(gains, st->mode->nbPBands, &st->enc); + + ec_enc_uint(&st->enc, pitch_index, MAX_PERIOD-(B+1)*N); + pitch_quant_bands(st->mode, X, P, gains); //for (i=0;iblock_size; @@ -533,18 +535,21 @@ int celt_decode(CELTDecoder *st, char *data, int len, celt_int16_t *pcm) ec_byte_readinit(&buf,data,len); ec_dec_init(&dec,&buf); + /* Get band energies */ + unquant_energy(st->mode, bandE, st->oldBandE, &dec); + + /* Get the pitch gains */ + unquant_pitch(gains, st->mode->nbPBands, &dec); + /* Get the pitch index */ pitch_index = ec_dec_uint(&dec, MAX_PERIOD-(B+1)*N); st->last_pitch_index = pitch_index; - /* Get band energies */ - unquant_energy(st->mode, bandE, st->oldBandE, &dec); - /* Pitch MDCT */ compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, P, N, B, C); { - float bandEp[st->mode->nbEBands]; + float bandEp[st->mode->nbEBands*C]; compute_band_energies(st->mode, P, bandEp); normalise_bands(st->mode, P, bandEp); } @@ -552,9 +557,6 @@ int celt_decode(CELTDecoder *st, char *data, int len, celt_int16_t *pcm) if (C==2) stereo_mix(st->mode, P, bandE, 1); - /* Get the pitch gains */ - unquant_pitch(gains, st->mode->nbPBands, &dec); - /* Apply pitch gains */ pitch_quant_bands(st->mode, X, P, gains); diff --git a/libcelt/celt.h b/libcelt/celt.h index 5208b569..bd366ea0 100644 --- a/libcelt/celt.h +++ b/libcelt/celt.h @@ -70,7 +70,7 @@ CELTDecoder *celt_decoder_new(const CELTMode *mode); void celt_decoder_destroy(CELTDecoder *st); -int celt_decode(CELTDecoder *st, char *data, int len, celt_int16_t *pcm); +int celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16_t *pcm); /* Mode calls */ diff --git a/libcelt/kiss_fft.c b/libcelt/kiss_fft.c index 5e7ca198..2668c5ac 100644 --- a/libcelt/kiss_fft.c +++ b/libcelt/kiss_fft.c @@ -39,7 +39,6 @@ static void kf_bfly2( { kiss_fft_cpx * Fout2; kiss_fft_cpx * tw1; - kiss_fft_cpx t; int i,j; kiss_fft_cpx * Fout_beg = Fout; for (i=0;inbChannels; break; + default: + return CELT_BAD_ARG; } + return CELT_OK; } diff --git a/libcelt/pgain_table.h b/libcelt/pgain_table.h index aeaf6daa..1c2c69bf 100644 --- a/libcelt/pgain_table.h +++ b/libcelt/pgain_table.h @@ -1,8 +1,8 @@ float pgain_table[1024] = { +0., 0., 0., 0., 0., 0., 0., 0., 0.0787638, 0.0502377, 0.0370167, 0.0322025, 0.356783, 0.0669546, 0.0574281, 0.0260472, 0.5126, 0.499592, 0.460184, 0.032245, 0.0312514, 0.0289121, 0.0265145, 0.0207962, 0.373555, 0.468631, 0.0241895, 0.0194926, 0.0256133, 0.0238522, 0.0211873, 0.0148774, -0.00139974, 0.000760276, 0.00107237, 0.00095473, 0.00115105, 0.001434, 0.00173201, 0.00274601, 0.513634, 0.467355, 0.255641, 0.091945, 0.319676, 0.0593489, 0.0488637, 0.02425, 0.297209, 0.0228254, 0.189478, 0.0192015, 0.0263458, 0.0241322, 0.0262124, 0.015507, 0.0575023, 0.297549, 0.022103, 0.0219353, 0.0442874, 0.043595, 0.0413361, 0.0220558, diff --git a/libcelt/psy.c b/libcelt/psy.c index 0f7ffaf0..3993bc2a 100644 --- a/libcelt/psy.c +++ b/libcelt/psy.c @@ -135,7 +135,6 @@ void compute_mdct_masking(struct PsyDecay *decay, float *X, float *mask, int len { int i; float psd[len]; - float mem; for (i=0;iePredCoef; - float error[m->nbEBands]; /* The .7 is a heuristic */ float beta = .7*coef; for (i=0;inbEBands;i++) diff --git a/libcelt/rate.c b/libcelt/rate.c index a727931b..a358784d 100644 --- a/libcelt/rate.c +++ b/libcelt/rate.c @@ -192,7 +192,6 @@ int vec_bits2pulses(const struct alloc_data *alloc, const int *bands, int *bits, for (i=0;ibits[i][pulses[i]]; } diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c index d0974895..091f21ad 100644 --- a/libcelt/testcelt.c +++ b/libcelt/testcelt.c @@ -34,6 +34,7 @@ #include #include #include +#include int main(int argc, char *argv[]) { @@ -46,7 +47,7 @@ int main(int argc, char *argv[]) int len; celt_int32_t frame_size, channels; int bytes_per_packet; - char data[1024]; + unsigned char data[1024]; double rmsd = 0; int count = 0;