Commit 14bd5915 authored by vaillancour's avatar vaillancour
Browse files

more comments

parent 5653c89c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@ int16_t select_stereo_mode(
        }
        else if ( element_mode == IVAS_CPE_TD )
        {
            /* Previous frame TD to LRTD decision (prev_fr_LRTD_TD_dec > 1) and content is speech, can switch to LRTD else remains in normal TD*/
            if ( hCPE->hStereoTD->prev_fr_LRTD_TD_dec > 0 && is_speech )
            {
                /* if unclr_decision goes from 1->0 on active content, continue in LRTD mode */
@@ -189,6 +190,14 @@ int16_t select_stereo_mode(
    /* switch from LRTD to DFT when xtalk_decision goes from 0->1 (note: this special case is not handled in the xtalk classifier) */
    if ( hCPE->last_element_mode == IVAS_CPE_TD && element_mode == IVAS_CPE_TD && hStereoClassif->xtalk_decision == 1 )
    {
        /*-------------------------------------------------------------------*
         * switch back to DFT, 
         * when the previous frame TD to LRTD decision = 0 (TD), 
         * more then 15 frame of LRTD, 
         * the prev_fr_LRTD_TD_dec has been to 0 for at least 3 frames, 
         * the classification of the primary channel tends to unvoiced characteristic 
         * and the interfering talker weighted score is low or the bitrate is >= 16k4 
         *-------------------------------------------------------------------*/
        if ( hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 0 && hCPE->hStereoTD->tdm_FD2LRTD_SW_cnt > 15 && hCPE->hStereoTD->tdm_last_LRTD_frame_cnt > 3 && hCPE->hCoreCoder[0]->clas < VOICED_CLAS && ( hCPE->element_brate >= IVAS_16k4 || hStereoClassif->xtalk_wscore < 0.01f ) )
        {
            if ( stereo_switching_flag == 1 )
@@ -844,7 +853,7 @@ void xtalk_classifier_td(
    }

    /* binary decision w. hysteresis (switch the decision only when coder_type is GC, UC or IC) */
    if ( ( hStereoClassif->unclr_decision == 0 && hStereoClassif->xtalk_decision == 0 && hStereoClassif->xtalk_wscore > 0.03f ) /*|| (hStereoClassif->xtalk_decision == 1 && hStereoClassif->xtalk_wscore < 0.00f)*/ && ( hStereoClassif->unclr_sw_enable_cnt[0] > 0 || hStereoClassif->unclr_sw_enable_cnt[1] > 0 ) )
    if ( ( hStereoClassif->unclr_decision == 0 && hStereoClassif->xtalk_decision == 0 && hStereoClassif->xtalk_wscore > 0.03f ) && ( hStereoClassif->unclr_sw_enable_cnt[0] > 0 || hStereoClassif->unclr_sw_enable_cnt[1] > 0 ) )
    {
        /* let's switch the binary decision */
        hStereoClassif->xtalk_decision = !hStereoClassif->xtalk_decision;
+10 −1
Original line number Diff line number Diff line
@@ -158,10 +158,19 @@ ivas_error stereo_set_tdm(
        hCPE->hStereoTD->tdm_lp_reuse_flag = 0;
        hCPE->hStereoTD->tdm_low_rate_mode = 0;
        hCPE->hStereoTD->tdm_Pitch_reuse_flag = 0;
       /*-------------------------------------------------------------------*
        * stereo classifier considered
        *
        * Set TD stereo encoder parameters
        *-------------------------------------------------------------------*/

        if ( hCPE->hStereoClassif->lrtd_mode == 1 )
        {
            /* initialize this flag when uncorrelated L&R channels have been detected in the previous frame */
           /*-------------------------------------------------------------------*
            * initialize LRTD flag when uncorrelated/interfering talker have been allowed in the previous frame, 
            * or when last element is not CPE_(LR)TD, 
            * or if the switching from FD is recent (<5 frames) 
            *-------------------------------------------------------------------*/
            if ( hCPE->hStereoTD->prev_fr_LRTD_TD_dec == 1 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->hStereoTD->tdm_FD2LRTD_SW_cnt < 5 )
            {
                hCPE->hStereoTD->tdm_LRTD_flag = 1;