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

This commit is contained in:
Jean-Marc Valin 2008-03-07 17:38:58 +11:00
parent a1d95d70ca
commit 3e65097528
3 changed files with 8 additions and 27 deletions

View file

@ -163,10 +163,10 @@ void compute_band_energies(const CELTMode *m, const celt_sig_t *X, celt_ener_t *
for (i=0;i<m->nbEBands;i++) for (i=0;i<m->nbEBands;i++)
{ {
int j; int j;
float sum = 1e-10; celt_word32_t sum = 1e-10;
for (j=B*eBands[i];j<B*eBands[i+1];j++) 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]; sum += X[j*C+c]*X[j*C+c];
bank[i*C+c] = ENER_SCALING*sqrt(sum); bank[i*C+c] = sqrt(sum);
/*printf ("%f ", bank[i*C+c]);*/ /*printf ("%f ", bank[i*C+c]);*/
} }
} }
@ -185,9 +185,9 @@ void normalise_bands(const CELTMode *m, const celt_sig_t *freq, celt_norm_t *X,
for (i=0;i<m->nbEBands;i++) for (i=0;i<m->nbEBands;i++)
{ {
int j; 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++) 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++) for (i=B*C*eBands[m->nbEBands];i<B*C*eBands[m->nbEBands+1];i++)

View file

@ -27,8 +27,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#include "mathops.h" #include "mathops.h"
/* The guts header contains all the multiplication and addition macros that are defined for /* 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( static void kf_bfly2(
kiss_fft_cpx * Fout, kiss_fft_cpx * Fout,

View file

@ -41,25 +41,6 @@
#include "arch.h" #include "arch.h"
#include "os_support.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), /** Takes the pitch vector and the decoded residual vector (non-compressed),
applies the compression in the pitch direction, computes the gain that will applies the compression in the pitch direction, computes the gain that will
give ||p+g*y||=1 and mixes the residual with the pitch. */ give ||p+g*y||=1 and mixes the residual with the pitch. */
@ -370,7 +351,7 @@ void alg_unquant(celt_norm_t *X, int N, int K, celt_norm_t *P, celt_word16_t alp
#ifdef FIXED_POINT #ifdef FIXED_POINT
static const celt_word16_t pg[11] = {32767, 24576, 21299, 19661, 19661, 19661, 18022, 18022, 16384, 16384, 16384}; static const celt_word16_t pg[11] = {32767, 24576, 21299, 19661, 19661, 19661, 18022, 18022, 16384, 16384, 16384};
#else #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 #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) 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)