Commit ef86491f authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Make Q-factor of synth_16_fx and output_16_fx dynamic to prevent overflow in HQ_CORE mode

parent 94987666
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@
#define FIX_2174_JBM_BASOP_ALIGNMENT                         /* VoiceAge, Nokia: Fixes to JBM BASOP implementation and alignment to float */

#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_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 ############################ */
+8 −2
Original line number Diff line number Diff line
@@ -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
#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
        }

        /*---------------------------------------------------------------------*