Commit ab266618 authored by vaclav's avatar vaclav
Browse files

port FIX_1384_MSAN_stereo_tcx_core_enc

parent d11823c9
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@
#define FIX_1385_INIT_IGF_STOP_FREQ                     /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS      /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
#define FIX_1384_MSAN_stereo_tcx_core_enc               /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */

/* #################### End BASOP porting switches ############################ */

+35 −5
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ void stereo_tcx_core_dec_fx(
    }

    /*--------------------------------------------------------------------------------*
     * LPC PARAMETERS
     * LPC envelope decoding
     *--------------------------------------------------------------------------------*/

    st->acelp_cfg.midLpc = 0;
@@ -349,6 +349,10 @@ void stereo_tcx_core_dec_fx(
        {
            Word16 tcx_lpc_cdk;

#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
            tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type );
            move16();
#else
            test();
            test();
            IF( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) )
@@ -361,6 +365,7 @@ void stereo_tcx_core_dec_fx(
                tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type ); /* Q0 */
                move16();
            }
#endif

            Copy( st->lsf_old_fx, &lsf_fx[0], M ); /* Q2.56 */
            Copy( st->lsp_old_fx, &lsp_fx[0], M ); /* Q15 */
@@ -485,13 +490,14 @@ void stereo_tcx_core_dec_fx(
        E_LPC_f_lsp_a_conversion( st->lsp_old_fx, st->old_Aq_12_8_fx, M );
    }

#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
    test();
    if ( st->enablePlcWaveadjust && bfi )
    {
        st->hPlcInfo->nbLostCmpt = add( st->hPlcInfo->nbLostCmpt, 1 ); /* Q0 */
        move16();
    }

#endif
    /*--------------------------------------------------------------------------------*
     * TD-TCX concealment
     *--------------------------------------------------------------------------------*/
@@ -630,6 +636,7 @@ void stereo_tcx_core_dec_fx(
    test();
    IF( EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, TCX_20_CORE ) )
    {
#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
        test();
        test();
        IF( st->enablePlcWaveadjust ||                 /* bfi      */
@@ -660,7 +667,7 @@ void stereo_tcx_core_dec_fx(
                }
            }
        }

#endif
        IF( !bfi && st->hTonalMDCTConc != NULL )
        {
            TonalMDCTConceal_SaveTimeSignal_ivas_fx( st->hTonalMDCTConc, synthFB_fx, 0, hTcxDec->L_frameTCX );
@@ -828,12 +835,13 @@ void stereo_tcx_core_dec_fx(

    IF( !bfi )
    {
#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
        if ( st->enablePlcWaveadjust )
        {
            st->hPlcInfo->nbLostCmpt = 0;
            move16();
        }

#endif
        IF( param[1 + NOISE_FILL_RANGES] != 0 )
        {
            Word32 tcxltp_pitch_tmp = L_add( L_deposit_h( hTcxLtpDec->tcxltp_pitch_int ), L_shl( L_deposit_l( div_s( hTcxLtpDec->tcxltp_pitch_fr, st->pit_res_max ) ), 1 ) ); /*15Q16*/
@@ -1017,8 +1025,12 @@ static void dec_prm_tcx_ivas_fx(
    getTCXMode_ivas_fx( st, st, 0 /* <- MCT_flag */ );

    /* last_core for error concealment */
#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
    IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
#else
    test();
    IF( !st->use_partial_copy && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
#endif
    {
        st->last_core_from_bs = get_next_indice_fx( st, 1 ); /* Store decoder memory of last_core	Q0*/
        move16();
@@ -1063,8 +1075,10 @@ static void dec_prm_tcx_ivas_fx(
        }
    }

#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
    IF( !st->use_partial_copy )
    {
#endif
        IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
        {
            getTCXWindowing_ivas_fx( st->core, st->last_core, st->element_mode, st->hTcxCfg, st );
@@ -1077,8 +1091,9 @@ static void dec_prm_tcx_ivas_fx(
            st->dec_glr_idx = -1;
            move16();
        }
#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
    }

#endif

    /*--------------------------------------------------------------------------------*
     * LPC parameters
@@ -1093,6 +1108,20 @@ static void dec_prm_tcx_ivas_fx(
     * TCX20/10 parameters
     *--------------------------------------------------------------------------------*/

#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
    getTCXparam_fx( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 );

    IF( LT_16( sub( *total_nbbits, bitsRead[0] ), sub( st->next_bit_pos, start_bit_pos ) ) )
    {
        st->BER_detect = 1;
        move16();
        st->next_bit_pos = add( start_bit_pos, sub( *total_nbbits, bitsRead[0] ) ); /* Q0 */
        move16();
    }

    bitsRead[0] = sub( st->next_bit_pos, start_bit_pos ); /* Q0 */
    move16();
#else
    IF( st->use_partial_copy == 0 )
    {
        getTCXparam_fx( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 );
@@ -1111,6 +1140,7 @@ static void dec_prm_tcx_ivas_fx(
        bitsRead[0] = sub( st->next_bit_pos, start_bit_pos ); /* Q0 */
        move16();
    }
#endif

    return;
}
+8 −0
Original line number Diff line number Diff line
@@ -408,6 +408,10 @@ void stereo_tcx_core_enc(
    st->hLPDmem->q_lpd_syn = st->Q_syn;
    move16();

    /*--------------------------------------------------------------*
     * LPC Envelope Quantization and FDNS
     *---------------------------------------------------------------*/

    IF( !st->enableTcxLpc )
    {
        IF( st->envWeighted )
@@ -432,6 +436,10 @@ void stereo_tcx_core_enc(
        }
    }

#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
    st->acelp_cfg.midLpc = 0;
    move16();
#endif
    last_core_orig = st->last_core;
    move16();