Commit 131109d4 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch '124-hplcinfo-handle-in-decoder' into 'main'

[non-BE] Resolve "hPlcInfo handle in decoder"

See merge request !228
parents b1ab6c1a c9c01f6b
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@
#define FIX_I173_I174                                   /* Issues 173 and 174: Remove frame and subframe index from ISm metadata and headtracking respectively. */
#define FIX_TCX_DEC_RECONF_BFI
#define FIX_SBA_DTX_DECODE_ERROR                        /* Issue 176: SBA decoder error with DTX at 80kbps SWB, Issue 21: SBA front-VAD threshold (203) */
#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS              /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */
/*#define FIX_MCT_PLC_RECOVERY*/                            /* Issue 184: scale the old synthesis part correctly in the first good frame after lost frames in MCT modes - to be activated after previous switch is merged */
#define FIX_MSAN_ERROR_STEREO_RATE_SWITCHING            /* addresses Issue 177 */
#define SBA_BR_SWITCHING                                /* Issue 114: Changes for sba bit rate switching*/
#define FIX_AGC_WINFUNC_MEMORY                          /* Issue 62: lower agc_com.winFunc memory consumption */
+4 −0
Original line number Diff line number Diff line
@@ -152,7 +152,11 @@ void decoder_tcx_post(
    if ( bfi && !st->use_partial_copy )
    {
        /* run lpc gain compensation not for waveform adjustment */
#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS
        if ( !st->enablePlcWaveadjust || ( st->hPlcInfo != NULL && st->hPlcInfo->concealment_method == TCX_TONAL ) )
#else
        if ( !st->enablePlcWaveadjust || st->hPlcInfo->concealment_method == TCX_TONAL )
#endif
        {
            float gainHelperFB = hTcxDec->gainHelper;
            float stepCompensateFB = hTcxDec->stepCompensate * st->L_frame / hTcxDec->L_frameTCX;
+6 −1
Original line number Diff line number Diff line
@@ -661,7 +661,11 @@ ivas_error init_decoder(
     * Mode 2 initialization
     *-----------------------------------------------------------------*/

#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS
    if ( st->element_mode == EVS_MONO )
#else
    if ( idchan == 0 && st->element_mode != IVAS_CPE_MDCT )
#endif
    {
        if ( ( st->hPlcInfo = (T_PLCInfo_HANDLE) count_malloc( sizeof( T_PLCInfo ) ) ) == NULL )
        {
@@ -685,8 +689,9 @@ ivas_error init_decoder(
        st->hTECDec = NULL;
    }

#ifndef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS // the initialziation is done in open_decoder_LPD()
    st->enablePlcWaveadjust = 0;

#endif
    /* Init Core Decoder */
    open_decoder_LPD( st, st->total_brate, st->last_total_brate, st->bwidth, 0, st->element_mode, 1 );

+22 −2
Original line number Diff line number Diff line
@@ -181,13 +181,32 @@ ivas_error ivas_core_dec(
            st->flagGuidedAcelp = 0;
        }

#ifdef FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS
#ifdef FIX_MCT_PLC_RECOVERY
        if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL )
#else
        if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) && st->hTcxDec != NULL && hMCT == NULL )
#endif
        {
            float gain;

            gain = st->hTcxDec->conceal_eof_gain * st->last_concealed_gain_syn_deemph;
            v_multc( st->hHQ_core->old_out, gain, st->hHQ_core->old_out, st->hTcxDec->L_frameTCX );
            v_multc( st->hHQ_core->old_outLB, gain, st->hHQ_core->old_outLB, st->L_frame );

            if ( !st->hTcxCfg->last_aldo )
            {
                v_multc( st->hTcxDec->syn_OverlFB, gain, st->hTcxDec->syn_OverlFB, st->hTcxCfg->tcx_mdct_window_lengthFB );
                v_multc( st->hTcxDec->syn_Overl, gain, st->hTcxDec->syn_Overl, st->hTcxCfg->tcx_mdct_window_length );
            }
        }
#else
        /* PLC: [TCX: Fade-out-recovery] - overlapping part needs to be attenuated for first good frame */
        if ( !st->bfi && st->prev_bfi && ( st->last_core_bfi == TCX_20_CORE || st->last_core_bfi == TCX_10_CORE ) )
        {
            float gain;

            gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain
                                                                                                                    : 0.0f;
            gain = ( st->element_mode == IVAS_CPE_MDCT ) ? st->hTcxDec->conceal_eof_gain : ( st->hPlcInfo != NULL ) ? st->hPlcInfo->recovery_gain : 0.0f;

            if ( ( st->element_mode == IVAS_CPE_MDCT && hMCT == NULL ) || ( st->hPlcInfo != NULL ) )
            {
@@ -201,6 +220,7 @@ ivas_error ivas_core_dec(
                }
            }
        }
#endif

        set_f( voice_factors[n], 0.f, NB_SUBFR16k );
        set_f( hb_synth[n], 0.0f, L_FRAME48k );