ref: 027ec51bfef87d7e9f2c48091a66a75bcf524152
parent: 2572c1e788318f8d765cb9cfab88c2d9f4744167
author: Ralph Giles <[email protected]>
date: Tue Oct 23 06:49:18 EDT 2012
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.
--- a/celt/pitch.c
+++ b/celt/pitch.c
@@ -77,7 +77,7 @@
#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 @@
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;
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -401,7 +401,7 @@
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 @@
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;