Commit 68de2b57 authored by multrus's avatar multrus
Browse files

Avoid reading of unitialized st->hTcxCfg->psychParamsCurrent by harmonizing open_decoder_LPD*_fx()

parent 496d928d
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 ################################## */

+6 −0
Original line number Diff line number Diff line
@@ -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*/
+11 −0
Original line number Diff line number Diff line
@@ -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*/
+18 −0
Original line number Diff line number Diff line
@@ -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
    {
+6 −0
Original line number Diff line number Diff line
@@ -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 */