shithub: opus

Download patch

ref: a733f08eb58f4ddec0441c34a75c106963432817
parent: 6cde5dd24c005e87fbae2fcfecf6f28a08ba59d3
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 4 17:52:26 EST 2008

Experimental code to improve both the speed and accuracy of the VQ search

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -138,6 +138,25 @@
    xy = yy = yp = 0;
 
    pulsesLeft = K;
+#if 0
+   if (K > (N>>1))
+   {
+      float sum=0;
+      j=0; do {
+         sum += X[j];
+      }  while (++j<N);
+      sum = K/(EPSILON+sum);
+      j=0; do {
+         iy[j] = floor(sum*X[j]);
+         y[j] = iy[j];
+         yy += y[j]*y[j];
+         xy += X[j]*y[j];
+         yp += P[j]*y[j];
+         y[j] *= 2;;
+         pulsesLeft -= iy[j];
+      }  while (++j<N);
+   }
+#endif
    while (pulsesLeft > 1)
    {
       int pulsesAtOnce=1;