From 6bc3e3cff7c81674d62455a5a55a83998e0dbcf6 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Sun, 17 Nov 2013 22:35:15 -0500 Subject: [PATCH] Fixes SILK surround calibration while fixing other MSVC warnings --- src/opus_encoder.c | 4 ++-- tests/test_opus_encode.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/opus_encoder.c b/src/opus_encoder.c index a365e56db..036143b82 100644 --- a/src/opus_encoder.c +++ b/src/opus_encoder.c @@ -1518,9 +1518,9 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_ } /* Conservative rate reduction, we cut the masking in half */ masking_depth = HALF16(mask_sum / end*st->channels); - rate_offset = PSHR32(MULT16_16(srate, masking_depth), DB_SHIFT); + masking_depth += QCONST16(.4f, DB_SHIFT); + rate_offset = (opus_int32)PSHR32(MULT16_16(srate, masking_depth), DB_SHIFT); rate_offset = MAX32(rate_offset, -2*st->silk_mode.bitRate/3); - rate_offset += QCONST16(.4f, DB_SHIFT); st->silk_mode.bitRate += rate_offset; bytes_target += rate_offset * frame_size / (8 * st->Fs); } diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c index 0e544a443..6c1d0238a 100644 --- a/tests/test_opus_encode.c +++ b/tests/test_opus_encode.c @@ -310,7 +310,7 @@ int run_test1(int no_fuzz) do { int pred,len,out_samples,frame_size,loss; if(opus_multistream_encoder_ctl(MSenc, OPUS_GET_PREDICTION_DISABLED(&pred))!=OPUS_OK)test_failed(); - if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_PREDICTION_DISABLED((fast_rand()&15)<(pred?11:4)))!=OPUS_OK)test_failed(); + if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_PREDICTION_DISABLED((int)(fast_rand()&15)<(pred?11:4)))!=OPUS_OK)test_failed(); frame_size=frame[j]; if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_COMPLEXITY((count>>2)%11))!=OPUS_OK)test_failed(); if(opus_multistream_encoder_ctl(MSenc, OPUS_SET_PACKET_LOSS_PERC((fast_rand()&15)&(fast_rand()%15)))!=OPUS_OK)test_failed(); -- GitLab