diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2009-12-17 06:42:32 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2009-12-17 06:42:32 +0300 |
commit | d5f99308c9005b0af302a2f488ef5e892d14174e (patch) | |
tree | c75af40d4bfaf14e8af1675fab8c5e0e28481527 | |
parent | 5a0fae53c7cb604c11014d1de73bbad293083e28 (diff) |
This fixes a bug in stereo PLC (offset wasn't changed between channels)
-rw-r--r-- | libcelt/celt.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libcelt/celt.c b/libcelt/celt.c index a2547a7..ee557f0 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -646,11 +646,12 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig * pcm, celt_sig && norm_rate < 50; if (has_pitch) { - /* FIXME: Should probably do a stack save/pop here */ VARDECL(celt_word16, x_lp); + SAVE_STACK; ALLOC(x_lp, (2*N-2*N4)>>1, celt_word16); pitch_downsample(in, x_lp, 2*N-2*N4, N, C, &st->xmem, &st->pitch_buf[MAX_PERIOD>>1]); pitch_search(st->mode, x_lp, st->pitch_buf, 2*N-2*N4, MAX_PERIOD-(2*N-2*N4), &pitch_index, &st->xmem); + RESTORE_STACK; } /* Deferred allocation after find_spectral_pitch() to reduce @@ -1269,8 +1270,8 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p fade = 0; } - offset = MAX_PERIOD-pitch_index; #ifdef FIXED_POINT + offset = MAX_PERIOD-pitch_index; ALLOC(freq,C*N, celt_sig); /**< Interleaved signal MDCTs */ while (offset+len >= MAX_PERIOD) offset -= pitch_index; @@ -1290,6 +1291,7 @@ static void celt_decode_lost(CELTDecoder * restrict st, celt_word16 * restrict p float decay = 1; celt_word32 mem[LPC_ORDER]={0}; + offset = MAX_PERIOD-pitch_index; for (i=0;i<MAX_PERIOD;i++) exc[i] = st->out_mem[i*C+c]; |