Applying the window properly in find_spectral_pitch()
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Mon, 3 Mar 2008 05:38:29 +0000 (16:38 +1100)
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>
Mon, 3 Mar 2008 05:38:29 +0000 (16:38 +1100)
libcelt/pitch.c

index 0d6ed6e..0b3d169 100644 (file)
@@ -77,8 +77,8 @@ void find_spectral_pitch(kiss_fftr_cfg fft, struct PsyDecay *decay, celt_sig_t *
    {
       X[2*fft->substate->bitrev[i]] = MULT16_32_Q15(window[2*i], X[2*fft->substate->bitrev[i]]);
       X[2*fft->substate->bitrev[i]+1] = MULT16_32_Q15(window[2*i+1], X[2*fft->substate->bitrev[i]+1]);
-      X[2*fft->substate->bitrev[len-i-1]] = MULT16_32_Q15(window[2*i], X[2*fft->substate->bitrev[len-i-1]]);
-      X[2*fft->substate->bitrev[len-i-1]+1] = MULT16_32_Q15(window[2*i+1], X[2*fft->substate->bitrev[len-i-1]+1]);
+      X[2*fft->substate->bitrev[L2-i-1]] = MULT16_32_Q15(window[2*i+1], X[2*fft->substate->bitrev[L2-i-1]]);
+      X[2*fft->substate->bitrev[L2-i-1]+1] = MULT16_32_Q15(window[2*i], X[2*fft->substate->bitrev[L2-i-1]+1]);
    }
 
    kf_work((kiss_fft_cpx*)X, NULL, 1,1, fft->substate->factors,fft->substate, 1, 1, 1);