Commit 9ed08a2f authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

fix fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder

parent aeaa35fb
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@
#define NONBE_FIX_1197_OMASA_META_BUFFER                /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching */

#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */

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

+17 −0
Original line number Diff line number Diff line
@@ -172,6 +172,23 @@ void ivas_decision_matrix_enc(
        st->core = ACELP_CORE;
    }

#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT
    if ( st->element_mode == IVAS_CPE_TD && st->idchan == 0 && element_brate < IVAS_24k4 && st->core == ACELP_CORE )
    {
        /* In TD stereo, TRANSITION mode has different bit allocation than other modes */
        /* the two conditions below are replicated from tdm_configure_enc() where mod_ct is derived from coder_type */
        /* it ensures that coder_type is identical in the TD stereo encoder and decoder */
        if ( ( ( st->last_L_frame >= L_FRAME16k && st->flag_ACELP16k == 0 ) || ( st->last_L_frame == L_FRAME && st->flag_ACELP16k == 1 ) ) && st->last_core_brate != FRAME_NO_DATA && st->last_core_brate != SID_2k40 && st->coder_type_raw != VOICED )
        {
            st->coder_type = TRANSITION;
        }
        else if ( st->coder_type != AUDIO && ( st->sp_aud_decision1 == 1 || st->sp_aud_decision2 == 1 ) )
        {
            st->coder_type = AUDIO;
        }
    }
#endif

    if ( st->is_ism_format && st->tcxonly )
    {
        st->core = TCX_20_CORE;