ref: 09dc5a18c555f891bda85c3669debb2bdd6e3739
parent: c7635b45f48b730985b00615806d4b37d47afc67
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 4 19:28:28 EST 2008
New VQ search nearly fixed-point ready
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -141,18 +141,22 @@
#if 0
if (K > (N>>1))
{
- float sum=0;
+ celt_word32_t sum=0;
j=0; do {
sum += X[j];
} while (++j<N);
- sum = K/(EPSILON+sum);
+ sum = DIV32(SHL32(EXTEND32(K),15),EPSILON+sum);
j=0; do {
+#ifdef FIXED_POINT
+ iy[j] = MULT16_32_Q15(X[j],sum);
+#else
iy[j] = floor(sum*X[j]);
+#endif
y[j] = SHL16(iy[j],yshift);
yy = MAC16_16(yy, y[j],y[j]);
xy = MAC16_16(xy, X[j],y[j]);
yp += P[j]*y[j];
- y[j] *= 2;;
+ y[j] *= 2;
pulsesLeft -= iy[j];
} while (++j<N);
}