diff --git a/lib_com/options.h b/lib_com/options.h index 2299ff1629d49800475b7ce07b33fdf623329dcc..af3166f5398bd140dab73a185741aba9ac80eb93 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,7 +94,7 @@ #define FIX_2176_ASSERT_DEC_MAP_PARAMS_DIRAC2STEREO /* FhG: Reduce hStereoDft->q_smooth_buf_fx by one to prevent overflow in the subframe_band_nrg[][] calculation */ #define FIX_2015_PREMPH_SAT_ALT /* VA: saturation can happen during preemphasis filtering due to a too aggressive scaling factor, allows preemphis to get 1 more bit headroom */ #define FIX_2178_FL_TO_FX_WITH_OBJ_EDIT_FILE_INTERFACE /* Nokia: Fixes float to fx conversion in decoder app with object edit file interface */ - +#define FIX_1947_DEC_HIGH_MLD_FOR_STEREO2MONO /* FhG: Make Q-factor of synth_16_fx and output_16_fx dynamic to prevent overflow in HQ_CORE mode */ /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index 1fd7cb0f321f0433359b5e141c513ee0cf3e72b2..ae955c5edb8e8abb653d57d33c6706d95c93ce28 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -643,8 +643,14 @@ ivas_error ivas_core_dec_fx( ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_output ) ); // Q11 - Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 - Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 +#ifdef FIX_1947_DEC_HIGH_MLD_FOR_STEREO2MONO + st->Q_syn_factor = s_min( 0, s_min( Q_synth, Q_output ) ); + Scale_sig( synth_16_fx[n], output_frame, sub( st->Q_syn_factor, Q_synth ) ); // st->Q_syn_factor + Scale_sig( output_16_fx[n], L_FRAME48k, sub( st->Q_syn_factor, Q_output ) ); // st->Q_syn_factor +#else + Scale_sig( synth_16_fx[n], output_frame, negate( Q_synth ) ); // Q0 + Scale_sig( output_16_fx[n], L_FRAME48k, negate( Q_output ) ); // Q0 +#endif } /*---------------------------------------------------------------------*