From f86881ca3773623155255244d2a18cfa7f231219 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 30 Sep 2025 16:31:31 +0200 Subject: [PATCH 1/4] port NONBE_1200_ISM_JBM_BRATE_SW_FLUSH --- lib_com/options.h | 1 + lib_dec/ivas_ism_dec.c | 22 ++++++++++++++++++---- lib_dec/lib_dec.c | 5 ++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b72019e28..1b6e46d3e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -188,6 +188,7 @@ #define FIX_ISSUE_2008_MISSING_CODE_FROM_PORTING /* FhG: Issue 2008: Code deleted while porting float-main MR !1504 (BASOP issue 1565)*/ #define ADJUST_MCT_CHANNELS_MAX /* FhG: set correct max mct channels constant*/ #define FIX_1053_REVERB_RECONFIGURATION +#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index bd051a922..93b036888 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -132,7 +132,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif /* transfer subframe info from DirAC or ParamMC to central tc buffer */ /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */ if ( last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && st_ivas->hTcBuffer->tc_buffer_mode != TC_BUFFER_MODE_BUFFER ) @@ -153,10 +155,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) + { + return error; + } #endif } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ @@ -167,7 +169,9 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif if ( st_ivas->ism_mode != last_ism_mode ) { @@ -307,19 +311,26 @@ static ivas_error ivas_ism_bitrate_switching_dec( * floating-point output audio buffers *-----------------------------------------------------------------*/ +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif /*-----------------------------------------------------------------* * JBM TC buffers *-----------------------------------------------------------------*/ + +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif int16_t tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -355,7 +366,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } + +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 81545fc6b..d295ba52e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1042,8 +1042,11 @@ ivas_error IVAS_DEC_ReadFormat( render what still fits in the new granularity */ int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + st_ivas->nchan_transport = nchan_transport_old; +#else // st_ivas->nchan_transport = nchan_transport_old; // ToDo: temporarily deactivated to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1200 - +#endif if ( st_ivas->ivas_format == MASA_FORMAT ) { st_ivas->nchan_ism = 0; // ToDo: temporary hack to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1199 -- GitLab From 0d0e42825a383fcefc491b279583f7fb4b1bc3d2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Oct 2025 22:18:13 +0200 Subject: [PATCH 2/4] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: sagnowski --- lib_dec/ivas_ism_dec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 93b036888..98988d10f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -366,7 +366,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } - #ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } #endif -- GitLab From d50901f583daf4c7e45afea4c1c42e65741afb01 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 1 Oct 2025 22:18:20 +0200 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: sagnowski --- lib_dec/ivas_ism_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 98988d10f..8f5cf252d 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -461,6 +461,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { + #ifdef FIX_HRTF_LOAD if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) #else -- GitLab From 011ce8e9134af4763939a1b9303c7665ed13e750 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Oct 2025 19:25:50 +0200 Subject: [PATCH 4/4] make NONBE_1200_ISM_JBM_BRATE_SW_FLUSH dependent on FIX_HRTF_LOAD --- lib_dec/ivas_ism_dec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 8f5cf252d..69c270b13 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -155,10 +155,19 @@ static ivas_error ivas_ism_bitrate_switching_dec( #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + /* write back info for correct rendering of the flushable samples */ + int16_t nchan_transport_ref = st_ivas->nchan_transport; + st_ivas->nchan_transport = nchan_transport_old; + +#endif if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) { return error; } +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + st_ivas->nchan_transport = nchan_transport_ref; +#endif #endif } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ -- GitLab