Commit 5b650bb0 authored by fotopoulou's avatar fotopoulou
Browse files

[fix] for issue 221, uninitialized tcx config values when switching from TD to MDCT stereo

parent e3510c80
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
/* ################### Start compiler switches ######################## */

#define SUPPORT_JBM_TRACEFILE                   /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
#define RAM_COUNTING_TOOL                       /* tool to automatically count the dynamically alocated static memory consumption */
//#define RAM_COUNTING_TOOL                       /* tool to automatically count the dynamically alocated static memory consumption */

/* #################### End compiler switches ######################### */

@@ -164,6 +164,7 @@
#define BRATE_SWITCHING_FRAMEWORK                       /* Bitrate switching changes related to the general framework  */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */
#define FIX_185_REDUCE_MD_BITS                          /* Issue 185: Crash in SBA encoder for 24.4 kbps HOA3 input with longer testvector */
#define FIX_221_BR_SWITCH_STEREO                        /* Issue 221: Fix missing initialization when switchin from TD to MDCT stereo*/

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+13 −1
Original line number Diff line number Diff line
@@ -1467,7 +1467,6 @@ void stereo_switching_dec(
        mvr2r( sts[0]->old_exc, sts[1]->old_exc, L_EXC_MEM_DEC );
        mvr2r( sts[0]->lsf_old, sts[1]->lsf_old, M );
        mvr2r( sts[0]->lsp_old, sts[1]->lsp_old, M );

        if ( hCPE->element_mode == IVAS_CPE_MDCT )
        {
            sts[1]->last_core = sts[0]->last_core;
@@ -1493,6 +1492,19 @@ void stereo_switching_dec(
        set_f( sts[0]->old_exc, 0.0f, L_EXC_MEM_DEC );
        set_f( sts[1]->old_exc, 0.0f, L_EXC_MEM_DEC );
    }
#ifdef FIX_221_BR_SWITCH_STEREO
    else if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode == IVAS_CPE_TD )
    {
        sts[1]->hTcxCfg->last_aldo = sts[0]->hTcxCfg->last_aldo;
        sts[1]->hTcxCfg->tcx_curr_overlap_mode = sts[0]->hTcxCfg->tcx_curr_overlap_mode;
        sts[1]->fscale = sts[0]->fscale;
        sts[1]->hTcxCfg->tcx_mdct_window_length = sts[0]->hTcxCfg->tcx_mdct_window_length;
        sts[1]->pit_res_max = sts[0]->pit_res_max;
        sts[1]->pit_res_max_past = sts[0]->pit_res_max_past;
        sts[1]->hTcxDec->L_frameTCX = sts[0]->hTcxDec->L_frameTCX;
        sts[1]->hTcxDec->conceal_eof_gain = sts[0]->hTcxDec->conceal_eof_gain;
    }
#endif

    return;
}
+7 −2
Original line number Diff line number Diff line
@@ -803,7 +803,6 @@ void stereo_switching_enc(
        mvr2r( sts[0]->lsp_old1, sts[1]->lsp_old1, M );

        sts[1]->GSC_noisy_speech = 0;

        if ( hCPE->element_mode == IVAS_CPE_MDCT )
        {
            /* cross-fade overlap region of DFT Stereo downmix and original stereo channels */
@@ -828,6 +827,12 @@ void stereo_switching_enc(
        set_f( sts[0]->hLPDmem->old_exc, 0.0f, L_EXC_MEM );
        set_f( sts[1]->hLPDmem->old_exc, 0.0f, L_EXC_MEM );
    }

#ifdef FIX_221_BR_SWITCH_STEREO
    else if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode == IVAS_CPE_TD )
    {
        sts[1]->hTcxCfg->last_aldo = sts[0]->hTcxCfg->last_aldo;
        sts[1]->hTcxCfg->tcx_curr_overlap_mode = sts[0]->hTcxCfg->tcx_curr_overlap_mode;
    }
#endif
    return;
}