shithub: opus

Download patch

ref: 3d152a5de419385d21e455f9e15f0b4055dd9060
parent: 3956de98eba200fbcaed3eed85fa2a116a761f8b
author: Jean-Marc Valin <[email protected]>
date: Tue Apr 15 03:46:48 EDT 2008

optimisation: merged the init loop of vq_quant().

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -112,7 +112,8 @@
    ALLOC(iy, N, int);
    ALLOC(signx, N, int);
    N_1 = 512/N;
-   
+
+   sum = 0;
    for (j=0;j<N;j++)
    {
       if (X[j]>0)
@@ -119,11 +120,8 @@
          signx[j]=1;
       else
          signx[j]=-1;
-   }
-   
-   sum = 0;
-   for (j=0;j<N;j++)
-   {
+      iy[j] = 0;
+      y[j] = 0;
       sum = MAC16_16(sum, P[j],P[j]);
    }
    Rpp = ROUND16(sum, NORM_SHIFT);
@@ -130,10 +128,6 @@
 
    celt_assert2(Rpp<=NORM_SCALING, "Rpp should never have a norm greater than unity");
 
-   for (i=0;i<N;i++)
-      y[i] = 0;
-   for (i=0;i<N;i++)
-      iy[i] = 0;
    xy = yy = yp = 0;
 
    pulsesLeft = K;