diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1cc4f2a8e5411270f718867305ad9cf01da3002d..b440299451557260c33eb4bbae825587dab3d6d0 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -53,7 +53,7 @@ #define PI_OVER_180_Q25 ( 585635 ) // Q25 #define _180_IN_Q22 ( 754974720 ) // Q22 #define _360_IN_Q22 ( 1509949440 ) // Q22 -#define _180_OVER_PI_FX ( (Word32) ( ( 180.0f / EVS_PI ) * ONE_IN_Q10 ) ) +#define _180_OVER_PI_FX ( 58670 ) // Q10 #define PI_OVER_180_Q15 ( 572 ) // Q15 #define _180_OVER_PI_Q9 ( 29335 ) // Q9 #define PI_OVER_4_Q29 ( 421657440 ) // Q29 @@ -61,7 +61,7 @@ #define PI_OVER_Q29 ( 1686629760 ) // Q29 #define Q31_0_99 ( 2126008811 ) // Q31 #define Q31_0_01 ( 21474836 ) // Q31 -#define PI_OVER_180_FX ( (Word32) ( ( EVS_PI / 180.0f ) * ONE_IN_Q31 ) ) // Q31 +#define PI_OVER_180_FX ( 37480660 ) // Q31 #define PI_OVER_4_Q29 ( 421657440 ) // Q29 #define PI_OVER_Q29 ( 1686629760 ) // Q29 #define PI2_C_ADP_RATE_Q31 ( 449767936 ) // Q31 (2.0f * EVS_PI * pOTR->centerAdaptationRate) diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 21857fd103a62a8ed20039fee4e56fa0c1e5238a..1b8438e84ad7f7266ddef765b5bed495cc7e340d 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -3324,10 +3324,6 @@ void msvq_dec( maxn = n; move16(); } - if ( maxn % 4 ) - { - n = n; - } assert( ( maxn % 4 ) == 0 ); N34 = mult( maxn, 24576 /*0.75 Q15*/ ); diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index 0535cb1c8398bf0ba28e93651dae605b447cbe7e..1f4fd180198108ce40b1c9d3e3480a79a4808681 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -208,7 +208,7 @@ Word16 har_est_fx( Word16 blk_end_LEN; Word16 *p_blk_peak_pos, *pm1_blk_peak_pos; - Word16 *p_diff_peak_pos, *pm1_diff_peak_pos; + Word16 *pm1_diff_peak_pos; Word16 blk_peak_max_idx, blk_peak_pos_max_diff, diff_peak_pos_te[30]; Word16 thr1, thr2; @@ -387,8 +387,6 @@ Word16 har_est_fx( blk_peak_max_idx = 0; move16(); - - p_diff_peak_pos = &diff_peak_pos[1]; pm1_diff_peak_pos = &diff_peak_pos[1 - 1]; FOR( i = 1; i < j; i++ ) { @@ -410,7 +408,6 @@ Word16 har_est_fx( temp = add( temp, 1 ); - p_diff_peak_pos++; pm1_diff_peak_pos++; } blk_peak_pos_max_diff = diff_peak_pos[blk_peak_max_idx]; diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c index ce4cc993de680785b1b6aeef395009aba1205a96..d357c03dd7d09ed3721a2fd735b48c26978e6fec 100644 --- a/lib_debug/wmc_auto.c +++ b/lib_debug/wmc_auto.c @@ -2513,4 +2513,4 @@ void Reset_BASOP_WMOPS_counter( unsigned int counterId ) return; } -#endif \ No newline at end of file +#endif diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index a13678a97124b2c8af8361358a98b4035db7c57a..3bf7e3eb62ff897d2028a462d3e8f30c33ead199 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -184,7 +184,7 @@ void AVQ_demuxdec_fx( move16(); FOR( j = i; j < Nsv - 1; j++ ) { - if ( ( nq[svOrder[j]] == 0 ) ) + if ( nq[svOrder[j]] == 0 ) { nullVec = add( nullVec, 1 ); } @@ -271,12 +271,7 @@ void AVQ_demuxdec_fx( /*Compute AVQ code book number from unused Bits */ tmp = (Word16) ( sub( bits, add( add( shl( add( unusedbitsFlag, unused_bits_idx ), 2 ), unusedbitsFlag ), unused_bits_idx ) ) ); nq_est = idiv1616( tmp, 5 ); - IF( ( ( tmp % 5 ) == 0 ) ) - { - nq_est = nq_est; - move16(); - } - ELSE + IF( ( ( tmp % 5 ) != 0 ) ) { nq_est = add( nq_est, 1 ); } diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index c0a83460a51adaf9b87906158817144fc14a3ff0..671dbfd2ca520671ad8ab10abb004f32f8b055f2 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1287,7 +1287,7 @@ void open_decoder_LPD_ivas_fx( move16(); st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */ move16(); - if ( ( st->ini_frame == 0 ) ) + if ( st->ini_frame == 0 ) { st->L_frameTCX_past = st->hTcxDec->L_frameTCX; move16(); @@ -1360,7 +1360,7 @@ void open_decoder_LPD_ivas_fx( } } - if ( ( st->ini_frame == 0 ) ) + if ( st->ini_frame == 0 ) { st->pit_res_max_past = st->pit_res_max; move16(); diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 9c2e014b4f5848aeaabee3343f09e6198aab4b0f..f3443349a1a542e0ff66f85b2ba1650107e1c2f8 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -448,7 +448,7 @@ void decoder_LPD_fx( IF( st->enablePlcWaveadjust ) { - if ( ( st->core == ACELP_CORE ) ) + if ( st->core == ACELP_CORE ) { st->tonality_flag = 0; move16(); diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 19ee1e68a54f1ed10ef9e29e25eb9526d2b433cf..983eb33095e6d03432387deede2d78b3c3a9270b 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2326,15 +2326,11 @@ void ivas_spar_param_to_masa_param_mapping_fx( move16(); res_q = 0; move16(); - IF( E_fx > 0 ) - { - E_fx = E_fx; - } - ELSE + IF( E_fx <= 0 ) { E_fx = 1; + move32(); } - move32(); ratio_float_fx = BASOP_Util_Divide3232_Scale( I_fx, E_fx, &res_q ); res_q = sub( res_q, sub( num_q, denom_q ) ); ratio_fx = L_shl_sat( ratio_float_fx, add( Q15, res_q ) ); // Q(15 + res_q) diff --git a/lib_enc/SNR_calc_fx.c b/lib_enc/SNR_calc_fx.c index 320a68d255f539a42d1f543642c5abcd85a10863..ab994602399f29238f738ea187e57a32e1c59e53 100644 --- a/lib_enc/SNR_calc_fx.c +++ b/lib_enc/SNR_calc_fx.c @@ -398,12 +398,7 @@ Word32 construct_snr_thresh_fx( IF( EQ_16( bw_index, CLDFBVAD_SWB_ID ) ) { - IF( GT_16( sp_center[3], 2864 /* 2.80 Q10 */ ) ) - { - snr_delta = snr_delta; - move32(); - } - ELSE IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) + IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) { snr_delta = L_add( snr_delta, 1006633 /* 0.03 Q25 */ ); } @@ -444,13 +439,7 @@ Word32 construct_snr_thresh_fx( } ELSE IF( EQ_16( bw_index, CLDFBVAD_WB_ID ) ) { - - IF( GT_16( sp_center[3], 2864 /* 2.80 Q10 */ ) ) - { - snr_delta = snr_delta; - move32(); - } - ELSE IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) + IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) { snr_delta = L_add( snr_delta, 1006633 /* 0.03 Q25 */ ); } @@ -491,13 +480,7 @@ Word32 construct_snr_thresh_fx( } ELSE IF( EQ_16( bw_index, CLDFBVAD_NB_ID ) ) { - - IF( GT_16( sp_center[3], 3069 /* 3.0 Q10 */ ) ) - { - snr_delta = snr_delta; - move32(); - } - ELSE IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) + IF( GT_16( sp_center[2], 2660 /* 2.6 Q10 */ ) ) { snr_delta = L_add( snr_delta, 671089 /* 0.02 Q25 */ ); } diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index e3b554fcb4ee702814d03c814d7b7531f98cdd0e..0bbd7b260ffd5d4c76c3ce49fa401d350d2bd869 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -4242,7 +4242,7 @@ void QuantizeTCXSpectrum_fx( Word8 tmp8 = 1; move16(); - if ( ( st->last_core == ACELP_CORE ) ) + if ( st->last_core == ACELP_CORE ) { tmp8 = 0; move16(); diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 171b229b4bcd8d47533f0b9c98ba640b7e387970..7214e6f2f79eacba94a40254239dcd5c13b12b9e 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -160,7 +160,7 @@ static void ivas_param_ism_compute_obj_parameters_fx( move16(); move16(); } - assert( ( power_ratios_m[b][m] >= ONE_IN_Q14 /* 0.5 in Q15 */ ) && ( power_ratios_m[b][m] <= ONE_IN_Q15 /* 1 in Q15 */ ) ); + assert( ( power_ratios_m[b][m] >= ONE_IN_Q14 /* 0.5 in Q15 */ ) && ( power_ratios_m[b][m] <= MAX_16 /* 1 in Q15 */ ) ); /* Quantize power ratios */ /* Power ratio range [0.5,1] is mapped to [0,1] first, rounding via truncation float->integer */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 27203fedef2dafdf9921f0006aafd84d4786299f..6b336708db443f043ba031fed56e9e33bdbdc8f5 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -242,7 +242,7 @@ void ivas_mct_core_enc_fx( Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][2]; Word32 *inv_mdst_spectrum_fx[MCT_MAX_CHANNELS][2]; Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][2]; - Word32 *mdst_spectrum_fx[MCT_MAX_CHANNELS][2] = { NULL }; + Word32 *mdst_spectrum_fx[MCT_MAX_CHANNELS][2] = { { NULL } }; Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ Word16 total_side_bits; Word16 chBitRatios[MCT_MAX_CHANNELS]; diff --git a/lib_enc/ivas_stereo_dft_td_itd.c b/lib_enc/ivas_stereo_dft_td_itd.c index 35f2467151a02a6e921a27388ed7b42b5758abd7..6a60af2c063ba382a99591a3f689c84817075eda 100644 --- a/lib_enc/ivas_stereo_dft_td_itd.c +++ b/lib_enc/ivas_stereo_dft_td_itd.c @@ -229,14 +229,14 @@ static void stereo_td_channel_extrapolate_fx( nsr = mult( g, f ); nsr_e = BASOP_Util_Add_MantExp( ONE_IN_Q14, 1, negate( nsr ), g_e + f_e, &nsr ); - IF( LE_16( g_e, 0 ) ) - g = g; - ELSE - g = check_bounds_s_fx( g, negate( shl( 1, 15 - g_e ) ), shl( ONE_HALF, ( 1 - g_e ) ) ); - IF( LE_16( nsr_e, 0 ) ) - nsr = nsr; - ELSE - nsr = check_bounds_s_fx( nsr, 0, shl( 1, 15 - ( nsr_e ) ) ); + IF( g_e > 0 ) + { + g = check_bounds_s_fx( g, negate( shl( 1, sub( 15, g_e ) ) ), shl( ONE_HALF, sub( 1, g_e ) ) ); + } + IF( nsr_e > 0 ) + { + nsr = check_bounds_s_fx( nsr, 0, shl( 1, sub( 15, nsr_e ) ) ); + } g = shl( g, g_e - 1 ); // q14 nsr = shl( nsr, nsr_e ); // Q15 g_lpc_e = 0; @@ -257,6 +257,7 @@ static void stereo_td_channel_extrapolate_fx( } r_l[0] = s_max( r_l[0], 1 ); + flag = E_LPC_lev_dur( r_h, r_l, A, NULL, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, NULL ); Copy_Scale_sig( A, A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1, sub( norm_s( A[0] ), 2 ) ); IF( EQ_16( flag, 1 ) ) diff --git a/lib_enc/ivas_stereo_icbwe_enc.c b/lib_enc/ivas_stereo_icbwe_enc.c index 30df4e0bc125069dadccfc09b6b9d87a9b188422..90d6da69ebfeba9256b988b36f943dba67f767ce 100644 --- a/lib_enc/ivas_stereo_icbwe_enc.c +++ b/lib_enc/ivas_stereo_icbwe_enc.c @@ -511,12 +511,7 @@ static void icbwe_dft_stereo_param_ivas_fx( { slopeILD_fx = negate( slopeILD_fx ); /* Q7 */ } - ELSE - { - slopeILD_fx = slopeILD_fx; /* Q7 */ - move16(); - } - spIndx = squant_fx( slopeILD_fx, &slopeILD_fx, slope_table_fx16, 1 << STEREO_ICBWE_SPBITS_DFT ); /* Q0 */ + spIndx = squant_fx( slopeILD_fx, &slopeILD_fx, slope_table_fx16, 1 << STEREO_ICBWE_SPBITS_DFT ); IF( Mpy_32_32( spec_table_fx[spIndx], hStereoICBWE->prevSpecMapping_fx ) < 0 ) { slopeILD_fx = 0; diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index c5fdfec9989d2c4628cad638e88fc2d7dcdaef64..23137a24a48d79090f986e4b546f3852ffe6feed 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -354,7 +354,6 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( Word32 L_lagEnergy; const Word16 *ptr_predBuf; - const Word16 *ptr_predBuf_ni; Word32 L_energy; Word32 L_corr; @@ -402,8 +401,6 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( move32(); ptr_predBuf = predBuf_fx; - ptr_predBuf_ni = predBuf_ni_fx; - /* This part must be computed on parent function. */ exp_norm_ss = 2; move16(); @@ -435,14 +432,12 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( WHILE( *ptr_predBuf == 0 && LT_16( absPos_fx, ssearch_buflim ) ) { ptr_predBuf++; - ptr_predBuf_ni++; absPos_fx = add( absPos_fx, 1 ); } IF( EQ_16( absPos_fx, ssearch_buflim ) ) { ptr_predBuf--; - ptr_predBuf_ni--; absPos_fx = sub( absPos_fx, 1 ); } @@ -452,11 +447,9 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( { L_energy = L_mac( L_energy, *ptr_ssBuf_ni_fx, *ptr_ssBuf_ni_fx ); /* (Qss-exp_norm_ss)*2+1 */ ptr_ssBuf_ni_fx++; - ptr_predBuf_ni++; } ptr_ssBuf_ni_fx -= fLen; - ptr_predBuf_ni -= fLen; L_lagEnergy = L_add( L_energy, 0 ); @@ -471,10 +464,8 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( { L_energy = L_mac( L_energy, *ptr_ssBuf_ni_fx, *ptr_ssBuf_ni_fx ); ptr_ssBuf_ni_fx++; - ptr_predBuf_ni++; } ptr_ssBuf_ni_fx -= fLen; - ptr_predBuf_ni -= fLen; /* Get cross-correlation */ IF( L_energy != 0x0L ) @@ -531,14 +522,12 @@ static Word16 GetSubbandCorrIndex2_pulsestep_fx( } ptr_predBuf++; ptr_ssBuf_ni_fx++; - ptr_predBuf_ni++; absPos_fx++; WHILE( *ptr_predBuf == 0 && LT_16( absPos_fx, ssearch_buflim ) ) { ptr_predBuf++; ptr_ssBuf_ni_fx++; - ptr_predBuf_ni++; absPos_fx = add( absPos_fx, 1 ); } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 7b8f42a73022eb5fbdfb0a903ae4379772fac784..3c6876fcb5369b92047669cc908742f4627425fb 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -684,7 +684,7 @@ void wb_tbe_enc_fx( const Word16 voicing_fx[] /* i : OL maximum normalized correlation */ ) { - Word16 i, j, k; + Word16 i, j; Word16 hb_old_speech[( L_LOOK_12k8 + L_SUBFR + L_FRAME ) * 5 / 16]; Word16 bwe_exc_extended_16[L_FRAME32k + NL_BUFF_OFFSET]; @@ -749,8 +749,6 @@ void wb_tbe_enc_fx( i = WBTBE_LOOK_LSUFBR_5_OVER_16; move16(); - k = 0; - move16(); FOR( j = 0; j < L_SUBFR16k; j = j + 4 ) { @@ -758,7 +756,6 @@ void wb_tbe_enc_fx( hb_old_speech[i] = mac_r( L_tmp, hb_speech[j], ola_win_shb_switch_fold_fx[L_SUBFR16k - 4 - j] ); move16(); i--; - k++; } } diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index dc2582212259b7a433f95a86797a830fbdc21bb2..106ca56f427cce1c623d588e78a54c7a549742f3 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -904,12 +904,7 @@ void ivas_mcmasa_param_est_ana_fx( surrCoh_e = 0; move16(); surrCoh_fx = Mult_32_32( surrCoh_fx, surrCoh_fx ); - IF( LT_32( surrCoh_fx, ONE_IN_Q31 ) ) - { - surrCoh_fx = surrCoh_fx; - move32(); - } - ELSE + IF( GE_32( surrCoh_fx, ONE_IN_Q31 ) ) { surrCoh_fx = ONE_IN_Q31; move32(); @@ -1094,21 +1089,11 @@ void ivas_mcmasa_param_est_ana_fx( move16(); } - IF( ( LT_32( spreadCoh_fx, L_shl_sat( 1, sub( 31, spreadCoh_e ) ) ) ) ) - { - spreadCoh_fx = spreadCoh_fx; - move32(); - } - ELSE + IF( GE_32( spreadCoh_fx, L_shl_sat( 1, sub( 31, spreadCoh_e ) ) ) ) { spreadCoh_fx = L_shl_sat( 1, sub( 31, spreadCoh_e ) ); } - IF( ( spreadCoh_fx > 0 ) ) - { - spreadCoh_fx = spreadCoh_fx; - move32(); - } - ELSE + IF( ( spreadCoh_fx <= 0 ) ) { spreadCoh_fx = 0; move32(); @@ -1145,23 +1130,13 @@ void ivas_mcmasa_param_est_ana_fx( move32(); } - IF( LT_32( cohRatio_fx, ONE_IN_Q31 ) ) - { - cohRatio_fx = cohRatio_fx; - move32(); - } - ELSE + IF( GE_32( cohRatio_fx, ONE_IN_Q31 ) ) { cohRatio_fx = ONE_IN_Q31; move32(); } - IF( cohRatio_fx > 0 ) - { - cohRatio_fx = cohRatio_fx; - move32(); - } - ELSE + IF( cohRatio_fx <= 0 ) { cohRatio_fx = 0; move32(); diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 874ff6cfa8a83296d81987e8bf7549a1b38bffed..3410ada712d8dd5d1c061ba496c4e50af661308c 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -848,7 +848,7 @@ static ivas_error create_HRTF_from_rawdata( /* latency_s */ //( *hHRTF )->latency_s = *( (float *) ( hrtf_data_rptr ) ); - ( *hHRTF )->latency_s_fx = (Word32) ( *( (float *) ( hrtf_data_rptr ) ) * ONE_IN_Q31 ); + ( *hHRTF )->latency_s_fx = (Word32) ( *( (float *) ( hrtf_data_rptr ) ) * (float) ONE_IN_Q31 ); hrtf_data_rptr += sizeof( float ); /* max_num_ir */