shithub: opus

Download patch

ref: 1ca07225343929f7270432f5ab9391273acb961b
parent: b50c541d8b21434fe523be7713d5b7f562d7f344
author: Jean-Marc Valin <[email protected]>
date: Wed Feb 27 12:23:04 EST 2008

fixed-point: mix_pitch_and_residual() check-point #3

--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -69,7 +69,7 @@
    float g;
    VARDECL(celt_norm_t *y);
 #ifdef FIXED_POINT
-   int yshift = 15-EC_ILOG(K);
+   int yshift = 14-EC_ILOG(K);
 #endif
    ALLOC(y, N, celt_norm_t);
 
@@ -98,7 +98,8 @@
    for (i=0;i<N;i++)
       Ryy = MAC16_16(Ryy, y[i],y[i]);
 
-   g = (sqrt(NORM_SCALING_1*NORM_SCALING_1*Ryp*Ryp + Ryy - NORM_SCALING_1*NORM_SCALING_1*Ryy*Rpp) - NORM_SCALING_1*Ryp)/Ryy;
+   /* g = (sqrt(Ryp^2 + Ryy - Rpp*Ryy)-Ryp)/Ryy */
+   g = (sqrt(MULT16_16(PSHR32(Ryp,14),PSHR32(Ryp,14)) + Ryy - MULT16_16(PSHR32(Ryy,14),PSHR32(Rpp,14))) - PSHR32(Ryp,14))/Ryy;
 
    for (i=0;i<N;i++)
       X[i] = P[i] + NORM_SCALING*g*y[i];