shithub: opus

Download patch

ref: f7a1e165aa8be3b2cad7c8c304e8fe15e5d32433
parent: f6dc1eba2615444d24cc84dfc2043d961418a035
author: Jean-Marc Valin <[email protected]>
date: Wed Oct 7 02:56:03 EDT 2009

Renamed mix_pitch_and_residual() to normalise_residual(), after minor
simplification.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -315,7 +315,7 @@
       celt_word16_t gg = gain;
       for (j=0;j<len;j++)
       {
-         X[j+c*N] += SHL(MULT16_32_Q15(gg,P[j+c*N]),1);
+         X[j+c*N] += SHL32(MULT16_32_Q15(gg,P[j+c*N]),1);
          gg = ADD16(gg, delta);
       }
    }
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -99,7 +99,7 @@
 
 /** Takes the pitch vector and the decoded residual vector, computes the gain
     that will give ||p+g*y||=1 and mixes the residual with the pitch. */
-static void mix_pitch_and_residual(int * restrict iy, celt_norm_t * restrict X, int N, int K, celt_word32_t Ryy)
+static void normalise_residual(int * restrict iy, celt_norm_t * restrict X, int N, int K, celt_word32_t Ryy)
 {
    int i;
    celt_word32_t g;
@@ -108,7 +108,7 @@
 
    i=0;
    do
-      X[i] = MULT16_32_P15(g, SHL32(EXTEND32(iy[i]),14));
+      X[i] = SHR16(MULT16_16_16(g, iy[i]),1);
    while (++i < N);
 }
 
@@ -270,7 +270,7 @@
    
    /* Recompute the gain in one pass to reduce the encoder-decoder mismatch
    due to the recursive computation used in quantisation. */
-   mix_pitch_and_residual(iy, X, N, K, EXTRACT16(SHR32(yy,2*yshift)));
+   normalise_residual(iy, X, N, K, EXTRACT16(SHR32(yy,2*yshift)));
    if (spread)
       exp_rotation(X, N, -1, spread, K);
    RESTORE_STACK;
@@ -293,7 +293,7 @@
    do {
       Ryy = MAC16_16(Ryy, iy[i], iy[i]);
    } while (++i < N);
-   mix_pitch_and_residual(iy, X, N, K, Ryy);
+   normalise_residual(iy, X, N, K, Ryy);
    if (spread)
       exp_rotation(X, N, -1, spread, K);
    RESTORE_STACK;