shithub: opus

Download patch

ref: 736efd6909fd951f03e1245183e8afc550246ed3
parent: 5c0c936d8f8ca65a44150f90ae0c583650ccb019
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 31 07:52:45 EDT 2010

Fixes some MSVC warnings

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -138,10 +138,10 @@
       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 @@
             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 @@
             /* 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;
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -809,7 +809,7 @@
      /*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);*/
 
--- a/libcelt/mathops.h
+++ b/libcelt/mathops.h
@@ -54,7 +54,7 @@
 #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 @@
 }
 
 #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
--- a/libcelt/mdct.c
+++ b/libcelt/mdct.c
@@ -92,7 +92,7 @@
       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 @@
 #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 @@
 #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 */
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -154,7 +154,7 @@
             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;
          }
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -251,7 +251,7 @@
          /* 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]);