Fixes more MSVC warnings
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 27 Jun 2013 18:45:50 +0000 (14:45 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 27 Jun 2013 18:45:50 +0000 (14:45 -0400)
src/analysis.c
src/opus_encoder.c

index 76f370f..e063c78 100644 (file)
@@ -479,7 +479,7 @@ void tonality_analysis(TonalityAnalysisState *tonal, AnalysisInfo *info_out, con
     frame_probs[0] = .5f*(frame_probs[0]+1);
     /* Curve fitting between the MLP probability and the actual probability */
     frame_probs[0] = .01f + 1.21f*frame_probs[0]*frame_probs[0] - .23f*(float)pow(frame_probs[0], 10);
-    frame_probs[1] = .5*frame_probs[1]+.5;
+    frame_probs[1] = .5f*frame_probs[1]+.5f;
     frame_probs[0] = frame_probs[1]*frame_probs[0] + (1-frame_probs[1])*.5f;
 
     /*printf("%f %f ", frame_probs[0], frame_probs[1]);*/
index e1d1186..cce7f27 100644 (file)
@@ -573,7 +573,7 @@ static float transient_boost(const float *E, const float *E_1, int LM, int maxM)
       printf("%f\n", metric);*/
    /*return metric>10 ? 1 : 0;*/
    /*return MAX16(0,1-exp(-.25*(metric-2.)));*/
-   return MIN16(1,sqrt(MAX16(0,.05f*(metric-2))));
+   return MIN16(1,(float)sqrt(MAX16(0,.05f*(metric-2))));
 }
 
 /* Viterbi decoding trying to find the best frame size combination using look-ahead
@@ -772,7 +772,7 @@ int optimize_framesize(const opus_val16 *x, int len, int C, opus_int32 Fs,
    e[i+pos] = e[i+pos-1];
    if (buffering)
       N=IMIN(MAX_DYNAMIC_FRAMESIZE, N+2);
-   bestLM = transient_viterbi(e, e_1, N, (1.f+.5f*tonality)*(60*C+40), bitrate/400);
+   bestLM = transient_viterbi(e, e_1, N, (int)((1.f+.5f*tonality)*(60*C+40)), bitrate/400);
    mem[0] = e[1<<bestLM];
    if (buffering)
    {
@@ -1594,7 +1594,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
                 {
                    bonus = (60*st->stream_channels+40)*(st->Fs/frame_size-50);
                    if (analysis_info->valid)
-                      bonus = bonus*(1.f+.5f*analysis_info->tonality);
+                      bonus = (opus_int32)(bonus*(1.f+.5f*analysis_info->tonality));
                 }
 #endif
                 celt_encoder_ctl(celt_enc, OPUS_SET_VBR(1));