diff --git a/lib_com/options.h b/lib_com/options.h index 6d9d98192d4f87e54492ddad3e63b8d410068ef7..d2ccffc1d20787ab7b7cf9f4020c903c0199fdda 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ +#define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI /* Nokia: BASOP issue 2442: Aligns float with identical diffuse gain limitation to minimize diff */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 11f20412ca2990563ca26b20d8261bbb27d62066..d4b4eaf096d003ddf06ea2779486589774134610 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -56,6 +56,10 @@ #define DIRAC_AVG_LENGTH_SYNTH_MS_FAST 10 #define DIRAC_ALPHA_MAX_FAST 0.12f #define DIRECTION_SMOOTHNESS_ALPHA 0.01f +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI +#define DIRAC_SMALL_DIFF_POW_LIM 65536.0f +#define DIRAC_SMALL_DIFF_POW_MAX_GAIN 2.0f +#endif /*------------------------------------------------------------------------- @@ -1250,6 +1254,9 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float *alpha_synthesis_fast; int16_t alphaMaxBin; int16_t alphaMaxBinFast; +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + float diff_gain_limit; +#endif push_wmops( "dirac_out_synth_sfr" ); @@ -1434,17 +1441,26 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*diffuse*/ *p_power_diff_smooth_prev = g1 * ( *p_power_smooth_diff++ ) + g2 * ( *p_power_diff_smooth_prev ) + EPSILON; *( p_cy_auto_diff_smooth_prev ) = g1 * ( *( p_cy_auto_diff_smooth++ ) ) + g2 * ( *( p_cy_auto_diff_smooth_prev ) ); - +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + diff_gain_limit = *p_power_diff_smooth_prev < DIRAC_SMALL_DIFF_POW_LIM ? DIRAC_SMALL_DIFF_POW_MAX_GAIN : DIRAC_GAIN_LIMIT; +#endif *( p_gains_diff ) = sqrtf( *( p_cy_auto_diff_smooth_prev++ ) / ( *( p_power_diff_smooth_prev++ ) ) ); if ( *( p_gains_diff ) < 0.f ) { *( p_gains_diff ) = 0.f; } +#ifdef FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI + else if ( *( p_gains_diff ) > diff_gain_limit ) + { + *( p_gains_diff ) = diff_gain_limit; + } +#else else if ( *( p_gains_diff ) > DIRAC_GAIN_LIMIT ) { *( p_gains_diff ) = DIRAC_GAIN_LIMIT; } +#endif p_gains_diff++; }