Commit 430ca242 authored by vaclav's avatar vaclav
Browse files

FIX_MCT3 - skip preprocessing/coding/decoding of MCT_CHAN_MODE_IGNORE channel

parent f9436023
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@

#define FIX_317                                         /* FhG: issue 317 - address sanitizer error in MDCT-Stereo PLC */

#define FIX_MCT3 // skip preprocessing/coding/decoding of MCT_CHAN_MODE_IGNORE channel

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+7 −0
Original line number Diff line number Diff line
@@ -118,6 +118,13 @@ ivas_error ivas_cpe_dec(
        n_channels = 1; /* in DFT stereo, only M channel is coded */
    }

#ifdef FIX_MCT3
    if ( hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
    {
        n_channels = 1; // VE: rename the parameter to 'n_CoreChannels' to match the name at the encoder
    }
#endif

    tdm_ratio_idx = LRTD_STEREO_RIGHT_IS_PRIM;

    for ( n = 0; n < n_channels; n++ )
+43 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ ivas_error ivas_mct_dec(
    float synth[CPE_CHANNELS][L_FRAME_PLUS];
    int32_t ivas_total_brate;
    ivas_error error;
#ifdef FIX_MCT3
    int16_t n_CoreChannels;
#endif

    error = IVAS_ERR_OK;

@@ -148,7 +151,19 @@ ivas_error ivas_mct_dec(
        st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect;
        st_ivas->hCPE[cpe_id]->hCoreCoder[1]->BER_detect |= st_ivas->BER_detect;

#ifdef FIX_MCT3
        n_CoreChannels = CPE_CHANNELS;
        if ( st_ivas->hCPE[cpe_id]->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
        {
            n_CoreChannels = 1;
        }
#endif

#ifdef FIX_MCT3
        for ( n = 0; n < n_CoreChannels; n++ )
#else
        for ( n = 0; n < CPE_CHANNELS; n++ )
#endif
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
@@ -171,7 +186,19 @@ ivas_error ivas_mct_dec(
    {
        hCPE = st_ivas->hCPE[cpe_id];

#ifdef FIX_MCT3
        n_CoreChannels = CPE_CHANNELS;
        if ( hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
        {
            n_CoreChannels = 1;
        }
#endif

#ifdef FIX_MCT3
        for ( n = 0; n < n_CoreChannels; n++ )
#else
        for ( n = 0; n < CPE_CHANNELS; n++ )
#endif
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
@@ -206,7 +233,19 @@ ivas_error ivas_mct_dec(
        hCPE = st_ivas->hCPE[cpe_id];
        sts = hCPE->hCoreCoder;

#ifdef FIX_MCT3
        n_CoreChannels = CPE_CHANNELS;
        if ( hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
        {
            n_CoreChannels = 1;
        }
#endif

#ifdef FIX_MCT3
        for ( n = 0; n < n_CoreChannels; n++ )
#else
        for ( n = 0; n < CPE_CHANNELS; n++ )
#endif
        {
            x[n][0] = &output[n + cpe_id * CPE_CHANNELS][0];
            x[n][1] = &output[n + cpe_id * CPE_CHANNELS][L_FRAME48k / 2];
@@ -218,7 +257,11 @@ ivas_error ivas_mct_dec(
         * CoreCoder Post-processing and updates
         *----------------------------------------------------------------*/

#ifdef FIX_MCT3
        for ( n = 0; n < n_CoreChannels; n++ )
#else
        for ( n = 0; n < CPE_CHANNELS; n++ )
#endif
        {
            if ( sts[n]->mct_chan_mode == MCT_CHAN_MODE_LFE )
            {
+35 −0
Original line number Diff line number Diff line
@@ -473,6 +473,13 @@ void ivas_mdct_core_invQ(
    float tmp_ms_sig[CPE_CHANNELS][N_MAX];
    float concealment_noise[CPE_CHANNELS][L_FRAME48k];
    TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode_bfi;
#ifdef FIX_MCT3
    int16_t n_CoreChannels = CPE_CHANNELS;
    if ( hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
    {
        n_CoreChannels = 1;
    }
#endif

    push_wmops( "mdct_core_invQ" );

@@ -517,7 +524,11 @@ void ivas_mdct_core_invQ(
    }

    /* parameter decoding */
#ifdef FIX_MCT3
    for ( ch = 0; ch < n_CoreChannels; ch++ )
#else
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
#endif
    {
        st = sts[ch];

@@ -637,7 +648,11 @@ void ivas_mdct_core_invQ(
        }
        else
        {
#ifdef FIX_MCT3
            for ( ch = 0; ch < n_CoreChannels; ch++ )
#else
            for ( ch = 0; ch < CPE_CHANNELS; ch++ )
#endif
            {
                st = sts[ch];
                if ( st->mct_chan_mode != MCT_CHAN_MODE_IGNORE )
@@ -652,7 +667,11 @@ void ivas_mdct_core_invQ(
     * Rate switching
     *---------------------------------------------------------------*/

#ifdef FIX_MCT3
    for ( ch = 0; ch < n_CoreChannels; ch++ )
#else
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
#endif
    {
        st = sts[ch];

@@ -666,7 +685,11 @@ void ivas_mdct_core_invQ(
     * TCX20/10/5
     *--------------------------------------------------------------------------------*/

#ifdef FIX_MCT3
    for ( ch = 0; ch < n_CoreChannels; ch++ )
#else
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
#endif
    {
        st = sts[ch];

@@ -775,6 +798,14 @@ void ivas_mdct_core_reconstruct(
    float pit_gain[CPE_CHANNELS][NB_SUBFR16k];
    int16_t isLFE;
    int16_t skip_decoding;
#ifdef FIX_MCT3
    int16_t n_CoreChannels = CPE_CHANNELS;

    if ( hCPE->hCoreCoder[1]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
    {
        n_CoreChannels = 1;
    }
#endif

    set_f( xn_buf, 0, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX );

@@ -783,7 +814,11 @@ void ivas_mdct_core_reconstruct(
    bfi = sts[0]->bfi;

    /* TNS, ITF, IMDCT and updates */
#ifdef FIX_MCT3
    for ( ch = 0; ch < n_CoreChannels; ch++ )
#else
    for ( ch = 0; ch < CPE_CHANNELS; ch++ )
#endif
    {
        st = sts[ch];

+6 −0
Original line number Diff line number Diff line
@@ -135,6 +135,12 @@ void TNSAnalysisStereo(
    {
        st = sts[ch];

#ifdef FIX_MCT3
        if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
        {
            continue;
        }
#endif
        if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE )
        {
            continue;
Loading