diff --git a/lib_com/basop32.h b/lib_com/basop32.h index 689c6b7aa951d2edccdeafbf8ce76f922c71084f..8ad044f440a442ff9dd0be1d33407414120fa8c0 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -169,46 +169,46 @@ Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with round, 2 */ #else /* BASOP_NOGLOB */ -Word32 L_add( Word32 L_var1, Word32 L_var2 ); /* Long add, 1 */ -Word32 L_sub( Word32 L_var1, Word32 L_var2 ); /* Long sub, 1 */ -Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long add with c, 2 */ -Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long sub with c, 2 */ -Word32 L_negate( Word32 L_var1 ); /* Long negate, 1 */ -Word16 mult_r( Word16 var1, Word16 var2 ); /* Mult with round, 1 */ -Word32 L_shl( Word32 L_var1, Word16 var2 ); /* Long shift left, 1 */ -Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ -Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with - round, 2 */ +Word32 L_add( Word32 L_var1, Word32 L_var2 ); /* Long add, 1 */ +Word32 L_sub( Word32 L_var1, Word32 L_var2 ); /* Long sub, 1 */ +Word32 DEPR_L_add_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long add with c, 2 */ +Word32 DEPR_L_sub_c( Word32 L_var1, Word32 L_var2, Flag *Carry ); /* Long sub with c, 2 */ +Word32 L_negate( Word32 L_var1 ); /* Long negate, 1 */ +Word16 mult_r( Word16 var1, Word16 var2 ); /* Mult with round, 1 */ +Word32 L_shl( Word32 L_var1, Word16 var2 ); /* Long shift left, 1 */ +Word32 L_shr( Word32 L_var1, Word16 var2 ); /* Long shift right, 1 */ +Word16 shr_r( Word16 var1, Word16 var2 ); /* Shift right with + round, 2 */ #endif /* BASOP_NOGLOB */ #ifndef BASOP_NOGLOB Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac with rounding, 1 */ #else /* BASOP_NOGLOB */ -Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac with - rounding, 1 */ +Word16 mac_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Mac with + rounding, 1 */ #endif /* BASOP_NOGLOB */ #ifndef BASOP_NOGLOB Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu with rounding, 1 */ #else /* BASOP_NOGLOB */ -Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu with - rounding, 1 */ +Word16 msu_r( Word32 L_var3, Word16 var1, Word16 var2 ); /* Msu with + rounding, 1 */ #endif /* BASOP_NOGLOB */ #ifndef BASOP_NOGLOB Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ #else /* BASOP_NOGLOB */ -Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ -Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ +Word32 L_deposit_h( Word16 var1 ); /* 16 bit var1 -> MSB, 1 */ +Word32 L_deposit_l( Word16 var1 ); /* 16 bit var1 -> LSB, 1 */ #endif /* BASOP_NOGLOB */ #ifndef BASOP_NOGLOB Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* Long shift right with round, 3 */ #else /* BASOP_NOGLOB */ -Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* Long shift right with - round, 3 */ +Word32 L_shr_r( Word32 L_var1, Word16 var2 ); /* Long shift right with + round, 3 */ #endif /* BASOP_NOGLOB */ #ifndef BASOP_NOGLOB Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ @@ -217,11 +217,11 @@ Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ #else /* BASOP_NOGLOB */ -Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ -Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation, 4 */ -Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ -Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ -Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ +Word32 L_abs( Word32 L_var1 ); /* Long abs, 1 */ +Word32 DEPR_L_sat_co( Word32 L_var1, Flag Overflow, Flag Carry ); /* Long saturation, 4 */ +Word16 norm_s( Word16 var1 ); /* Short norm, 1 */ +Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ +Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ #endif /* BASOP_NOGLOB */ @@ -233,9 +233,9 @@ Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ Word16 i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ #else /* BASOP_NOGLOB */ -Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ -Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ -Word16 DEPR_i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ +Word32 L_mls( Word32, Word16 ); /* Weight FFS; currently assigned 5 */ +Word16 div_l( Word32, Word16 ); /* Weight FFS; currently assigned 32 */ +Word16 DEPR_i_mult( Word16 a, Word16 b ); /* Weight FFS; currently assigned 3 */ #endif /* BASOP_NOGLOB */ /* diff --git a/lib_com/basop_proto_func.h b/lib_com/basop_proto_func.h index 5cf3a16761763826e3037b7b99a5605ac30904c7..be71af44aa2f11c9200db9a200cd67d9a644d8d8 100644 --- a/lib_com/basop_proto_func.h +++ b/lib_com/basop_proto_func.h @@ -44,7 +44,7 @@ /* tcx_lpc_cdk.h */ -#define LSF_GAP_VAL( x ) ( Word16 )( (x) *2.0f * 1.28f ) +#define LSF_GAP_VAL( x ) ( Word16 )( ( x ) * 2.0f * 1.28f ) #define LSFM( x ) FL2WORD16_SCALE( x * 1.28, 15 - 1 ) /* 14Q1*1.28 */ /* cnst.h */ diff --git a/lib_com/basop_settings.h b/lib_com/basop_settings.h index 58f769ef58aca3eddc3f851920d0aff943a2de6b..9ce800755faac1f13b391c580c33b1a82aa69da0 100644 --- a/lib_com/basop_settings.h +++ b/lib_com/basop_settings.h @@ -60,13 +60,13 @@ \def Macro converts a float < 1 to Word32 fixed point with saturation and rounding */ #define FL2WORD32( val ) \ - ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * (WORD32_FIX_SCALE) -0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) (WORD32_FIX_SCALE) -0.5 ) ) ) + ( Word32 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD32 ) ) ? (int32_t) ( MAXVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD32_FIX_SCALE ) - 0.5 ) <= (double) ( MINVAL_WORD32 ) ) ? (int32_t) ( MINVAL_WORD32 ) : (int32_t) ( (double) ( val ) * (double) ( WORD32_FIX_SCALE ) - 0.5 ) ) ) /*! \def Macro converts a float < 1 to Word16 fixed point with saturation and rounding */ #define FL2WORD16( val ) \ - ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * (WORD16_FIX_SCALE) -0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) (WORD16_FIX_SCALE) -0.5 ) ) ) + ( Word16 )( ( ( val ) >= 0 ) ? ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) + 0.5 ) >= (double) ( MAXVAL_WORD16 ) ) ? (int32_t) ( MAXVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) + 0.5 ) ) : ( ( ( (double) ( val ) * ( WORD16_FIX_SCALE ) - 0.5 ) <= (double) ( MINVAL_WORD16 ) ) ? (int32_t) ( MINVAL_WORD16 ) : (int32_t) ( (double) ( val ) * (double) ( WORD16_FIX_SCALE ) - 0.5 ) ) ) /*! \def Macro converts a Word32 fixed point to Word16 fixed point <1 with saturation diff --git a/lib_com/bitalloc.c b/lib_com/bitalloc.c index 07c42d101411cc063c7cd8e2b4a2e6db55c2d1d6..17b7de9a23a8cc8a786136434de338c0cee8cab2 100644 --- a/lib_com/bitalloc.c +++ b/lib_com/bitalloc.c @@ -368,7 +368,7 @@ int16_t BitAllocF( #ifndef BASOP_NOGLOB m_fx = shl( tmp, sub( exp2, exp1 ) ); /*Q14*/ #else - m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ + m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/ #endif t_fx = 0; diff --git a/lib_com/env_stab.c b/lib_com/env_stab.c index 671a79ef41360059c9939497bf98c79b90937725..cafe309360d23b80d4a98ae0c3675bea1210c082 100644 --- a/lib_com/env_stab.c +++ b/lib_com/env_stab.c @@ -143,7 +143,7 @@ float env_stability( #ifndef BASOP_NOGLOB env_delta = round_fx( L_shl( L_tmp, 1 ) ); /* Q13 */ #else /* BASOP_NOGLOB */ - env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ + env_delta = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /* Q13 */ #endif /* BASOP_NOGLOB */ } if ( Overflow != 0 ) /* Saturated due to the above up-shifting operation. */ diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 1e324fdd437b4fe7b77d699899bb84b0d192fc4e..5da6f60b951c91306fef50d2634ac70d29842db0 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -1957,12 +1957,12 @@ static void fec_noise_filling( { if ( kk == 0 ) { - tmp = ( ( own_random( ni_seed_forfec ) / (PCM16_TO_FLT_FAC) *0.2f ) + 0.5f ); + tmp = ( ( own_random( ni_seed_forfec ) / ( PCM16_TO_FLT_FAC ) * 0.2f ) + 0.5f ); kk = 1; } else { - tmp = ( ( own_random( ni_seed_forfec ) / (PCM16_TO_FLT_FAC) *0.3f ) + 0.7f ); + tmp = ( ( own_random( ni_seed_forfec ) / ( PCM16_TO_FLT_FAC ) * 0.3f ) + 0.7f ); kk = 0; } diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 74bfd668d2ad779efef8a295fd9c9684b97b5107..fef2ccdd7413012a6d8cd567cc2dbe6d8cedcbc2 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -424,7 +424,7 @@ void ApplyFdCng( /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || - ( *timeDomainInput( -FLT_MAX ) && + ( *timeDomainInput < FLT_MAX && *timeDomainInput > ( -FLT_MAX ) && *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_format ) ) && diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index a1ee7d227ce7fdbf776b170343f05f6c54b6d914..510c1078df54697469124212ebda377b0c3a7e43 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -265,7 +265,7 @@ void hq_lr_dec( #ifdef BASOP_NOGLOB Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */ #else - Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */ + Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */ #endif Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) ); } @@ -560,14 +560,14 @@ void hq_lr_dec( L_tmp = L_shl( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */ tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ #else /* BASOP_NOGLOB */ - L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ + L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ + tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ #endif /* BASOP_NOGLOB */ Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo ); #ifndef BASOP_NOGLOB L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */ #else /* BASOP_NOGLOB */ - L_band_energy_tmp[i] = L_shl_o( L_tmp, 1, &Overflow ); /*Q_band_energy */ + L_band_energy_tmp[i] = L_shl_o( L_tmp, 1, &Overflow ); /*Q_band_energy */ #endif /* BASOP_NOGLOB */ } } @@ -687,7 +687,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ #else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp1 != 0 ) { @@ -731,7 +731,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB tmp = extract_h( L_shl( L_tmp, 16 ) ); /*Q0 */ #else - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ + tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ #endif IF( tmp != 0 ) { @@ -760,7 +760,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ #else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp1 != 0 ) { @@ -803,7 +803,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ #else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #endif /* BASOP_NOGLOB */ } ELSE @@ -811,7 +811,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ #else /* BASOP_NOGLOB */ - Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ + Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #endif /* BASOP_NOGLOB */ IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { @@ -835,7 +835,7 @@ void hq_lr_dec( #ifndef BASOP_NOGLOB tmp = extract_h( L_shl( Ep_avrgL_fx, 1 ) ); /*Q0 */ #else - tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ + tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp != 0 ) { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 7bdc85a25d768bb266f92df373ad11f80b762ebb..0b5f02fa0f239526c80530d83e1b799d0bfcde20 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1423,8 +1423,8 @@ void ivas_qmetadata_to_dirac( tmp_write_idx_param_band = ( tmp_write_idx_param_band + 1 ) % hSpatParamRendCom->dirac_md_buffer_length; } /* for ( block =...) */ - } /* for ( band = ...) */ - } /* for ( idx_sec = ...)*/ + } /* for ( band = ...) */ + } /* for ( idx_sec = ...)*/ /* Bands not transmitted -> zeroed*/ for ( b = band_grouping[band]; b < hSpatParamRendCom->num_freq_bands; b++ ) diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 678d57b565978fdb141d79ec69663f61e04174c1..bd851195430331e781d8a54f3de31a06f2b2b943 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -128,7 +128,7 @@ static void DecodeSWBSubbands( float sspectra[L_FRAME32k]; float sspectra_ni[L_FRAME32k], sspectra_diff[L_FRAME32k], th_g[NB_SWB_SUBBANDS]; float ss_min = 1.0f, g, be_tonal[SWB_HAR_RAN1], xSynth_har[L_FRAME32k]; - GainItem pk_sf[(NB_SWB_SUBBANDS) *8]; + GainItem pk_sf[( NB_SWB_SUBBANDS ) * 8]; int16_t lagIndices_real[NB_SWB_SUBBANDS]; int16_t pul_res[NB_SWB_SUBBANDS], imin; int16_t har_freq_est1 = 0; diff --git a/lib_enc/hq_lr_enc.c b/lib_enc/hq_lr_enc.c index 376bb65e4b7c3a2cde99ba8421ddfdd625099cea..320d94738b7118f7c80844221b3cd07257315261 100644 --- a/lib_enc/hq_lr_enc.c +++ b/lib_enc/hq_lr_enc.c @@ -339,7 +339,7 @@ void hq_lr_enc( #ifdef BASOP_NOGLOB Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */ #else - Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */ + Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */ #endif Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) ); } @@ -417,7 +417,7 @@ void hq_lr_enc( #ifdef BASOP_NOGLOB Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #else - Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ + Ep_avrgL_fx = L_add( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */ #endif IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 ) { @@ -593,7 +593,7 @@ void hq_lr_enc( #ifdef BASOP_NOGLOB Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #else - Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ + Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ #endif } ELSE @@ -637,8 +637,8 @@ void hq_lr_enc( L_tmp = L_shl( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */ tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ #else /* BASOP_NOGLOB */ - L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ - tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ + L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */ + tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */ #endif /* BASOP_NOGLOB */ Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo ); L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */ @@ -706,7 +706,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ #else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #endif /* BASOP_NOGLOB */ } @@ -743,7 +743,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ #else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp1 != 0 ) { @@ -786,7 +786,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB tmp = extract_h( L_shl( L_tmp, 16 ) ); /*Q0 */ #else /* BASOP_NOGLOB */ - tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ + tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */ #endif /* BASOP_NOGLOB */ IF( tmp != 0 ) { @@ -815,7 +815,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB tmp1 = extract_h( L_shl( Ep_avrg_fx, 1 ) ); /*Q0 */ #else - tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ + tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp1 != 0 ) { @@ -857,7 +857,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB Ep_avrg_fx = L_add( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */ #else /* BASOP_NOGLOB */ - Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ + Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */ #endif /* BASOP_NOGLOB */ } ELSE @@ -889,7 +889,7 @@ void hq_lr_enc( #ifndef BASOP_NOGLOB tmp = extract_h( L_shl( Ep_avrgL_fx, 1 ) ); /*Q0 */ #else - tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ + tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */ #endif IF( tmp != 0 ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 71ed3b4fde73004e1413f99b685ed07db83bd53f..b0ffb61171bd05895b84d4c50bbd6b45009be2c1 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -2645,7 +2645,7 @@ static void masa_metadata_direction_alignment( prev_ele_dir2_sin = sin_ele2; } } /* sf */ - } /* band */ + } /* band */ return; } diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index 5c6a06b73f0f48fe1be5b6b48a5a2129cbf1f46d..47a5a7d1e2293ca89801a3b5ec016ae5a641ede6 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -167,12 +167,12 @@ int16_t msvq_stage1_dct_search( if ( mse < st1_mse_pair[p_max] ) /* L_sub */ { st1_idx_pair[p_max] = j_full; /* move16, single BASOP */ - } /* BASOP 2 ops */ + } /* BASOP 2 ops */ if ( st1_idx_pair[p_max] == j_full ) { /* idx updated --> also update mse */ st1_mse_pair[p_max] = mse; /* move32(), single BASOP */ - } /* BASOP 3 ops */ + } /* BASOP 3 ops */ /* avoid WC costly candidate list management by always updating p_max, as we have only a pair in each segment to maintain */ @@ -180,7 +180,7 @@ int16_t msvq_stage1_dct_search( if ( ( st1_mse_pair[0] - st1_mse_pair[1] ) < 0 ) /* L_sub()*/ { p_max = 1; /* move16() */ - } /* BASOP 3 ops ,Note 2 ops possible in BASOP with L_sub and L_lshr */ + } /* BASOP 3 ops ,Note 2 ops possible in BASOP with L_sub and L_lshr */ /* Note: logical shift right not available in ANSI-C */ /* p_max = (st1_mse_pair[0] - st1_mse_pair[1]) ">>>" 31; */ @@ -493,7 +493,7 @@ void msvq_enc( } } } /* if (tmp <= dist[1][p_max]) */ - } /* for (j=0; jelement_mode == IVAS_CPE_MDCT && ( ( sqrt( (float) ( hTcxEnc->tcxltp_on_mem ) ) * (norm_corr) *0.9f ) > 0.44f && ( tempFlatness < 6.0f || ( tempFlatness < 7.0f && maxEnergyChange < 22.0f ) ) ) ) + if ( tcxOnly == 1 && st->element_mode == IVAS_CPE_MDCT && ( ( sqrt( (float) ( hTcxEnc->tcxltp_on_mem ) ) * ( norm_corr ) * 0.9f ) > 0.44f && ( tempFlatness < 6.0f || ( tempFlatness < 7.0f && maxEnergyChange < 22.0f ) ) ) ) { ltp_on = 1; } diff --git a/lib_isar/isar_lc3plus_dec.h b/lib_isar/isar_lc3plus_dec.h index 4a2e65995f94928446de82c01c97bd1e9ae37b15..5f159e514bace463515192e5f368984f67a86b72 100644 --- a/lib_isar/isar_lc3plus_dec.h +++ b/lib_isar/isar_lc3plus_dec.h @@ -75,7 +75,7 @@ typedef struct ISAR_LC3PLUS_DEC_HANDLE uint32_t num_decs; int16_t *pcm_conversion_buffer; LC3PLUS_CONFIG config; -} * ISAR_LC3PLUS_DEC_HANDLE; +} *ISAR_LC3PLUS_DEC_HANDLE; ivas_error ISAR_LC3PLUS_DEC_Open( const LC3PLUS_CONFIG config, /* i : decoder configuration */ diff --git a/lib_isar/isar_lc3plus_enc.h b/lib_isar/isar_lc3plus_enc.h index 9fea4b7cfbcd494ed98d94c268ab6ef1de057d27..fc501b5c1c90818d500f196943e4f986eecb1e62 100644 --- a/lib_isar/isar_lc3plus_enc.h +++ b/lib_isar/isar_lc3plus_enc.h @@ -49,7 +49,7 @@ typedef struct ISAR_LC3PLUS_ENC_HANDLE LC3PLUS_RTP_FTD *frame_type_descriptors; int32_t num_ftds; LC3PLUS_RTP_FDL fdl_request; -} * ISAR_LC3PLUS_ENC_HANDLE; +} *ISAR_LC3PLUS_ENC_HANDLE; ivas_error ISAR_LC3PLUS_ENC_Open( const LC3PLUS_CONFIG config, /* i : encoder configuration */ diff --git a/lib_isar/isar_lcld_encoder.c b/lib_isar/isar_lcld_encoder.c index ca02818448d83a11696e3494781217c06ebd9e24..a25a7e70416f5bccb28cdd1f9ec1419ab16fc010 100644 --- a/lib_isar/isar_lcld_encoder.c +++ b/lib_isar/isar_lcld_encoder.c @@ -1240,7 +1240,7 @@ static void QuantizeSpectrumDPCM_Opt( iBlockOffset++; } /* group length */ - } /* groups */ + } /* groups */ pfPredStateReal[iFBOffset] = fPrevReal; pfPredStateImag[iFBOffset] = fPrevImag; } /* predEnable */ @@ -1266,11 +1266,11 @@ static void QuantizeSpectrumDPCM_Opt( iBlockOffset++; } /* group length */ - } /* groups */ - } /* predEnable */ + } /* groups */ + } /* predEnable */ iFBOffset++; } /* bandwidth */ - } /* bands */ + } /* bands */ return; } diff --git a/scripts/check-format.sh b/scripts/check-format.sh index 4da3764bc0b82bc26f3fc684add6e0122cd209b7..8b830332d08193ed2ea803242b6ab80fff79affe 100755 --- a/scripts/check-format.sh +++ b/scripts/check-format.sh @@ -34,12 +34,12 @@ # for questions: dla@iis.fhg.de if [ ! -d "lib_com" ]; then - echo "not in root directory! - please run in IVAS root" - exit 255 + echo "not in root directory! - please run in IVAS root" + exit 255 fi CLANG_FORMAT=clang-format -CLANG_FORMAT_REQUIRED_VERSION="13.0" +CLANG_FORMAT_REQUIRED_VERSION="18.1" # list (with space between entries) of substrings that are excluded from the file list, e.g. very large files EXCLUDE_FILES="ivas_rom_binaural_crend_head.c" @@ -47,7 +47,7 @@ EXCLUDE_FILES="ivas_rom_binaural_crend_head.c" NUMPROCS=1 function usage() { - cat < clang-format-13 does not add them and warnings e.g. on MacOS are triggered by them - sed -i -e '$a\' $1 - # second command removes multiple newlines at the end of a file so that there is only one left - # -> clang-format-13 does not do that, but complains about it - sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' $1 +ensure-one-newline() { + # first command adds a newline at the end of the file if there might be none + # -> clang-format-13 does not add them and warnings e.g. on MacOS are triggered by them + sed -i -e '$a\' $1 + # second command removes multiple newlines at the end of a file so that there is only one left + # -> clang-format-13 does not do that, but complains about it + sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' $1 } cl-format-check() { - local I=$1 - local COLOR=$2 - local RED="" - local GREEN="" - local DEFAULT="" - - if [[ $NUMPROCS -lt 2 ]]; then - printf '%-50s' $I - fi - - if [ $COLOR ]; then - RED="\e[41m" - GREEN="\e[42m" - DEFAULT="\e[49m" - fi - - local O=$(${CLANG_FORMAT} $I) - local DIFF=$(diff $I <(echo "$O")) - - if [[ $NUMPROCS -ge 2 ]]; then - printf '%-50s' $I - fi - - if [ "$DIFF" != "" ]; then - printf '[%bFAIL%b]\n' $RED $DEFAULT - if [ ! $NODIFF ]; then - DIFF=$(diff -u $I <(echo "$O")) - if [ $COLOR ]; then - if [[ "$OSTYPE" == "darwin"* ]]; then - echo "$DIFF" | sed "s/^-/`echo -e \"\x1b\"`[41m-/;s/^+/`echo -e \"\x1b\"`[42m+/;s/^@/`echo -e \"\x1b\"`[34m@/;s/$/`echo -e \"\x1b\"`[0m/" - else - echo "$DIFF" | sed 's/^-/\x1b[41m-/;s/^+/\x1b[42m+/;s/^@/\x1b[34m@/;s/$/\x1b[0m/' - fi - else - echo "$DIFF" - fi + local I=$1 + local COLOR=$2 + local RED="" + local GREEN="" + local DEFAULT="" + + if [[ $NUMPROCS -lt 2 ]]; then + printf '%-50s' $I + fi + + if [ $COLOR ]; then + RED="\e[41m" + GREEN="\e[42m" + DEFAULT="\e[49m" + fi + + local O=$(${CLANG_FORMAT} $I) + local DIFF=$(diff $I <(echo "$O")) + + if [[ $NUMPROCS -ge 2 ]]; then + printf '%-50s' $I + fi + + if [ "$DIFF" != "" ]; then + printf '[%bFAIL%b]\n' $RED $DEFAULT + if [ ! $NODIFF ]; then + DIFF=$(diff -u $I <(echo "$O")) + if [ $COLOR ]; then + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "$DIFF" | sed "s/^-/$(echo -e \"\x1b\")[41m-/;s/^+/$(echo -e \"\x1b\")[42m+/;s/^@/$(echo -e \"\x1b\")[34m@/;s/$/$(echo -e \"\x1b\")[0m/" + else + echo "$DIFF" | sed 's/^-/\x1b[41m-/;s/^+/\x1b[42m+/;s/^@/\x1b[34m@/;s/$/\x1b[0m/' fi - return 1 - else - printf '[%bOK%b]\n' $GREEN $DEFAULT - return 0 + else + echo "$DIFF" + fi fi + return 1 + else + printf '[%bOK%b]\n' $GREEN $DEFAULT + return 0 + fi } while getopts "facDVe:p:h" OPTIONS; do - case ${OPTIONS} in - f) - FORMAT=true - ;; - a) - ALL=true - ;; - c) - COLOR=true - ;; - D) - NODIFF=true - ;; - V) - NOVERSION=true - ;; - e) - CLANG_FORMAT=$OPTARG - ;; - p) - NUMPROCS=$OPTARG - ;; - h | *) - usage - ;; - esac + case ${OPTIONS} in + f) + FORMAT=true + ;; + a) + ALL=true + ;; + c) + COLOR=true + ;; + D) + NODIFF=true + ;; + V) + NOVERSION=true + ;; + e) + CLANG_FORMAT=$OPTARG + ;; + p) + NUMPROCS=$OPTARG + ;; + h | *) + usage + ;; + esac done -shift $((OPTIND-1)) +shift $((OPTIND - 1)) FILES="$@" if [ ! -d "lib_com" ]; then - echo "not in root directory! - please run in IVAS root" - exit 253 + echo "not in root directory! - please run in IVAS root" + exit 253 fi if [ ! $NOVERSION ]; then - if [[ $(cl-format-check-version) != "${CLANG_FORMAT_REQUIRED_VERSION}"* ]]; then - echo "clang-format must be version ${CLANG_FORMAT_REQUIRED_VERSION} but is $(cl-format-check-version) !!!" - echo "Executables for Win32 could be downloaded from https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/LLVM-13.0.1-win32.exe" - exit 252 - fi + if [[ $(cl-format-check-version) != "${CLANG_FORMAT_REQUIRED_VERSION}"* ]]; then + echo "clang-format must be version ${CLANG_FORMAT_REQUIRED_VERSION} but is $(cl-format-check-version) !!!" + echo "Executables for Win32 could be downloaded from https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/LLVM-13.0.1-win32.exe" + exit 252 + fi fi if [ -z "$FILES" ]; then - if [ $ALL ]; then - FILES=$(ls lib_com/*.[c,h] lib_dec/*.[c,h] lib_enc/*.[c,h] lib_isar/*.[c,h] lib_rend/*.[c,h] lib_util/*.[c,h] apps/*.[c,h]) - elif [ -d ".svn" ]; then - if [ ! -x "$(command -v svn)" ]; then - echo "Subversion doesn't seem to be installed. Please ensure svn is in your PATH" - exit 251 - fi - if [[ "$OSTYPE" == "darwin"* ]]; then - FILES=$(svn st | grep '^M' | cut -b 9- | grep -E "\.c|\.h") - else - FILES=$(svn st | grep '^M' | cut -b 9- | grep '\.c$\|\.h$') - fi - elif [ -d ".git" ]; then - if [ ! -x "$(command -v git)" ]; then - echo "GIT doesn't seem to be installed. Please ensure git is in your PATH" - exit 251 - fi - if [[ "$OSTYPE" == "darwin"* ]]; then - FILES=$(git status | grep 'modified: ' | cut -b 14- | grep -E "\.c|\.h") - else - FILES=$(git status | grep 'modified: ' | cut -b 14- | grep '\.c$\|\.h$') - fi + if [ $ALL ]; then + FILES=$(ls lib_com/*.[c,h] lib_dec/*.[c,h] lib_enc/*.[c,h] lib_isar/*.[c,h] lib_rend/*.[c,h] lib_util/*.[c,h] apps/*.[c,h]) + elif [ -d ".svn" ]; then + if [ ! -x "$(command -v svn)" ]; then + echo "Subversion doesn't seem to be installed. Please ensure svn is in your PATH" + exit 251 + fi + if [[ "$OSTYPE" == "darwin"* ]]; then + FILES=$(svn st | grep '^M' | cut -b 9- | grep -E "\.c|\.h") else - echo "Warning: no files checked (either no cmdl params or no modified files)" - exit 0 + FILES=$(svn st | grep '^M' | cut -b 9- | grep '\.c$\|\.h$') fi - for i in ${EXCLUDE_FILES}; do - FILES=$(echo ${FILES} | xargs -n 1 | grep -v ${i} | tr '\n' ' ') - done + elif [ -d ".git" ]; then + if [ ! -x "$(command -v git)" ]; then + echo "GIT doesn't seem to be installed. Please ensure git is in your PATH" + exit 251 + fi + if [[ "$OSTYPE" == "darwin"* ]]; then + FILES=$(git status | grep 'modified: ' | cut -b 14- | grep -E "\.c|\.h") + else + FILES=$(git status | grep 'modified: ' | cut -b 14- | grep '\.c$\|\.h$') + fi + else + echo "Warning: no files checked (either no cmdl params or no modified files)" + exit 0 + fi + for i in ${EXCLUDE_FILES}; do + FILES=$(echo ${FILES} | xargs -n 1 | grep -v ${i} | tr '\n' ' ') + done fi if [[ $NUMPROCS -lt 2 ]]; then - NUMFAILS=0 - for i in ${FILES}; do - cl-format-check $i $COLOR - RET=$? - ((NUMFAILS+=RET)) - if [ $FORMAT ]; then - ensure-one-newline $i - cl-format-apply $i - fi - done - if [[ $NUMFAILS -gt 0 ]]; then - echo "Total fails: $NUMFAILS" -# exit $NUMFAILS ## uncomment if script should have num fails as return code + NUMFAILS=0 + for i in ${FILES}; do + cl-format-check $i $COLOR + RET=$? + ((NUMFAILS += RET)) + if [ $FORMAT ]; then + ensure-one-newline $i + cl-format-apply $i fi + done + if [[ $NUMFAILS -gt 0 ]]; then + echo "Total fails: $NUMFAILS" + # exit $NUMFAILS ## uncomment if script should have num fails as return code + fi else - NUMFAILS=0 - NUMFAILSTMPFILE=$(mktemp) - # parallel processing. Note that return code is always 0 then and fails are not counted - for i in ${FILES}; do - ( - cl-format-check $i $COLOR - RET=$? - if [[ $RET -gt 0 ]] - then - echo "1" >> "$NUMFAILSTMPFILE" - fi - ((NUMFAILS+=RET)) - if [ $FORMAT ]; then - ensure-one-newline $i - cl-format-apply $i - fi ) & - while [[ $(jobs -r -p | wc -l) -ge $NUMPROCS ]];do - sleep 0.1 - done + NUMFAILS=0 + NUMFAILSTMPFILE=$(mktemp) + # parallel processing. Note that return code is always 0 then and fails are not counted + for i in ${FILES}; do + ( + cl-format-check $i $COLOR + RET=$? + if [[ $RET -gt 0 ]]; then + echo "1" >>"$NUMFAILSTMPFILE" + fi + ((NUMFAILS += RET)) + if [ $FORMAT ]; then + ensure-one-newline $i + cl-format-apply $i + fi + ) & + while [[ $(jobs -r -p | wc -l) -ge $NUMPROCS ]]; do + sleep 0.1 done - wait - NUMFAILS=`cat $NUMFAILSTMPFILE | wc -l` - rm "$NUMFAILSTMPFILE" - if [[ $NUMFAILS -gt 0 ]]; then - echo "Total fails: $NUMFAILS" - exit $NUMFAILS ## uncomment if script should have num fails as return code - fi + done + wait + NUMFAILS=$(cat $NUMFAILSTMPFILE | wc -l) + rm "$NUMFAILSTMPFILE" + if [[ $NUMFAILS -gt 0 ]]; then + echo "Total fails: $NUMFAILS" + exit $NUMFAILS ## uncomment if script should have num fails as return code + fi fi exit 0