diff --git a/lib_com/options.h b/lib_com/options.h index 503146f4a67bd0929699ce90a2752323d0d5fbeb..1deb15668697282105fe8a7c9d29f685913b2745 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,7 @@ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ #define MC_BITRATE_SWITCHING /* Issue 116: support bitrate switching in MC format */ #define MC_JBM /* FhG: extend JBM beyond mono for running IVAS in VoIP mode (contribution 19) */ - +#define FIX_265_MC_BRATE_SWITCHING /* Issue 265: fix use-of-uninitialized-value in MC bitrate switching */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 04dc4cccfcb14f86841410d665ad389fc1a9d033..8b29d9c7859afc9347415f920955b9c383a969f8 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -244,6 +244,12 @@ ivas_error ivas_corecoder_dec_reconfig( for ( ; cpe_id < st_ivas->nCPE; cpe_id++ ) { #ifdef MC_BITRATE_SWITCHING +#ifdef FIX_265_MC_BRATE_SWITCHING + if ( st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->hOutSetup.separateChannelEnabled ) + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } +#endif if ( ( error = create_cpe_dec( st_ivas, cpe_id, brate_CPE ) ) != IVAS_ERR_OK ) #else if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index b04cae97a9404ba0081c2f303309445abaf5ed1e..165d7dc89624b5aac5eb00e64b9a10c4975b79cf 100755 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -40,6 +40,9 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef FIX_265_MC_BRATE_SWITCHING +#include "assert.h" +#endif #include "wmc_auto.h" #include @@ -354,6 +357,11 @@ ivas_error stereo_memory_dec( error = IVAS_ERR_OK; +#ifdef FIX_265_MC_BRATE_SWITCHING + assert( hCPE->last_element_mode >= IVAS_CPE_DFT && "Switching from SCE to CPE is not a valid configuration!" ); +#endif + + hCPE->hCoreCoder[0]->element_mode = hCPE->element_mode; hCPE->hCoreCoder[1]->element_mode = hCPE->element_mode; diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 75c62cfba961b1679017a3ddb207bddda118a4ab..8f39a1f15d540184d6d7ac54e9b050b78f435427 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -32,16 +32,18 @@ #include #include "options.h" -#ifdef DEBUGGING -#include "debug.h" -#endif #include "cnst.h" #include "rom_com.h" #include "prot.h" #include "ivas_prot.h" #include "ivas_rom_com.h" +#ifdef FIX_265_MC_BRATE_SWITCHING +#include "assert.h" +#endif #include "wmc_auto.h" - +#ifdef DEBUGGING +#include "debug.h" +#endif /*-------------------------------------------------------------------* * Function allocate_CoreCoder_enc() @@ -231,6 +233,10 @@ ivas_error stereo_memory_enc( error = IVAS_ERR_OK; +#ifdef FIX_265_MC_BRATE_SWITCHING + assert( hCPE->last_element_mode >= IVAS_CPE_DFT && "Switching from SCE to CPE is not a valid configuration!" ); +#endif + /*--------------------------------------------------------------* * save parameters from structures that will be freed *---------------------------------------------------------------*/