From 840a1e90837b3748ea00b38206c339f108f62fb2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 11 Apr 2025 10:33:10 +0200 Subject: [PATCH] lib_rend: replace BASOP_Util_Divide3232_Scale_cadence() by BASOP_Util_Divide3232_Scale_newton() --- .../ivas_dirac_dec_binaural_functions_fx.c | 44 +++++++++---------- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 20 ++++----- lib_rend/ivas_dirac_rend_fx.c | 10 ++--- lib_rend/ivas_orient_trk_fx.c | 14 +++--- lib_rend/ivas_reverb_filter_design_fx.c | 22 +++++----- lib_rend/ivas_rotation_fx.c | 2 +- lib_rend/ivas_shoebox_fx.c | 8 ++-- lib_rend/lib_rend.c | 4 +- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index ce602160f..59ba8062e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -1655,7 +1655,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move32(); /* Formulate average diffuseness over frame */ - frameMeanDiffuseness = BASOP_Util_Divide3232_Scale_cadence( frameMeanDiffuseness, L_max( EPSILLON_FX, frameMeanDiffusenessEneWeight_fx[bin] ), &exp ); // exp = exp + 31 - q_meanEnePerCh - exp1 + frameMeanDiffuseness = BASOP_Util_Divide3232_Scale_newton( frameMeanDiffuseness, L_max( EPSILLON_FX, frameMeanDiffusenessEneWeight_fx[bin] ), &exp ); // exp = exp + 31 - q_meanEnePerCh - exp1 exp = sub( exp, sub( sub( 31, q_meanEnePerCh ), exp1 ) ); hDiracDecBin->frameMeanDiffuseness_fx[bin] = L_shl( frameMeanDiffuseness, sub( exp, 2 ) ); // Q29 move32(); @@ -1687,7 +1687,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric move16(); den = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEnePrev_fx[0][bin], hDiracDecBin->ChEnePrev_e[0][bin], hDiracDecBin->ChEnePrev_fx[1][bin], hDiracDecBin->ChEnePrev_e[1][bin], &den_e ); den = L_max( 1, den ); - IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_cadence( num, den, &exp ); + IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_newton( num, den, &exp ); exp = add( sub( num_e, den_e ), add( 5, exp ) ); IF( L_shr_sat( IIReneLimiter_fx, sub( 31, exp ) ) > 0 ) { @@ -3310,7 +3310,7 @@ static void eig2x2_fx( tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); #if 1 - tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); + tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3386,7 +3386,7 @@ static void eig2x2_fx( tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); #if 1 - tmp2 = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, tmp3, &exp ); + tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); @@ -3731,11 +3731,11 @@ static void chol2x2_fx( // 4611686 = 1e-12 in Q62 IF( outRe[0][0] == 0 ) { - outRe[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); + outRe[1][0] = BASOP_Util_Divide3232_Scale_newton( c_re, 4611686, &exp ); move32(); q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); - outIm[1][0] = BASOP_Util_Divide3232_Scale_cadence( c_im, 4611686, &exp ); + outIm[1][0] = BASOP_Util_Divide3232_Scale_newton( c_im, 4611686, &exp ); move32(); q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); } @@ -3792,7 +3792,7 @@ static void chol2x2_fx( } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( temp, e1, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( temp, e1, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); } if ( temp == 0 ) @@ -3837,7 +3837,7 @@ static void chol2x2_fx( // 4611686 = Q62 IF( outRe[1][1] == 0 ) { - // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, 4611686, &exp ); + // outRe[0][1] = BASOP_Util_Divide3232_Scale_newton( c_re, 4611686, &exp ); Word32 tmp1 = 1953125005; /* 1/4611686 Q62 */ exp = 9; @@ -3845,7 +3845,7 @@ static void chol2x2_fx( move32(); q_re2 = add( sub( 31, exp ), sub( q_c, 62 ) ); - // outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, 4611686, &exp ); + // outIm[0][1] = BASOP_Util_Divide3232_Scale_newton( -c_im, 4611686, &exp ); outIm[0][1] = Mpy_32_32( tmp1, -c_im ); move32(); q_im = add( sub( 31, exp ), sub( q_c, 62 ) ); @@ -3853,13 +3853,13 @@ static void chol2x2_fx( ELSE { { - // outRe[0][1] = BASOP_Util_Divide3232_Scale_cadence( c_re, outRe[1][1], &exp ); - Word32 tmp1 = BASOP_Util_Divide3232_Scale_cadence( 0x7FFFFFFF, outRe[1][1], &exp ); + // outRe[0][1] = BASOP_Util_Divide3232_Scale_newton( c_re, outRe[1][1], &exp ); + Word32 tmp1 = BASOP_Util_Divide3232_Scale_newton( 0x7FFFFFFF, outRe[1][1], &exp ); outRe[0][1] = Mpy_32_32( tmp1, c_re ); move32(); q_re2 = add( sub( 31, exp ), sub( q_c, q_re1 ) ); - // outIm[0][1] = BASOP_Util_Divide3232_Scale_cadence( -c_im, outRe[1][1], &exp ); + // outIm[0][1] = BASOP_Util_Divide3232_Scale_newton( -c_im, outRe[1][1], &exp ); outIm[0][1] = Mpy_32_32( tmp1, -c_im ); move32(); q_im = add( sub( 31, exp ), sub( q_c, q_re1 ) ); @@ -3882,12 +3882,12 @@ static void chol2x2_fx( // 4611686 = 1e-12 in Q62 IF( e2 == 0 ) { - temp = BASOP_Util_Divide3232_Scale_cadence( temp, 4611686, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( temp, 4611686, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, 62 ) ); } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( temp, e2, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( temp, e2, &exp ); q_tmp = add( sub( 31, exp ), sub( q_tmp, q_e ) ); } if ( temp == 0 ) @@ -4035,7 +4035,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - maxEneDiv_fx = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, maxEne_fx, &exp ); + maxEneDiv_fx = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, maxEne_fx, &exp ); q_maxEneDiv = add( sub( 31, exp ), sub( Q30, q_maxEne ) ); } exp = norm_l( maxEneDiv_fx ); @@ -4100,7 +4100,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, 4611686, &exp ); // 4611686 = Q62 + temp = BASOP_Util_Divide3232_Scale_newton( E_out1, 4611686, &exp ); // 4611686 = Q62 exp = sub( exp, sub( q_eout, 62 ) ); Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp } @@ -4109,7 +4109,7 @@ static void formulate2x2MixingMatrix_fx( { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - temp = BASOP_Util_Divide3232_Scale_cadence( E_out1, temp, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( E_out1, temp, &exp ); exp = sub( exp, sub( q_eout, sub( 31, exp_temp ) ) ); Ghat_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp } @@ -4127,7 +4127,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, 4611686, &exp1 ); // 4611686 = Q62 + temp = BASOP_Util_Divide3232_Scale_newton( E_out2, 4611686, &exp1 ); // 4611686 = Q62 exp1 = sub( exp1, sub( q_eout, 62 ) ); Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 } @@ -4136,7 +4136,7 @@ static void formulate2x2MixingMatrix_fx( { temp = BASOP_Util_Add_Mant32Exp( temp, sub( 31, q_ein ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - temp = BASOP_Util_Divide3232_Scale_cadence( E_out2, temp, &exp1 ); + temp = BASOP_Util_Divide3232_Scale_newton( E_out2, temp, &exp1 ); exp1 = sub( exp1, sub( q_eout, sub( 31, exp_temp ) ) ); Ghat_fx[1] = Sqrt32( temp, &exp1 ); // Q = 31 - exp1 } @@ -4195,7 +4195,7 @@ static void formulate2x2MixingMatrix_fx( } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, D_fx[0], &exp ); exp = sub( exp, sub( Q30, q_D ) ); } div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp @@ -4328,7 +4328,7 @@ static void formulate2x2MixingMatrix_fx( Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, temp, &exp ); Pre_shift = norm_l( Pre_fx[chA][chB] ); Pim_shift = norm_l( Pim_fx[chA][chB] ); Pre_fx[chA][chB] = Mpy_32_32( L_shl( Pre_fx[chA][chB], Pre_shift ), temp ); @@ -4372,7 +4372,7 @@ static void formulate2x2MixingMatrix_fx( { Word16 Pre_shift, Pim_shift; temp = BASOP_Util_Add_Mant32Exp( Sx_fx[chB], sub( 31, q_Sx ), EPSILON_MANT, EPSILON_EXP, &exp_temp ); - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, temp, &exp ); + temp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, temp, &exp ); q_temp = add( sub( sub( q_P, exp ), sub( 31, Q30 ) ), exp_temp ); Pre_shift = norm_l( Pre_fx[0][chB] ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 7b446a80e..0cdbe3a10 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2097,9 +2097,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move16(); exp1 = 0; move16(); - tmp32 = BASOP_Util_Divide3232_Scale_cadence( L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, q_cy_auto_dir_smooth_local[1] ) ), - ( L_add( Sqrt32( h_dirac_output_synthesis_state->direct_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) - &exp1 ); + tmp32 = BASOP_Util_Divide3232_Scale_newton( L_shl( p_cy_auto_dir_smooth[num_freq_bands], sub( q_com, q_cy_auto_dir_smooth_local[1] ) ), + ( L_add( Sqrt32( h_dirac_output_synthesis_state->direct_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) + &exp1 ); target_power_y = L_shr( tmp32, 1 ); // Q31 + (q_com - (31 - exp)) q_target_power_y = add( sub( Q31, exp1 ), sub( q_com, sub( Q31, exp ) ) ); q_target_power_y = sub( q_target_power_y, 1 ); @@ -2108,9 +2108,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move16(); exp1 = 0; move16(); - tmp32 = BASOP_Util_Divide3232_Scale_cadence( L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ), - ( L_add( Sqrt32( h_dirac_output_synthesis_state->diffuse_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) - &exp1 ); + tmp32 = BASOP_Util_Divide3232_Scale_newton( L_shl( p_cy_auto_diff_smooth[num_freq_bands], sub( q_com, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ) ), + ( L_add( Sqrt32( h_dirac_output_synthesis_state->diffuse_power_factor_fx[0], &exp ), EPSILON_FX ) ), // (Q31 - exp) + &exp1 ); target_power_y1 = L_shr( tmp32, 1 ); // Q31 + (q_com - (31 - exp)) q_target_power_y1 = add( sub( Q31, exp1 ), sub( q_com, sub( Q31, exp ) ) ); q_target_power_y1 = sub( q_target_power_y1, 1 ); @@ -2268,7 +2268,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { p_power_smooth_prev++; - L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ + L_tmp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q31, EPSILON_FX, &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ exp_arr[k * num_freq_bands + l] = exp; move16(); @@ -2277,7 +2277,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( } ELSE { - L_tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ + L_tmp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q31, *( p_power_smooth_prev++ ), &exp ); /*Q=31-(exp-(31-q_proto_power_smooth))*/ exp_arr[k * num_freq_bands + l] = exp; move16(); @@ -2495,7 +2495,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( exp = 0; move16(); - L_tmp = BASOP_Util_Divide3232_Scale_cadence( *( p_cy_auto_diff_smooth_prev++ ), ( *( p_power_diff_smooth_prev++ ) ), &exp ); // (Q31 - exp) + (q_a - q_b) + L_tmp = BASOP_Util_Divide3232_Scale_newton( *( p_cy_auto_diff_smooth_prev++ ), ( *( p_power_diff_smooth_prev++ ) ), &exp ); // (Q31 - exp) + (q_a - q_b) exp = sub( Q31, add( sub( Q31, exp ), sub( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth_prev, h_dirac_output_synthesis_state->proto_power_diff_smooth_q ) ) ); *( p_gains_diff ) = Sqrt32( L_tmp, &exp ); // (31 - exp) @@ -3982,7 +3982,7 @@ void ivas_lfe_synth_with_filters_fx( } ELSE { - lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_cadence( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ + lfeGain_fx = extract_h( BASOP_Util_Divide3232_Scale_newton( hMasaLfeSynth->targetEneLfeSmooth_fx, L_add( EPSILON_FX, hMasaLfeSynth->transportEneSmooth_fx ), &lfeGain_fx_exp ) ); /*Q(31-(lfeGain_fx_exp+hMasaLfeSynth->transportEneSmooth_q-hMasaLfeSynth->targetEneLfeSmooth_q))-16*/ lfeGain_fx_exp = add( sub( hMasaLfeSynth->transportEneSmooth_q, hMasaLfeSynth->targetEneLfeSmooth_q ), lfeGain_fx_exp ); lfeGain_fx = Sqrt16( lfeGain_fx, &lfeGain_fx_exp ); // Q15-lfeGain_fx_exp lfeGain_fx = shl_r( lfeGain_fx, lfeGain_fx_exp ); // Q15 diff --git a/lib_rend/ivas_dirac_rend_fx.c b/lib_rend/ivas_dirac_rend_fx.c index f67f3761b..9de710b36 100644 --- a/lib_rend/ivas_dirac_rend_fx.c +++ b/lib_rend/ivas_dirac_rend_fx.c @@ -2691,8 +2691,8 @@ void protoSignalComputation2_fx( q_lr_bb_power = stereo_type_detect->q_right_bb_power; move16(); } - q_lr_bb_power = sub( q_lr_bb_power, 1 ); /* = (lr_bb_power_fx * 2) */ - temp = BASOP_Util_Divide3232_Scale_cadence( lr_bb_power_fx, L_add( stereo_type_detect->total_bb_power_fx, EPSILON_FX ), &exp ); // Q(31-(exp+stereo_type_detect->q_total_bb_power-q_lr_bb_power)) + q_lr_bb_power = sub( q_lr_bb_power, 1 ); /* = (lr_bb_power_fx * 2) */ + temp = BASOP_Util_Divide3232_Scale_newton( lr_bb_power_fx, L_add( stereo_type_detect->total_bb_power_fx, EPSILON_FX ), &exp ); // Q(31-(exp+stereo_type_detect->q_total_bb_power-q_lr_bb_power)) exp = sub( 31, add( sub( 31, exp ), sub( q_lr_bb_power, stereo_type_detect->q_total_bb_power ) ) ); temp = BASOP_Util_Log2( temp ); // q25 IF( NE_32( temp, MIN_32 ) ) @@ -2740,8 +2740,8 @@ void protoSignalComputation2_fx( move32(); q_lr_hi_power = stereo_type_detect->q_right_hi_power; } - q_lr_hi_power = sub( q_lr_hi_power, 1 ); /* = (q_lr_hi_power * 2) */ - temp = BASOP_Util_Divide3232_Scale_cadence( lr_hi_power_fx, L_add( stereo_type_detect->total_hi_power_fx, EPSILON_FX ), &exp ); // Q=31-(exp+ stereo_type_detect->q_total_hi_power-q_lr_hi_power) + q_lr_hi_power = sub( q_lr_hi_power, 1 ); /* = (q_lr_hi_power * 2) */ + temp = BASOP_Util_Divide3232_Scale_newton( lr_hi_power_fx, L_add( stereo_type_detect->total_hi_power_fx, EPSILON_FX ), &exp ); // Q=31-(exp+ stereo_type_detect->q_total_hi_power-q_lr_hi_power) exp = sub( 31, add( sub( 31, exp ), sub( q_lr_hi_power, stereo_type_detect->q_total_hi_power ) ) ); temp = BASOP_Util_Log2( temp ); // q25 IF( NE_32( temp, MIN_32 ) ) @@ -3419,7 +3419,7 @@ void computeDirectionAngles_fx( } ELSE { - temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, intensityNorm, &exp ); // Q=31-(exp-(30-q_intensityNorm)) + temp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, intensityNorm, &exp ); // Q=31-(exp-(30-q_intensityNorm)) exp = sub( exp, sub( Q30, q_intensityNorm ) ); temp = Sqrt32( temp, &exp ); // Q=31-exp q_temp = sub( 31, exp ); diff --git a/lib_rend/ivas_orient_trk_fx.c b/lib_rend/ivas_orient_trk_fx.c index a25a8db53..6ed7cf3b1 100644 --- a/lib_rend/ivas_orient_trk_fx.c +++ b/lib_rend/ivas_orient_trk_fx.c @@ -140,22 +140,22 @@ static void QuaternionDivision_fx( { Word16 scale_e, result_e = 0, w_q, x_q, y_q, z_q, result_q; - r->w_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.w_fx ), d, &scale_e ); + r->w_fx = BASOP_Util_Divide3232_Scale_newton( ( q.w_fx ), d, &scale_e ); move32(); result_e = add( scale_e, sub( sub( Q31, q.q_fact ), den_e ) ); // e+e1-e2// w_q = sub( Q31, result_e ); - r->x_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.x_fx ), d, &scale_e ); + r->x_fx = BASOP_Util_Divide3232_Scale_newton( ( q.x_fx ), d, &scale_e ); move32(); result_e = add( scale_e, sub( sub( Q31, q.q_fact ), den_e ) ); x_q = sub( Q31, result_e ); - r->y_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.y_fx ), d, &scale_e ); + r->y_fx = BASOP_Util_Divide3232_Scale_newton( ( q.y_fx ), d, &scale_e ); move32(); result_e = add( scale_e, sub( sub( Q31, q.q_fact ), den_e ) ); y_q = sub( Q31, result_e ); - r->z_fx = BASOP_Util_Divide3232_Scale_cadence( ( q.z_fx ), d, &scale_e ); + r->z_fx = BASOP_Util_Divide3232_Scale_newton( ( q.z_fx ), d, &scale_e ); move32(); result_e = add( scale_e, sub( sub( Q31, q.q_fact ), den_e ) ); z_q = sub( Q31, result_e ); @@ -505,15 +505,15 @@ static IVAS_VECTOR3 VectorNormalize_fx( move16(); length_fx = VectorLength_fx( p, &q_len ); - result_fx.x_fx = BASOP_Util_Divide3232_Scale_cadence( p.x_fx, length_fx, &scale ); + result_fx.x_fx = BASOP_Util_Divide3232_Scale_newton( p.x_fx, length_fx, &scale ); move32(); x_qfact = sub( Q31, add( scale, sub( q_len, p.q_fact ) ) ); // e+(e1-e2)// - result_fx.y_fx = BASOP_Util_Divide3232_Scale_cadence( p.y_fx, length_fx, &scale ); + result_fx.y_fx = BASOP_Util_Divide3232_Scale_newton( p.y_fx, length_fx, &scale ); move32(); y_qfact = sub( Q31, add( scale, sub( q_len, p.q_fact ) ) ); - result_fx.z_fx = BASOP_Util_Divide3232_Scale_cadence( p.z_fx, length_fx, &scale ); + result_fx.z_fx = BASOP_Util_Divide3232_Scale_newton( p.z_fx, length_fx, &scale ); move32(); z_qfact = sub( Q31, add( scale, sub( q_len, p.q_fact ) ) ); diff --git a/lib_rend/ivas_reverb_filter_design_fx.c b/lib_rend/ivas_reverb_filter_design_fx.c index 62c97f88f..c70e8d667 100644 --- a/lib_rend/ivas_reverb_filter_design_fx.c +++ b/lib_rend/ivas_reverb_filter_design_fx.c @@ -411,7 +411,7 @@ static void response_step_limit_fx( IF( X[i] ) { - desiredChange = BASOP_Util_Divide3232_Scale_cadence( X[i], X[i - 1], &div_e ); + desiredChange = BASOP_Util_Divide3232_Scale_newton( X[i], X[i - 1], &div_e ); desiredChange_q = sub( 31, ( div_e ) ); } @@ -459,7 +459,7 @@ static void response_step_limit_fx( IF( X[i] ) { - desiredChange = BASOP_Util_Divide3232_Scale_cadence( X[i], X[i + 1], &div_e ); + desiredChange = BASOP_Util_Divide3232_Scale_newton( X[i], X[i + 1], &div_e ); desiredChange_q = sub( 31, ( div_e ) ); } IF( GT_16( desiredChange_q, 30 ) ) @@ -742,9 +742,9 @@ void ivas_reverb_calc_color_levels_fx( move16(); cos_w = getCosWord16R2( (Word16) L_abs( L_shl( Mpy_32_32( pFc[freq_idx], fs_inverted ), 3 ) ) ); // q = 15 H_filter = L_add( L_shr( L_add( L_shr( Mpy_32_32( coefB[0], coefB[0] ), 1 ), L_shr( Mpy_32_32( coefB[1], coefB[1] ), 1 ) ), 2 ), L_shr( Mpy_32_32( coefB[0], Mpy_32_32( coefB[1], L_shl( cos_w, 15 ) ) ), 1 ) ); // q = 28 - H_filter = BASOP_Util_Divide3232_Scale_cadence( H_filter, L_add( ONE_IN_Q28, L_shr( L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) ), 1 ) ), &temp ); + H_filter = BASOP_Util_Divide3232_Scale_newton( H_filter, L_add( ONE_IN_Q28, L_shr( L_add( L_shr( Mpy_32_32( coefA[1], coefA[1] ), 2 ), Mpy_32_32( coefA[1], L_shl( cos_w, 15 ) ) ), 1 ) ), &temp ); H_filter = Sqrt32( H_filter, &temp ); - T60_est = BASOP_Util_Divide3232_Scale_cadence( L_shl( i_mult( -3, pLoop_delays[loop_idx] ), 2 ), Mpy_32_32( Mpy_32_32( L_add( BASOP_Util_Log2( H_filter ), L_shl( temp, 25 ) ), LOG10_2_Q31 ), L_shl( output_Fs, 8 ) ), &temp ); // conversion of log2 to log10. + T60_est = BASOP_Util_Divide3232_Scale_newton( L_shl( i_mult( -3, pLoop_delays[loop_idx] ), 2 ), Mpy_32_32( Mpy_32_32( L_add( BASOP_Util_Log2( H_filter ), L_shl( temp, 25 ) ), LOG10_2_Q31 ), L_shl( output_Fs, 8 ) ), &temp ); // conversion of log2 to log10. t60[freq_idx] = BASOP_Util_Add_Mant32Exp( T60_est, temp, t60[freq_idx], t60_e[freq_idx], &result_e ); move16(); t60_e[freq_idx] = result_e; @@ -775,14 +775,14 @@ void ivas_reverb_calc_color_levels_fx( { Word16 temp, temp1, temp2, temp3 = 0, temp4, temp5; move16(); - Word32 var1 = BASOP_Util_Divide3232_Scale_cadence( (Word32) i_mult( -6, minDelay ), L_shr( Mpy_32_32( t60[freq_idx], L_shl( output_Fs, 11 ) ), sub( 11, t60_e[freq_idx] ) ), &temp ); + Word32 var1 = BASOP_Util_Divide3232_Scale_newton( (Word32) i_mult( -6, minDelay ), L_shr( Mpy_32_32( t60[freq_idx], L_shl( output_Fs, 11 ) ), sub( 11, t60_e[freq_idx] ) ), &temp ); var1 = Mpy_32_32( var1, LOG2_10_Q29 ); // e = temp + (31 - 29) Word32 A0_square_est = BASOP_util_Pow2( var1, add( temp, 31 - 29 ), &temp ); Word16 alpha_e; - Word32 alpha = BASOP_Util_Divide3232_Scale_cadence( -log__0_001, t60[freq_idx], &alpha_e ); // alpha_e = 1 + alpha_e + (3 - t60_e[257]) + Word32 alpha = BASOP_Util_Divide3232_Scale_newton( -log__0_001, t60[freq_idx], &alpha_e ); // alpha_e = 1 + alpha_e + (3 - t60_e[257]) - Word32 div11 = BASOP_Util_Divide3232_Scale_cadence( A0_square_est, alpha, &temp1 ); // e = temp1 + (temp - alpha_e) - Word32 div2 = BASOP_Util_Divide3232_Scale_cadence( L_shl( output_Fs, 11 ), L_shr( L_add( Mpy_32_16_1( 1884631649, shl( minDelayDiff, 3 ) ), 14037339 ), 8 ), &temp2 ); // e = temp2, 26.7741 in Q19, 0.8776 in Q31 + Word32 div11 = BASOP_Util_Divide3232_Scale_newton( A0_square_est, alpha, &temp1 ); // e = temp1 + (temp - alpha_e) + Word32 div2 = BASOP_Util_Divide3232_Scale_newton( L_shl( output_Fs, 11 ), L_shr( L_add( Mpy_32_16_1( 1884631649, shl( minDelayDiff, 3 ) ), 14037339 ), 8 ), &temp2 ); // e = temp2, 26.7741 in Q19, 0.8776 in Q31 const Word32 revPredNormEnergy = Mpy_32_32( div2, div11 ); // q = (15 - temp2) + (15 - temp1) - 15 + 1 // L_max @@ -794,7 +794,7 @@ void ivas_reverb_calc_color_levels_fx( L_tmp = W_extract_h( W_shl( W_tmp1, W_shift ) ); temp4 = sub( 3, W_shift ); div2 = Sqrt32( L_tmp, &temp4 ); - pTarget_color_L[freq_idx] = BASOP_Util_Divide3232_Scale_cadence( div2, div1, &temp5 ); + pTarget_color_L[freq_idx] = BASOP_Util_Divide3232_Scale_newton( div2, div1, &temp5 ); move32(); temp5 = add( temp5, sub( temp4, temp3 ) ); pTarget_color_L_e[freq_idx] = temp5; @@ -807,7 +807,7 @@ void ivas_reverb_calc_color_levels_fx( L_tmp = W_extract_h( W_shl( W_tmp2, W_shift ) ); temp4 = sub( 3, W_shift ); div2 = Sqrt32( L_tmp, &temp4 ); - pTarget_color_R[freq_idx] = BASOP_Util_Divide3232_Scale_cadence( div2, div1, &temp5 ); + pTarget_color_R[freq_idx] = BASOP_Util_Divide3232_Scale_newton( div2, div1, &temp5 ); move32(); temp5 = add( temp5, sub( temp4, temp3 ) ); pTarget_color_R_e[freq_idx] = temp5; @@ -825,7 +825,7 @@ void ivas_reverb_calc_color_levels_fx( Word32 div1; Word16 temp = 0; move16(); - div1 = BASOP_Util_Divide3232_Scale_cadence( L_mult0( 1000, sub( freq_count, 1 ) ), L_shr( output_Fs, 1 ), &temp ); + div1 = BASOP_Util_Divide3232_Scale_newton( L_mult0( 1000, sub( freq_count, 1 ) ), L_shr( output_Fs, 1 ), &temp ); div1 = BASOP_Util_Add_Mant32Exp( div1, temp, ONE_IN_Q30, 1, &temp ); idx_pivot = extract_l( L_shr( div1, sub( 31, temp ) ) ); /* Perform step limiting */ diff --git a/lib_rend/ivas_rotation_fx.c b/lib_rend/ivas_rotation_fx.c index e6f8f2653..1633f42d0 100644 --- a/lib_rend/ivas_rotation_fx.c +++ b/lib_rend/ivas_rotation_fx.c @@ -1974,7 +1974,7 @@ static void external_target_interpolation_fx( move16(); Word32 tmp; /* Calculate the interpolation increment and coefficient */ - tmp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, L_shl( L_deposit_l( hExtOrientationData->numFramesToTargetOrientation[i] ), 2 ), &tmp_e ); + tmp = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, L_shl( L_deposit_l( hExtOrientationData->numFramesToTargetOrientation[i] ), 2 ), &tmp_e ); hCombinedOrientationData->interpolationIncrement_fx = L_shl( tmp, sub( tmp_e, 31 ) ); /* Q30 */ move32(); hCombinedOrientationData->interpolationCoefficient_fx = hCombinedOrientationData->interpolationIncrement_fx; diff --git a/lib_rend/ivas_shoebox_fx.c b/lib_rend/ivas_shoebox_fx.c index 1a4496085..0156e70b5 100644 --- a/lib_rend/ivas_shoebox_fx.c +++ b/lib_rend/ivas_shoebox_fx.c @@ -387,7 +387,7 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( { q = Q22; move16(); - t = (Word32) BASOP_Util_Divide3232_Scale_cadence( *scale, absxk, &q ); + t = (Word32) BASOP_Util_Divide3232_Scale_newton( *scale, absxk, &q ); out_tmp = W_extract_h( W_shl( W_mult_32_32( out_tmp, t ), q ) ); // Q22 + Q31 + Q1 - 32 = Q22 out_tmp = W_extract_h( W_shl( W_mult_32_32( out_tmp, t ), q ) ); // Q22 + Q31 + Q1 - 32 = Q22 @@ -397,7 +397,7 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( } ELSE { - t = (Word32) BASOP_Util_Divide3232_Scale_cadence( absxk, *scale, &q ); + t = (Word32) BASOP_Util_Divide3232_Scale_newton( absxk, *scale, &q ); t = W_extract_h( W_shl( W_mult_32_32( t, t ), sub( shl( q, 1 ), 9 ) ) ); // Q31 + Q31 + Q1 - 9 - 32 = Q22 out_tmp = L_add( out_tmp, t ); // Q22 move32(); @@ -407,7 +407,7 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( IF( GE_32( absxk, *scale ) ) { - t = (Word32) BASOP_Util_Divide3232_Scale_cadence( *scale, absxk, &q ); + t = (Word32) BASOP_Util_Divide3232_Scale_newton( *scale, absxk, &q ); out_tmp = W_extract_h( W_shl( W_mult_32_32( out_tmp, t ), q ) ); // Q22 + Q31 + Q1 - 32 = Q22 out_tmp = W_extract_h( W_shl( W_mult_32_32( out_tmp, t ), q ) ); // Q22 + Q31 + Q1 - 32 = Q22 @@ -417,7 +417,7 @@ static Word32 shoebox_get_euclidian_distance_internal_fx( } ELSE { - t = (Word32) BASOP_Util_Divide3232_Scale_cadence( absxk, *scale, &q ); + t = (Word32) BASOP_Util_Divide3232_Scale_newton( absxk, *scale, &q ); t = W_extract_h( W_shl( W_mult_32_32( t, t ), sub( shl( q, 1 ), 9 ) ) ); // Q31 + Q31 + Q1 - 9 - 32 = Q22 out_tmp = L_add( out_tmp, t ); // Q22 } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7e526ca77..859768784 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -6836,7 +6836,7 @@ static void renderMasaToMasa( move32(); FOR( dir = 0; dir < numDirs; dir++ ) { - tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); + tmp = BASOP_Util_Divide3232_Scale_newton( inMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); inMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); /* Q30 */ move32(); } @@ -6844,7 +6844,7 @@ static void renderMasaToMasa( move16(); tmp = 0; move32(); - tmp = BASOP_Util_Divide3232_Scale_cadence( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); + tmp = BASOP_Util_Divide3232_Scale_newton( inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum_fx, &tmp_e ); inMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( tmp, sub( tmp_e, 1 ) ); /* Q30 */ move32(); } -- GitLab