shithub: opus

Download patch

ref: df7ab43087a7713a60b8ef4721d42dec22f2a222
parent: 95088d450509429a6ce7cc0e639e12e6130dc6cd
author: Jean-Marc Valin <[email protected]>
date: Wed Mar 26 14:03:22 EDT 2008

Making it obvious to the compiler how to generate a dual-MAC in
mix_pitch_and_residual()

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -66,13 +66,14 @@
       y[i] = SHL16(iy[i],yshift);
    
    Ryp = 0;
-   for (i=0;i<N;i++)
-      Ryp = MAC16_16(Ryp,y[i],P[i]);
-
    Ryy = 0;
+   /* If this doesn't generate a dual MAC (on supported archs), fire the compiler guy */
    for (i=0;i<N;i++)
-      Ryy = MAC16_16(Ryy, y[i],y[i]);
-
+   {
+      Ryp = MAC16_16(Ryp, y[i], P[i]);
+      Ryy = MAC16_16(Ryy, y[i], y[i]);
+   }
+   
    /* g = (sqrt(Ryp^2 + Ryy - Rpp*Ryy)-Ryp)/Ryy */
    g = MULT16_32_Q15(
             celt_sqrt(MULT16_16(ROUND16(Ryp,14),ROUND16(Ryp,14)) + Ryy -