From cb3deb8f6464190c0c83462af91176cbe0297bf9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 15 Oct 2024 17:02:22 +0200 Subject: [PATCH 1/2] issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching; under NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH --- lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 13 ++++++++++++- lib_dec/ivas_masa_dec.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0d67f8497f..3387bb3674 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,6 +185,7 @@ #define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ #define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ +#define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 63f3cc026d..46ab7a15aa 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -221,6 +221,10 @@ ivas_error ivas_dec_setup( element_mode_flag = 1; } +#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH + st_ivas->ism_mode = ISM_MODE_NONE; + +#endif if ( st_ivas->ini_frame > 0 ) { /* reconfigure in case a change of operation mode is detected */ @@ -234,7 +238,6 @@ ivas_error ivas_dec_setup( } else { - if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) { return error; @@ -435,6 +438,14 @@ ivas_error ivas_dec_setup( } } +#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH + if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == MASA_FORMAT ) + { + st_ivas->nchan_ism = 0; + st_ivas->ism_mode = ISM_MODE_NONE; + } + +#endif if ( st_ivas->ivas_format == ISM_FORMAT ) { ISM_MODE last_ism_mode = st_ivas->ism_mode; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 2335f14147..a2d533c0ae 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1470,6 +1470,7 @@ ivas_error ivas_masa_dec_reconfigure( ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); +#ifndef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH if ( st_ivas->ivas_format == MASA_FORMAT ) { if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) @@ -1481,6 +1482,7 @@ ivas_error ivas_masa_dec_reconfigure( st_ivas->ism_mode = ISM_MODE_NONE; } +#endif { int16_t tc_nchan_to_allocate; int16_t tc_nchan_transport; -- GitLab From 3ff46ed980497f682ba4e5edb972e4d2e931f703 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 18 Oct 2024 10:01:58 +0200 Subject: [PATCH 2/2] avoid rewriting of 'st->nchan_ism' --- lib_dec/ivas_init_dec.c | 8 ++++---- lib_dec/ivas_masa_dec.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 46ab7a15aa..e380b90aa8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -199,6 +199,9 @@ ivas_error ivas_dec_setup( } /* this should be non-zero if original input format was MASA_ISM_FORMAT */ +#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH + st_ivas->ism_mode = ISM_MODE_NONE; +#endif st_ivas->nchan_ism = st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2]; if ( st_ivas->nchan_ism > 0 ) @@ -216,15 +219,12 @@ ivas_error ivas_dec_setup( { st_ivas->nchan_ism = 1; } + /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/ st_ivas->nchan_transport = 2; element_mode_flag = 1; } -#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH - st_ivas->ism_mode = ISM_MODE_NONE; - -#endif if ( st_ivas->ini_frame > 0 ) { /* reconfigure in case a change of operation mode is detected */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a2d533c0ae..d1d7e47157 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -155,8 +155,20 @@ ivas_error ivas_masa_decode( { /* re-read the number of objects, needed in case of bad frame */ st_ivas->nchan_ism = 5 - ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2] ); + +#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH + if ( st_ivas->nchan_ism == 5 ) + { + st_ivas->nchan_ism = 0; + } +#endif } + +#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH + if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) +#else if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 ) +#endif { /* there was OMASA in the input */ hMasa->config.input_ivas_format = MASA_ISM_FORMAT; -- GitLab