diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2024-03-02 15:04:20 -0500 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2024-03-02 15:05:45 -0500 |
commit | b4ff554268a6edaf154f01c646ae528cab0dcd58 (patch) | |
tree | a2306b4b19c61b46656a3a7600c71df104d4e323 | |
parent | 1f5189a50a41a07ebc15f0d3423ef236de9f9893 (diff) | |
download | libopus-b4ff554268a6edaf154f01c646ae528cab0dcd58.tar.gz |
Fix conversion warnings
-rw-r--r-- | dnn/dump_data.c | 8 | ||||
-rw-r--r-- | dnn/vec_avx.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/dnn/dump_data.c b/dnn/dump_data.c index c502b60d..e4c78c7e 100644 --- a/dnn/dump_data.c +++ b/dnn/dump_data.c @@ -216,7 +216,7 @@ int main(int argc, char **argv) { long pos; /* Randomize the fraction because rand() only gives us 31 bits. */ float frac_pos = rand()/(float)RAND_MAX; - pos = (frac_pos*noise_size); + pos = (long)(frac_pos*noise_size); /* 32-bit alignment. */ pos = pos/4 * 4; if (pos > noise_size-500000) pos = noise_size-500000; @@ -244,7 +244,7 @@ int main(int argc, char **argv) { fwrite(ceps, sizeof(float), 2*NB_BANDS, ffeat); } preemphasis(x, &mem_preemph, x, PREEMPHASIS, FRAME_SIZE); - for (i=0;i<FRAME_SIZE;i++) x[i] += rand()/(float)RAND_MAX - .5; + for (i=0;i<FRAME_SIZE;i++) x[i] += rand()/(float)RAND_MAX - .5f; /* PCM is delayed by 1/2 frame to make the features centered on the frames. */ for (i=0;i<FRAME_SIZE-TRAINING_OFFSET;i++) pcm[i+TRAINING_OFFSET] = float2short(x[i]); compute_frame_features(st, x, arch); @@ -256,10 +256,10 @@ int main(int argc, char **argv) { if (pitch) { signed char pitch_features[PITCH_MAX_PERIOD-PITCH_MIN_PERIOD+PITCH_IF_FEATURES]; for (i=0;i<PITCH_MAX_PERIOD-PITCH_MIN_PERIOD;i++) { - pitch_features[i] = floor(.5 + 127.f*st->xcorr_features[i]); + pitch_features[i] = (int)floor(.5f + 127.f*st->xcorr_features[i]); } for (i=0;i<PITCH_IF_FEATURES;i++) { - pitch_features[i+PITCH_MAX_PERIOD-PITCH_MIN_PERIOD] = floor(.5 + 127.f*st->if_features[i]); + pitch_features[i+PITCH_MAX_PERIOD-PITCH_MIN_PERIOD] = (int)floor(.5f + 127.f*st->if_features[i]); } fwrite(pitch_features, PITCH_MAX_PERIOD-PITCH_MIN_PERIOD+PITCH_IF_FEATURES, 1, ffeat); } else { diff --git a/dnn/vec_avx.h b/dnn/vec_avx.h index 53a0056b..979e77fe 100644 --- a/dnn/vec_avx.h +++ b/dnn/vec_avx.h @@ -378,7 +378,7 @@ static inline __m256 exp8_approx(__m256 X) static inline void vector_ps_to_epi8(unsigned char *x, const float *_x, int len) { int i; - for (i=0;i<len;i++) x[i] = 127+floor(.5+127*_x[i]); + for (i=0;i<len;i++) x[i] = 127+(int)floor(.5+127*_x[i]); } #endif |