diff --git a/lib_com/options.h b/lib_com/options.h index 499a45afcaccdbf438b8eba5bbfc75c275211997..3077f91f2c6162774a99c63c5dd2e2b61de98fca 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -126,6 +126,7 @@ #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 */ +#define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 31eb3a3f60413e8d084713951728c35d73e5f9e7..4c5f7ba284226a09b4c85615d95ddbc47184028e 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -3160,7 +3160,11 @@ static void average_masa_metadata_fx( hMeta->directional_meta[i].spread_coherence_fx[j][k] = BASOP_Util_Divide3232_Scale( spread_coh_sum_fx, L_add( energy_sum_fx, EPSILON_FX ), &temp2_e ); move16(); temp2_e = add( temp2_e, sub( spread_coh_sum_e, energy_sum_e ) ); +#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 + hMeta->directional_meta[i].spread_coherence_fx[j][k] = shl_sat( hMeta->directional_meta[i].spread_coherence_fx[j][k], temp2_e ); /*changing q from 15-temp2_e to q15*/ +#else hMeta->directional_meta[i].spread_coherence_fx[j][k] = shl( hMeta->directional_meta[i].spread_coherence_fx[j][k], temp2_e ); /*changing q from 15-temp2_e to q15*/ +#endif move16(); IF( i == 0 ) { diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 04ffdbfaa148982912ab01722bdfe39844fe0086..b96e7fc98d04ebd43b70d1ed628454ed2bc0f3c1 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -210,7 +210,12 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { #ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS +#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 + int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; + hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp +#else hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 +#endif #else hMeta->directional_meta[i].spread_coherence_fx[j][b] = (Word16) ( readOther[b] * ONE_IN_Q7 ); // Q15 #endif @@ -242,7 +247,12 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { #ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS +#ifdef FIX_BASOP_2545_FIX_LTV_REGRESSION_2529 + int32_t tmp_coh = ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255; + hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( tmp_coh > MAX_16 ? MAX_16 : tmp_coh ); // Q15, need to clamp +#else hMeta->common_meta.surround_coherence_fx[j][b] = (Word16) ( ( (int32_t) readOther[b] * ONE_IN_Q15 + 254 ) / 255 ); // Q15 +#endif #else hMeta->common_meta.surround_coherence_fx[j][b] = shl( (Word16) readOther[b], 7 ); // Q8->Q15 move16();