diff --git a/lib_com/options.h b/lib_com/options.h index 111fe7f2ccfa6342b6f2d284f1e29a6fa770ae89..499a45afcaccdbf438b8eba5bbfc75c275211997 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -125,6 +125,7 @@ #define FIX_1574_EFAP_CODE_LINT /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_BASOP_2529_MASA_RATIO_SCALINGS /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */ #define FIX_BASOP_2531_MCT_CP_BITRATE /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */ +#define FIX_BASOP_2541_OMASA_ENC_FIXES /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 32a85a7aaf0c286998cc379630fe317dbfd246e1..31eb3a3f60413e8d084713951728c35d73e5f9e7 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -4842,8 +4842,13 @@ static void ivas_encode_masaism_metadata_fx( eneBand32 = W_extract_h( W_shl( eneBand, shift ) ); eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) ); +#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES + energy_ism = L_tmp; // Copy existing value + energy_ism_e = L_tmp_e; +#else energy_ism = 0; energy_ism_e = 0; +#endif move32(); move16(); FOR( obj = 0; obj < nchan_ism; obj++ ) @@ -4856,13 +4861,20 @@ static void ivas_encode_masaism_metadata_fx( FOR( band = 0; band < omasa_nbands; band++ ) { +#ifndef FIX_BASOP_2541_OMASA_ENC_FIXES energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e ); - +#endif FOR( obj = 0; obj < nchan_ism; obj++ ) { +#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES + L_tmp = Mpy_32_32( hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31 + L_tmp_e = add( 1, hOmasaEnergy->energy_ism_fx_e[sf][band] ); + energy_ism_ind[obj] = BASOP_Util_Add_Mant32Exp( energy_ism_ind[obj], energy_ism_ind_e[obj], L_tmp, L_tmp_e, &energy_ism_ind_e[obj] ); +#else hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = ONE_IN_Q30; // 1.0f in Q30 move32(); +#endif } }