diff --git a/libcelt/celt.c b/libcelt/celt.c index dd46d162..c279d1e3 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -178,22 +178,16 @@ static celt_word32_t compute_mdcts(const mdct_lookup *mdct_lookup, celt_word16_t int j; for (j=0;j<2*N;j++) x[j] = in[C*i*N+C*j+c]; -#if 0 - for (j=0;j<2*N;j++) - x[j] = MULT16_32_Q15(window[j],x[j]); -#else for (j=0;joverlap;i++) { - in[C*(i+N4)+c] = MULT16_32_Q15(st->mode->window[i+N4], in[C*(i+N4)+c]); - in[C*(B*N+N-i-N4-1)+c] = MULT16_32_Q15(st->mode->window[i+N4], in[C*(B*N+N-i-N4-1)+c]); + in[C*(i+N4)+c] = MULT16_32_Q15(st->mode->window[i], in[C*(i+N4)+c]); + in[C*(B*N+N-i-N4-1)+c] = MULT16_32_Q15(st->mode->window[i], in[C*(B*N+N-i-N4-1)+c]); } } find_spectral_pitch(st->fft, &st->psy, in, st->out_mem, MAX_PERIOD, (B+1)*N, C, &pitch_index); diff --git a/libcelt/modes.c b/libcelt/modes.c index 07533990..7c8c1807 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -270,21 +270,15 @@ CELTMode *celt_mode_create(int Fs, int channels, int frame_size, int lookahead, N4 = N/4; mdct_init(&mode->mdct, 2*N); - mode->window = (celt_word16_t*)celt_alloc(2*N*sizeof(celt_word16_t)); + mode->window = (celt_word16_t*)celt_alloc(mode->overlap*sizeof(celt_word16_t)); - for (i=0;i<2*N;i++) - mode->window[i] = 0; #ifndef FIXED_POINT for (i=0;ioverlap;i++) - mode->window[N4+i] = mode->window[2*N-N4-i-1] - = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap)); + mode->window[i] = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap)); #else for (i=0;ioverlap;i++) - mode->window[N4+i] = mode->window[2*N-N4-i-1] - = MIN32(32767,32768.*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap))); + mode->window[i] = MIN32(32767,32768.*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap))); #endif - for (i=0;iwindow[N-N4+i] = Q15ONE; mode->marker_start = MODEVALID; mode->marker_end = MODEVALID; diff --git a/libcelt/vq.c b/libcelt/vq.c index f9b529bf..d7883967 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -243,7 +243,7 @@ void alg_quant(celt_norm_t *X, celt_mask_t *W, int N, int K, celt_norm_t *P, cel /* Compute the gain such that ||p + g*y|| = 1 */ g = DIV32(SHL32(celt_sqrt(MULT16_16(ROUND(Ryp,14),ROUND(Ryp,14)) + Ryy - MULT16_16(ROUND(Ryy,14),Rpp)) - ROUND(Ryp,14),14),ROUND(Ryy,14)); - //g *= NORM_SCALING_1; + /* Knowing that gain, what the error: (x-g*y)^2 (result is negated and we discard x^2 because it's constant) */ /*score = 2.f*g*Rxy - 1.f*g*g*Ryy*NORM_SCALING_1;*/