Commit c315f4d6 authored by fotopoulou's avatar fotopoulou
Browse files

fix for MSAN issue 778 for TNS in unified stereo

parent 83d74290
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@
#define NONBE_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE    /* FhG: fix for cng in ISM DTX on sudden silence periods - JBM addon (issue 552) */
#define NONBE_FIX_738_SBA_BR_SW_ASAN                          /* FhG: issue 738: fixes bug when switching to an MCT bitrate and previous frame was ACELP */
#define NONBE_CR_FIX_735_SBA_HP20_BRATE_SWITCHING             /* VA: Issue 735: Resolve "HP20 filtering bug in SBA/OSBA bitrate switching" */

#define NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN                  /* FhG: Issue 778: MSAN error due to uninitialized TNS configuration */

/* ##################### End NON-BE switches ########################### */

+13 −0
Original line number Diff line number Diff line
@@ -54,6 +54,9 @@ void stereo_tcx_init_enc(
    Encoder_State *st /* i/o: encoder state structure */
)
{
#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN
    int16_t prev_IsTNSAllowed;
#endif
    assert( st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA );

    /* Get the raw coder type from signal analysis*/
@@ -100,11 +103,21 @@ void stereo_tcx_init_enc(
    st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC );
    st->hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode, st->element_mode );
    st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode );
#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN
    prev_IsTNSAllowed = st->hTcxCfg->fIsTNSAllowed;
#endif
    if ( st->element_mode != EVS_MONO )
    {
        st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode );
    }
#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN
    if ( !prev_IsTNSAllowed && st->hTcxCfg->fIsTNSAllowed && st->element_mode == IVAS_CPE_DFT ) /*may happen in unified stereo when switching stereo technologies */
    {
        InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->bits_frame_nominal * FRAMES_PER_SEC, st->element_mode, 0 );

        SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, 0 );
    }
#endif
    st->core_brate = st->total_brate;

    return;