Fixes some MSVC warnings
authorJean-Marc Valin <jean-marc.valin@octasic.com>
Tue, 31 Aug 2010 15:52:45 +0000 (11:52 -0400)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Tue, 31 Aug 2010 15:52:45 +0000 (11:52 -0400)
libcelt/bands.c
libcelt/celt.c
libcelt/mathops.h
libcelt/mdct.c
libcelt/quant_bands.c
libcelt/vq.c

index 3e2390d..c4fbf06 100644 (file)
@@ -138,10 +138,10 @@ void compute_band_energies(const CELTMode *m, const celt_sig *X, celt_ener *bank
       for (i=0;i<end;i++)
       {
          int j;
-         celt_word32 sum = 1e-10;
+         celt_word32 sum = 1e-10f;
          for (j=M*eBands[i];j<M*eBands[i+1];j++)
             sum += X[j+c*N]*X[j+c*N];
-         bank[i+c*m->nbEBands] = sqrt(sum);
+         bank[i+c*m->nbEBands] = celt_sqrt(sum);
          /*printf ("%f ", bank[i+c*m->nbEBands]);*/
       }
    }
@@ -280,7 +280,7 @@ int folding_decision(const CELTMode *m, celt_norm *X, celt_word16 *average, int
             floor_ener += x[j]*x[j];
       }
 #else
-      floor_ener = QCONST32(1.,28)-MULT16_16(max_val,max_val);
+      floor_ener = QCONST32(1.f,28)-MULT16_16(max_val,max_val);
       if (max_i < N-1)
          floor_ener -= MULT16_16(x[(max_i+1)], x[(max_i+1)]);
       if (max_i < N-2)
@@ -577,7 +577,7 @@ static void quant_band(int encode, const CELTMode *m, int i, celt_norm *X, celt_
             /* 0.63662 = 2/pi */
             itheta = MULT16_16_Q15(QCONST16(0.63662f,15),celt_atan2p(side, mid));
    #else
-            itheta = floor(.5f+16384*0.63662f*atan2(side,mid));
+            itheta = (int)floor(.5f+16384*0.63662f*atan2(side,mid));
    #endif
 
             itheta = (itheta*qn+8192)>>14;
index 404ad4a..71b89aa 100644 (file)
@@ -809,7 +809,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c
      /*printf ("%d\n", st->vbr_reservoir);*/
 
      /* Compute the offset we need to apply in order to reach the target */
-     st->vbr_drift += MULT16_32_Q15(alpha,delta-st->vbr_offset-st->vbr_drift);
+     st->vbr_drift += (celt_int32)MULT16_32_Q15(alpha,delta-st->vbr_offset-st->vbr_drift);
      st->vbr_offset = -st->vbr_drift;
      /*printf ("%d\n", st->vbr_drift);*/
 
index 8717ca9..160c220 100644 (file)
@@ -54,7 +54,7 @@ unsigned isqrt32(celt_uint32 _val);
 #define celt_rsqrt_norm(x) (celt_rsqrt(x))
 #define celt_acos acos
 #define celt_exp exp
-#define celt_cos_norm(x) (cos((.5f*M_PI)*(x)))
+#define celt_cos_norm(x) ((float)cos((.5f*M_PI)*(x)))
 #define celt_atan atan
 #define celt_rcp(x) (1.f/(x))
 #define celt_div(a,b) ((a)/(b))
@@ -104,8 +104,8 @@ static inline float celt_exp2(float x)
 }
 
 #else
-#define celt_log2(x) (1.442695040888963387*log(x))
-#define celt_exp2(x) (exp(0.6931471805599453094*(x)))
+#define celt_log2(x) ((float)(1.442695040888963387*log(x)))
+#define celt_exp2(x) ((float)exp(0.6931471805599453094*(x)))
 #endif
 
 #endif
index e06f8a9..428a980 100644 (file)
@@ -92,7 +92,7 @@ void clt_mdct_init(mdct_lookup *l,int N, int maxshift)
       trig[i] = TRIG_UPSCALE*celt_cos_norm(DIV32(ADD32(SHL32(EXTEND32(i),17),N2),N));
 #else
    for (i=0;i<=N4;i++)
-      trig[i] = cos(2*M_PI*i/N);
+      trig[i] = (kiss_twiddle_scalar)cos(2*M_PI*i/N);
 #endif
 }
 
@@ -122,7 +122,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar
 #ifdef FIXED_POINT
    sine = TRIG_UPSCALE*(QCONST16(0.7853981f, 15)+N2)/N;
 #else
-   sine = 2*M_PI*(.125f)/N;
+   sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N;
 #endif
 
    /* Consider the input to be composed of four blocks: [a, b, c, d] */
@@ -228,7 +228,7 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
 #ifdef FIXED_POINT
    sine = TRIG_UPSCALE*(QCONST16(0.7853981f, 15)+N2)/N;
 #else
-   sine = 2*M_PI*(.125f)/N;
+   sine = (kiss_twiddle_scalar)2*M_PI*(.125f)/N;
 #endif
    
    /* Pre-rotate */
index a8d0ba2..2677a5a 100644 (file)
@@ -154,7 +154,7 @@ static void quant_coarse_energy_impl(const CELTMode *m, int start, int end,
             that have just one bin) */
          if (qi < 0 && x < oldEBands[i+c*m->nbEBands]-max_decay)
          {
-            qi += SHR16(oldEBands[i+c*m->nbEBands]-max_decay-x, DB_SHIFT);
+            qi += (int)SHR16(oldEBands[i+c*m->nbEBands]-max_decay-x, DB_SHIFT);
             if (qi > 0)
                qi = 0;
          }
index 1fd3064..4876b59 100644 (file)
@@ -251,7 +251,7 @@ void alg_quant(celt_norm *X, int N, int K, int spread, int B, celt_norm *lowband
          /* It's really important to round *towards zero* here */
          iy[j] = MULT16_16_Q15(X[j],rcp);
 #else
-         iy[j] = floor(rcp*X[j]);
+         iy[j] = (int)floor(rcp*X[j]);
 #endif
          y[j] = SHL16(iy[j],yshift);
          yy = MAC16_16(yy, y[j],y[j]);