From 6f6192536ac2b0cc1bdf4f965268d1800623597b Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Wed, 5 Nov 2025 08:02:48 +0100 Subject: [PATCH 1/6] Add FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE to change nchan_in -> nchan_transport for scaling on p_tc_fx --- lib_com/options.h | 1 + lib_dec/ivas_jbm_dec_fx.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8171bdec9..8d1737e41 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -94,6 +94,7 @@ #define FIX_2176_ASSERT_DEC_MAP_PARAMS_DIRAC2STEREO /* FhG: Reduce hStereoDft->q_smooth_buf_fx by one to prevent overflow in the subframe_band_nrg[][] calculation */ #define FIX_2015_PREMPH_SAT_ALT /* VA: saturation can happen during preemphasis filtering due to a too aggressive scaling factor, allows preemphis to get 1 more bit headroom */ #define FIX_2178_FL_TO_FX_WITH_OBJ_EDIT_FILE_INTERFACE /* Nokia: Fixes float to fx conversion in decoder app with object edit file interface */ +#define FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE /* Eri/Orange: scale_sig32 problem on p_tc_fx[] */ /* ################### End FIXES switches ########################### */ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 57101b4de..f977f30aa 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2152,7 +2152,11 @@ ivas_error ivas_jbm_dec_render_fx( IF( crendInPlaceRotation ) { +#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE + FOR( i = 0; i < st_ivas->nchan_transport; i++ ) +#else FOR( i = 0; i < nchan_in; i++ ) +#endif { scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor IF( st_ivas->hDecoderConfig->Opt_tsm ) @@ -2163,7 +2167,11 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { +#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE + FOR( i = 0; i < st_ivas->nchan_transport; i++ ) +#else FOR( i = 0; i < nchan_in; i++ ) +#endif { scale_sig32( p_tc_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor } @@ -2222,7 +2230,11 @@ ivas_error ivas_jbm_dec_render_fx( move16(); } +#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE + FOR( i = n; i < st_ivas->nchan_transport; i++ ) +#else FOR( i = n; i < nchan_in; i++ ) +#endif { scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11 } -- GitLab From af956756a2d3ab889164a96f9c6ff5bd1a37bff9 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Wed, 5 Nov 2025 10:03:32 +0100 Subject: [PATCH 2/6] fix crash, best solution ? --- lib_dec/ivas_jbm_dec_fx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index f977f30aa..c9a89eec3 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2159,7 +2159,7 @@ ivas_error ivas_jbm_dec_render_fx( #endif { scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor - IF( st_ivas->hDecoderConfig->Opt_tsm ) + IF( ( p_output_fx[0] != p_tc_fx[0] ) ) { scale_sig32( p_tc_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor } @@ -2195,7 +2195,11 @@ ivas_error ivas_jbm_dec_render_fx( } // Todo main-pc update: This might be needed also in the split rendering path +#ifdef FIX_1330_JBM_MEMORY + IF( ( p_output_fx[0] != p_tc_fx[0] ) ) +#else IF( st_ivas->hDecoderConfig->Opt_tsm ) +#endif { IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { @@ -2211,7 +2215,11 @@ ivas_error ivas_jbm_dec_render_fx( IF( crendInPlaceRotation ) { +#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE + n = st_ivas->nchan_transport; +#else n = nchan_in; +#endif } ELSE { @@ -2223,8 +2231,11 @@ ivas_error ivas_jbm_dec_render_fx( { scale_sig32( p_output_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11 } - +#ifdef FIX_1330_JBM_MEMORY + IF( ( p_output_fx[0] != p_tc_fx[0] ) && crendInPlaceRotation ) +#else IF( st_ivas->hDecoderConfig->Opt_tsm && crendInPlaceRotation ) +#endif { n = 0; move16(); -- GitLab From b7e93ac4fe34c5d5650c8981fe3fb90011c4bba7 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Wed, 5 Nov 2025 11:50:21 +0100 Subject: [PATCH 3/6] simplify fix --- lib_dec/ivas_jbm_dec_fx.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index c9a89eec3..6c9b4706f 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2159,10 +2159,12 @@ ivas_error ivas_jbm_dec_render_fx( #endif { scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor - IF( ( p_output_fx[0] != p_tc_fx[0] ) ) +#ifndef FIX_1330_JBM_MEMORY + IF( st_ivas->hDecoderConfig->Opt_tsm ) { scale_sig32( p_tc_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor } +#endif } } ELSE @@ -2179,28 +2181,37 @@ ivas_error ivas_jbm_dec_render_fx( IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifdef FIX_1330_JBM_MEMORY + IF( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_output_fx, p_output_fx, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) +#else IF( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) +#endif { return error; } } ELSE { +#ifdef FIX_1330_JBM_MEMORY + IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_output_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ), + IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ), IVAS_ERR_OK ) ) +#endif { return error; } // Todo main-pc update: This might be needed also in the split rendering path -#ifdef FIX_1330_JBM_MEMORY - IF( ( p_output_fx[0] != p_tc_fx[0] ) ) -#else +#ifndef FIX_1330_JBM_MEMORY IF( st_ivas->hDecoderConfig->Opt_tsm ) -#endif { +#endif IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { FOR( i = 0; i < nchan_in; i++ ) @@ -2208,8 +2219,9 @@ ivas_error ivas_jbm_dec_render_fx( scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, exp ) ); } } +#ifndef FIX_1330_JBM_MEMORY } - +#endif ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_tc_fx, p_output_fx ); } @@ -2231,15 +2243,13 @@ ivas_error ivas_jbm_dec_render_fx( { scale_sig32( p_output_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11 } -#ifdef FIX_1330_JBM_MEMORY - IF( ( p_output_fx[0] != p_tc_fx[0] ) && crendInPlaceRotation ) -#else +#ifndef FIX_1330_JBM_MEMORY IF( st_ivas->hDecoderConfig->Opt_tsm && crendInPlaceRotation ) -#endif { n = 0; move16(); } +#endif #ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE FOR( i = n; i < st_ivas->nchan_transport; i++ ) -- GitLab From 6f847f36139e0dc212d6334d3a511e8ccd7fd4ba Mon Sep 17 00:00:00 2001 From: marc emerit Date: Wed, 5 Nov 2025 12:08:29 +0100 Subject: [PATCH 4/6] simplify fix --- lib_dec/ivas_jbm_dec_fx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 6c9b4706f..31d80e304 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2138,10 +2138,12 @@ ivas_error ivas_jbm_dec_render_fx( gd_bits = find_guarded_bits_fx( subframe_len ); exp = 13; move16(); +#ifndef FIX_1330_JBM_MEMORY IF( NE_32( ( error = getAudioConfigNumChannels( st_ivas->intern_config, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } +#endif IF( NE_32( ( error = getAudioConfigNumChannels( st_ivas->hOutSetup.output_config, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; @@ -2214,7 +2216,11 @@ ivas_error ivas_jbm_dec_render_fx( #endif IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { - FOR( i = 0; i < nchan_in; i++ ) +#ifdef FIX_1330_JBM_MEMORY + FOR( i = 0; i < st_ivas->nchan_transport; i++ ) +#else + FOR( i = 0; i < nchan_in; i++ ) +#endif { scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, exp ) ); } -- GitLab From 0a908ba48cdf1b750e8942f07627dc9697b650e7 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 6 Nov 2025 08:29:44 +0100 Subject: [PATCH 5/6] Trigger Build -- GitLab From fc0987bc258f92ac3346a3f0e0908b6b3ff59609 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 6 Nov 2025 10:30:15 +0100 Subject: [PATCH 6/6] rollback nchan_in --- lib_dec/ivas_jbm_dec_fx.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 9e67be09c..909d2ae51 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2142,12 +2142,10 @@ ivas_error ivas_jbm_dec_render_fx( gd_bits = find_guarded_bits_fx( subframe_len ); exp = 13; move16(); -#ifndef FIX_1330_JBM_MEMORY IF( NE_32( ( error = getAudioConfigNumChannels( st_ivas->intern_config, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } -#endif IF( NE_32( ( error = getAudioConfigNumChannels( st_ivas->hOutSetup.output_config, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; @@ -2158,11 +2156,7 @@ ivas_error ivas_jbm_dec_render_fx( IF( crendInPlaceRotation ) { -#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE - FOR( i = 0; i < st_ivas->nchan_transport; i++ ) -#else FOR( i = 0; i < nchan_in; i++ ) -#endif { scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor #ifndef FIX_1330_JBM_MEMORY @@ -2175,11 +2169,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE { -#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE - FOR( i = 0; i < st_ivas->nchan_transport; i++ ) -#else FOR( i = 0; i < nchan_in; i++ ) -#endif { scale_sig32( p_tc_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor } @@ -2217,19 +2207,13 @@ ivas_error ivas_jbm_dec_render_fx( #ifndef FIX_1330_JBM_MEMORY IF( st_ivas->hDecoderConfig->Opt_tsm ) { -#endif IF( NE_16( exp, *st_ivas->hCrendWrapper->p_io_qfactor ) ) { -#ifdef FIX_1330_JBM_MEMORY - FOR( i = 0; i < st_ivas->nchan_transport; i++ ) -#else - FOR( i = 0; i < nchan_in; i++ ) -#endif + FOR( i = 0; i < nchan_in; i++ ) { scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, exp ) ); } } -#ifndef FIX_1330_JBM_MEMORY } #endif ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_tc_fx, p_output_fx ); @@ -2237,11 +2221,7 @@ ivas_error ivas_jbm_dec_render_fx( IF( crendInPlaceRotation ) { -#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE - n = st_ivas->nchan_transport; -#else n = nchan_in; -#endif } ELSE { @@ -2261,11 +2241,7 @@ ivas_error ivas_jbm_dec_render_fx( } #endif -#ifdef FIX_2070_JBM_TC_CHANNEL_RESCALING_ISSUE - FOR( i = n; i < st_ivas->nchan_transport; i++ ) -#else FOR( i = n; i < nchan_in; i++ ) -#endif { scale_sig32( p_tc_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11 } -- GitLab