diff options
author | Ralph Giles <giles@mozilla.com> | 2012-10-23 21:49:18 +0400 |
---|---|---|
committer | Ralph Giles <giles@mozilla.com> | 2012-10-23 21:49:18 +0400 |
commit | 027ec51bfef87d7e9f2c48091a66a75bcf524152 (patch) | |
tree | cca9dbe5d02e67a069ff05cd243226b2c325177a | |
parent | 2572c1e788318f8d765cb9cfab88c2d9f4744167 (diff) |
Fix MSVC format conversion warnings.
The Microsoft compiler warns about precision reduction from
default double literals to the floats we generally use outside
the fixed-point build. Avoid these by qualifying the literals
as floats.
Thanks to derf for review.
-rw-r--r-- | celt/pitch.c | 8 | ||||
-rw-r--r-- | src/opus_encoder.c | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/celt/pitch.c b/celt/pitch.c index d9bba1b2..c5b70e59 100644 --- a/celt/pitch.c +++ b/celt/pitch.c @@ -77,7 +77,7 @@ static void find_best_pitch(opus_val32 *xcorr, opus_val16 *y, int len, #ifndef FIXED_POINT /* Considering the range of xcorr16, this should avoid both underflows and overflows (inf) when squaring xcorr16 */ - xcorr16 *= 1e-12; + xcorr16 *= 1e-12f; #endif num = MULT16_16_Q15(xcorr16,xcorr16); if (MULT16_32_Q15(num,best_den[1]) > MULT16_32_Q15(best_num[1],Syy)) @@ -373,13 +373,13 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, cont = HALF32(prev_gain); else cont = 0; - thresh = MAX16(QCONST16(.3f,15), MULT16_16_Q15(QCONST16(.7,15),g0)-cont); + thresh = MAX16(QCONST16(.3f,15), MULT16_16_Q15(QCONST16(.7f,15),g0)-cont); /* Bias against very high pitch (very short period) to avoid false-positives due to short-term correlation */ if (T1<3*minperiod) - thresh = MAX16(QCONST16(.4f,15), MULT16_16_Q15(QCONST16(.85,15),g0)-cont); + thresh = MAX16(QCONST16(.4f,15), MULT16_16_Q15(QCONST16(.85f,15),g0)-cont); else if (T1<2*minperiod) - thresh = MAX16(QCONST16(.5f,15), MULT16_16_Q15(QCONST16(.9,15),g0)-cont); + thresh = MAX16(QCONST16(.5f,15), MULT16_16_Q15(QCONST16(.9f,15),g0)-cont); if (g1 > thresh) { best_xy = xy; diff --git a/src/opus_encoder.c b/src/opus_encoder.c index 4a8f9a70..6c491b59 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -401,7 +401,7 @@ static void dc_reject(const opus_val16 *in, opus_int32 cutoff_Hz, opus_val16 *ou int c, i; float coef; - coef = 4.*cutoff_Hz/Fs; + coef = 4.0f*cutoff_Hz/Fs; for (c=0;c<channels;c++) { for (i=0;i<len;i++) @@ -978,7 +978,7 @@ opus_int32 opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_s for (i=0;i<nb_analysis_frames;i++) tonality_analysis(&st->analysis, &analysis_info, celt_enc, pcm_buf+i*(st->Fs/100)*st->channels, st->channels); if (st->signal_type == OPUS_AUTO) - st->voice_ratio = floor(.5+100*(1-analysis_info.music_prob)); + st->voice_ratio = (int)floor(.5+100*(1-analysis_info.music_prob)); } else { analysis_info.valid = 0; st->voice_ratio = -1; |