diff --git a/libcelt/celt.c b/libcelt/celt.c index 9fc212cebd126752fc26b25b479b754f18e19fb3..a3eef28d2ce1c7012634c4aee2219f7c89e24edd 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -769,7 +769,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c gain1 = MULT16_16_Q15(QCONST16(.7f,15),gain1); if (gain1 > QCONST16(.6f,15)) gain1 = QCONST16(.6f,15); - if (fabs(gain1-st->prefilter_gain)<QCONST16(.1,15)) + if (ABS16(gain1-st->prefilter_gain)<QCONST16(.1,15)) gain1=st->prefilter_gain; if (gain1<QCONST16(.2f,15)) { diff --git a/libcelt/pitch.c b/libcelt/pitch.c index 20eb4e09643ff0311468f9106502a8f29910bbd4..71637a832688fbebb19c5bcee1fc48101a98d0e0 100644 --- a/libcelt/pitch.c +++ b/libcelt/pitch.c @@ -137,11 +137,11 @@ void pitch_downsample(celt_sig * restrict x[], celt_word16 * restrict x_lp, int } _celt_lpc(lpc, ac, 4); - float tmp=1; + celt_word16 tmp=Q15ONE; for (i=0;i<4;i++) { - tmp *= .9; - lpc[i] *= tmp; + tmp = MULT16_16_Q15(QCONST16(.9f,15), tmp); + lpc[i] = MULT16_16_Q15(lpc[i], tmp); } fir(x_lp, lpc, x_lp, len>>1, 4, mem); @@ -289,8 +289,8 @@ celt_word16 remove_doubling(celt_word16 *x, int maxperiod, int minperiod, for (k=2;k<=15;k++) { int T1, T1b; - float g1; - float cont=0; + celt_word16 g1; + celt_word16 cont=0; T1 = (2*T0+k)/(2*k); if (T1 < minperiod) break; @@ -327,10 +327,12 @@ celt_word16 remove_doubling(celt_word16 *x, int maxperiod, int minperiod, g1 = xy/sqrt(1+2.f*xx*1.f*yy); #endif if (abs(T1-prev_period)<=2) - cont += prev_gain; + cont = prev_gain; else if (abs(T1-prev_period)<=4) - cont += .5*prev_gain; - if (g1+cont > .85*g0 || g1+cont > QCONST16(.5f,15)) + cont = HALF32(prev_gain); + else + cont = 0; + if (g1 > MULT16_16_Q15(QCONST16(.85f,15),g0)-cont || g1 > QCONST16(.5f,15)-cont) { best_xy = xy; best_yy = yy; diff --git a/libcelt/plc.c b/libcelt/plc.c index 2204c02c31471efb6302a34d5947f78c0e7c21f2..5625c679a91d6906d3fa7bed12f7105b1d85fe4a 100644 --- a/libcelt/plc.c +++ b/libcelt/plc.c @@ -166,7 +166,7 @@ void _celt_autocorr( } #ifdef FIXED_POINT { - float ac0=0; + celt_word32 ac0=0; int shift; for(i=0;i<n;i++) ac0 += SHR32(MULT16_16(xx[i],xx[i]),8);