From e949b720495fa9d11fdb189ffe38a7e115c1c426 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 7 May 2010 07:48:07 -0400 Subject: [PATCH] Fixed pitchEnd wrt to variable frame size. It should (sort of) all work now --- libcelt/bands.c | 4 ++-- libcelt/modes.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libcelt/bands.c b/libcelt/bands.c index fe03eb7c..4fc7dd3f 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -227,7 +227,7 @@ int compute_pitch_gain(const CELTMode *m, const celt_sig *X, const celt_sig *P, celt_word16 delta; const int C = CHANNELS(_C); celt_word32 Sxy=0, Sxx=0, Syy=0; - int len = m->pitchEnd; + int len = M*m->pitchEnd; int N = M*m->eBands[m->nbEBands+1]; #ifdef FIXED_POINT int shift = 0; @@ -319,7 +319,7 @@ void apply_pitch(const CELTMode *m, celt_sig *X, const celt_sig *P, int gain_id, celt_word16 gain; celt_word16 delta; const int C = CHANNELS(_C); - int len = m->pitchEnd; + int len = M*m->pitchEnd; N = M*m->eBands[m->nbEBands+1]; gain = ADD16(QCONST16(.5f,14), MULT16_16_16(QCONST16(.05f,14),gain_id)); diff --git a/libcelt/modes.c b/libcelt/modes.c index 46b027a2..69165a17 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -343,7 +343,7 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) if (mode->eBands==NULL) goto failure; - mode->pitchEnd = 4000*(celt_int32)frame_size/Fs; + mode->pitchEnd = 4000*(celt_int32)mode->shortMdctSize/Fs; /* Overlap must be divisible by 4 */ if (mode->nbShortMdcts > 1)