Commit fc8a766b authored by malenov's avatar malenov
Browse files

fix element_mode read/write location

parent 87acb66c
Loading
Loading
Loading
Loading
Loading
+60 −16
Original line number Diff line number Diff line
@@ -176,17 +176,6 @@ int16_t select_stereo_mode(
        }
    }

#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &element_mode, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_element_mode.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &element_mode, sizeof( int16_t ), 1, 1, "res/force_element_mode.enf" );
    }
#endif

    /* 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 )
    {
@@ -201,6 +190,17 @@ int16_t select_stereo_mode(
        }
    }

#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &element_mode, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_element_mode.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &element_mode, sizeof( int16_t ), 1, 1, "res/force_element_mode.enf" );
    }
#endif

    if ( hCPE->last_element_mode != element_mode )
    {
        if ( hCPE->last_element_mode != IVAS_CPE_DFT && hCPE->last_element_mode != IVAS_CPE_TD )
@@ -633,6 +633,17 @@ void unclr_classifier_td(
    dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/unclr_dec_hyst.x" );
#endif

#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_unclr_decision.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/force_unclr_decision.enf" );
    }
#endif

    return;
}

@@ -723,6 +734,17 @@ void unclr_classifier_dft(
    dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/unclr_dec_hyst.x" );
#endif

#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_unclr_decision.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &hStereoClassif->unclr_decision, sizeof( int16_t ), 1, 1, "res/force_unclr_decision.enf" );
    }
#endif

    return;
}

@@ -857,6 +879,17 @@ void xtalk_classifier_td(
    dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/xtalk_dec_hyst.x" );
#endif

#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_xtalk_decision.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/force_xtalk_decision.enf" );
    }
#endif

    return;
}

@@ -1017,17 +1050,28 @@ void xtalk_classifier_dft(
        hStereoClassif->xtalk_decision = 1;
    }

    /* updates */
    hItd->prev_m1 = m1;
    hItd->prev_m2 = m2;
    hItd->prev_itd1 = itd;
    hItd->prev_itd2 = itd2;

#ifdef DEBUG_MODE_TD
    dbgwrite( &hStereoClassif->xtalk_wscore, sizeof( float ), 1, 1, "res/xtalk_wscore.x" );
    dbgwrite( &dec, sizeof( int16_t ), 1, 1, "res/xtalk_dec.x" );
    dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/xtalk_dec_hyst.x" );
#endif

    /* updates */
    hItd->prev_m1 = m1;
    hItd->prev_m2 = m2;
    hItd->prev_itd1 = itd;
    hItd->prev_itd2 = itd2;
#ifdef DEBUG_FORCE_DIR
    if ( hCPE->hCoreCoder[0]->force_dir[0] != '\0' )
    {
        dbgread( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, fname( hCPE->hCoreCoder[0]->force_dir, "force_xtalk_decision.enf", -1, -1, -1 ) );
    }
    else
    {
        dbgwrite( &hStereoClassif->xtalk_decision, sizeof( int16_t ), 1, 1, "res/force_xtalk_decision.enf" );
    }
#endif

    return;
}