Commit 3645ec6d authored by vaclav's avatar vaclav
Browse files

Issue 386: Resolve ToDo comments in CoreCoder reconfig.; under FIX_386_CORECODER_RECONFIG

parent e287a7ad
Loading
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3225,6 +3225,12 @@ void ivas_sba_config(
    int16_t *element_mode                                       /* o  : element mode of the core coder          */
);

#ifdef FIX_386_CORECODER_RECONFIG
void ivas_sba_set_cna_cng_flag(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif

ivas_error ivas_sba_dec_reconfigure(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
+2 −1
Original line number Diff line number Diff line
@@ -148,8 +148,9 @@
#define FIX_MDCT_BASED_BWD                              /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */
#define DISCRETE_ISM_DTX_CNG                            /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */
#define NCHAN_ISM_PARAMETER                             /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */

#define FIX_382_MASA_META_FRAMING_ASYNC                 /* Nokia: Issue 382: detect potential MASA metadata framing offset */
#define FIX_386_CORECODER_RECONFIG                      /* VA: Issue 386: Resolve ToDo comments in CoreCoder reconfig. */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+7 −0
Original line number Diff line number Diff line
@@ -297,6 +297,12 @@ ivas_error ivas_corecoder_dec_reconfig(
     * Set CNA/CNG flags
     *-----------------------------------------------------------------*/

#ifdef FIX_386_CORECODER_RECONFIG
    if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
    {
        ivas_sba_set_cna_cng_flag( st_ivas );
    }
#else
    /// VE: this could be merged with part of ivas_init_decoder()
    if ( st_ivas->ivas_format == SBA_FORMAT )
    {
@@ -329,6 +335,7 @@ ivas_error ivas_corecoder_dec_reconfig(
            }
        }
    }
#endif

    /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */
    if ( hDecoderConfig->last_ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE >= 1 )
+4 −0
Original line number Diff line number Diff line
@@ -1049,6 +1049,9 @@ ivas_error ivas_init_decoder(
        }

        /* set CNA/CNG flags */
#ifdef FIX_386_CORECODER_RECONFIG
        ivas_sba_set_cna_cng_flag( st_ivas );
#else
        if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 )
        {
            st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */
@@ -1067,6 +1070,7 @@ ivas_error ivas_init_decoder(
                st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1;
            }
        }
#endif
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
+50 −0
Original line number Diff line number Diff line
@@ -46,6 +46,56 @@
#endif
#include "wmc_auto.h"


#ifdef FIX_386_CORECODER_RECONFIG
/*-------------------------------------------------------------------*
 * ivas_sba_set_cna_cng_flag()
 *
 * Set CNA/CNG flags in IVAS SBA decoder
 *-------------------------------------------------------------------*/

void ivas_sba_set_cna_cng_flag(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
)
{
    int16_t n, cpe_id;

    if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 )
    {
        /* skip as done in init function */
        /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ /* Todo: Check if these can be enabled */
        /* st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; */
    }
    else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) )
    {
        st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1;
        st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1;
    }
    else if ( st_ivas->nchan_transport == 2 )
    {
        for ( n = 0; n < CPE_CHANNELS; n++ )
        {
            st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */
            st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1;
        }
    }
    else
    {
        for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
        {
            for ( n = 0; n < CPE_CHANNELS; n++ )
            {
                st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cna_dirac_flag = 0;
                st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 0;
            }
        }
    }

    return;
}
#endif


/*-------------------------------------------------------------------*
 * ivas_sba_dec_reconfigure()
 *
Loading