shithub: opus

Download patch

ref: a073c7bedfec57c7a8c6d2fbbd4ebc9c4936e709
parent: 3b277dc757535d7f7ff17a0136f21eed644b7a78
author: Jean-Marc Valin <[email protected]>
date: Thu Feb 14 11:58:04 EST 2008

minor cleanup/commenting to vq search

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -92,13 +92,9 @@
       
    for (m=0;m<L;m++)
       for (i=0;i<N;i++)
-         ny[m][i] = 0;
+         iy[m][i] = 0;
 
    for (m=0;m<L;m++)
-      for (i=0;i<N;i++)
-         iy[m][i] = iny[m][i] = 0;
-
-   for (m=0;m<L;m++)
       xy[m] = yy[m] = yp[m] = 0;
    
    pulsesLeft = K;
@@ -142,11 +138,15 @@
                float g;
                float s = sign*pulsesAtOnce;
                
-               /* Updating the sums the the new pulse(s) */
+               /* Updating the sums of the new pulse(s) */
                tmp_xy = xy[m] + s*x[j]               - alpha*s*p[j]*Rxp;
                tmp_yy = yy[m] + 2*s*y[m][j] + s*s      +s*s*alpha*alpha*p[j]*p[j]*Rpp - 2*alpha*s*p[j]*yp[m] - 2*s*s*alpha*p[j]*p[j];
                tmp_yp = yp[m] + s*p[j]               *(1-alpha*Rpp);
+               
+               /* Compute the gain such that ||p + g*y|| = 1 */
                g = (sqrt(tmp_yp*tmp_yp + tmp_yy - tmp_yy*Rpp) - tmp_yp)/tmp_yy;
+               /* Knowing that gain, what the error: (x-g*y)^2 
+                  (result is negated and we discard x^2 because it's constant) */
                score = 2*g*tmp_xy - g*g*tmp_yy;
 
                if (score>nbest[Lupdate-1]->score)