From faeaeb84596e0e13cb1a3037b228104730cda03c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 14 Apr 2025 22:04:05 +0200 Subject: [PATCH 1/3] lib_enc: replace BASOP_Util_Divide3232_Scale_cadence() by BASOP_Util_Divide3232_Scale_newton() with exception of ivas_stereo_dmx_evs_fx.c --- lib_enc/find_tilt_fx.c | 2 +- lib_enc/hq_classifier_enc_fx.c | 2 +- lib_enc/ivas_enc_cov_handler_fx.c | 2 +- lib_enc/ivas_masa_enc_fx.c | 24 ++++---- lib_enc/ivas_mdct_core_enc_fx.c | 10 +-- lib_enc/ivas_qmetadata_enc_fx.c | 12 ++-- lib_enc/ivas_stereo_classifier_fx.c | 14 ++--- lib_enc/ivas_stereo_cng_enc_fx.c | 12 ++-- lib_enc/ivas_stereo_dft_enc_fx.c | 78 ++++++++++++------------ lib_enc/ivas_stereo_dft_enc_itd_fx.c | 50 +++++++-------- lib_enc/ivas_stereo_eclvq_enc_fx.c | 20 +++--- lib_enc/ivas_stereo_ica_enc_fx.c | 10 +-- lib_enc/ivas_stereo_mdct_stereo_enc_fx.c | 4 +- lib_enc/ivas_stereo_td_analysis_fx.c | 6 +- lib_enc/ivas_tcx_core_enc_fx.c | 2 +- lib_enc/speech_music_classif_fx.c | 4 +- lib_enc/tcx_utils_enc_fx.c | 2 +- lib_enc/transient_detection_fx.c | 6 +- 18 files changed, 130 insertions(+), 130 deletions(-) diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c index ed8ff425e..dc78719d2 100644 --- a/lib_enc/find_tilt_fx.c +++ b/lib_enc/find_tilt_fx.c @@ -329,7 +329,7 @@ void find_tilt_ivas_fx( { hp_bckr = L_deposit_l( 1 ); } - Ltmp = BASOP_Util_Divide3232_Scale_cadence( lp_bckr, hp_bckr, &e_tmp ); + Ltmp = BASOP_Util_Divide3232_Scale_newton( lp_bckr, hp_bckr, &e_tmp ); Ltmp = Mpy_32_16_r( Ltmp, 3277 /* 0.1f in Q15 */ ); Ltmp = L_shr_sat( Ltmp, sub( 15, e_tmp ) ); *bckr_tilt_lt = L_add_sat( Mpy_32_16_r( *bckr_tilt_lt, 29491 /* 0.9f in Q15 */ ), Ltmp ); // Q16 diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 300e31e8e..d82eebfb5 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -143,7 +143,7 @@ static Word16 hf_spectrum_sparseness_fx( Word16 l_shift = W_norm( inv_rms_fx ); inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32 Word16 q_rms = sub( add( Q15, l_shift ), 32 ); // q_rms - inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_cadence( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e ); /* Q31-inv_rms32_e */ + inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_newton( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e ); /* Q31-inv_rms32_e */ inv_rms32_e = sub( 31, add( sub( Q31, inv_rms32_e ), q_rms ) ); // inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); inv_rms32_fx = ISqrt32( inv_rms32_div_fx, &inv_rms32_e ); /* Q31-inv_rms32_e */ diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index c05d59b90..138e1467d 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -271,7 +271,7 @@ static Word16 ivas_spar_get_activeW_flag_fx( } ELSE { - L_tmp = BASOP_Util_Divide3232_Scale_cadence( hCovEnc->bb_var_lt_fx[0], side_ch_var, &exp_diff ); // (Q31 - exp_diff) + L_tmp = BASOP_Util_Divide3232_Scale_newton( hCovEnc->bb_var_lt_fx[0], side_ch_var, &exp_diff ); // (Q31 - exp_diff) en_ratio = L_shl_sat( L_tmp, exp_diff ); // Q31 IF( LT_32( en_ratio, Mpy_32_32( IVAS_SPAR_DYN_ACTIVEW_THRESH_FX, IVAS_SPAR_DYN_ACTIVEW_THRESH_FX ) ) ) // LHS Q31 :: RHS Q31 { diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 2b9ffef15..5c5de97ab 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -1477,7 +1477,7 @@ static void combine_freqbands_and_subframes_fx( move16(); hMeta->directional_meta[i].energy_ratio_fx[j][k] = - BASOP_Util_Divide3232_Scale_cadence( vecLen, L_add( energySum, EPSILON_FX ), &exp_diff ); /*exp_diff+vecLen_e-energySum_e*/ + BASOP_Util_Divide3232_Scale_newton( vecLen, L_add( energySum, EPSILON_FX ), &exp_diff ); /*exp_diff+vecLen_e-energySum_e*/ move32(); exp_diff = add( exp_diff, sub( vecLen_e, energySum_e ) ); hMeta->directional_meta[i].energy_ratio_fx[j][k] = @@ -1585,7 +1585,7 @@ static void combine_freqbands_and_subframes_fx( { energyRatioSum = BASOP_Util_Add_Mant32Exp( energyRatioSum, energyRatioSum_e, Mpy_32_32( energy[j][k], hMeta->directional_meta[i].energy_ratio_fx[j][k] ), add( energy_e[j][k], 1 ), &energyRatioSum_e ); // 31-energyRatioSum_e } - energyRatioTemp = BASOP_Util_Divide3232_Scale_cadence( energyRatioSum, L_add( energySum, EPSILON_FX ), &exp_diff ); + energyRatioTemp = BASOP_Util_Divide3232_Scale_newton( energyRatioSum, L_add( energySum, EPSILON_FX ), &exp_diff ); exp_diff = add( exp_diff, sub( energyRatioSum_e, energySum_e ) ); energyRatioTemp = L_shl( energyRatioTemp, sub( exp_diff, 1 ) ); // Q30 @@ -2264,13 +2264,13 @@ static void compensate_energy_ratios_fx( FOR( dir = 0; dir < numDirs; dir++ ) { hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = - BASOP_Util_Divide3232_Scale_cadence( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum, &exp_diff ); + BASOP_Util_Divide3232_Scale_newton( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum, &exp_diff ); move32(); hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30 move32(); } hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = - BASOP_Util_Divide3232_Scale_cadence( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum, &exp_diff ); + BASOP_Util_Divide3232_Scale_newton( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum, &exp_diff ); move32(); hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30 move32(); @@ -2406,7 +2406,7 @@ static void reduce_metadata_further_fx( IF( hMasa->data.onset_detector_1_fx != 0 ) { - onset_filter = L_max( BASOP_Util_Divide3232_Scale_cadence( hMasa->data.onset_detector_2_fx, hMasa->data.onset_detector_1_fx, &onset_filter_e ), 0 ); + onset_filter = L_max( BASOP_Util_Divide3232_Scale_newton( hMasa->data.onset_detector_2_fx, hMasa->data.onset_detector_1_fx, &onset_filter_e ), 0 ); IF( BASOP_Util_Cmp_Mant32Exp( onset_filter, onset_filter_e, ONE_IN_Q31, 0 ) > 0 ) { @@ -2433,7 +2433,7 @@ static void reduce_metadata_further_fx( Word32 bandRatio; // threshold = totalEnergySum / ( MAX_PARAM_SPATIAL_SUBFRAMES * LOWBITRATE_NUM_BANDS ) * 0.5f; /* Average energy multiplied with energy ratio of 0.5f */ - threshold = BASOP_Util_Divide3232_Scale_cadence( totalEnergySum, ( MAX_PARAM_SPATIAL_SUBFRAMES * LOWBITRATE_NUM_BANDS ) * 2, &exp ); /* Average energy multiplied with energy ratio of 0.5f */ + threshold = BASOP_Util_Divide3232_Scale_newton( totalEnergySum, ( MAX_PARAM_SPATIAL_SUBFRAMES * LOWBITRATE_NUM_BANDS ) * 2, &exp ); /* Average energy multiplied with energy ratio of 0.5f */ exp = add( exp, sub( sub( 31, add( hMasa->data.q_energy, tmp2 ) ), 31 ) ); bandRatio = hqmetadata->q_direction[0].band_data[band].energy_ratio_fx[0]; // Q30 move32(); @@ -2468,7 +2468,7 @@ static void reduce_metadata_further_fx( } IF( totalEnergySum != 0 ) { - meanRatio = BASOP_Util_Divide3232_Scale_cadence( meanRatio, totalEnergySum, &exp ); + meanRatio = BASOP_Util_Divide3232_Scale_newton( meanRatio, totalEnergySum, &exp ); exp = add( add( exp, 1 ), tmp2 ); // 31 - (hMasa->data.q_energy - 1) - 31 - hMasa->data.q_energy - tmp2 => 1 + tmp2 } ELSE @@ -4730,7 +4730,7 @@ static void ivas_encode_masaism_metadata_fx( FOR( obj = 0; obj < nchan_ism; obj++ ) { - hOmasaData->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_cadence( energy_ism_ind[obj], energy_ism, &L_tmp_e ); + hOmasaData->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); move32(); L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) ); /* Scaling to Q30 */ @@ -4740,7 +4740,7 @@ static void ivas_encode_masaism_metadata_fx( L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = BASOP_Util_Divide3232_Scale_newton( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ @@ -4791,7 +4791,7 @@ static void ivas_encode_masaism_metadata_fx( { FOR( obj = 0; obj < nchan_ism; obj++ ) { - hOmasaData->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_cadence( energy_ism_ind[obj], energy_ism, &L_tmp_e ); + hOmasaData->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e ); move32(); L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) ); /* Scaling to Q30 */ @@ -4819,7 +4819,7 @@ static void ivas_encode_masaism_metadata_fx( L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[0][band] = BASOP_Util_Divide3232_Scale_newton( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ @@ -4876,7 +4876,7 @@ static void ivas_encode_masaism_metadata_fx( L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e ); IF( L_tmp != 0 ) { - hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_cadence( eneBand32, L_tmp, &tmp ); + hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_newton( eneBand32, L_tmp, &tmp ); move32(); tmp = add( tmp, sub( eneBand_exp, L_tmp_e ) ); /* Scaling to Q30 */ diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index e744c7f47..401e1360d 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -233,7 +233,7 @@ static Word16 kernel_switch_detect_fx( L_tmp1 = Sqrt32( L_tmp1, &exp_tmp1 ); L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, exp_tmp, L_tmp1, exp_tmp1, &exp_tmp ); L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, exp_tmp, ONE_IN_Q30, 1, &exp_tmp ); - cov00 = BASOP_Util_Divide3232_Scale_cadence( cov00, L_tmp, &exp_tmp1 ); + cov00 = BASOP_Util_Divide3232_Scale_newton( cov00, L_tmp, &exp_tmp1 ); exp_tmp = add( exp_tmp1, sub( sub( Q31, q_com ), exp_tmp ) ); /* Added saturation to handle overflows when value is very close to 1.f */ cov00 = L_shl_sat( cov00, exp_tmp ); // Q31 @@ -247,7 +247,7 @@ static Word16 kernel_switch_detect_fx( L_tmp1 = Sqrt32( L_tmp1, &exp_tmp1 ); L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, exp_tmp, L_tmp1, exp_tmp1, &exp_tmp ); L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, exp_tmp, ONE_IN_Q30, 1, &exp_tmp ); - cov90 = BASOP_Util_Divide3232_Scale_cadence( cov90, L_tmp, &exp_tmp1 ); + cov90 = BASOP_Util_Divide3232_Scale_newton( cov90, L_tmp, &exp_tmp1 ); exp_tmp = add( exp_tmp1, sub( sub( Q31, q_com ), exp_tmp ) ); /* Added saturation to handle overflows when value is very close to 1.f */ cov90 = L_shl_sat( cov90, exp_tmp ); // Q31 @@ -735,7 +735,7 @@ static void applyStereoPreProcessingCplx( d_q = sub( 31, d_q ); deno = L_max( L_shl_sat( 1, d_q ), d_fx ); - sq_imp = BASOP_Util_Divide3232_Scale_cadence( n_fx, deno, &exp ); + sq_imp = BASOP_Util_Divide3232_Scale_newton( n_fx, deno, &exp ); exp = add( exp, sub( d_q, n_q ) ); d_fx = Sqrt32( sq_imp, &exp ); *mdctSample1_fx = Mpy_32_32( dmxR1_fx, d_fx ); @@ -764,7 +764,7 @@ static void applyStereoPreProcessingCplx( d_q = sub( 31, d_q ); deno = L_max( L_shl_sat( 1, d_q ), d_fx ); - sq_imp = BASOP_Util_Divide3232_Scale_cadence( n_fx, deno, &exp ); + sq_imp = BASOP_Util_Divide3232_Scale_newton( n_fx, deno, &exp ); exp = add( exp, sub( d_q, n_q ) ); d_fx = Sqrt32( sq_imp, &exp ); *mdctSample2_fx = Mpy_32_32( dmxR2_fx, d_fx ); @@ -956,7 +956,7 @@ static UWord16 enc_ste_pre_mdct( ELSE { Word16 exp1; - corr_fx = BASOP_Util_Divide3232_Scale_cadence( Mpy_32_32( corr_fx, corr_fx ), Mpy_32_32( sumL_fx, sumR_fx ), &exp1 ); + corr_fx = BASOP_Util_Divide3232_Scale_newton( Mpy_32_32( corr_fx, corr_fx ), Mpy_32_32( sumL_fx, sumR_fx ), &exp1 ); corr_e = add( exp1, sub( shl( corr_e, 1 ), add( sumL_e, sumR_e ) ) ); } test(); diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 10380f422..79a4adee7 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -1332,12 +1332,12 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512_fx( ratioSum = L_add( hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k], hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] ); IF( GT_32( ratioSum, ONE_IN_Q30 /*1.0f*/ ) ) { - hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_cadence( hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); + hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_newton( hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k] = L_shl( hQMetaData->q_direction[0].band_data[j].energy_ratio_fx[k], sub( div_e, 1 ) ); move32(); move32(); - hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_cadence( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); + hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_newton( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = L_shl( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], sub( div_e, 1 ) ); move32(); move32(); @@ -1385,12 +1385,12 @@ static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512_fx( IF( GT_32( ratioSum, ONE_IN_Q30 /*1.0f*/ ) ) { - hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_cadence( hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k], ratioSum, &div_e ); + hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_newton( hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k], ratioSum, &div_e ); hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k] = L_shl( hQMetaData->q_direction[0].band_data[pos_2dir_band[j]].energy_ratio_fx[k], sub( div_e, 1 ) ); move32(); move32(); - hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_cadence( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); + hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = BASOP_Util_Divide3232_Scale_newton( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], ratioSum, &div_e ); hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k] = L_shl( hQMetaData->q_direction[1].band_data[j].energy_ratio_fx[k], sub( div_e, 1 ) ); move32(); move32(); @@ -6619,7 +6619,7 @@ void ivas_omasa_encode_masa_to_total_fx( { j = imult1616( k, len_stream ); /* quantize with fixed common step */ - L_tmp = BASOP_Util_Divide3232_Scale_cadence( dct_data[j], step, &tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( dct_data[j], step, &tmp_e ); tmp_e = add( tmp_e, Q6 ); q_idx[j] = rint_new_fx( L_shr( L_tmp, sub( 15, tmp_e ) ) /* Q16 */ ); // Q0 move16(); @@ -6642,7 +6642,7 @@ void ivas_omasa_encode_masa_to_total_fx( { FOR( i = 1; i < len_stream; i++ ) { - L_tmp = BASOP_Util_Divide3232_Scale_cadence( dct_data[j + i], step, &tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( dct_data[j + i], step, &tmp_e ); tmp_e = add( tmp_e, Q6 ); q_idx[j + i] = rint_new_fx( L_shr( L_tmp, sub( 15, tmp_e ) ) ); move16(); diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index 3e69a0ca6..3a040517a 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -890,7 +890,7 @@ void unclr_classifier_td_fx( move16(); /* mean & std removal */ - fvn = BASOP_Util_Divide3232_Scale_cadence( L_sub( hStereoClassif->unclr_fv_fx[ind], unclr_mean_td[i] ), unclr_scale_td[i], &exp ); + fvn = BASOP_Util_Divide3232_Scale_newton( L_sub( hStereoClassif->unclr_fv_fx[ind], unclr_mean_td[i] ), unclr_scale_td[i], &exp ); fvn = Mpy_32_32( fvn, unclr_coef_td[i] ); // Q = 31-exp+15-31 = 15-exp exp = add( exp, 16 ); // exp = 31-(15-exp) = 16+exp @@ -1016,7 +1016,7 @@ void unclr_classifier_dft_fx( /* mean & std removal */ // fvn[i] = (hStereoClassif->unclr_fv[ind] - unclr_mean_dft[i]) / unclr_scale_dft[i]; - fvn[i] = BASOP_Util_Divide3232_Scale_cadence( L_sub( hStereoClassif->unclr_fv_fx[ind], unclr_mean_dft_Q15[i] ), unclr_scale_dft_Q15[i], &fvn_e[i] ); + fvn[i] = BASOP_Util_Divide3232_Scale_newton( L_sub( hStereoClassif->unclr_fv_fx[ind], unclr_mean_dft_Q15[i] ), unclr_scale_dft_Q15[i], &fvn_e[i] ); move32(); /* LR */ @@ -1157,7 +1157,7 @@ void xtalk_classifier_td_fx( move16(); /* mean & std removal */ - fvn = BASOP_Util_Divide3232_Scale_cadence( L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_td[i] ), xtalk_scale_td[i], &exp ); + fvn = BASOP_Util_Divide3232_Scale_newton( L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_td[i] ), xtalk_scale_td[i], &exp ); fvn = Mpy_32_32( fvn, xtalk_coef_td[i] ); // Q = 31-exp+15-31 = 15-exp exp = add( exp, 16 ); // exp = 31-(15-exp) = 16+exp @@ -1372,7 +1372,7 @@ void xtalk_classifier_dft_fx( // ratio_m1_m2 = fabsf( m1 * m2 ) / fabsf( m1 + m2 + 1.0f ); Word16 exp; - ratio_m1_m2 = BASOP_Util_Divide3232_Scale_cadence( L_abs( Mpy_32_32( m1, m2 ) ), L_abs( L_add( L_add( L_shr( m1, 2 ), L_shr( m2, 2 ) ), ONE_IN_Q29 ) ), &exp ); + ratio_m1_m2 = BASOP_Util_Divide3232_Scale_newton( L_abs( Mpy_32_32( m1, m2 ) ), L_abs( L_add( L_add( L_shr( m1, 2 ), L_shr( m2, 2 ) ), ONE_IN_Q29 ) ), &exp ); exp = sub( exp, 2 ); // m2_m2 = hItd->prev_m2 * m2; m2_m2 = Mpy_32_32( hItd->prev_m2_fx, m2 ); @@ -1406,7 +1406,7 @@ void xtalk_classifier_dft_fx( /* mean & std removal */ // fvn[i] = ( hStereoClassif->xtalk_fv[ind] - xtalk_mean_dft[i] ) / xtalk_scale_dft[i]; - fvn[i] = BASOP_Util_Divide3232_Scale_cadence( L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_dft_q15[i] ), xtalk_scale_dft_q15[i], &exp ); // Q15 + fvn[i] = BASOP_Util_Divide3232_Scale_newton( L_sub( hStereoClassif->xtalk_fv_fx[ind], xtalk_mean_dft_q15[i] ), xtalk_scale_dft_q15[i], &exp ); // Q15 move32(); fvn[i] = L_shl_sat( fvn[i], sub( exp, 2 ) ); // Q29 move32(); @@ -1755,7 +1755,7 @@ static Word32 redge_detect_fx( { // edge_slope = ( inp_max - inp_min ) / i; L_temp = BASOP_Util_Add_Mant32Exp( inp_max, 0, L_negate( inp_min ), 0, &L_temp_e ); - edge_slope = BASOP_Util_Divide3232_Scale_cadence( L_temp, i, &edge_slope_e ); + edge_slope = BASOP_Util_Divide3232_Scale_newton( L_temp, i, &edge_slope_e ); edge_slope_e = add( edge_slope_e, sub( L_temp_e, 31 ) ); edge[i] = err0; move32(); @@ -1788,7 +1788,7 @@ static Word32 redge_detect_fx( } // edge[i] /= i + 1; - edge[i] = BASOP_Util_Divide3232_Scale_cadence( edge[i], add( i, 1 ), &L_temp_e ); + edge[i] = BASOP_Util_Divide3232_Scale_newton( edge[i], add( i, 1 ), &L_temp_e ); move32(); edge_e[i] = add( L_temp_e, sub( edge_e[i], 31 ) ); move16(); diff --git a/lib_enc/ivas_stereo_cng_enc_fx.c b/lib_enc/ivas_stereo_cng_enc_fx.c index aa7c2d0aa..b73a57f46 100644 --- a/lib_enc/ivas_stereo_cng_enc_fx.c +++ b/lib_enc/ivas_stereo_cng_enc_fx.c @@ -101,7 +101,7 @@ void stereo_dft_enc_sid_calc_coh_fx( L_tmp1_e = sub( add( hStereoDft->Spd_L_smooth_fx_e, hStereoDft->Spd_R_smooth_fx_e ), W_tmp_q ); L_tmp2 = BASOP_Util_Add_Mant32Exp( Mpy_32_32( hStereoDft->xspec_smooth_fx[2 * k], hStereoDft->xspec_smooth_fx[2 * k] ), shl( hStereoDft->xspec_smooth_fx_e[2 * k], 1 ), Mpy_32_32( hStereoDft->xspec_smooth_fx[2 * k + 1], hStereoDft->xspec_smooth_fx[2 * k + 1] ), shl( hStereoDft->xspec_smooth_fx_e[2 * k + 1], 1 ), &L_tmp2_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp2_e ); - L_tmp3 = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp3_e ); + L_tmp3 = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp3_e ); L_tmp3_e = add( L_tmp3_e, sub( L_tmp1_e, L_tmp2_e ) ); L_tmp3 = Mpy_32_32( prev_cohBand[b], L_tmp3 ); xspec_scale = Sqrt32( L_tmp3, &L_tmp3_e ); @@ -137,7 +137,7 @@ void stereo_dft_enc_sid_calc_coh_fx( L_tmp2 = W_extract_h( W_shl( W_tmp, W_tmp_q ) ); L_tmp2_e = sub( add( hStereoDft->Spd_L_smooth_fx_e, hStereoDft->Spd_R_smooth_fx_e ), W_tmp_q ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp2_e ); - L_tmp3 = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp3_e ); + L_tmp3 = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp3_e ); L_tmp3_e = add( L_tmp3_e, sub( L_tmp1_e, L_tmp2_e ) ); L_tmp3 = Mpy_32_32( coh_weight, L_tmp3 ); L_tmp3_e = add( coh_weight_e, L_tmp3_e ); @@ -150,7 +150,7 @@ void stereo_dft_enc_sid_calc_coh_fx( IF( coh_weight_sum > 0 ) { // cohBand[b] = cohBand[b] / coh_weight_sum; - cohBand[b] = BASOP_Util_Divide3232_Scale_cadence( cohBand[b], coh_weight_sum, &L_tmp1_e ); + cohBand[b] = BASOP_Util_Divide3232_Scale_newton( cohBand[b], coh_weight_sum, &L_tmp1_e ); move32(); cohBand_e[b] = add( L_tmp1_e, sub( cohBand_e[b], coh_weight_sum_e ) ); move16(); @@ -510,7 +510,7 @@ void stereo_dft_cng_side_gain_fx( hStereoCng->prev_sg_average_fx[b] = hStereoCng->sg_average_fx[b]; move32(); // hStereoCng->sg_average[b] = hStereoCng->sg_average[b] / (float) hStereoCng->sg_average_counter; - hStereoCng->sg_average_fx[b] = BASOP_Util_Divide3232_Scale_cadence( hStereoCng->sg_average_fx[b], hStereoCng->sg_average_counter, &tmp_e ); + hStereoCng->sg_average_fx[b] = BASOP_Util_Divide3232_Scale_newton( hStereoCng->sg_average_fx[b], hStereoCng->sg_average_counter, &tmp_e ); move32(); tmp_e = sub( tmp_e, 31 - 5 ); hStereoCng->sg_average_fx[b] = L_shl_r( hStereoCng->sg_average_fx[b], sub( tmp_e, 5 ) ); // Q31 @@ -535,7 +535,7 @@ void stereo_dft_cng_side_gain_fx( tmp = hStereoCng->sg_average_fx[b]; move32(); // hStereoCng->sg_average[b] = ( hStereoCng->sg_average[b] + prev_weight * hStereoCng->prev_sg_average[b] ) / ( (float) hStereoCng->sg_average_counter + prev_weight * (float) hStereoCng->prev_sg_average_counter ); - hStereoCng->sg_average_fx[b] = BASOP_Util_Divide3232_Scale_cadence( L_add( hStereoCng->sg_average_fx[b], Mpy_32_16_1( hStereoCng->prev_sg_average_fx[b], prev_weight ) ), L_add( L_shl( hStereoCng->sg_average_counter, Q15 ), L_mult0( prev_weight, hStereoCng->prev_sg_average_counter ) ), &tmp_e ); + hStereoCng->sg_average_fx[b] = BASOP_Util_Divide3232_Scale_newton( L_add( hStereoCng->sg_average_fx[b], Mpy_32_16_1( hStereoCng->prev_sg_average_fx[b], prev_weight ) ), L_add( L_shl( hStereoCng->sg_average_counter, Q15 ), L_mult0( prev_weight, hStereoCng->prev_sg_average_counter ) ), &tmp_e ); move32(); tmp_e = sub( tmp_e, 16 - 5 ); hStereoCng->sg_average_fx[b] = L_shl_r( hStereoCng->sg_average_fx[b], sub( tmp_e, 5 ) ); // Q26 @@ -571,7 +571,7 @@ void stereo_dft_cng_side_gain_fx( W_tmp_q = W_norm( W_tmp ); hStereoDft->sidSideGain_fx[b] = W_extract_h( W_shl( W_tmp, W_tmp_q ) ); move32(); - hStereoDft->sidSideGain_fx[b] = BASOP_Util_Divide3232_Scale_cadence( hStereoDft->sidSideGain_fx[b], sgSum, &tmp_e ); + hStereoDft->sidSideGain_fx[b] = BASOP_Util_Divide3232_Scale_newton( hStereoDft->sidSideGain_fx[b], sgSum, &tmp_e ); move32(); tmp_e = sub( tmp_e, W_tmp_q ); hStereoDft->sidSideGain_fx[b] = L_shl_sat( hStereoDft->sidSideGain_fx[b], tmp_e ); // Q31: saturation is fine since stereo_dft_quantize_res_gains_fx limits value to 1.0 diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 01318af28..6406158b4 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -880,7 +880,7 @@ void stereo_dft_enc_update_fx( // hStereoDft->res_cod_line_max = (int16_t) ( 0.5f + ( hStereoDft->band_limits[hStereoDft->res_cod_band_max] - 1 ) * 2.f * hStereoDft->N / (float) ( hStereoDft->NFFT ) ); Word32 tmp = L_shl( L_mult0( sub( hStereoDft->band_limits[hStereoDft->res_cod_band_max], 1 ), hStereoDft->N ), 1 ); Word16 exp; - tmp = BASOP_Util_Divide3232_Scale_cadence( tmp, hStereoDft->NFFT, &exp ); + tmp = BASOP_Util_Divide3232_Scale_newton( tmp, hStereoDft->NFFT, &exp ); hStereoDft->res_cod_line_max = extract_l( L_shr( tmp, sub( 31, exp ) ) ); move16(); // hStereoDft->res_cod_line_max = 8 * (hStereoDft->res_cod_line_max / 8); @@ -1226,7 +1226,7 @@ Word32 stereo_dft_enc_synthesize_fx( zp = STEREO_DFT_ZP_12k8_ENC; move16(); // fac = (float) ( NFFT ) / (float) ( hStereoDft->NFFT ); - fac_fx = BASOP_Util_Divide3232_Scale_cadence( NFFT, hStereoDft->NFFT, &temp_exp ); + fac_fx = BASOP_Util_Divide3232_Scale_newton( NFFT, hStereoDft->NFFT, &temp_exp ); fac_fx = L_shl( fac_fx, temp_exp ); ovl = STEREO_DFT_OVL_12k8; move16(); @@ -1250,7 +1250,7 @@ Word32 stereo_dft_enc_synthesize_fx( zp = STEREO_DFT_ZP_16k_ENC; move16(); // fac = (float) ( NFFT ) / (float) ( hStereoDft->NFFT ); - fac_fx = BASOP_Util_Divide3232_Scale_cadence( NFFT, hStereoDft->NFFT, &temp_exp ); + fac_fx = BASOP_Util_Divide3232_Scale_newton( NFFT, hStereoDft->NFFT, &temp_exp ); fac_fx = L_shl( fac_fx, temp_exp ); ovl = STEREO_DFT_OVL_16k; move16(); @@ -1283,7 +1283,7 @@ Word32 stereo_dft_enc_synthesize_fx( zp = STEREO_DFT_ZP_32k_ENC; move16(); // fac = (float) ( NFFT ) / (float) ( hStereoDft->NFFT ); - fac_fx = BASOP_Util_Divide3232_Scale_cadence( NFFT, hStereoDft->NFFT, &temp_exp ); + fac_fx = BASOP_Util_Divide3232_Scale_newton( NFFT, hStereoDft->NFFT, &temp_exp ); fac_fx = L_shl( fac_fx, temp_exp ); ovl = STEREO_DFT_OVL_32k; move16(); @@ -1307,7 +1307,7 @@ Word32 stereo_dft_enc_synthesize_fx( zp = STEREO_DFT_ZP_8k_ENC; move16(); // fac = (float) ( NFFT ) / (float) ( hStereoDft->NFFT ); - fac_fx = BASOP_Util_Divide3232_Scale_cadence( NFFT, hStereoDft->NFFT, &temp_exp ); + fac_fx = BASOP_Util_Divide3232_Scale_newton( NFFT, hStereoDft->NFFT, &temp_exp ); fac_fx = L_shl( fac_fx, temp_exp ); ovl = STEREO_DFT_OVL_8k; move16(); @@ -1511,7 +1511,7 @@ Word32 stereo_dft_enc_synthesize_fx( move32(); // output[offset + N + i] = ( tmp[zp + N + i] - ifft_deviation ) / win_ana[ovl - 1 - i] + ifft_deviation; Word16 L_temp_e; - Word32 L_temp = BASOP_Util_Divide3232_Scale_cadence( L_sub_sat( tmp_fx[zp + N + i], ifft_deviation ), L_deposit_h( win_ana_fx[ovl - 1 - i] ), &L_temp_e ); + Word32 L_temp = BASOP_Util_Divide3232_Scale_newton( L_sub_sat( tmp_fx[zp + N + i], ifft_deviation ), L_deposit_h( win_ana_fx[ovl - 1 - i] ), &L_temp_e ); L_temp = L_shl_sat( L_temp, L_temp_e ); output_fx[offset + N + i] = L_add_sat( L_temp, ifft_deviation ); // Q15 move32(); @@ -1733,7 +1733,7 @@ void stereo_dft_enc_process_fx( } // if ( fabsf( hStereoDft->hItd->deltaItd[k_offset] * 32000.f / input_Fs ) > 80.0f ) - tmp_32fx = L_abs( BASOP_Util_Divide3232_Scale_cadence( hStereoDft->hItd->deltaItd_fx[k_offset], input_Fs, &tmp_e ) ); + tmp_32fx = L_abs( BASOP_Util_Divide3232_Scale_newton( hStereoDft->hItd->deltaItd_fx[k_offset], input_Fs, &tmp_e ) ); tmp_e = add( tmp_e, 15 - 31 ); IF( BASOP_Util_Cmp_Mant32Exp( tmp_32fx, tmp_e, 5368709 /* 80.0f / 32000.f in Q31 */, 0 ) > 0 ) { @@ -2026,13 +2026,13 @@ void stereo_dft_enc_process_fx( // wR = sqrtf( 0.5f * ( comb_nrgL + comb_nrgR ) + frac_dot_prod ) / sum_abs; L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp1, sub( L_tmp1_e, 1 ), frac_dot_prod, frac_dot_prod_e, &L_tmp1_e ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - wR = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &wR_e ); + wR = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &wR_e ); wR_e = add( wR_e, sub( L_tmp1_e, sum_abs_e ) ); // wL = wR + sqrtf( 2.f ) * ( 1.f - ( sqrtf( Sr + Si ) / sum_abs ) ); L_tmp1 = BASOP_Util_Add_Mant32Exp( Sr, Sr_e, Si, Si_e, &L_tmp1_e ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &L_tmp2_e ); L_tmp2_e = add( L_tmp2_e, sub( L_tmp1_e, sum_abs_e ) ); L_tmp2 = L_shl_sat( L_tmp2, L_tmp2_e ); // Q31 saturation expected L_tmp1 = L_sub( MAX_32, L_tmp2 ); // Q31 @@ -2111,13 +2111,13 @@ void stereo_dft_enc_process_fx( // wR = sqrtf( 0.5f * ( comb_nrgL + comb_nrgR ) + frac_dot_prod ) / sum_abs; L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp1, sub( L_tmp1_e, 1 ), frac_dot_prod, frac_dot_prod_e, &L_tmp1_e ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - wR = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &wR_e ); + wR = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &wR_e ); wR_e = add( wR_e, sub( L_tmp1_e, sum_abs_e ) ); // wL = wR + sqrtf( 2.f ) * ( 1.f - ( sqrtf( Sr + Si ) / sum_abs ) ); L_tmp1 = BASOP_Util_Add_Mant32Exp( Sr, Sr_e, Si, Si_e, &L_tmp1_e ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &L_tmp2_e ); L_tmp2_e = add( L_tmp2_e, sub( L_tmp1_e, sum_abs_e ) ); L_tmp2 = L_shl_sat( L_tmp2, L_tmp2_e ); // Q31 saturation expected L_tmp1 = L_sub( MAX_32, L_tmp2 ); // Q31 @@ -2191,7 +2191,7 @@ void stereo_dft_enc_process_fx( // wR = sqrtf( 0.5f * ( sum_nrg_L2 + sum_nrg_R2 ) + dot_prod_nrg_ratio[b] ) / sum_abs; L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp3, sub( L_tmp3_e, 1 ), dot_prod_nrg_ratio_fx[b], dot_prod_nrg_ratio_fx_e[b], &L_tmp1_e ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - wR = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &wR_e ); + wR = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &wR_e ); wR_e = add( wR_e, sub( L_tmp1_e, sum_abs_e ) ); // wL = wR + sqrtf( 2.f ) * ( 1.f - sqrtf( sum_nrg_Mid ) / sum_abs ); @@ -2200,7 +2200,7 @@ void stereo_dft_enc_process_fx( L_tmp1_e = sum_nrg_Mid_e; move16(); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_abs, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_abs, &L_tmp2_e ); L_tmp2_e = add( L_tmp2_e, sub( L_tmp1_e, sum_abs_e ) ); L_tmp2 = L_shl_sat( L_tmp2, L_tmp2_e ); // Q31 saturation expected L_tmp1 = L_sub( MAX_32, L_tmp2 ); // Q31 @@ -2478,7 +2478,7 @@ static void stereo_dft_enc_get_res_cod_mode_flag_fx( L_tmp1 = L_sub( MAX_32, g ); // Q31 L_tmp2 = BASOP_Util_Add_Mant32Exp( hStereoDft->res_cod_NRG_S_fx[b], hStereoDft->res_cod_NRG_S_fx_e[b], Mpy_32_32( Mpy_32_32( L_tmp1, L_tmp1 ), hStereoDft->res_cod_NRG_M_fx[b] ), hStereoDft->res_cod_NRG_M_fx_e[b], &L_tmp2_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, MAX_32, 0, &L_tmp2_e ); - L_tmp1 = BASOP_Util_Divide3232_Scale_cadence( hStereoDft->res_cod_NRG_S_fx[b], L_tmp2, &L_tmp1_e ); + L_tmp1 = BASOP_Util_Divide3232_Scale_newton( hStereoDft->res_cod_NRG_S_fx[b], L_tmp2, &L_tmp1_e ); L_tmp1_e = add( L_tmp1_e, sub( hStereoDft->res_cod_NRG_S_fx_e[b], L_tmp2_e ) ); L_tmp1 = L_shl( L_tmp1, L_tmp1_e ); // Q31 *res_dmx_ratio = L_max( L_tmp1, *res_dmx_ratio ); @@ -2494,7 +2494,7 @@ static void stereo_dft_enc_get_res_cod_mode_flag_fx( /*Calculate the energy ratio of the inter-frame */ //*frame_nrg_ratio = dmx_res_all / hStereoDft->dmx_res_all_prev; - *frame_nrg_ratio = BASOP_Util_Divide3232_Scale_cadence( dmx_res_all, hStereoDft->dmx_res_all_prev_fx, &L_tmp1_e ); + *frame_nrg_ratio = BASOP_Util_Divide3232_Scale_newton( dmx_res_all, hStereoDft->dmx_res_all_prev_fx, &L_tmp1_e ); move32(); L_tmp1_e = add( L_tmp1_e, sub( dmx_res_all_e, hStereoDft->dmx_res_all_prev_fx_e ) ); *frame_nrg_ratio = L_shr_r_sat( *frame_nrg_ratio, sub( 3, L_tmp1_e ) ); // Q28 @@ -2741,7 +2741,7 @@ void stereo_dft_enc_res_fx( L_tmp2_e = hStereoDft->res_cod_NRG_M_fx_e[b]; L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, hStereoDft->res_cod_NRG_S_fx[b], hStereoDft->res_cod_NRG_S_fx_e[b], &L_tmp2_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, MAX_32, 0, &L_tmp2_e ); - in_phase_ratio = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &in_phase_ratio_e ); + in_phase_ratio = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &in_phase_ratio_e ); in_phase_ratio_e = add( in_phase_ratio_e, sub( hStereoDft->res_cod_NRG_M_fx_e[b], L_tmp2_e ) ); in_phase_ratio = L_shl_sat( in_phase_ratio, in_phase_ratio_e ); // Q31 : bound from 0.0 to 1.0 in_phase_ratio = L_max( 0, in_phase_ratio ); @@ -3512,7 +3512,7 @@ static void stereo_dft_enc_compute_prm_fx( W_shift = W_norm( W_tmp ); L_tmp2 = W_extract_h( W_shl( W_tmp, W_shift ) ); L_tmp2_e = sub( add( sub_nrg_DMX2_e, 31 ), W_shift ); - L_tmp = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, L_tmp2_e ) ); L_tmp = L_shl( L_tmp, L_tmp_e ); // Q31hStereoDft->gainIPD_sm_fx = L_add( L_shr( hStereoDft->gainIPD_sm_fx, 1 ), L_ gain_IPD = L_add_sat( gain_IPD, L_tmp ); // Q31: saturation expected @@ -3597,7 +3597,7 @@ static void stereo_dft_enc_compute_prm_fx( // dot_prod_nrg_ratio[b2] = sum_past_dot_prod_abs2 / ( sum_past_nrgL2 + sum_past_nrgR2 + EPSILON ); L_tmp2 = BASOP_Util_Add_Mant32Exp( sum_past_nrgL2, sum_past_nrgL2_e, sum_past_nrgR2, sum_past_nrgR2_e, &L_tmp2_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp2_e ); - dot_prod_nrg_ratio_fx[b2] = BASOP_Util_Divide3232_Scale_cadence( sum_past_dot_prod_abs2, L_tmp2, &L_tmp_e ); + dot_prod_nrg_ratio_fx[b2] = BASOP_Util_Divide3232_Scale_newton( sum_past_dot_prod_abs2, L_tmp2, &L_tmp_e ); move32(); L_tmp_e = add( L_tmp_e, sub( sum_past_dot_prod_abs2_e, L_tmp2_e ) ); dot_prod_nrg_ratio_fx[b2] = L_shl( dot_prod_nrg_ratio_fx[b2], L_tmp_e ); // Q31 @@ -3624,7 +3624,7 @@ static void stereo_dft_enc_compute_prm_fx( // dot_prod_nrg_ratio[b2] /= ( sum_nrg_L2 + sum_nrg_R2 + EPSILON ); L_tmp2 = BASOP_Util_Add_Mant32Exp( sum_nrg_L2, sum_nrg_L2_e, sum_nrg_R2, sum_nrg_R2_e, &L_tmp2_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( L_tmp2, L_tmp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_tmp2_e ); - dot_prod_nrg_ratio_fx[b2] = BASOP_Util_Divide3232_Scale_cadence( dot_prod_nrg_ratio_fx[b2], L_tmp2, &L_tmp_e ); + dot_prod_nrg_ratio_fx[b2] = BASOP_Util_Divide3232_Scale_newton( dot_prod_nrg_ratio_fx[b2], L_tmp2, &L_tmp_e ); move32(); L_tmp_e = add( L_tmp_e, sub( dot_prod_nrg_ratio_fx_e[b2], L_tmp2_e ) ); dot_prod_nrg_ratio_fx[b2] = L_shl( dot_prod_nrg_ratio_fx[b2], L_tmp_e ); // Q31 @@ -3691,7 +3691,7 @@ static void stereo_dft_enc_compute_prm_fx( } // c = sqrtf( sum_past_nrgL / sum_past_nrgR ); - c = BASOP_Util_Divide3232_Scale_cadence( sum_past_nrgL, sum_past_nrgR, &c_e ); + c = BASOP_Util_Divide3232_Scale_newton( sum_past_nrgL, sum_past_nrgR, &c_e ); c_e = add( c_e, sub( sum_past_nrgL_e, sum_past_nrgR_e ) ); c = Sqrt32( c, &c_e ); // sum_past_nrg_dmx = sum_past_nrgL + sum_past_nrgR + 2 * sum_past_dot_prod_abs; @@ -3718,7 +3718,7 @@ static void stereo_dft_enc_compute_prm_fx( { // g = ( sum_past_nrgL - sum_past_nrgR ) / ( sum_past_nrg_dmx ); L_tmp1 = BASOP_Util_Add_Mant32Exp( sum_past_nrgL, sum_past_nrgL_e, L_negate( sum_past_nrgR ), sum_past_nrgR_e, &L_tmp1_e ); - L_tmp = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, sum_past_nrg_dmx, &L_tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( L_tmp1, sum_past_nrg_dmx, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, sum_past_nrg_dmx_e ) ); g = L_shl_sat( L_tmp, L_tmp_e ); // Q31 saturation expected pSideGain[b] = g; @@ -3731,7 +3731,7 @@ static void stereo_dft_enc_compute_prm_fx( // pSideGain[b] = ( c - 1 ) / ( c + 1 ); L_tmp1 = BASOP_Util_Add_Mant32Exp( c, c_e, MIN_32, 0, &L_tmp1_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( c, c_e, MAX_32, 0, &L_tmp2_e ); - L_tmp = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, L_tmp2_e ) ); pSideGain[b] = L_shl_sat( L_tmp, L_tmp_e ); // Q31 saturation expected move32(); @@ -3774,7 +3774,7 @@ static void stereo_dft_enc_compute_prm_fx( // pPredGain[b] = sqrtf( pPredGain[b] / ( reg + sum_past_nrg_dmx ) ); L_tmp2 = BASOP_Util_Add_Mant32Exp( reg, reg_e, sum_past_nrg_dmx, sum_past_nrg_dmx_e, &L_tmp2_e ); - L_tmp1 = BASOP_Util_Divide3232_Scale_cadence( L_tmp, L_tmp2, &L_tmp1_e ); + L_tmp1 = BASOP_Util_Divide3232_Scale_newton( L_tmp, L_tmp2, &L_tmp1_e ); L_tmp1_e = add( L_tmp1_e, sub( L_tmp_e, L_tmp2_e ) ); L_tmp1 = Sqrt32( L_tmp1, &L_tmp1_e ); pPredGain[b] = L_shl( L_tmp1, L_tmp1_e ); // Q31 @@ -3913,14 +3913,14 @@ static void stereo_dft_enc_compute_prm_fx( } // c = sqrtf( sum_energy_L / sum_energy_R ); - c = BASOP_Util_Divide3232_Scale_cadence( sum_energy_L, sum_energy_R, &c_e ); + c = BASOP_Util_Divide3232_Scale_newton( sum_energy_L, sum_energy_R, &c_e ); c_e = add( c_e, sub( sum_energy_L_e, sum_energy_R_e ) ); c = Sqrt32( c, &c_e ); // g = fabsf( ( c - 1 ) / ( c + 1 ) ); L_tmp1 = BASOP_Util_Add_Mant32Exp( c, c_e, MIN_32, 0, &L_tmp1_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( c, c_e, MAX_32, 0, &L_tmp2_e ); - g = L_abs( BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp_e ) ); + g = L_abs( BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp_e ) ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, L_tmp2_e ) ); g = L_shl_sat( g, L_tmp_e ); // Q31 saturation expected IF( GT_32( g, 1717986918 /*0.8f in Q31*/ ) ) @@ -4326,7 +4326,7 @@ static Word32 stereo_dft_calc_mean_ipd_change_fx( ipd_mean_change = L_add( ipd_mean_change, ipd_change[b] ); } // ipd_mean_change /= gipd_band_max; - ipd_mean_change = BASOP_Util_Divide3232_Scale_cadence( ipd_mean_change, gipd_band_max, &ipd_mean_change_e ); + ipd_mean_change = BASOP_Util_Divide3232_Scale_newton( ipd_mean_change, gipd_band_max, &ipd_mean_change_e ); ipd_mean_change_e = add( ipd_mean_change_e, 18 - 31 ); ipd_mean_change = L_shr( ipd_mean_change, sub( 18, ipd_mean_change_e ) ); // Q13 @@ -4510,13 +4510,13 @@ static void stereo_dft_enc_get_reverb_flag_fx( FOR( b = 0; b <= s_min( hStereoDft->nbands, 6 ); b++ ) /* choose the subbands used for stereo filling */ { // norm_dmx = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_DMX[b]); - norm_dmx = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_DMX[b], &norm_dmx_e ); + norm_dmx = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_DMX[b], &norm_dmx_e ); norm_dmx_e = add( norm_dmx_e, sub( 31, sub_nrg_DMX_e[b] ) ); // norm_l = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_L[b]); - norm_l = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_L[b], &norm_l_e ); + norm_l = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_L[b], &norm_l_e ); norm_l_e = add( norm_l_e, sub( 31, sub_nrg_L_e[b] ) ); // norm_r = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_R[b]); - norm_r = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_R[b], &norm_r_e ); + norm_r = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_R[b], &norm_r_e ); norm_r_e = add( norm_r_e, sub( 31, sub_nrg_R_e[b] ) ); FOR( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) /* normalization on each subbands */ @@ -4562,13 +4562,13 @@ static void stereo_dft_enc_get_reverb_flag_fx( FOR( ; b < s_min( hStereoDft->nbands, 10 ); b++ ) /* choose the subbands used for stereo filling */ { // norm_dmx = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_DMX[b]); - norm_dmx = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_DMX[b], &norm_dmx_e ); + norm_dmx = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_DMX[b], &norm_dmx_e ); norm_dmx_e = add( norm_dmx_e, sub( 31, sub_nrg_DMX_e[b] ) ); // norm_l = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_L[b]); - norm_l = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_L[b], &norm_l_e ); + norm_l = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_L[b], &norm_l_e ); norm_l_e = add( norm_l_e, sub( 31, sub_nrg_L_e[b] ) ); // norm_r = ((hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]) / sub_nrg_R[b]); - norm_r = BASOP_Util_Divide3232_Scale_cadence( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_R[b], &norm_r_e ); + norm_r = BASOP_Util_Divide3232_Scale_newton( sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), sub_nrg_R[b], &norm_r_e ); norm_r_e = add( norm_r_e, sub( 31, sub_nrg_R_e[b] ) ); FOR( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) /* normalization on each subbands */ @@ -4614,7 +4614,7 @@ static void stereo_dft_enc_get_reverb_flag_fx( FOR( b = 0; b < hStereoDft->nbands; b++ ) /* choose the subbands used for stereo filling */ { // sub_nrg_DMX[b] /= (hStereoDft->band_limits[b + 1] - hStereoDft->band_limits[b]); - sub_nrg_DMX[b] = BASOP_Util_Divide3232_Scale_cadence( sub_nrg_DMX[b], sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), &L_tmp_e ); + sub_nrg_DMX[b] = BASOP_Util_Divide3232_Scale_newton( sub_nrg_DMX[b], sub( hStereoDft->band_limits[b + 1], hStereoDft->band_limits[b] ), &L_tmp_e ); move32(); sub_nrg_DMX_e[b] = add( L_tmp_e, sub( sub_nrg_DMX_e[b], 31 ) ); move16(); @@ -4735,12 +4735,12 @@ static void stereo_dft_enc_get_reverb_flag_fx( // fac = ((diff_l_l > diff_r_l) ? diff_r_l / diff_l_l : diff_l_l / diff_r_l); IF( BASOP_Util_Cmp_Mant32Exp( diff_l_l, diff_l_l_e, diff_r_l, diff_r_l_e ) > 0 ) { - fac = BASOP_Util_Divide3232_Scale_cadence( diff_r_l, diff_l_l, &L_tmp_e ); + fac = BASOP_Util_Divide3232_Scale_newton( diff_r_l, diff_l_l, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( diff_r_l_e, diff_l_l_e ) ); } ELSE { - fac = BASOP_Util_Divide3232_Scale_cadence( diff_l_l, diff_r_l, &L_tmp_e ); + fac = BASOP_Util_Divide3232_Scale_newton( diff_l_l, diff_r_l, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( diff_l_l_e, diff_r_l_e ) ); } fac = L_shl_sat( fac, L_tmp_e ); // Q31 @@ -4792,7 +4792,7 @@ static Word32 stereo_dft_gain_offset_fx( * function @ 32kHz from which the values are interpolated: */ k0 = shr( tau, 3 ); // alpha = s_and(tau, 7) / 8.f; - alpha = BASOP_Util_Divide3232_Scale_cadence( s_and( tau, 7 ), 8, &alpha_e ); + alpha = BASOP_Util_Divide3232_Scale_newton( s_and( tau, 7 ), 8, &alpha_e ); alpha = L_shl( alpha, alpha_e ); // Q31 // wnt = (1 - alpha) * Wn_table[k0] + alpha * Wn_table[k0 + 1]; wnt = L_add( Mpy_32_32( L_sub( MAX_32, alpha ), Wn_table_fx[k0] ), Mpy_32_32( alpha, Wn_table_fx[k0 + 1] ) ); // Q31 @@ -4803,12 +4803,12 @@ static Word32 stereo_dft_gain_offset_fx( L_tmp1 = BASOP_Util_Add_Mant32Exp( MAX_32, 0, c, c_e, &L_tmp1_e ); L_tmp1 = Mpy_32_32( L_tmp1, L_tmp1 ); L_tmp1_e = shl( L_tmp1_e, 1 ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( L_tmp, L_tmp1, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( L_tmp, L_tmp1, &L_tmp2_e ); L_tmp2_e = add( add( L_tmp2_e, sub( L_tmp_e, L_tmp1_e ) ), 3 /*multiply by 8*/ ); L_tmp2 = Mpy_32_32( L_tmp2, L_sub( MAX_32, wnt ) ); L_tmp1 = BASOP_Util_Add_Mant32Exp( MAX_32, 0, L_tmp, L_tmp_e, &L_tmp1_e ); L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp1, L_tmp1_e, Mpy_32_32( c, wnt ), add( c_e, 1 ), &L_tmp1_e ); - L_tmp = BASOP_Util_Divide3232_Scale_cadence( L_tmp2, L_tmp1, &L_tmp_e ); + L_tmp = BASOP_Util_Divide3232_Scale_newton( L_tmp2, L_tmp1, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp2_e, L_tmp1_e ) ); L_tmp = Sqrt32( L_tmp, &L_tmp_e ); go = L_shl( L_tmp, L_tmp_e ); @@ -4838,7 +4838,7 @@ static void stereo_dft_enc_calculate_nrg_for_icbwe_fx( Word32 tmp; // bandResDft = ( (float) input_Fs ) / hStereoDft->NFFT; - bandResDft = BASOP_Util_Divide3232_Scale_cadence( input_Fs, hStereoDft->NFFT, &bandResDft_e ); + bandResDft = BASOP_Util_Divide3232_Scale_newton( input_Fs, hStereoDft->NFFT, &bandResDft_e ); // shbBins[0] = (int16_t) ( 6400 / bandResDft ); shbBins[0] = BASOP_Util_Divide3232_Scale( 6400, bandResDft, &tmp_e ); move16(); diff --git a/lib_enc/ivas_stereo_dft_enc_itd_fx.c b/lib_enc/ivas_stereo_dft_enc_itd_fx.c index b7429e2e7..1beacd19a 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_itd_fx.c @@ -232,7 +232,7 @@ static Word32 itd_vad_ms_snr_calc_fx( move32(); } // E_band[i] = E_band[i] / ( itd_vad_band_tbl[i + 1] - itd_vad_band_tbl[i] ); - E_band[i] = BASOP_Util_Divide3232_Scale_cadence( E_band[i], L_sub( itd_vad_band_tbl[i + 1], itd_vad_band_tbl[i] ), &exp ); + E_band[i] = BASOP_Util_Divide3232_Scale_newton( E_band[i], L_sub( itd_vad_band_tbl[i + 1], itd_vad_band_tbl[i] ), &exp ); move32(); E_band_e[i] = add( exp, sub( E_band_e[i], 31 ) ); move16(); @@ -245,7 +245,7 @@ static Word32 itd_vad_ms_snr_calc_fx( FOR( i = 0; i < STEREO_DFT_ITD_VAD_BAND_NUM; i++ ) { // snr[i] = E_band[i] / E_band_n[i]; - snr[i] = BASOP_Util_Divide3232_Scale_cadence( E_band[i], E_band_n[i], &snr_e[i] ); + snr[i] = BASOP_Util_Divide3232_Scale_newton( E_band[i], E_band_n[i], &snr_e[i] ); move32(); snr_e[i] = add( snr_e[i], sub( E_band_e[i], E_band_n_exp[i] ) ); move16(); @@ -327,7 +327,7 @@ static void itd_vad_background_update_fx( L_temp = L_shl( *vad_frm_cnt, q_temp ); L_temp_e = sub( 31, q_temp ); L_temp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( E_band_n[i], L_temp ), add( E_band_n_exp[i], L_temp_e ), E_band[i], E_band_e[i], &L_temp_e ); - E_band_n[i] = BASOP_Util_Divide3232_Scale_cadence( L_temp, L_add( *vad_frm_cnt, 1 ), &E_band_n_e_tmp ); + E_band_n[i] = BASOP_Util_Divide3232_Scale_newton( L_temp, L_add( *vad_frm_cnt, 1 ), &E_band_n_e_tmp ); move32(); E_band_n_exp[i] = add( E_band_n_e_tmp, sub( L_temp_e, 31 ) ); move16(); @@ -536,7 +536,7 @@ static Word32 calc_mean_E_ratio_fx( L_temp1 = BASOP_Util_Add_Mant32Exp( acorr, acorr_e, fi[b], fi_e[b], &L_temp1_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( acorr, acorr_e, L_negate( fi[b] ), fi_e[b], &L_temp2_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( L_temp2, L_temp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_temp2_e ); - Er[b] = BASOP_Util_Divide3232_Scale_cadence( L_temp1, L_temp2, &Er_e[b] ); + Er[b] = BASOP_Util_Divide3232_Scale_newton( L_temp1, L_temp2, &Er_e[b] ); move32(); Er_e[b] = add( Er_e[b], sub( L_temp1_e, L_temp2_e ) ); move16(); @@ -585,7 +585,7 @@ static Word32 calc_mean_E_ratio_fx( L_temp1 = BASOP_Util_Add_Mant32Exp( acorr, acorr_e, total_fi, total_fi_e, &L_temp1_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( acorr, acorr_e, L_negate( total_fi ), total_fi_e, &L_temp2_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( L_temp2, L_temp2_e, EPSILON_FX_M, EPSILON_FX_E, &L_temp2_e ); - *total_mEr = BASOP_Util_Divide3232_Scale_cadence( L_temp1, L_temp2, total_mEr_e ); + *total_mEr = BASOP_Util_Divide3232_Scale_newton( L_temp1, L_temp2, total_mEr_e ); move32(); *total_mEr_e = add( *total_mEr_e, sub( L_temp1_e, L_temp2_e ) ); move16(); @@ -1302,14 +1302,14 @@ void stereo_dft_enc_compute_itd_fx( // g_ILD = sqrtf( sum_nrg_L / ( sum_nrg_R + 1.0f ) ); L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_R, sum_nrg_R_e, MAX_32, 0, &L_temp_e ); - g_ILD = BASOP_Util_Divide3232_Scale_cadence( sum_nrg_L, L_temp, &g_ILD_e ); + g_ILD = BASOP_Util_Divide3232_Scale_newton( sum_nrg_L, L_temp, &g_ILD_e ); g_ILD_e = add( g_ILD_e, sub( sum_nrg_L_e, L_temp_e ) ); g_ILD = Sqrt32( g_ILD, &g_ILD_e ); // g_ILD = fabsf( ( g_ILD - 1 ) / ( g_ILD + 1 ) ); L_temp = BASOP_Util_Add_Mant32Exp( g_ILD, g_ILD_e, MIN_32, 0, &L_temp_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( g_ILD, g_ILD_e, MAX_32, 0, &L_temp2_e ); - g_ILD = L_abs( BASOP_Util_Divide3232_Scale_cadence( L_temp, L_temp2, &g_ILD_e ) ); + g_ILD = L_abs( BASOP_Util_Divide3232_Scale_newton( L_temp, L_temp2, &g_ILD_e ) ); g_ILD_e = add( g_ILD_e, sub( L_temp_e, L_temp2_e ) ); g_ILD = L_shl_sat( g_ILD, g_ILD_e ); // Q31 @@ -1339,7 +1339,7 @@ void stereo_dft_enc_compute_itd_fx( // g_IPD = ( sum_nrg_L + sum_nrg_R + 2 * grand_dot_prod_real ) / grand_nrg_DMX; L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, sum_nrg_R, sum_nrg_R_e, &L_temp_e ); L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, grand_dot_prod_real, add( grand_dot_prod_real_e, 1 ), &L_temp_e ); - g_IPD = BASOP_Util_Divide3232_Scale_cadence( L_temp, grand_nrg_DMX, &g_IPD_e ); + g_IPD = BASOP_Util_Divide3232_Scale_newton( L_temp, grand_nrg_DMX, &g_IPD_e ); g_IPD_e = add( g_IPD_e, sub( L_temp_e, grand_nrg_DMX_e ) ); // if ( g_IPD >= 1.0f ) IF( BASOP_Util_Cmp_Mant32Exp( g_IPD, g_IPD_e, ONE_IN_Q29 - ONE_IN_Q14 /*Adjusting threshold for precision loss*/, 2 ) >= 0 ) @@ -1366,7 +1366,7 @@ void stereo_dft_enc_compute_itd_fx( // angle_rot = fabsf( atanf( 2.0f * ( grand_dot_prod_real ) / ( sum_nrg_L - sum_nrg_R + 1.0f ) ) ); L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, L_negate( sum_nrg_R ), sum_nrg_R_e, &L_temp_e ); L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, MAX_32, 0, &L_temp_e ); - L_temp2 = BASOP_Util_Divide3232_Scale_cadence( grand_dot_prod_real, L_temp, &L_temp2_e ); + L_temp2 = BASOP_Util_Divide3232_Scale_newton( grand_dot_prod_real, L_temp, &L_temp2_e ); L_temp2_e = add( L_temp2_e, sub( add( grand_dot_prod_real_e, 1 ), L_temp_e ) ); angle_rot = L_abs( BASOP_util_atan( L_shr_r_sat( L_temp2, ( sub( 6, L_temp2_e ) ) ) ) ); // Q14 // angle_rot = L_abs( BASOP_util_atan2( grand_dot_prod_real, L_temp, sub( add( grand_dot_prod_real_e, 1 ), L_temp_e ) ) ); // Q13 @@ -1378,7 +1378,7 @@ void stereo_dft_enc_compute_itd_fx( // g_side = fabsf( sum_nrg_L - sum_nrg_R ) / ( grand_nrg_DMX ); L_temp = L_abs( BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, L_negate( sum_nrg_R ), sum_nrg_R_e, &L_temp_e ) ); - g_side = BASOP_Util_Divide3232_Scale_cadence( L_temp, grand_nrg_DMX, &g_side_e ); + g_side = BASOP_Util_Divide3232_Scale_newton( L_temp, grand_nrg_DMX, &g_side_e ); g_side_e = add( g_side_e, sub( L_temp_e, grand_nrg_DMX_e ) ); g_side = L_shl_sat( g_side, g_side_e ); // Q31 g_side_e = 0; @@ -1443,7 +1443,7 @@ void stereo_dft_enc_compute_itd_fx( ELSE { // sfm_L = expf( log_prod_L / ( NFFT_mid ) ) / ( sum_abs_L / ( NFFT_mid ) ); - L_temp = BASOP_Util_Divide3232_Scale_cadence( log_prod_L, NFFT_mid, &L_temp_e ); + L_temp = BASOP_Util_Divide3232_Scale_newton( log_prod_L, NFFT_mid, &L_temp_e ); L_temp_e = add( L_temp_e, sub( log_prod_L_e, 31 ) ); L_temp = BASOP_Util_fPow( 1459366444 /*2.718 in Q29*/, 2, L_temp, L_temp_e, &L_temp_e ); q_temp = norm_l( NFFT_mid ); @@ -1451,7 +1451,7 @@ void stereo_dft_enc_compute_itd_fx( L_temp2_e = sub( 31, q_temp ); L_temp = Mpy_32_32( L_temp, L_temp2 ); L_temp_e = add( L_temp_e, L_temp2_e ); - sfm_L = BASOP_Util_Divide3232_Scale_cadence( L_temp, sum_abs_L, &sfm_L_e ); + sfm_L = BASOP_Util_Divide3232_Scale_newton( L_temp, sum_abs_L, &sfm_L_e ); sfm_L_e = add( sfm_L_e, sub( L_temp_e, sum_abs_L_e ) ); sfm_L = L_shl_sat( sfm_L, sfm_L_e ); // Q31 - should be rechecked for -10dB tests } @@ -1467,7 +1467,7 @@ void stereo_dft_enc_compute_itd_fx( ELSE { // sfm_R = expf( log_prod_R / ( NFFT_mid ) ) / ( sum_abs_R / ( NFFT_mid ) ); - L_temp = BASOP_Util_Divide3232_Scale_cadence( log_prod_R, NFFT_mid, &L_temp_e ); + L_temp = BASOP_Util_Divide3232_Scale_newton( log_prod_R, NFFT_mid, &L_temp_e ); L_temp_e = add( L_temp_e, sub( log_prod_R_e, 31 ) ); L_temp = BASOP_Util_fPow( 1459366444 /*2.718 in Q29*/, 2, L_temp, L_temp_e, &L_temp_e ); q_temp = norm_l( NFFT_mid ); @@ -1475,7 +1475,7 @@ void stereo_dft_enc_compute_itd_fx( L_temp2_e = sub( 31, q_temp ); L_temp = Mpy_32_32( L_temp, L_temp2 ); L_temp_e = add( L_temp_e, L_temp2_e ); - sfm_R = BASOP_Util_Divide3232_Scale_cadence( L_temp, sum_abs_R, &sfm_L_e ); + sfm_R = BASOP_Util_Divide3232_Scale_newton( L_temp, sum_abs_R, &sfm_L_e ); sfm_R_e = add( sfm_L_e, sub( L_temp_e, sum_abs_R_e ) ); // sfm_R = L_shl_r( sfm_R, sfm_R_e ); // Q31 sfm_R = L_shl_sat( sfm_R, sfm_R_e ); // Q31 @@ -1663,7 +1663,7 @@ void stereo_dft_enc_compute_itd_fx( } // cng_xcorr_filt = max( min( CORR_FILT, 10.0f * CORR_FILT / ( hStereoDft->expectedNumUpdates + hStereoDft->currentNumUpdates ) ), sfm_L ); - cng_xcorr_filt = BASOP_Util_Divide3232_Scale_cadence( 8 /*10.0f * CORR_FILT*/, add( hStereoDft->expectedNumUpdates, hStereoDft->currentNumUpdates ), &cng_xcorr_filt_e ); + cng_xcorr_filt = BASOP_Util_Divide3232_Scale_newton( 8 /*10.0f * CORR_FILT*/, add( hStereoDft->expectedNumUpdates, hStereoDft->currentNumUpdates ), &cng_xcorr_filt_e ); cng_xcorr_filt = L_shl_sat( cng_xcorr_filt, cng_xcorr_filt_e ); // Q31 cng_xcorr_filt = L_max( L_min( CORR_FILT_Q31, cng_xcorr_filt ), sfm_L ); // Q31 @@ -1724,7 +1724,7 @@ void stereo_dft_enc_compute_itd_fx( // cng_xcorr_filt = max( min( CORR_FILT, 10.0f * CORR_FILT / ( hStereoDft->expectedNumUpdates + hStereoDft->currentNumUpdates ) ), sfm_L ); IF( add( hStereoDft->expectedNumUpdates, hStereoDft->currentNumUpdates ) != 0 ) { - cng_xcorr_filt = BASOP_Util_Divide3232_Scale_cadence( 8 /*10.0f * CORR_FILT*/, add( hStereoDft->expectedNumUpdates, hStereoDft->currentNumUpdates ), &cng_xcorr_filt_e ); + cng_xcorr_filt = BASOP_Util_Divide3232_Scale_newton( 8 /*10.0f * CORR_FILT*/, add( hStereoDft->expectedNumUpdates, hStereoDft->currentNumUpdates ), &cng_xcorr_filt_e ); cng_xcorr_filt = L_shl_sat( cng_xcorr_filt, cng_xcorr_filt_e ); // Q31 cng_xcorr_filt = L_max( L_min( CORR_FILT_Q31, cng_xcorr_filt ), sfm_L ); // Q31 } @@ -1917,7 +1917,7 @@ void stereo_dft_enc_compute_itd_fx( } // tmpf1 = (float) ( NFFT / 2 + 1 ) / tmpf3; - tmpf1 = BASOP_Util_Divide3232_Scale_cadence( add( shr( NFFT, 1 ), 1 ), tmpf3, &tmpf1_e ); + tmpf1 = BASOP_Util_Divide3232_Scale_newton( add( shr( NFFT, 1 ), 1 ), tmpf3, &tmpf1_e ); tmpf1_e = add( tmpf1_e, sub( 31, tmpf3_e ) ); FOR( i = 0; i < NFFT; i++ ) { @@ -1995,7 +1995,7 @@ void stereo_dft_enc_compute_itd_fx( L_temp = L_abs( BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, L_negate( sum_nrg_R ), sum_nrg_R_e, &L_temp_e ) ); L_temp2 = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, sum_nrg_R, sum_nrg_R_e, &L_temp2_e ); L_temp2 = BASOP_Util_Add_Mant32Exp( L_temp2, L_temp2_e, 1407374883, -16, &L_temp2_e ); - es_em = BASOP_Util_Divide3232_Scale_cadence( L_temp, L_temp2, &es_em_e ); + es_em = BASOP_Util_Divide3232_Scale_newton( L_temp, L_temp2, &es_em_e ); es_em_e = add( es_em_e, sub( L_temp_e, L_temp2_e ) ); hStereoClassif->unclr_fv_fx[E_es_em] = L_shr_r( es_em, sub( 16, es_em_e ) ); // Q15 @@ -2027,7 +2027,7 @@ void stereo_dft_enc_compute_itd_fx( move16(); } L_temp2 = BASOP_Util_Add_Mant32Exp( L_temp2, L_temp2_e, 1407374883, -16, &L_temp2_e ); - d_prodL_prodR = BASOP_Util_Divide3232_Scale_cadence( L_temp, L_temp2, &d_prodL_prodR_e ); + d_prodL_prodR = BASOP_Util_Divide3232_Scale_newton( L_temp, L_temp2, &d_prodL_prodR_e ); d_prodL_prodR_e = add( d_prodL_prodR_e, sub( L_temp_e, L_temp2_e ) ); d_prodL_prodR = BASOP_Util_Add_Mant32Exp( d_prodL_prodR, d_prodL_prodR_e, MAX_32, 0, &d_prodL_prodR_e ); d_prodL_prodR = BASOP_Util_Loge( d_prodL_prodR, d_prodL_prodR_e ); // Q25 @@ -2046,7 +2046,7 @@ void stereo_dft_enc_compute_itd_fx( // xcorr_abs[i] = logf( xcorr_abs[i] / ( sum_nrg_L + sum_nrg_R + 1e-5f ) + 1e-5f ); L_temp = BASOP_Util_Add_Mant32Exp( sum_nrg_L, sum_nrg_L_e, sum_nrg_R, sum_nrg_R_e, &L_temp_e ); L_temp = BASOP_Util_Add_Mant32Exp( L_temp, L_temp_e, 1407374883, -16, &L_temp_e ); - L_temp2 = BASOP_Util_Divide3232_Scale_cadence( xcorr_abs[i], L_temp, &L_temp2_e ); + L_temp2 = BASOP_Util_Divide3232_Scale_newton( xcorr_abs[i], L_temp, &L_temp2_e ); L_temp2_e = add( L_temp2_e, sub( xcorr_abs_e[i], L_temp_e ) ); L_temp2 = BASOP_Util_Add_Mant32Exp( L_temp2, L_temp2_e, 1407374883, -16, &L_temp2_e ); xcorr_abs[i] = BASOP_Util_Loge( L_temp2, L_temp2_e ); @@ -2112,12 +2112,12 @@ void stereo_dft_enc_compute_itd_fx( move16(); // hStereoClassif->ave_ener_L = sum_nrg_L / ( NFFT_mid * NFFT_mid ); - hStereoClassif->ave_ener_L_fx = BASOP_Util_Divide3232_Scale_cadence( sum_nrg_L, L_mult0( NFFT_mid, NFFT_mid ), &hStereoClassif->ave_ener_L_fx_e ); + hStereoClassif->ave_ener_L_fx = BASOP_Util_Divide3232_Scale_newton( sum_nrg_L, L_mult0( NFFT_mid, NFFT_mid ), &hStereoClassif->ave_ener_L_fx_e ); move32(); hStereoClassif->ave_ener_L_fx_e = add( hStereoClassif->ave_ener_L_fx_e, sub( sum_nrg_L_e, 31 ) ); move16(); // hStereoClassif->ave_ener_R = sum_nrg_R / ( NFFT_mid * NFFT_mid ); - hStereoClassif->ave_ener_R_fx = BASOP_Util_Divide3232_Scale_cadence( sum_nrg_R, L_mult0( NFFT_mid, NFFT_mid ), &hStereoClassif->ave_ener_R_fx_e ); + hStereoClassif->ave_ener_R_fx = BASOP_Util_Divide3232_Scale_newton( sum_nrg_R, L_mult0( NFFT_mid, NFFT_mid ), &hStereoClassif->ave_ener_R_fx_e ); move32(); hStereoClassif->ave_ener_R_fx_e = add( hStereoClassif->ave_ener_R_fx_e, sub( sum_nrg_R_e, 31 ) ); move16(); @@ -2145,7 +2145,7 @@ void stereo_dft_enc_compute_itd_fx( { // thres *= 1.0f + 1.f * min( 1.f, max( 0.f, ( -1.0f * sfm_L + 0.5f ) / ( 0.5f - 0.2f ) ) ); L_temp = BASOP_Util_Add_Mant32Exp( L_negate( sfm_L ), 0, ONE_IN_Q30, 0, &L_temp_e ); - L_temp2 = BASOP_Util_Divide3232_Scale_cadence( L_temp, 644245094, &L_temp2_e ); + L_temp2 = BASOP_Util_Divide3232_Scale_newton( L_temp, 644245094, &L_temp2_e ); L_temp2_e = add( L_temp2_e, L_temp_e - 0 ); L_temp2 = L_shl_sat( L_temp2, sub( L_temp2_e, 1 ) ); // Q30 L_temp2_e = 1; @@ -2363,7 +2363,7 @@ void stereo_dft_enc_compute_itd_fx( L_temp = Mpy_32_32( den_cor_cur, den_cor_prev ); L_temp_e = add( den_cor_cur_e, den_cor_prev_e ); L_temp = Sqrt32( L_temp, &L_temp_e ); - cor_lb[i] = BASOP_Util_Divide3232_Scale_cadence( num_cor, L_temp, &cor_lb_e[i] ); + cor_lb[i] = BASOP_Util_Divide3232_Scale_newton( num_cor, L_temp, &cor_lb_e[i] ); move32(); cor_lb_e[i] = add( cor_lb_e[i], sub( num_cor_e, L_temp_e ) ); move16(); @@ -2375,7 +2375,7 @@ void stereo_dft_enc_compute_itd_fx( // par_L[i] = xcorr_max / ( sum_nrg_L_tmp + FLT_MIN ); IF( xcorr_max ) { - par_L[i] = BASOP_Util_Divide3232_Scale_cadence( xcorr_max, sum_nrg_L_tmp, &par_L_e[i] ); + par_L[i] = BASOP_Util_Divide3232_Scale_newton( xcorr_max, sum_nrg_L_tmp, &par_L_e[i] ); move32(); par_L_e[i] = add( par_L_e[i], sub( xcorr_max_e, sum_nrg_L_tmp_e ) ); move16(); diff --git a/lib_enc/ivas_stereo_eclvq_enc_fx.c b/lib_enc/ivas_stereo_eclvq_enc_fx.c index 3abc07811..dc2cf18a0 100644 --- a/lib_enc/ivas_stereo_eclvq_enc_fx.c +++ b/lib_enc/ivas_stereo_eclvq_enc_fx.c @@ -89,7 +89,7 @@ void ECSQ_quantize_vector_fx( } ELSE { - inv_global_gain = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q15, global_gain, &inv_global_gain_e ); + inv_global_gain = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q15, global_gain, &inv_global_gain_e ); inv_global_gain = L_shl( inv_global_gain, inv_global_gain_e ); // Q31 FOR( i = 0; i < N; ++i ) { @@ -140,7 +140,7 @@ Word32 ECSQ_compute_optimal_gain_fx( // Q15 IF( sum_sq_output != 0 ) { // optimal_global_gain = sum_input_output / sum_sq_output; - optimal_global_gain = BASOP_Util_Divide3232_Scale_cadence( sum_input_output, sum_sq_output, &optimal_global_gain_e ); // 31 - ( sum_input_output_e - 31 + optimal_global_gain_e ) = 62 - ( sum_input_output_e + optimal_global_gain_e ) + optimal_global_gain = BASOP_Util_Divide3232_Scale_newton( sum_input_output, sum_sq_output, &optimal_global_gain_e ); // 31 - ( sum_input_output_e - 31 + optimal_global_gain_e ) = 62 - ( sum_input_output_e + optimal_global_gain_e ) optimal_global_gain = L_shr( optimal_global_gain, sub( sub( 62, add( sum_input_output_e, optimal_global_gain_e ) ), 15 ) ); // Q15 } @@ -427,7 +427,7 @@ static Word16 get_best_param_fx( IF( LE_16( sub( count, count0 ), ECSQ_NONZERO_MAX ) && EQ_32( sum_abs, L_shl( sub( count, count0 ), 10 ) ) ) { //*avg_abs_sum = ( sum_abs + 0.25f * count0 ) / count; - *avg_abs_sum = BASOP_Util_Divide3232_Scale_cadence( L_add( sum_abs, L_shl( count0, 8 ) ), L_shl( count, 10 ), &L_tmp_e ); + *avg_abs_sum = BASOP_Util_Divide3232_Scale_newton( L_add( sum_abs, L_shl( count0, 8 ) ), L_shl( count, 10 ), &L_tmp_e ); move32(); *avg_abs_sum = L_shr_r( *avg_abs_sum, sub( 21, L_tmp_e ) ); // Q10 move32(); @@ -438,7 +438,7 @@ static Word16 get_best_param_fx( } //*avg_abs_sum = ( sum_abs + 0.25f * count0 ) / count; - *avg_abs_sum = BASOP_Util_Divide3232_Scale_cadence( L_add( sum_abs, L_shl( count0, 8 ) ), L_shl( count, 10 ), &L_tmp_e ); + *avg_abs_sum = BASOP_Util_Divide3232_Scale_newton( L_add( sum_abs, L_shl( count0, 8 ) ), L_shl( count, 10 ), &L_tmp_e ); move32(); *avg_abs_sum = L_shr_r( *avg_abs_sum, sub( 21, L_tmp_e ) ); // Q10 move32(); @@ -478,7 +478,7 @@ static Word32 get_est_size_fx( // Q10 // if ( param < 0 ) //{ // //two_to_param = 1.0f / two_to_param; - // two_to_param = BASOP_Util_Divide3232_Scale_cadence( 1, two_to_param,&two_to_param_e); + // two_to_param = BASOP_Util_Divide3232_Scale_newton( 1, two_to_param,&two_to_param_e); // } IF( NE_16( param, ECSQ_ALL_ZERO_PARAM ) ) /* not all values are zeros */ @@ -508,7 +508,7 @@ static Word32 get_est_size_fx( // Q10 nonzero = sub( N, N0 ); // required_avg_abs_sum = ( nonzero + 0.25f * N0 ) / N; /* the vector must have nonzero +-1 and N0 zeros */ - required_avg_abs_sum = BASOP_Util_Divide3232_Scale_cadence( L_add( L_shl( nonzero, 10 ), L_shl( N0, 8 ) ), L_shl( N, 10 ), &required_avg_abs_sum_e ); /* the vector must have nonzero +-1 and N0 zeros */ + required_avg_abs_sum = BASOP_Util_Divide3232_Scale_newton( L_add( L_shl( nonzero, 10 ), L_shl( N0, 8 ) ), L_shl( N, 10 ), &required_avg_abs_sum_e ); /* the vector must have nonzero +-1 and N0 zeros */ required_avg_abs_sum = L_shr_r( required_avg_abs_sum, sub( 21, required_avg_abs_sum_e ) ); // Q10 test(); @@ -847,18 +847,18 @@ Word32 ECSQ_encode_target_SNR_fx( /* target_ratio is the target ratio between the sum squared values of input and sum squared values of quantization error */ // target_ratio = powf( 10.0f, target_SNR / 10.0f ); - L_tmp1 = BASOP_Util_Divide3232_Scale_cadence( target_SNR, 10, &L_tmp1_e ); + L_tmp1 = BASOP_Util_Divide3232_Scale_newton( target_SNR, 10, &L_tmp1_e ); L_tmp1_e = add( L_tmp1_e, 6 - 31 ); target_ratio = BASOP_Util_fPow( 10 << 27, 4, L_tmp1, L_tmp1_e, &target_ratio_e ); // target_sum_squared_error = sum_squared / target_ratio; - target_sum_squared_error = BASOP_Util_Divide3232_Scale_cadence( sum_squared, target_ratio, &target_sum_squared_error_e ); + target_sum_squared_error = BASOP_Util_Divide3232_Scale_newton( sum_squared, target_ratio, &target_sum_squared_error_e ); target_sum_squared_error_e = add( target_sum_squared_error_e, sub( sum_squared_e, target_ratio_e ) ); /* the mean of squared quantization error for uniform scalar quantization is 1 / 12, approximately 0.0833 */ /* when including global_gain, the relationship is target_sum_squared_error ~ (0.0833 * N) * global_gain ^ 2 */ /* the representable range for global_gain is from 1 (global_gain_index 0) to 29145 (global_gain_index 126) inclusive */ // global_gain = sqrtf( target_sum_squared_error / ( 0.0833f * (float) N ) ); - global_gain = BASOP_Util_Divide3232_Scale_cadence( target_sum_squared_error, L_mult0( 5459 /*0.0833f in Q16*/, N ), &global_gain_e ); + global_gain = BASOP_Util_Divide3232_Scale_newton( target_sum_squared_error, L_mult0( 5459 /*0.0833f in Q16*/, N ), &global_gain_e ); global_gain_e = add( global_gain_e, sub( target_sum_squared_error_e, 15 ) ); global_gain = Sqrt32( global_gain, &global_gain_e ); global_gain = L_shr( global_gain, sub( 16, global_gain_e ) ); // Q15 @@ -885,7 +885,7 @@ Word32 ECSQ_encode_target_SNR_fx( adjust_size = L_sub( test_size, max_bits_fixpt ); /* assume doubling the quantization step size will reduce the entropy with (up to) one bit */ // adjust_global_gain_index = (int16_t) ceil( adjust_size / ( 1024.0f * N * log_base2( global_gain_step ) ) ); - adjust_global_gain_index = BASOP_Util_Divide3232_Scale_cadence( adjust_size, N, &tmp_e ); + adjust_global_gain_index = BASOP_Util_Divide3232_Scale_newton( adjust_size, N, &tmp_e ); adjust_global_gain_index = Mpy_32_32( adjust_global_gain_index, 17816838 /*/ ( 1024.0f * log_base2( global_gain_step ) )*/ ); IF( NE_32( adjust_global_gain_index, L_shl( L_shr( adjust_global_gain_index, sub( 31, tmp_e ) ), sub( 31, tmp_e ) ) ) ) { diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index a8a088f20..61057fbca 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -150,7 +150,7 @@ static void tcaTargetCh_LA_fx( deno_exp = 0; move16(); } - gAdj = BASOP_Util_Divide3232_Scale_cadence( tempF2, deno, &gAdj_exp ); /* Q31-gAdj_exp */ + gAdj = BASOP_Util_Divide3232_Scale_newton( tempF2, deno, &gAdj_exp ); /* Q31-gAdj_exp */ gAdj_exp = add( gAdj_exp, sub( tempF2_exp, deno_exp ) ); } @@ -923,7 +923,7 @@ static void corrStatsEst_fx( IF( tempF_fx != 0 ) { temp32 = BASOP_Util_Add_Mant32Exp( XY_hat_fx, XY_hat_exp, L_negate( Mpy_32_32( X_hat_fx, Y_hat_fx ) ), add( X_hat_exp, Y_hat_exp ), &exp ); /* Q31-exp */ - beta_reg_fx = BASOP_Util_Divide3232_Scale_cadence( temp32, tempF_fx, &beta_reg_exp ); /* Q31-beta_reg_exp */ + beta_reg_fx = BASOP_Util_Divide3232_Scale_newton( temp32, tempF_fx, &beta_reg_exp ); /* Q31-beta_reg_exp */ if ( beta_reg_fx ) { beta_reg_exp = add( beta_reg_exp, sub( exp, tempF_exp ) ); @@ -2345,9 +2345,9 @@ static void unclr_calc_corr_features_fx( move32(); } - ic_Lm = BASOP_Util_Divide3232_Scale_cadence( corrL, ener, &exp1 ); /* Q31-exp1 */ + ic_Lm = BASOP_Util_Divide3232_Scale_newton( corrL, ener, &exp1 ); /* Q31-exp1 */ exp1 = add( exp1, sub( corrL_exp, ener_exp ) ); - ic_Rm = BASOP_Util_Divide3232_Scale_cadence( corrR, ener, &exp2 ); /* Q31-exp2 */ + ic_Rm = BASOP_Util_Divide3232_Scale_newton( corrR, ener, &exp2 ); /* Q31-exp2 */ exp2 = add( exp2, sub( corrR_exp, ener_exp ) ); m_corrL_corrR = L_sub( L_max( L_abs( L_shl( ic_Lm, sub( exp1, s_max( exp1, exp2 ) ) ) ), L_abs( L_shl( ic_Rm, sub( exp2, s_max( exp1, exp2 ) ) ) ) ), L_min( L_abs( L_shl( ic_Lm, sub( exp1, s_max( exp1, exp2 ) ) ) ), L_abs( L_shl( ic_Rm, sub( exp2, s_max( exp1, exp2 ) ) ) ) ) ); // s_max(exp1, exp2) @@ -2405,7 +2405,7 @@ static void unclr_calc_corr_features_fx( } ELSE { - *corrEst_ncorr = BASOP_Util_Divide3232_Scale_cadence( num, den, &exp ); /* Q31-corrEst_ncorr_exp */ + *corrEst_ncorr = BASOP_Util_Divide3232_Scale_newton( num, den, &exp ); /* Q31-corrEst_ncorr_exp */ *corrEst_ncorr_exp = add( exp, sub( num_exp, den_exp ) ); move32(); move16(); diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c index 9a1198e20..b1eae7862 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c @@ -382,14 +382,14 @@ void stereo_coder_tcx_fx( Word16 fTemp_e, tmp_e; Word32 fTemp_fx = BASOP_Util_Add_Mant32Exp( nrgRatio_fx[0], nrgRatio_e[0], nrgRatio_fx[1], nrgRatio_e[1], &fTemp_e ); /* Q31-fTemp_e */ fTemp_e = sub( fTemp_e, 1 ); - nrgRatio_fx[0] = BASOP_Util_Divide3232_Scale_cadence( fTemp_fx, nrgRatio_fx[0], &tmp_e ); /* Q31 - tmp_e - fTemp_e + nrgRatio_e[0] */ + nrgRatio_fx[0] = BASOP_Util_Divide3232_Scale_newton( fTemp_fx, nrgRatio_fx[0], &tmp_e ); /* Q31 - tmp_e - fTemp_e + nrgRatio_e[0] */ move32(); nrgRatio_e[0] = add( tmp_e, sub( fTemp_e, nrgRatio_e[0] ) ); move16(); nrgRatio_fx[0] = Sqrt32( nrgRatio_fx[0], &nrgRatio_e[0] ); /* Q31-nrgRatio_e[0] */ move32(); - nrgRatio_fx[1] = BASOP_Util_Divide3232_Scale_cadence( fTemp_fx, nrgRatio_fx[1], &tmp_e ); /* Q31 - tmp_e - fTemp_e + nrgRatio_e[1] */ + nrgRatio_fx[1] = BASOP_Util_Divide3232_Scale_newton( fTemp_fx, nrgRatio_fx[1], &tmp_e ); /* Q31 - tmp_e - fTemp_e + nrgRatio_e[1] */ move32(); nrgRatio_e[1] = add( tmp_e, sub( fTemp_e, nrgRatio_e[1] ) ); move16(); diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 6ffd05c0c..6a107e91f 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -2013,7 +2013,7 @@ static void Get_corr_n_fx( } ELSE { - *ic_Lm = BASOP_Util_Divide3232_Scale_cadence( corrL, ener, &exp_diff ); // (Q31 - exp_diff) + *ic_Lm = BASOP_Util_Divide3232_Scale_newton( corrL, ener, &exp_diff ); // (Q31 - exp_diff) move32(); IF( *ic_Lm == 0 ) { @@ -2025,7 +2025,7 @@ static void Get_corr_n_fx( *q_ic_Lm = sub( Q31, exp_diff ); move16(); } - *ic_Rm = BASOP_Util_Divide3232_Scale_cadence( corrR, ener, &exp_diff ); // (Q31 - exp_diff) + *ic_Rm = BASOP_Util_Divide3232_Scale_newton( corrR, ener, &exp_diff ); // (Q31 - exp_diff) move16(); IF( *ic_Rm == 0 ) { @@ -2041,7 +2041,7 @@ static void Get_corr_n_fx( /* *es_em = 10 * ( log10f( sqrtf( ener_side / len ) ) - log10f( sqrtf( ener / len ) ) ); is simplified to *es_em = 10 * ( log10f( sqrtf( ener_side / ener ) ) ); */ - L_tmp = BASOP_Util_Divide3232_Scale_cadence( ener_side, ener, &exp_diff ); // (Q31 - exp_diff) + L_tmp = BASOP_Util_Divide3232_Scale_newton( ener_side, ener, &exp_diff ); // (Q31 - exp_diff) L_tmp = Sqrt32( L_tmp, &exp_diff ); /* (Q31 - exp_diff) */ L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ *es_em = Mpy_32_32( Mpy_32_32( L_add( L_tmp, L_shl( exp_diff, Q25 ) ), LOG10_2_Q31 ), TEN_IN_Q27 ); // (Q25, Q27) -> Q21 diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index fd84d2f21..5f2e9a8e0 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -1086,7 +1086,7 @@ Word16 ivas_acelp_tcx20_switching_fx( nrg_s = BASOP_Util_Add_Mant32Exp( nrg_s, e_num, Mpy_32_32( y_fx[i], y_fx[i] ), shl( e_x, 1 ), &e_num ); /* Q31-e_num */ nrg_n = BASOP_Util_Add_Mant32Exp( nrg_n, e_den, Mpy_32_32( x_fx[i], x_fx[i] ), shl( temp_ene_e, 1 ), &e_den ); /* Q31-e_den */ } - res_cod_SNR_M[iter] = BASOP_Util_Divide3232_Scale_cadence( nrg_s, nrg_n, &temp_e ); /* Q31-res_cod_SNR_M_e[iter] */ + res_cod_SNR_M[iter] = BASOP_Util_Divide3232_Scale_newton( nrg_s, nrg_n, &temp_e ); /* Q31-res_cod_SNR_M_e[iter] */ move32(); res_cod_SNR_M_e[iter] = add( temp_e, sub( e_num, e_den ) ); move16(); diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 3f6449a0c..ecccc8011 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1961,7 +1961,7 @@ Word16 ivas_smc_gmm_fx( FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - temp32 = BASOP_Util_Divide3232_Scale_cadence( PS_fx[i], sum_PS_fx, &temp_exp ); // 31-temp_exp + temp32 = BASOP_Util_Divide3232_Scale_newton( PS_fx[i], sum_PS_fx, &temp_exp ); // 31-temp_exp PS_norm_fx[i] = L_shl( temp32, sub( Qfact_PS_past, add( sub( 31, temp_exp ), sub( Qfact_PS, sub( 31, sum_PS_e ) ) ) ) ); // Qfact_PS_past move32(); dPS_fx[i] = L_abs( L_sub( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ); @@ -1992,7 +1992,7 @@ Word16 ivas_smc_gmm_fx( Word32 tmp_max; tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); - temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp + temp32 = BASOP_Util_Divide3232_Scale_newton( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); } temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 2abe538e4..228e522bf 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2786,7 +2786,7 @@ void tcx_noise_factor_ivas_fx( /* noise level factor: average of segment magnitudes of noise bins */ IF( n > 0 ) { - tmp4 = BASOP_Util_Divide3232_Scale_cadence( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); + tmp4 = BASOP_Util_Divide3232_Scale_newton( Mpy_32_16_1( sqErrorNrg, att ), n, &s ); s = add( add( exp_sqErrorNrg, -15 ), s ); BASOP_SATURATE_WARNING_OFF_EVS; tmp4 = L_shl_o( tmp4, s, &Overflow ); diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 60d661db4..2ade624b6 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -458,7 +458,7 @@ Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx( struct TransientDetection const } /* exponent = AVG_FLAT_E */ - i = BASOP_Util_Divide3232_Scale_cadence( sumTempFlatness, nTotBlocks, &exp ); + i = BASOP_Util_Divide3232_Scale_newton( sumTempFlatness, nTotBlocks, &exp ); exp = add( exp, sub( sumTempFlatness_exp, 31 ) ); i = L_shl_sat( i, sub( exp, 10 ) ); // Can be saturated, since it is used for comparision againt 3.25/20.0f, Q21 return i; @@ -1569,12 +1569,12 @@ static void CalculateSubblockEnergies_ivas_fx( Word16 const *input, Word16 nSamp IF( GT_32( w0, w1 ) ) { - pSubblockNrgChange[w] = BASOP_Util_Divide3232_Scale_cadence( w0, w1, &k ); + pSubblockNrgChange[w] = BASOP_Util_Divide3232_Scale_newton( w0, w1, &k ); pSubblockNrgChange_exp[w] = k; } ELSE { - pSubblockNrgChange[w] = BASOP_Util_Divide3232_Scale_cadence( w1, w0, &k ); + pSubblockNrgChange[w] = BASOP_Util_Divide3232_Scale_newton( w1, w0, &k ); pSubblockNrgChange_exp[w] = k; } move32(); -- GitLab From ae29b091c06820aec13831523e343bce6ea25781 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 14 Apr 2025 23:22:47 +0200 Subject: [PATCH 2/3] formatting --- lib_enc/hq_classifier_enc_fx.c | 4 ++-- lib_enc/ivas_enc_cov_handler_fx.c | 2 +- lib_enc/ivas_stereo_eclvq_enc_fx.c | 4 ++-- lib_enc/ivas_stereo_ica_enc_fx.c | 2 +- lib_enc/ivas_stereo_td_analysis_fx.c | 2 +- lib_enc/speech_music_classif_fx.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index d82eebfb5..558ae89a7 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -141,8 +141,8 @@ static Word16 hf_spectrum_sparseness_fx( } } Word16 l_shift = W_norm( inv_rms_fx ); - inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32 - Word16 q_rms = sub( add( Q15, l_shift ), 32 ); // q_rms + inv_rms32_fx = W_extract_h( W_shl( inv_rms_fx, l_shift ) ); // Q15+l_shift-32 + Word16 q_rms = sub( add( Q15, l_shift ), 32 ); // q_rms inv_rms32_div_fx = BASOP_Util_Divide3232_Scale_newton( inv_rms32_fx, L_SPEC_HB, &inv_rms32_e ); /* Q31-inv_rms32_e */ inv_rms32_e = sub( 31, add( sub( Q31, inv_rms32_e ), q_rms ) ); // inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 138e1467d..59c38aa5d 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -271,7 +271,7 @@ static Word16 ivas_spar_get_activeW_flag_fx( } ELSE { - L_tmp = BASOP_Util_Divide3232_Scale_newton( hCovEnc->bb_var_lt_fx[0], side_ch_var, &exp_diff ); // (Q31 - exp_diff) + L_tmp = BASOP_Util_Divide3232_Scale_newton( hCovEnc->bb_var_lt_fx[0], side_ch_var, &exp_diff ); // (Q31 - exp_diff) en_ratio = L_shl_sat( L_tmp, exp_diff ); // Q31 IF( LT_32( en_ratio, Mpy_32_32( IVAS_SPAR_DYN_ACTIVEW_THRESH_FX, IVAS_SPAR_DYN_ACTIVEW_THRESH_FX ) ) ) // LHS Q31 :: RHS Q31 { diff --git a/lib_enc/ivas_stereo_eclvq_enc_fx.c b/lib_enc/ivas_stereo_eclvq_enc_fx.c index dc2cf18a0..a09daffe0 100644 --- a/lib_enc/ivas_stereo_eclvq_enc_fx.c +++ b/lib_enc/ivas_stereo_eclvq_enc_fx.c @@ -140,7 +140,7 @@ Word32 ECSQ_compute_optimal_gain_fx( // Q15 IF( sum_sq_output != 0 ) { // optimal_global_gain = sum_input_output / sum_sq_output; - optimal_global_gain = BASOP_Util_Divide3232_Scale_newton( sum_input_output, sum_sq_output, &optimal_global_gain_e ); // 31 - ( sum_input_output_e - 31 + optimal_global_gain_e ) = 62 - ( sum_input_output_e + optimal_global_gain_e ) + optimal_global_gain = BASOP_Util_Divide3232_Scale_newton( sum_input_output, sum_sq_output, &optimal_global_gain_e ); // 31 - ( sum_input_output_e - 31 + optimal_global_gain_e ) = 62 - ( sum_input_output_e + optimal_global_gain_e ) optimal_global_gain = L_shr( optimal_global_gain, sub( sub( 62, add( sum_input_output_e, optimal_global_gain_e ) ), 15 ) ); // Q15 } @@ -509,7 +509,7 @@ static Word32 get_est_size_fx( // Q10 // required_avg_abs_sum = ( nonzero + 0.25f * N0 ) / N; /* the vector must have nonzero +-1 and N0 zeros */ required_avg_abs_sum = BASOP_Util_Divide3232_Scale_newton( L_add( L_shl( nonzero, 10 ), L_shl( N0, 8 ) ), L_shl( N, 10 ), &required_avg_abs_sum_e ); /* the vector must have nonzero +-1 and N0 zeros */ - required_avg_abs_sum = L_shr_r( required_avg_abs_sum, sub( 21, required_avg_abs_sum_e ) ); // Q10 + required_avg_abs_sum = L_shr_r( required_avg_abs_sum, sub( 21, required_avg_abs_sum_e ) ); // Q10 test(); IF( EQ_32( avg_abs_sum, required_avg_abs_sum ) && LE_16( nonzero, ECSQ_NONZERO_MAX ) ) diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 61057fbca..6057ace6b 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -923,7 +923,7 @@ static void corrStatsEst_fx( IF( tempF_fx != 0 ) { temp32 = BASOP_Util_Add_Mant32Exp( XY_hat_fx, XY_hat_exp, L_negate( Mpy_32_32( X_hat_fx, Y_hat_fx ) ), add( X_hat_exp, Y_hat_exp ), &exp ); /* Q31-exp */ - beta_reg_fx = BASOP_Util_Divide3232_Scale_newton( temp32, tempF_fx, &beta_reg_exp ); /* Q31-beta_reg_exp */ + beta_reg_fx = BASOP_Util_Divide3232_Scale_newton( temp32, tempF_fx, &beta_reg_exp ); /* Q31-beta_reg_exp */ if ( beta_reg_fx ) { beta_reg_exp = add( beta_reg_exp, sub( exp, tempF_exp ) ); diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 6a107e91f..1856370f6 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -2041,7 +2041,7 @@ static void Get_corr_n_fx( /* *es_em = 10 * ( log10f( sqrtf( ener_side / len ) ) - log10f( sqrtf( ener / len ) ) ); is simplified to *es_em = 10 * ( log10f( sqrtf( ener_side / ener ) ) ); */ - L_tmp = BASOP_Util_Divide3232_Scale_newton( ener_side, ener, &exp_diff ); // (Q31 - exp_diff) + L_tmp = BASOP_Util_Divide3232_Scale_newton( ener_side, ener, &exp_diff ); // (Q31 - exp_diff) L_tmp = Sqrt32( L_tmp, &exp_diff ); /* (Q31 - exp_diff) */ L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */ *es_em = Mpy_32_32( Mpy_32_32( L_add( L_tmp, L_shl( exp_diff, Q25 ) ), LOG10_2_Q31 ), TEN_IN_Q27 ); // (Q25, Q27) -> Q21 diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index ecccc8011..3852d6dc4 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1961,7 +1961,7 @@ Word16 ivas_smc_gmm_fx( FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - temp32 = BASOP_Util_Divide3232_Scale_newton( PS_fx[i], sum_PS_fx, &temp_exp ); // 31-temp_exp + temp32 = BASOP_Util_Divide3232_Scale_newton( PS_fx[i], sum_PS_fx, &temp_exp ); // 31-temp_exp PS_norm_fx[i] = L_shl( temp32, sub( Qfact_PS_past, add( sub( 31, temp_exp ), sub( Qfact_PS, sub( 31, sum_PS_e ) ) ) ) ); // Qfact_PS_past move32(); dPS_fx[i] = L_abs( L_sub( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ); -- GitLab From f34b6383bddca55252f3f7671c9c19461b5f62b2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 15 Apr 2025 20:41:00 +0200 Subject: [PATCH 3/3] convert remaining places in ivas_stereo_dmx_evs_fx.c --- lib_enc/ivas_stereo_dmx_evs_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c index 625ff8ee9..425685529 100644 --- a/lib_enc/ivas_stereo_dmx_evs_fx.c +++ b/lib_enc/ivas_stereo_dmx_evs_fx.c @@ -830,7 +830,7 @@ static void calc_poc_fx( // ICCr = (float) sqrt( ( Nr * Nr + Ni * Ni ) / ( eneL * eneR + EPSILON ) ); L_tmp1 = BASOP_Util_Add_Mant32Exp( Mpy_32_32_r( Nr, Nr ), shl( Nr_e, 1 ), Mpy_32_32_r( Ni, Ni ), shl( Ni_e, 1 ), &L_tmp1_e ); L_tmp2 = BASOP_Util_Add_Mant32Exp( Mpy_32_32_r( eneL, eneR ), add( eneL_e, eneR_e ), EPSILON_FX_M, EPSILON_FX_E, &L_tmp2_e ); - ICCr = BASOP_Util_Divide3232_Scale_cadence( L_tmp1, L_tmp2, &L_tmp_e ); + ICCr = BASOP_Util_Divide3232_Scale_newton( L_tmp1, L_tmp2, &L_tmp_e ); L_tmp_e = add( L_tmp_e, sub( L_tmp1_e, L_tmp2_e ) ); ICCr = Sqrt32( ICCr, &L_tmp_e ); // Saturation to handle values close to 1.0f @@ -1891,7 +1891,7 @@ void stereo_dmx_evs_enc_fx( } L_tmp1 = BASOP_Util_Add_Mant32Exp( hStereoDmxEVS->hPHA->trns_aux_energy_fx[k], hStereoDmxEVS->hPHA->trns_aux_energy_fx_e[k], EPSILON_FX_M, EPSILON_FX_E, &L_tmp1_e ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( subframe_energy[m], L_tmp1, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( subframe_energy[m], L_tmp1, &L_tmp2_e ); L_tmp2_e = add( L_tmp2_e, sub( subframe_energy_e[m], L_tmp1_e ) ); // if ( subframe_energy[m] / ( hStereoDmxEVS->hPHA->trns_aux_energy[k] + EPSILON ) > hStereoDmxEVS->hPHA->crst_fctr ) if ( BASOP_Util_Cmp_Mant32Exp( L_tmp2, L_tmp2_e, hStereoDmxEVS->hPHA->crst_fctr_fx, 31 ) > 0 ) @@ -1919,7 +1919,7 @@ void stereo_dmx_evs_enc_fx( FOR( m = 1; m < STEREO_DMX_EVS_NB_SBFRM; m++ ) { L_tmp1 = BASOP_Util_Add_Mant32Exp( subframe_energy[m - 1], subframe_energy_e[m - 1], EPSILON_FX_M, EPSILON_FX_E, &L_tmp1_e ); - L_tmp2 = BASOP_Util_Divide3232_Scale_cadence( subframe_energy[m], L_tmp1, &L_tmp2_e ); + L_tmp2 = BASOP_Util_Divide3232_Scale_newton( subframe_energy[m], L_tmp1, &L_tmp2_e ); L_tmp2_e = add( L_tmp2_e, sub( subframe_energy_e[m], L_tmp1_e ) ); // if ( subframe_energy[m] / ( subframe_energy[m - 1] + EPSILON ) > STEREO_DMX_EVS_TRNS_DTC_INST ) if ( BASOP_Util_Cmp_Mant32Exp( L_tmp2, L_tmp2_e, STEREO_DMX_EVS_TRNS_DTC_INST_Q0, 31 ) > 0 ) -- GitLab