From 80a7ee1304edde9ec4a9180ba5bde28c48162c70 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 30 Sep 2025 16:43:25 +0200 Subject: [PATCH 1/3] port NONBE_1200_ISM_JBM_BRATE_SW_FLUSH --- lib_com/options.h | 1 + lib_dec/ivas_ism_dec_fx.c | 13 +++++++++++++ lib_dec/lib_dec_fx.c | 8 ++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5ae3f1416..aaccec070 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -130,6 +130,7 @@ #define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ #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_fx.c b/lib_dec/ivas_ism_dec_fx.c index d7caec1ac..40f3763de 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -149,7 +149,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif test(); test(); /* transfer subframe info from DirAC or ParamMC to central tc buffer */ @@ -189,7 +191,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } } +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH } +#endif IF( NE_16( st_ivas->ism_mode, last_ism_mode ) ) { @@ -333,19 +337,26 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( * floating-point output audio buffers *-----------------------------------------------------------------*/ +#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH { +#endif nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 ); IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, 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 Word16 tc_nchan_full_new; DECODER_TC_BUFFER_HANDLE hTcBuffer; @@ -394,7 +405,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( Copy( 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_fx.c b/lib_dec/lib_dec_fx.c index 2404212eb..cd5930b12 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -3580,8 +3580,12 @@ ivas_error IVAS_DEC_ReadFormat( render what still fits in the new granularity */ Word16 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 ); - // 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 - +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + st_ivas->nchan_transport = nchan_transport_old; + move16(); +#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 f83b910cae3d35f7e773f3868690fe405d7c13f8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 30 Sep 2025 17:21:05 +0200 Subject: [PATCH 2/3] clang-format --- lib_dec/ivas_ism_dec_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 40f3763de..11b56a1d6 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -177,9 +177,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( #ifdef FIX_HRTF_LOAD /* flush already done in IVAS_DEC_ReadFormat() */ #else - IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ){ - return error; - } + IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ){ + return error; +} #endif } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ -- GitLab From 77396af58fab79cba89cf2182ab4f758b077e14a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Oct 2025 19:38:27 +0200 Subject: [PATCH 3/3] make NONBE_1200_ISM_JBM_BRATE_SW_FLUSH dependent on FIX_HRTF_LOAD --- lib_dec/ivas_ism_dec_fx.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c index 11b56a1d6..63609317d 100644 --- a/lib_dec/ivas_ism_dec_fx.c +++ b/lib_dec/ivas_ism_dec_fx.c @@ -173,18 +173,31 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( render what still fits in the new granularity */ 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 ); - IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ){ + IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) + { #ifdef FIX_HRTF_LOAD - /* flush already done in IVAS_DEC_ReadFormat() */ + /* flush already done in IVAS_DEC_ReadFormat() */ #else - IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ){ +#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; + move16(); + +#endif + IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) ) + { return error; -} + } +#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH + + st_ivas->nchan_transport = nchan_transport_ref; + move16(); +#endif #endif } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - ELSE - IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) + ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ) { IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -256,7 +269,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( #ifdef FIX_CREND_SIMPLIFY_CODE IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) ) #endif st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; @@ -319,7 +332,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( #ifdef FIX_CREND_SIMPLIFY_CODE ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ) ); #else - ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); + ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); #endif } } @@ -412,7 +425,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( #ifdef FIX_HRTF_LOAD return IVAS_ERR_OK; #else -return error; + return error; #endif } -- GitLab