diff options
author | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-02-14 08:58:04 +0300 |
---|---|---|
committer | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-02-14 08:58:04 +0300 |
commit | a073c7bedfec57c7a8c6d2fbbd4ebc9c4936e709 (patch) | |
tree | b54437f6441aaf003cb3fc41c99e2304cbf6d421 | |
parent | 3b277dc757535d7f7ff17a0136f21eed644b7a78 (diff) |
minor cleanup/commenting to vq search
-rw-r--r-- | libcelt/vq.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libcelt/vq.c b/libcelt/vq.c index 5ae7f54..2a54eab 100644 --- a/libcelt/vq.c +++ b/libcelt/vq.c @@ -92,11 +92,7 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc * for (m=0;m<L;m++) for (i=0;i<N;i++) - ny[m][i] = 0; - - for (m=0;m<L;m++) - for (i=0;i<N;i++) - iy[m][i] = iny[m][i] = 0; + iy[m][i] = 0; for (m=0;m<L;m++) xy[m] = yy[m] = yp[m] = 0; @@ -142,11 +138,15 @@ void alg_quant(float *x, float *W, int N, int K, float *p, float alpha, ec_enc * 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) |