diff --git a/lib_com/options.h b/lib_com/options.h index 5390fd919b424d1cbb634d663986f69f38f87b69..87301cd49cc005dbbcfbcaf571407256cf467c5a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -132,6 +132,7 @@ #define FIX_FLOAT_1578_OMASA_REND_SPIKES /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */ #define FIX_1521_SBA_LOUDNESS_STEREO /* FhG: issue 1521: Fix loudness for SBA to stereo rendering */ #define FIX_1559 /* Eri/FhG: fix for Issue 1559 in FD CNG with bitrate/bw switching */ +#define FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT /* Dolby: fix 2580: use dynamic length denominator for average energy in unclr_calc_corr_features_fx() */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 234652072aafb5da36bdc5e843e522bd6928ad00..0b9a2c9f9c0e21eae770e321365b1b3c1342b107 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -2220,7 +2220,13 @@ static void unclr_calc_corr_features_fx( Word16 *corrEst_ncorr_exp ) { Word16 i, corrLagMax, d_corrLagMax, tempLen, k; +#ifdef FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT + Word16 inv_len_exp; +#endif Word32 num, den; +#ifdef FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT + Word32 inv_len; +#endif Word32 corrL, corrR, ener, ener_side, mono_i, side_i, ic_Lm, ic_Rm, tdm_es_em, m_corrL_corrR, d_corrL_corrR; Word32 sum_prod, corrEstMax; Word16 corrL_exp, corrR_exp, ener_exp, ener_side_exp, sum_prod_exp, exp, exp1, exp2, num_exp, den_exp; @@ -2268,6 +2274,18 @@ static void unclr_calc_corr_features_fx( } /* average energy of L and R channels */ +#ifdef FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT + inv_len = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q31, L_deposit_l( length ), &inv_len_exp ); /* Q31-inv_len_exp */ + + hStereoClassif->ave_ener_L_fx = Mpy_32_32( hStereoTCA->E1_mem_fx, inv_len ); /* Q31-hStereoClassif->ave_ener_L_fx_e */ + move32(); + hStereoClassif->ave_ener_L_fx_e = add( hStereoTCA->E1_mem_exp, inv_len_exp ); + move16(); + hStereoClassif->ave_ener_R_fx = Mpy_32_32( hStereoTCA->E2_mem_fx, inv_len ); /* Q31-hStereoClassif->ave_ener_R_fx_e */ + move32(); + hStereoClassif->ave_ener_R_fx_e = add( hStereoTCA->E2_mem_exp, inv_len_exp ); + move16(); +#else hStereoClassif->ave_ener_L_fx = Mpy_32_32( hStereoTCA->E1_mem_fx, 13421772 /* 1/length in Q31*/ ); /* Q31-hStereoClassif->ave_ener_L_fx_e */ move32(); hStereoClassif->ave_ener_L_fx_e = hStereoTCA->E1_mem_exp; @@ -2276,6 +2294,7 @@ static void unclr_calc_corr_features_fx( move32(); hStereoClassif->ave_ener_R_fx_e = hStereoTCA->E2_mem_exp; move16(); +#endif /* unnormalized L/R correlation */ IF( sum_prod )