diff --git a/lib_com/options.h b/lib_com/options.h index e628cf13df47edce08dc03fdac03c2c31a968cf5..8d4c9acae68bba138b3574df6f67388da2728ce4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -103,6 +103,7 @@ #define HARMONIZE_DCT /* VA: removal of duplicated DCT functions */ #define FIX_2489_HARMONIZE_FdCng_encodeSID /* FhG: harmonize FdCng_encodeSID_fx() and FdCng_encodeSID_ivas_fx() */ #define FIX_1527_CMR_BITRATE_IDX /* Fix for incorrect bitrate idx packed in rtp CMR E-byte */ +#define FIX_2509_HARMONIZE_OPEN_DECODER_LPD /* FhG: BASOP issue 2509: Avoid reading of unitialized st->hTcxCfg->psychParamsCurrent by harmonizing open_decoder_LPD*_fx() */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 1df94661325ecfc10e10246218d3b7f577e5184d..08447ca59a1a9591b3f2ca1d0275d55a6fdafec8 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -7287,13 +7287,19 @@ ivas_error ppp_quarter_decoder_fx( DTFS_STRUCTURE PREV_CW_D_FX, /* i : Previous DTFS */ Decoder_State *st_fx ); +#ifndef FIX_2509_HARMONIZE_OPEN_DECODER_LPD void open_decoder_LPD_fx( Decoder_State *st, const Word32 total_brate, /* Q0 */ const Word16 bwidth /* Q0 */ ); +#endif +#ifdef FIX_2509_HARMONIZE_OPEN_DECODER_LPD +void open_decoder_LPD_fx( +#else void open_decoder_LPD_ivas_fx( +#endif Decoder_State *st, /* i/o: decoder state structure */ const Word32 total_brate, /* i : total bitrate Q0*/ const Word32 last_total_brate, /* i : last total bitrate Q0*/ diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index dd3115fb709f0b1bcbdffa12ccfacdde208e166c..080c2c844083594382b11ce1cd4e9b98f81aa1ae 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -12,6 +12,7 @@ #include "rom_com.h" #include "cnst.h" /* for MIN_CNG_LEV */ +#ifndef FIX_2509_HARMONIZE_OPEN_DECODER_LPD /*-----------------------------------------------------------------------* * open_decoder_LPD_fx() * @@ -1005,6 +1006,7 @@ void open_decoder_LPD_fx( } return; } +#endif void tcxltp_dec_init_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec, /* Q0 */ @@ -1114,7 +1116,16 @@ void acelp_plc_mdct_transition_fx( return; } +#ifdef FIX_2509_HARMONIZE_OPEN_DECODER_LPD +/*-----------------------------------------------------------------------* + * open_decoder_LPD_fx() + * + * Initialization of state variables + *-----------------------------------------------------------------------*/ +void open_decoder_LPD_fx( +#else void open_decoder_LPD_ivas_fx( +#endif Decoder_State *st, /* i/o: decoder state structure */ const Word32 total_brate, /* i : total bitrate Q0*/ const Word32 last_total_brate, /* i : last total bitrate Q0*/ diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 142609fff4505ab659dc70912ef87ecd305fabeb..671dfc433d65add4eeba7c45e4169fad1a3353ad 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -89,7 +89,21 @@ void mode_switch_decoder_LPD_fx( test(); IF( NE_16( fscale, st->fscale ) || ( switchWB != 0 ) || ( bSwitchFromAmrwbIO != 0 ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) { +#ifdef FIX_2509_HARMONIZE_OPEN_DECODER_LPD + Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + move16(); + + open_decoder_LPD_fx( st, total_brate, st->last_total_brate, bwidth, 0, EVS_MONO, 0, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8 ); +#else open_decoder_LPD_fx( st, total_brate, bwidth ); +#endif } ELSE { @@ -323,7 +337,11 @@ void mode_switch_decoder_LPD_ivas_fx( assert( (Word16) ( st->sr_core / FRAMES_PER_SEC ) == extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ) ); IF( NE_16( fscale, st->fscale ) || switchWB || bSwitchFromAmrwbIO || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) { +#ifdef FIX_2509_HARMONIZE_OPEN_DECODER_LPD + open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, Q_syn_Overl_TDAC, Q_fer_samples, Q_syn_Overl, Q_syn_Overl_TDACFB, Q_syn_OverlFB, Q_old_out, Q_old_outLB, Q_old_Aq_12_8 ); +#else open_decoder_LPD_ivas_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, Q_syn_Overl_TDAC, Q_fer_samples, Q_syn_Overl, Q_syn_Overl_TDACFB, Q_syn_OverlFB, Q_old_out, Q_old_outLB, Q_old_Aq_12_8 ); +#endif } ELSE { diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index bae2638e15c67d5ccb26102b92b4f527bc961233..999b763f6e3578c582bfa7bf8dd5f500a868de0c 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -878,12 +878,14 @@ ivas_error init_decoder_fx( st_fx->hTECDec = NULL; } +#ifndef FIX_2509_HARMONIZE_OPEN_DECODER_LPD /* Init Decoder */ IF( st_fx->element_mode == EVS_MONO ) { open_decoder_LPD_fx( st_fx, st_fx->total_brate, st_fx->bwidth ); } ELSE +#endif { Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; move16(); @@ -894,7 +896,11 @@ ivas_error init_decoder_fx( move16(); move16(); move16(); +#ifdef FIX_2509_HARMONIZE_OPEN_DECODER_LPD + open_decoder_LPD_fx( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8 ); +#else open_decoder_LPD_ivas_fx( st_fx, st_fx->total_brate, st_fx->last_total_brate, st_fx->bwidth, 0, st_fx->element_mode, 1, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8 ); +#endif } /* PLC mode initialization */