Commit 92416844 authored by vaillancour's avatar vaillancour
Browse files

change to Vladimir proposed fix, moving it to ivas_stereo_td_enc

parent 9ed08a2f
Loading
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -172,23 +172,6 @@ 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;
+13 −1
Original line number Diff line number Diff line
@@ -449,6 +449,18 @@ void tdm_configure_enc(
    }

    mod_ct = AUDIO;
#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT
    if ( hCPE->element_brate < IVAS_24k4 )
    {
        mod_ct = AUDIO;
        /* Only sure TRANSITION coding modes are important for bit allocation, otherwise mod_ct is set to AUDIO only to easy debugging if needed */
        if ( sts[0]->coder_type == TRANSITION ||
             ( ( ( sts[0]->last_L_frame >= L_FRAME16k && sts[0]->flag_ACELP16k == 0 ) || ( sts[0]->last_L_frame == L_FRAME && sts[0]->flag_ACELP16k == 1 ) ) && sts[0]->last_core_brate != FRAME_NO_DATA && sts[0]->last_core_brate != SID_2k40 && sts[0]->coder_type_raw != VOICED /*in case of CNG, this code is not reached sts[0]->core_brate != FRAME_NO_DATA && sts[0]->core_brate != SID_2k40 &&*/ ) )
        {
            mod_ct = TRANSITION;
        }
    }
#else
    if ( hCPE->element_brate < IVAS_24k4 )
    {
        mod_ct = sts[0]->coder_type;
@@ -462,7 +474,7 @@ void tdm_configure_enc(
            mod_ct = AUDIO;
        }
    }

#endif
    /* Correction of tdm_inst_ratio_idx in case of TC in the seecondary channel */
    if ( hStereoTD->flag_skip_DMX == 0 && hStereoTD->tdm_LRTD_flag == 1 && sts[1]->tc_cnt > 1 /*&& abs(hStereoTD->tdm_inst_ratio_idx-LRTD_STEREO_MID_IS_PRIM) > 5*/ )
    {