diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 04866530c16ca77758bd39f7a6fb45e12b34314c..64d08afe8ab7163d619684e69654cf7401a78632 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -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 */ ); diff --git a/lib_com/options.h b/lib_com/options.h index f0f86f814d9a7f55754f04a0b9071d51b2f3a64d..8b4fad84547a8750faa3d8ddde7a23970315eb13 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -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 */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index a066164da4dea999bdcbdcd92f064b4e941226e5..4723532dae28520575eacb766a4537a96763e4bc 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -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 ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 5c19eca256723bf9fe739ee147c2b0d03cf0cc54..b5f251945f94cf6ce1e42d84534731f92d82c387 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -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 ) { diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 745ea1b9ba052106117ba064d3f3524f69570125..68b9909ea51273ff2b835622e76f7d4176c06bad 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -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() * diff --git a/lib_enc/ivas_corecoder_enc_reconfig.c b/lib_enc/ivas_corecoder_enc_reconfig.c index e9d6968f1b2d01f41523c1a7115509890251b28c..cfe3a1badf7477fb347e89779d5ff030c215876c 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig.c +++ b/lib_enc/ivas_corecoder_enc_reconfig.c @@ -211,7 +211,11 @@ ivas_error ivas_corecoder_enc_reconfig( { if ( n_CoreCoder_existing > cpe_id * CPE_CHANNELS + n ) { +#ifdef FIX_386_CORECODER_RECONFIG + mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); +#else mvr2r( st_ivas->hCPE[cpe_id]->hCoreCoder[0]->input_buff, input_buff[( cpe_id - st_ivas->nCPE ) * CPE_CHANNELS + n], len_inp_memory ); /* TODO VoiceAge: Please check if this should be hCoreCoder[n] */ +#endif } }