From 5d30048d6fd8107b2217b688c3ae4d8cbfafc8ba Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 26 Dec 2024 10:56:52 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1075: Cleanup/Maintenance: Build warnings with Clang Link #1075 --- lib_com/ivas_cnst.h | 4 ++-- lib_com/lsf_tools_fx.c | 4 ---- lib_com/swb_bwe_com_lr_fx.c | 5 +---- lib_debug/wmc_auto.c | 2 +- lib_dec/avq_dec_fx.c | 9 ++------ lib_dec/core_dec_init_fx.c | 4 ++-- lib_dec/dec_LPD_fx.c | 2 +- lib_dec/ivas_masa_dec.c | 8 ++------ lib_enc/SNR_calc_fx.c | 23 +++------------------ lib_enc/cod_tcx_fx.c | 2 +- lib_enc/ivas_ism_param_enc.c | 2 +- lib_enc/ivas_mct_core_enc.c | 2 +- lib_enc/ivas_stereo_dft_td_itd.c | 17 ++++++++-------- lib_enc/ivas_stereo_icbwe_enc.c | 7 +------ lib_enc/swb_bwe_enc_lr_fx.c | 11 ---------- lib_enc/swb_tbe_enc_fx.c | 5 +---- lib_rend/ivas_mcmasa_ana.c | 35 +++++--------------------------- lib_util/hrtf_file_reader.c | 2 +- 18 files changed, 34 insertions(+), 110 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 1cc4f2a8e..b44029945 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 21857fd10..1b8438e84 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 0535cb1c8..1f4fd1801 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 ce4cc993d..d357c03dd 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 a13678a97..3bf7e3eb6 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 c0a83460a..671dbfd2c 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 9c2e014b4..f3443349a 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 19ee1e68a..983eb3309 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 320a68d25..ab9946023 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 e3b554fcb..0bbd7b260 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 171b229b4..7214e6f2f 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 27203fede..6b336708d 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 35f246715..6a60af2c0 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 30df4e0bc..90d6da69e 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 c5fdfec99..23137a24a 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 7b8f42a73..3c6876fcb 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 dc2582212..106ca56f4 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 874ff6cfa..169ca87d8 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 */ -- GitLab From 0b9ee693124ee8bf5aa5515b679a1f205d61b199 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 26 Dec 2024 11:00:46 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_util/hrtf_file_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 169ca87d8..3410ada71 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 ) ) * ( float ) ONE_IN_Q31 ); + ( *hHRTF )->latency_s_fx = (Word32) ( *( (float *) ( hrtf_data_rptr ) ) * (float) ONE_IN_Q31 ); hrtf_data_rptr += sizeof( float ); /* max_num_ir */ -- GitLab