diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-03-08 23:09:09 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-03-08 23:09:09 +0400 |
commit | 905197d750d00c460c4940c42c3b7b9c2f85441c (patch) | |
tree | a81fb46750b02635cad0c22bb429a6b41d294ed3 /silk | |
parent | 59354a7742ff0fc182886f2f2567026e516c1eef (diff) |
Fixes a bunch of 16-bit issues that the C5X compiler warns about
Diffstat (limited to 'silk')
-rw-r--r-- | silk/CNG.c | 2 | ||||
-rw-r--r-- | silk/Inlines.h | 2 | ||||
-rw-r--r-- | silk/LPC_inv_pred_gain.c | 2 | ||||
-rw-r--r-- | silk/LP_variable_cutoff.c | 4 | ||||
-rw-r--r-- | silk/NLSF_VQ_weights_laroia.c | 10 | ||||
-rw-r--r-- | silk/NLSF_decode.c | 2 | ||||
-rw-r--r-- | silk/NLSF_del_dec_quant.c | 6 | ||||
-rw-r--r-- | silk/NSQ.c | 4 | ||||
-rw-r--r-- | silk/NSQ_del_dec.c | 4 | ||||
-rw-r--r-- | silk/PLC.c | 8 | ||||
-rw-r--r-- | silk/VAD.c | 4 | ||||
-rw-r--r-- | silk/control_codec.c | 2 | ||||
-rw-r--r-- | silk/dec_API.c | 2 | ||||
-rw-r--r-- | silk/decode_core.c | 4 | ||||
-rw-r--r-- | silk/fixed/apply_sine_window_FIX.c | 10 | ||||
-rw-r--r-- | silk/fixed/burg_modified_FIX.c | 6 | ||||
-rw-r--r-- | silk/fixed/find_LTP_FIX.c | 2 | ||||
-rw-r--r-- | silk/fixed/find_pred_coefs_FIX.c | 4 | ||||
-rw-r--r-- | silk/fixed/noise_shape_analysis_FIX.c | 6 | ||||
-rw-r--r-- | silk/fixed/prefilter_FIX.c | 2 | ||||
-rw-r--r-- | silk/fixed/solve_LS_FIX.c | 2 | ||||
-rw-r--r-- | silk/process_NLSFs.c | 2 | ||||
-rw-r--r-- | silk/stereo_LR_to_MS.c | 2 | ||||
-rw-r--r-- | silk/stereo_MS_to_LR.c | 2 |
24 files changed, 47 insertions, 47 deletions
@@ -100,7 +100,7 @@ void silk_CNG( /* Smoothing of LSF's */ for( i = 0; i < psDec->LPC_order; i++ ) { - psCNG->CNG_smth_NLSF_Q15[ i ] += silk_SMULWB( psDec->prevNLSF_Q15[ i ] - psCNG->CNG_smth_NLSF_Q15[ i ], CNG_NLSF_SMTH_Q16 ); + psCNG->CNG_smth_NLSF_Q15[ i ] += silk_SMULWB( (opus_int32)psDec->prevNLSF_Q15[ i ] - (opus_int32)psCNG->CNG_smth_NLSF_Q15[ i ], CNG_NLSF_SMTH_Q16 ); } /* Find the subframe with the highest gain */ max_Gain_Q16 = 0; diff --git a/silk/Inlines.h b/silk/Inlines.h index 8458c97c..0b9bae55 100644 --- a/silk/Inlines.h +++ b/silk/Inlines.h @@ -162,7 +162,7 @@ static inline opus_int32 silk_INVERSE32_varQ( /* O returns a good approxima result = silk_LSHIFT(b32_inv, 16); /* Q: 61 - b_headrm */ /* Compute residual by subtracting product of denominator and first approximation from one */ - err_Q32 = silk_LSHIFT( (1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 ); /* Q32 */ + err_Q32 = silk_LSHIFT( ((opus_int32)1<<29) - silk_SMULWB(b32_nrm, b32_inv), 3 ); /* Q32 */ /* Refinement */ result = silk_SMLAWW(result, err_Q32, b32_inv); /* Q: 61 - b_headrm */ diff --git a/silk/LPC_inv_pred_gain.c b/silk/LPC_inv_pred_gain.c index db529d14..9dc3984b 100644 --- a/silk/LPC_inv_pred_gain.c +++ b/silk/LPC_inv_pred_gain.c @@ -49,7 +49,7 @@ static opus_int32 LPC_inverse_pred_gain_QA( /* O Returns inver Anew_QA = A_QA[ order & 1 ]; - invGain_Q30 = 1 << 30; + invGain_Q30 = (opus_int32)1 << 30; for( k = order - 1; k > 0; k-- ) { /* Check for stability */ if( ( Anew_QA[ k ] > A_LIMIT ) || ( Anew_QA[ k ] < -A_LIMIT ) ) { diff --git a/silk/LP_variable_cutoff.c b/silk/LP_variable_cutoff.c index 44f541ec..0ada36ca 100644 --- a/silk/LP_variable_cutoff.c +++ b/silk/LP_variable_cutoff.c @@ -73,14 +73,14 @@ static inline void silk_LP_interpolate_filter_taps( silk_Transition_LP_B_Q28[ ind + 1 ][ nb ], silk_Transition_LP_B_Q28[ ind + 1 ][ nb ] - silk_Transition_LP_B_Q28[ ind ][ nb ], - fac_Q16 - ( 1 << 16 ) ); + fac_Q16 - ( (opus_int32)1 << 16 ) ); } for( na = 0; na < TRANSITION_NA; na++ ) { A_Q28[ na ] = silk_SMLAWB( silk_Transition_LP_A_Q28[ ind + 1 ][ na ], silk_Transition_LP_A_Q28[ ind + 1 ][ na ] - silk_Transition_LP_A_Q28[ ind ][ na ], - fac_Q16 - ( 1 << 16 ) ); + fac_Q16 - ( (opus_int32)1 << 16 ) ); } } } else { diff --git a/silk/NLSF_VQ_weights_laroia.c b/silk/NLSF_VQ_weights_laroia.c index 8e8be43c..332af0e3 100644 --- a/silk/NLSF_VQ_weights_laroia.c +++ b/silk/NLSF_VQ_weights_laroia.c @@ -53,28 +53,28 @@ void silk_NLSF_VQ_weights_laroia( /* First value */ tmp1_int = silk_max_int( pNLSF_Q15[ 0 ], 1 ); - tmp1_int = silk_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); + tmp1_int = silk_DIV32_16( (opus_int32)1 << ( 15 + NLSF_W_Q ), tmp1_int ); tmp2_int = silk_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], 1 ); - tmp2_int = silk_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp2_int ); + tmp2_int = silk_DIV32_16( (opus_int32)1 << ( 15 + NLSF_W_Q ), tmp2_int ); pNLSFW_Q_OUT[ 0 ] = (opus_int16)silk_min_int( tmp1_int + tmp2_int, silk_int16_MAX ); silk_assert( pNLSFW_Q_OUT[ 0 ] > 0 ); /* Main loop */ for( k = 1; k < D - 1; k += 2 ) { tmp1_int = silk_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], 1 ); - tmp1_int = silk_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); + tmp1_int = silk_DIV32_16( (opus_int32)1 << ( 15 + NLSF_W_Q ), tmp1_int ); pNLSFW_Q_OUT[ k ] = (opus_int16)silk_min_int( tmp1_int + tmp2_int, silk_int16_MAX ); silk_assert( pNLSFW_Q_OUT[ k ] > 0 ); tmp2_int = silk_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], 1 ); - tmp2_int = silk_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp2_int ); + tmp2_int = silk_DIV32_16( (opus_int32)1 << ( 15 + NLSF_W_Q ), tmp2_int ); pNLSFW_Q_OUT[ k + 1 ] = (opus_int16)silk_min_int( tmp1_int + tmp2_int, silk_int16_MAX ); silk_assert( pNLSFW_Q_OUT[ k + 1 ] > 0 ); } /* Last value */ tmp1_int = silk_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], 1 ); - tmp1_int = silk_DIV32_16( 1 << ( 15 + NLSF_W_Q ), tmp1_int ); + tmp1_int = silk_DIV32_16( (opus_int32)1 << ( 15 + NLSF_W_Q ), tmp1_int ); pNLSFW_Q_OUT[ D - 1 ] = (opus_int16)silk_min_int( tmp1_int + tmp2_int, silk_int16_MAX ); silk_assert( pNLSFW_Q_OUT[ D - 1 ] > 0 ); } diff --git a/silk/NLSF_decode.c b/silk/NLSF_decode.c index f2c2dec7..e969d7a5 100644 --- a/silk/NLSF_decode.c +++ b/silk/NLSF_decode.c @@ -51,7 +51,7 @@ static inline void silk_NLSF_residual_dequant( /* O Returns RD } else if( out_Q10 < 0 ) { out_Q10 = silk_ADD16( out_Q10, SILK_FIX_CONST( NLSF_QUANT_LEVEL_ADJ, 10 ) ); } - out_Q10 = silk_SMLAWB( pred_Q10, out_Q10, quant_step_size_Q16 ); + out_Q10 = silk_SMLAWB( pred_Q10, (opus_int32)out_Q10, quant_step_size_Q16 ); x_Q10[ i ] = out_Q10; } } diff --git a/silk/NLSF_del_dec_quant.c b/silk/NLSF_del_dec_quant.c index d2eef3cb..989fb873 100644 --- a/silk/NLSF_del_dec_quant.c +++ b/silk/NLSF_del_dec_quant.c @@ -68,7 +68,7 @@ opus_int32 silk_NLSF_del_dec_quant( /* O Returns for( j = 0; j < nStates; j++ ) { pred_Q10 = silk_SMULWB( pred_coef_Q16, prev_out_Q10[ j ] ); res_Q10 = silk_SUB16( in_Q10, pred_Q10 ); - ind_tmp = silk_SMULWB( inv_quant_step_size_Q6, res_Q10 ); + ind_tmp = silk_SMULWB( (opus_int32)inv_quant_step_size_Q6, res_Q10 ); ind_tmp = silk_LIMIT( ind_tmp, -NLSF_QUANT_MAX_AMPLITUDE_EXT, NLSF_QUANT_MAX_AMPLITUDE_EXT-1 ); ind[ j ][ i ] = (opus_int8)ind_tmp; @@ -86,8 +86,8 @@ opus_int32 silk_NLSF_del_dec_quant( /* O Returns out0_Q10 = silk_ADD16( out0_Q10, SILK_FIX_CONST( NLSF_QUANT_LEVEL_ADJ, 10 ) ); out1_Q10 = silk_ADD16( out1_Q10, SILK_FIX_CONST( NLSF_QUANT_LEVEL_ADJ, 10 ) ); } - out0_Q10 = silk_SMULWB( out0_Q10, quant_step_size_Q16 ); - out1_Q10 = silk_SMULWB( out1_Q10, quant_step_size_Q16 ); + out0_Q10 = silk_SMULWB( (opus_int32)out0_Q10, quant_step_size_Q16 ); + out1_Q10 = silk_SMULWB( (opus_int32)out1_Q10, quant_step_size_Q16 ); out0_Q10 = silk_ADD16( out0_Q10, pred_Q10 ); out1_Q10 = silk_ADD16( out1_Q10, pred_Q10 ); prev_out_Q10[ j ] = out0_Q10; @@ -388,7 +388,7 @@ static inline void silk_nsq_scale_states( if( Gains_Q16[ subfr ] != NSQ->prev_gain_Q16 ) { gain_adj_Q16 = silk_DIV32_varQ( NSQ->prev_gain_Q16, Gains_Q16[ subfr ], 16 ); } else { - gain_adj_Q16 = 1 << 16; + gain_adj_Q16 = (opus_int32)1 << 16; } /* Scale input */ @@ -413,7 +413,7 @@ static inline void silk_nsq_scale_states( } /* Adjust for changing gain */ - if( gain_adj_Q16 != 1 << 16 ) { + if( gain_adj_Q16 != (opus_int32)1 << 16 ) { /* Scale long-term shaping state */ for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx; i++ ) { NSQ->sLTP_shp_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q14[ i ] ); diff --git a/silk/NSQ_del_dec.c b/silk/NSQ_del_dec.c index d4ee0fbc..c58ff78b 100644 --- a/silk/NSQ_del_dec.c +++ b/silk/NSQ_del_dec.c @@ -645,7 +645,7 @@ static inline void silk_nsq_del_dec_scale_states( if( Gains_Q16[ subfr ] != NSQ->prev_gain_Q16 ) { gain_adj_Q16 = silk_DIV32_varQ( NSQ->prev_gain_Q16, Gains_Q16[ subfr ], 16 ); } else { - gain_adj_Q16 = 1 << 16; + gain_adj_Q16 = (opus_int32)1 << 16; } /* Scale input */ @@ -670,7 +670,7 @@ static inline void silk_nsq_del_dec_scale_states( } /* Adjust for changing gain */ - if( gain_adj_Q16 != 1 << 16 ) { + if( gain_adj_Q16 != (opus_int32)1 << 16 ) { /* Scale long-term shaping state */ for( i = NSQ->sLTP_shp_buf_idx - psEncC->ltp_mem_length; i < NSQ->sLTP_shp_buf_idx; i++ ) { NSQ->sLTP_shp_Q14[ i ] = silk_SMULWW( gain_adj_Q16, NSQ->sLTP_shp_Q14[ i ] ); @@ -249,8 +249,8 @@ static inline void silk_PLC_conceal( invGain_Q30 = silk_LPC_inverse_pred_gain( psPLC->prevLPC_Q12, psDec->LPC_order ); - down_scale_Q30 = silk_min_32( silk_RSHIFT( 1 << 30, LOG2_INV_LPC_GAIN_HIGH_THRES ), invGain_Q30 ); - down_scale_Q30 = silk_max_32( silk_RSHIFT( 1 << 30, LOG2_INV_LPC_GAIN_LOW_THRES ), down_scale_Q30 ); + down_scale_Q30 = silk_min_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2_INV_LPC_GAIN_HIGH_THRES ), invGain_Q30 ); + down_scale_Q30 = silk_max_32( silk_RSHIFT( (opus_int32)1 << 30, LOG2_INV_LPC_GAIN_LOW_THRES ), down_scale_Q30 ); down_scale_Q30 = silk_LSHIFT( down_scale_Q30, LOG2_INV_LPC_GAIN_HIGH_THRES ); rand_Gain_Q15 = silk_RSHIFT( silk_SMULWB( down_scale_Q30, rand_Gain_Q15 ), 14 ); @@ -398,14 +398,14 @@ void silk_PLC_glue_frames( frac_Q24 = silk_DIV32( psPLC->conc_energy, silk_max( energy, 1 ) ); gain_Q16 = silk_LSHIFT( silk_SQRT_APPROX( frac_Q24 ), 4 ); - slope_Q16 = silk_DIV32_16( ( 1 << 16 ) - gain_Q16, length ); + slope_Q16 = silk_DIV32_16( ( (opus_int32)1 << 16 ) - gain_Q16, length ); /* Make slope 4x steeper to avoid missing onsets after DTX */ slope_Q16 = silk_LSHIFT( slope_Q16, 2 ); for( i = 0; i < length; i++ ) { frame[ i ] = silk_SMULWB( gain_Q16, frame[ i ] ); gain_Q16 += slope_Q16; - if( gain_Q16 > 1 << 16 ) { + if( gain_Q16 > (opus_int32)1 << 16 ) { break; } } @@ -190,7 +190,7 @@ opus_int silk_VAD_GetSA_Q8( /* O Return v sumSquared = silk_SMLABB( sumSquared, SNR_Q7, SNR_Q7 ); /* Q14 */ /* Tilt measure */ - if( speech_nrg < ( 1 << 20 ) ) { + if( speech_nrg < ( (opus_int32)1 << 20 ) ) { /* Scale down SNR value for small subband speech energies */ SNR_Q7 = silk_SMULWB( silk_LSHIFT( silk_SQRT_APPROX( speech_nrg ), 6 ), SNR_Q7 ); } @@ -247,7 +247,7 @@ opus_int silk_VAD_GetSA_Q8( /* O Return v /* Energy Level and SNR estimation */ /***********************************/ /* Smoothing coefficient */ - smooth_coef_Q16 = silk_SMULWB( VAD_SNR_SMOOTH_COEF_Q18, silk_SMULWB( SA_Q15, SA_Q15 ) ); + smooth_coef_Q16 = silk_SMULWB( VAD_SNR_SMOOTH_COEF_Q18, silk_SMULWB( (opus_int32)SA_Q15, SA_Q15 ) ); if( psEncC->frame_length == 10 * psEncC->fs_kHz ) { smooth_coef_Q16 >>= 1; diff --git a/silk/control_codec.c b/silk/control_codec.c index 5a997018..4920d6c9 100644 --- a/silk/control_codec.c +++ b/silk/control_codec.c @@ -403,7 +403,7 @@ static inline opus_int silk_setup_LBRR( if( TargetRate_bps > LBRR_rate_thres_bps ) { /* Set gain increase for coding LBRR excitation */ psEncC->LBRR_enabled = 1; - psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); + psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_int32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); } } diff --git a/silk/dec_API.c b/silk/dec_API.c index 8c9ed24a..77ea5e77 100644 --- a/silk/dec_API.c +++ b/silk/dec_API.c @@ -151,7 +151,7 @@ opus_int silk_Decode( /* O Returns error co psDec->nChannelsAPI = decControl->nChannelsAPI; psDec->nChannelsInternal = decControl->nChannelsInternal; - if( decControl->API_sampleRate > MAX_API_FS_KHZ * 1000 || decControl->API_sampleRate < 8000 ) { + if( decControl->API_sampleRate > (opus_int32)MAX_API_FS_KHZ * 1000 || decControl->API_sampleRate < 8000 ) { ret = SILK_DEC_INVALID_SAMPLING_FREQUENCY; return( ret ); } diff --git a/silk/decode_core.c b/silk/decode_core.c index ff3ab795..e3ed41e6 100644 --- a/silk/decode_core.c +++ b/silk/decode_core.c @@ -107,7 +107,7 @@ void silk_decode_core( sLPC_Q14[ i ] = silk_SMULWW( gain_adj_Q16, sLPC_Q14[ i ] ); } } else { - gain_adj_Q16 = 1 << 16; + gain_adj_Q16 = (opus_int32)1 << 16; } /* Save inv_gain */ @@ -152,7 +152,7 @@ void silk_decode_core( } } else { /* Update LTP state when Gain changes */ - if( gain_adj_Q16 != 1 << 16 ) { + if( gain_adj_Q16 != (opus_int32)1 << 16 ) { for( i = 0; i < lag + LTP_ORDER/2; i++ ) { sLTP_Q15[ sLTP_buf_idx - i - 1 ] = silk_SMULWW( gain_adj_Q16, sLTP_Q15[ sLTP_buf_idx - i - 1 ] ); } diff --git a/silk/fixed/apply_sine_window_FIX.c b/silk/fixed/apply_sine_window_FIX.c index 4d4f096e..cfa0180a 100644 --- a/silk/fixed/apply_sine_window_FIX.c +++ b/silk/fixed/apply_sine_window_FIX.c @@ -69,7 +69,7 @@ void silk_apply_sine_window( f_Q16 = (opus_int)freq_table_Q16[ k ]; /* Factor used for cosine approximation */ - c_Q16 = silk_SMULWB( f_Q16, -f_Q16 ); + c_Q16 = silk_SMULWB( (opus_int32)f_Q16, -f_Q16 ); silk_assert( c_Q16 >= -32768 ); /* initialize state */ @@ -80,9 +80,9 @@ void silk_apply_sine_window( S1_Q16 = f_Q16 + silk_RSHIFT( length, 3 ); } else { /* start from 1 */ - S0_Q16 = ( 1 << 16 ); + S0_Q16 = ( (opus_int32)1 << 16 ); /* approximation of cos(f) */ - S1_Q16 = ( 1 << 16 ) + silk_RSHIFT( c_Q16, 1 ) + silk_RSHIFT( length, 4 ); + S1_Q16 = ( (opus_int32)1 << 16 ) + silk_RSHIFT( c_Q16, 1 ) + silk_RSHIFT( length, 4 ); } /* Uses the recursive equation: sin(n*f) = 2 * cos(f) * sin((n-1)*f) - sin((n-2)*f) */ @@ -91,11 +91,11 @@ void silk_apply_sine_window( px_win[ k ] = (opus_int16)silk_SMULWB( silk_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k ] ); px_win[ k + 1 ] = (opus_int16)silk_SMULWB( S1_Q16, px[ k + 1] ); S0_Q16 = silk_SMULWB( S1_Q16, c_Q16 ) + silk_LSHIFT( S1_Q16, 1 ) - S0_Q16 + 1; - S0_Q16 = silk_min( S0_Q16, ( 1 << 16 ) ); + S0_Q16 = silk_min( S0_Q16, ( (opus_int32)1 << 16 ) ); px_win[ k + 2 ] = (opus_int16)silk_SMULWB( silk_RSHIFT( S0_Q16 + S1_Q16, 1 ), px[ k + 2] ); px_win[ k + 3 ] = (opus_int16)silk_SMULWB( S0_Q16, px[ k + 3 ] ); S1_Q16 = silk_SMULWB( S0_Q16, c_Q16 ) + silk_LSHIFT( S0_Q16, 1 ) - S1_Q16; - S1_Q16 = silk_min( S1_Q16, ( 1 << 16 ) ); + S1_Q16 = silk_min( S1_Q16, ( (opus_int32)1 << 16 ) ); } } diff --git a/silk/fixed/burg_modified_FIX.c b/silk/fixed/burg_modified_FIX.c index fc82d368..e2a2553e 100644 --- a/silk/fixed/burg_modified_FIX.c +++ b/silk/fixed/burg_modified_FIX.c @@ -105,7 +105,7 @@ void silk_burg_modified( /* Initialize */ CAb[ 0 ] = CAf[ 0 ] = C0 + silk_SMMUL( SILK_FIX_CONST( FIND_LPC_COND_FAC, 32 ), C0 ) + 1; /* Q(-rshifts) */ - invGain_Q30 = 1 << 30; + invGain_Q30 = (opus_int32)1 << 30; reached_max_gain = 0; for( n = 0; n < D; n++ ) { /* Update first row of correlation matrix (without first element) */ @@ -192,7 +192,7 @@ void silk_burg_modified( tmp1 = silk_LSHIFT( silk_SMMUL( invGain_Q30, tmp1 ), 2 ); if( tmp1 <= minInvGain_Q30 ) { /* Max prediction gain exceeded; set reflection coefficient such that max prediction gain is exactly hit */ - tmp2 = ( 1 << 30 ) - silk_DIV32_varQ( minInvGain_Q30, invGain_Q30, 30 ); /* Q30 */ + tmp2 = ( (opus_int32)1 << 30 ) - silk_DIV32_varQ( minInvGain_Q30, invGain_Q30, 30 ); /* Q30 */ rc_Q31 = silk_SQRT_APPROX( tmp2 ); /* Q15 */ /* Newton-Raphson iteration */ rc_Q31 = silk_RSHIFT32( rc_Q31 + silk_DIV32( tmp2, rc_Q31 ), 1 ); /* Q15 */ @@ -256,7 +256,7 @@ void silk_burg_modified( } else { /* Return residual energy */ nrg = CAf[ 0 ]; /* Q( -rshifts ) */ - tmp1 = 1 << 16; /* Q16 */ + tmp1 = (opus_int32)1 << 16; /* Q16 */ for( k = 0; k < D; k++ ) { Atmp1 = silk_RSHIFT_ROUND( Af_QA[ k ], QA - 16 ); /* Q16 */ nrg = silk_SMLAWW( nrg, CAf[ k + 1 ], Atmp1 ); /* Q( -rshifts ) */ diff --git a/silk/fixed/find_LTP_FIX.c b/silk/fixed/find_LTP_FIX.c index 078d84cb..ab367e5a 100644 --- a/silk/fixed/find_LTP_FIX.c +++ b/silk/fixed/find_LTP_FIX.c @@ -110,7 +110,7 @@ void silk_find_LTP_FIX( /* temp = Wght[ k ] / ( nrg[ k ] * Wght[ k ] + 0.01f * subfr_length ); */ extra_shifts = silk_min_int( corr_rshifts[ k ], LTP_CORRS_HEAD_ROOM ); denom32 = silk_LSHIFT_SAT32( silk_SMULWB( nrg[ k ], Wght_Q15[ k ] ), 1 + extra_shifts ) + /* Q( -corr_rshifts[ k ] + extra_shifts ) */ - silk_RSHIFT( silk_SMULWB( subfr_length, 655 ), corr_rshifts[ k ] - extra_shifts ); /* Q( -corr_rshifts[ k ] + extra_shifts ) */ + silk_RSHIFT( silk_SMULWB( (opus_int32)subfr_length, 655 ), corr_rshifts[ k ] - extra_shifts ); /* Q( -corr_rshifts[ k ] + extra_shifts ) */ denom32 = silk_max( denom32, 1 ); silk_assert( ((opus_int64)Wght_Q15[ k ] << 16 ) < silk_int32_MAX ); /* Wght always < 0.5 in Q0 */ temp32 = silk_DIV32( silk_LSHIFT( (opus_int32)Wght_Q15[ k ], 16 ), denom32 ); /* Q( 15 + 16 + corr_rshifts[k] - extra_shifts ) */ diff --git a/silk/fixed/find_pred_coefs_FIX.c b/silk/fixed/find_pred_coefs_FIX.c index 2053905c..e73f305f 100644 --- a/silk/fixed/find_pred_coefs_FIX.c +++ b/silk/fixed/find_pred_coefs_FIX.c @@ -68,7 +68,7 @@ void silk_find_pred_coefs_FIX( Wght_Q15[ i ] = silk_RSHIFT( tmp, 1 ); /* Invert the inverted and normalized gains */ - local_gains[ i ] = silk_DIV32( ( 1 << 16 ), invGains_Q16[ i ] ); + local_gains[ i ] = silk_DIV32( ( (opus_int32)1 << 16 ), invGains_Q16[ i ] ); } if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) { @@ -115,7 +115,7 @@ void silk_find_pred_coefs_FIX( if( psEnc->sCmn.first_frame_after_reset ) { minInvGain_Q30 = SILK_FIX_CONST( 1.0f / MAX_PREDICTION_POWER_GAIN_AFTER_RESET, 30 ); } else { - minInvGain_Q30 = silk_log2lin( silk_SMLAWB( 16 << 7, psEncCtrl->LTPredCodGain_Q7, SILK_FIX_CONST( 1.0 / 3, 16 ) ) ); /* Q16 */ + minInvGain_Q30 = silk_log2lin( silk_SMLAWB( 16 << 7, (opus_int32)psEncCtrl->LTPredCodGain_Q7, SILK_FIX_CONST( 1.0 / 3, 16 ) ) ); /* Q16 */ minInvGain_Q30 = silk_DIV32_varQ( minInvGain_Q30, silk_SMULWW( SILK_FIX_CONST( MAX_PREDICTION_POWER_GAIN, 0 ), silk_SMLAWB( SILK_FIX_CONST( 0.25, 18 ), SILK_FIX_CONST( 0.75, 18 ), psEncCtrl->coding_quality_Q14 ) ), 14 ); diff --git a/silk/fixed/noise_shape_analysis_FIX.c b/silk/fixed/noise_shape_analysis_FIX.c index 94c5bb26..db90136d 100644 --- a/silk/fixed/noise_shape_analysis_FIX.c +++ b/silk/fixed/noise_shape_analysis_FIX.c @@ -71,7 +71,7 @@ static inline void limit_warped_coefs( coefs_ana_Q24[ i - 1 ] = silk_SMLAWB( coefs_ana_Q24[ i - 1 ], coefs_ana_Q24[ i ], lambda_Q16 ); } lambda_Q16 = -lambda_Q16; - nom_Q16 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 16 ), -lambda_Q16, lambda_Q16 ); + nom_Q16 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 16 ), -(opus_int32)lambda_Q16, lambda_Q16 ); den_Q24 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 24 ), coefs_syn_Q24[ 0 ], lambda_Q16 ); gain_syn_Q16 = silk_DIV32_varQ( nom_Q16, den_Q24, 24 ); den_Q24 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 24 ), coefs_ana_Q24[ 0 ], lambda_Q16 ); @@ -122,7 +122,7 @@ static inline void limit_warped_coefs( coefs_ana_Q24[ i - 1 ] = silk_SMLAWB( coefs_ana_Q24[ i - 1 ], coefs_ana_Q24[ i ], lambda_Q16 ); } lambda_Q16 = -lambda_Q16; - nom_Q16 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 16 ), -lambda_Q16, lambda_Q16 ); + nom_Q16 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 16 ), -(opus_int32)lambda_Q16, lambda_Q16 ); den_Q24 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 24 ), coefs_syn_Q24[ 0 ], lambda_Q16 ); gain_syn_Q16 = silk_DIV32_varQ( nom_Q16, den_Q24, 24 ); den_Q24 = silk_SMLAWB( SILK_FIX_CONST( 1.0, 24 ), coefs_ana_Q24[ 0 ], lambda_Q16 ); @@ -248,7 +248,7 @@ void silk_noise_shape_analysis_FIX( if( psEnc->sCmn.warping_Q16 > 0 ) { /* Slightly more warping in analysis will move quantization noise up in frequency, where it's better masked */ - warping_Q16 = silk_SMLAWB( psEnc->sCmn.warping_Q16, psEncCtrl->coding_quality_Q14, SILK_FIX_CONST( 0.01, 18 ) ); + warping_Q16 = silk_SMLAWB( psEnc->sCmn.warping_Q16, (opus_int32)psEncCtrl->coding_quality_Q14, SILK_FIX_CONST( 0.01, 18 ) ); } else { warping_Q16 = 0; } diff --git a/silk/fixed/prefilter_FIX.c b/silk/fixed/prefilter_FIX.c index 31b0cb57..eaf81d3d 100644 --- a/silk/fixed/prefilter_FIX.c +++ b/silk/fixed/prefilter_FIX.c @@ -116,7 +116,7 @@ void silk_prefilter_FIX( } /* Noise shape parameters */ - HarmShapeGain_Q12 = silk_SMULWB( psEncCtrl->HarmShapeGain_Q14[ k ], 16384 - psEncCtrl->HarmBoost_Q14[ k ] ); + HarmShapeGain_Q12 = silk_SMULWB( (opus_int32)psEncCtrl->HarmShapeGain_Q14[ k ], 16384 - psEncCtrl->HarmBoost_Q14[ k ] ); silk_assert( HarmShapeGain_Q12 >= 0 ); HarmShapeFIRPacked_Q12 = silk_RSHIFT( HarmShapeGain_Q12, 2 ); HarmShapeFIRPacked_Q12 |= silk_LSHIFT( (opus_int32)silk_RSHIFT( HarmShapeGain_Q12, 1 ), 16 ); diff --git a/silk/fixed/solve_LS_FIX.c b/silk/fixed/solve_LS_FIX.c index f6b5da01..b5c016ba 100644 --- a/silk/fixed/solve_LS_FIX.c +++ b/silk/fixed/solve_LS_FIX.c @@ -151,7 +151,7 @@ static inline void silk_LDL_factorize_FIX( /* two-step division */ one_div_diag_Q36 = silk_INVERSE32_varQ( tmp_32, 36 ); /* Q36 */ one_div_diag_Q40 = silk_LSHIFT( one_div_diag_Q36, 4 ); /* Q40 */ - err = silk_SUB32( 1 << 24, silk_SMULWW( tmp_32, one_div_diag_Q40 ) ); /* Q24 */ + err = silk_SUB32( (opus_int32)1 << 24, silk_SMULWW( tmp_32, one_div_diag_Q40 ) ); /* Q24 */ one_div_diag_Q48 = silk_SMULWW( err, one_div_diag_Q40 ); /* Q48 */ /* Save 1/Ds */ diff --git a/silk/process_NLSFs.c b/silk/process_NLSFs.c index c49f884f..54d453a6 100644 --- a/silk/process_NLSFs.c +++ b/silk/process_NLSFs.c @@ -79,7 +79,7 @@ void silk_process_NLSFs( /* Update NLSF weights with contribution from first half */ i_sqr_Q15 = silk_LSHIFT( silk_SMULBB( psEncC->indices.NLSFInterpCoef_Q2, psEncC->indices.NLSFInterpCoef_Q2 ), 11 ); for( i = 0; i < psEncC->predictLPCOrder; i++ ) { - pNLSFW_QW[ i ] = silk_SMLAWB( silk_RSHIFT( pNLSFW_QW[ i ], 1 ), pNLSFW0_temp_QW[ i ], i_sqr_Q15 ); + pNLSFW_QW[ i ] = silk_SMLAWB( silk_RSHIFT( pNLSFW_QW[ i ], 1 ), (opus_int32)pNLSFW0_temp_QW[ i ], i_sqr_Q15 ); silk_assert( pNLSFW_QW[ i ] >= 1 ); } } diff --git a/silk/stereo_LR_to_MS.c b/silk/stereo_LR_to_MS.c index bc203941..b42ed646 100644 --- a/silk/stereo_LR_to_MS.c +++ b/silk/stereo_LR_to_MS.c @@ -190,7 +190,7 @@ void silk_stereo_LR_to_MS( pred0_Q13 = -state->pred_prev_Q13[ 0 ]; pred1_Q13 = -state->pred_prev_Q13[ 1 ]; w_Q24 = silk_LSHIFT( state->width_prev_Q14, 10 ); - denom_Q16 = silk_DIV32_16( 1 << 16, STEREO_INTERP_LEN_MS * fs_kHz ); + denom_Q16 = silk_DIV32_16( (opus_int32)1 << 16, STEREO_INTERP_LEN_MS * fs_kHz ); delta0_Q13 = -silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 0 ] - state->pred_prev_Q13[ 0 ], denom_Q16 ), 16 ); delta1_Q13 = -silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 1 ] - state->pred_prev_Q13[ 1 ], denom_Q16 ), 16 ); deltaw_Q24 = silk_LSHIFT( silk_SMULWB( width_Q14 - state->width_prev_Q14, denom_Q16 ), 10 ); diff --git a/silk/stereo_MS_to_LR.c b/silk/stereo_MS_to_LR.c index a9f105b5..eed21c32 100644 --- a/silk/stereo_MS_to_LR.c +++ b/silk/stereo_MS_to_LR.c @@ -53,7 +53,7 @@ void silk_stereo_MS_to_LR( /* Interpolate predictors and add prediction to side channel */ pred0_Q13 = state->pred_prev_Q13[ 0 ]; pred1_Q13 = state->pred_prev_Q13[ 1 ]; - denom_Q16 = silk_DIV32_16( 1 << 16, STEREO_INTERP_LEN_MS * fs_kHz ); + denom_Q16 = silk_DIV32_16( (opus_int32)1 << 16, STEREO_INTERP_LEN_MS * fs_kHz ); delta0_Q13 = silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 0 ] - state->pred_prev_Q13[ 0 ], denom_Q16 ), 16 ); delta1_Q13 = silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 1 ] - state->pred_prev_Q13[ 1 ], denom_Q16 ), 16 ); for( n = 0; n < STEREO_INTERP_LEN_MS * fs_kHz; n++ ) { |