diff --git a/libcelt/celt.c b/libcelt/celt.c index d582438c..002fd083 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -371,10 +371,10 @@ static void compute_inv_mdcts(const CELTMode *mode, int shortBlocks, celt_sig_t } #ifdef FIXED_POINT -int celt_encode(CELTEncoder * restrict st, celt_int16_t * restrict pcm, unsigned char *compressed, int nbCompressedBytes) +int celt_encode(CELTEncoder * restrict st, const celt_int16_t * pcm, celt_int16_t * optional_synthesis, unsigned char *compressed, int nbCompressedBytes) { #else -int celt_encode_float(CELTEncoder * restrict st, celt_sig_t * restrict pcm, unsigned char *compressed, int nbCompressedBytes) +int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_sig_t * optional_synthesis, unsigned char *compressed, int nbCompressedBytes) { #endif int i, c, N, N4; @@ -602,7 +602,7 @@ int celt_encode_float(CELTEncoder * restrict st, celt_sig_t * restrict pcm, unsi /* Residual quantisation */ quant_bands(st->mode, X, P, NULL, bandE, stereo_mode, pulses, shortBlocks, nbCompressedBytes*8, &st->enc); - if (st->pitch_enabled) + if (st->pitch_enabled || optional_synthesis!=NULL) { if (C==2) renormalise_bands(st->mode, X); @@ -614,19 +614,19 @@ int celt_encode_float(CELTEncoder * restrict st, celt_sig_t * restrict pcm, unsi compute_inv_mdcts(st->mode, shortBlocks, freq, transient_time, transient_shift, st->out_mem); /* De-emphasis and put everything back at the right place in the synthesis history */ -#ifndef SHORTCUTS - for (c=0;cout_mem[C*(MAX_PERIOD-N)+C*j+c], + int j; + for (j=0;jout_mem[C*(MAX_PERIOD-N)+C*j+c], preemph,st->preemph_memD[c]); - st->preemph_memD[c] = tmp; - pcm[C*j+c] = SCALEOUT(SIG2WORD16(tmp)); + st->preemph_memD[c] = tmp; + optional_synthesis[C*j+c] = SCALEOUT(SIG2WORD16(tmp)); + } } } -#endif } /*fprintf (stderr, "remaining bits after encode = %d\n", nbCompressedBytes*8-ec_enc_tell(&st->enc, 0));*/ /*if (ec_enc_tell(&st->enc, 0) < nbCompressedBytes*8 - 7) @@ -668,7 +668,7 @@ int celt_encode_float(CELTEncoder * restrict st, celt_sig_t * restrict pcm, unsi #ifdef FIXED_POINT #ifndef DISABLE_FLOAT_API -int celt_encode_float(CELTEncoder * restrict st, float * restrict pcm, unsigned char *compressed, int nbCompressedBytes) +int celt_encode_float(CELTEncoder * restrict st, const float * pcm, float * optional_synthesis, unsigned char *compressed, int nbCompressedBytes) { int j, ret; const int C = CHANNELS(st->mode); @@ -679,18 +679,20 @@ int celt_encode_float(CELTEncoder * restrict st, float * restrict pcm, unsigned for (j=0;j