shithub: opus

Download patch

ref: 3e65097528b58d57aaef15c7ec41baeefacbdc43
parent: a1d95d70ca6d2017e7146a512e8425b82df465fc
author: Jean-Marc Valin <[email protected]>
date: Fri Mar 7 12:38:58 EST 2008

Bit of cleaning up. No real code change (well, I hope so!).

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -163,10 +163,10 @@
       for (i=0;i<m->nbEBands;i++)
       {
          int j;
-         float sum = 1e-10;
+         celt_word32_t sum = 1e-10;
          for (j=B*eBands[i];j<B*eBands[i+1];j++)
-            sum += SIG_SCALING_1*SIG_SCALING_1*X[j*C+c]*X[j*C+c];
-         bank[i*C+c] = ENER_SCALING*sqrt(sum);
+            sum += X[j*C+c]*X[j*C+c];
+         bank[i*C+c] = sqrt(sum);
          /*printf ("%f ", bank[i*C+c]);*/
       }
    }
@@ -185,9 +185,9 @@
       for (i=0;i<m->nbEBands;i++)
       {
          int j;
-         float g = 1.f/(1e-10+ENER_SCALING_1*bank[i*C+c]*sqrt(C));
+         celt_word16_t g = 1.f/(1e-10+bank[i*C+c]*sqrt(C));
          for (j=B*eBands[i];j<B*eBands[i+1];j++)
-            X[j*C+c] = NORM_SCALING*SIG_SCALING_1*freq[j*C+c]*g;
+            X[j*C+c] = freq[j*C+c]*g;
       }
    }
    for (i=B*C*eBands[m->nbEBands];i<B*C*eBands[m->nbEBands+1];i++)
--- a/libcelt/kiss_fft.c
+++ b/libcelt/kiss_fft.c
@@ -27,8 +27,8 @@
 #include "mathops.h"
 
 /* The guts header contains all the multiplication and addition macros that are defined for
- fixed or floating point complex numbers.  It also delares the kf_ internal functions.
- */
+   complex numbers.  It also delares the kf_ internal functions.
+*/
 
 static void kf_bfly2(
                      kiss_fft_cpx * Fout,
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -41,25 +41,6 @@
 #include "arch.h"
 #include "os_support.h"
 
-/* Enable this or define your own implementation if you want to speed up the
-   VQ search (used in inner loop only) */
-#if 0
-#include <xmmintrin.h>
-static inline float approx_sqrt(float x)
-{
-   _mm_store_ss(&x, _mm_sqrt_ss(_mm_set_ss(x)));
-   return x;
-}
-static inline float approx_inv(float x)
-{
-   _mm_store_ss(&x, _mm_rcp_ss(_mm_set_ss(x)));
-   return x;
-}
-#else
-#define approx_sqrt(x) (sqrt(x))
-#define approx_inv(x) (1.f/(x))
-#endif
-
 /** Takes the pitch vector and the decoded residual vector (non-compressed), 
    applies the compression in the pitch direction, computes the gain that will
    give ||p+g*y||=1 and mixes the residual with the pitch. */
@@ -370,7 +351,7 @@
 #ifdef FIXED_POINT
 static const celt_word16_t pg[11] = {32767, 24576, 21299, 19661, 19661, 19661, 18022, 18022, 16384, 16384, 16384};
 #else
-static const float pg[11] = {1.f, .75f, .65f, 0.6f, 0.6f, .6f, .55f, .55f, .5f, .5f, .5f};
+static const celt_word16_t pg[11] = {1.f, .75f, .65f, 0.6f, 0.6f, .6f, .55f, .55f, .5f, .5f, .5f};
 #endif
 
 void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc)