From 936020e9f31b1074655d09bbff30903062b3a314 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 8 Jun 2026 13:45:29 +0300 Subject: [PATCH 1/2] Fix float 1601 by updating IIR state faster on renderer reset. --- lib_com/options.h | 2 ++ lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 34 +++++++++++++++++++ lib_rend/ivas_stat_rend.h | 4 +++ 3 files changed, 40 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index aebd87cb0..7b028ce4c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,6 +99,8 @@ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ #define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI /* Nokia: BASOP issue 2442: Increase accuracy of computations and add additional gain clamp for low energy decorrelated signal rendering. */ #define FIX_FMSW_DEC_EXT /* float issue 1566: fix EXT output in format switching */ +#define FIX_FLOAT_1601_DIRAC_REND_ON_RESET_PREV_SEED /* Nokia: float issue 1601: Improve DirAC renderer on rate switching by seeding prev values on first subframe after reset */ +#define FIX_FLOAT_1601_STEREO_TYPE_ON_RESET_PREV_SEED /* Nokia: float issue 1601: Improve stereo type detection on rate switching by seeding prev values on first subframe after reset */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 23e8b5ea7..b988f23c9 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -524,6 +524,11 @@ void ivas_dirac_dec_output_synthesis_init_fx( } h_dirac_output_synthesis_state->proto_power_diff_smooth_prev_q = Q31; move16(); +#ifdef FIX_FLOAT_1601_DIRAC_REND_ON_RESET_PREV_SEED + + h_dirac_output_synthesis_state->first_sf_after_reset = 1; + move16(); +#endif return; } @@ -2005,6 +2010,17 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move32(); b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */ +#ifdef FIX_FLOAT_1601_STEREO_TYPE_ON_RESET_PREV_SEED + IF ( h_dirac_output_synthesis_state->first_sf_after_reset ) + { + /* Do not smooth with zero history value after reset */ + a = ONE_IN_Q31; + move32(); + b = 0; + move32(); + } +#endif + q_com = s_min( exp, masa_stereo_type_detect->q_target_power_y_smooth ); target_power_y = L_shl( target_power_y, sub( q_com, exp ) ); masa_stereo_type_detect->target_power_y_smooth_fx = L_shl( masa_stereo_type_detect->target_power_y_smooth_fx, @@ -2159,6 +2175,14 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( move32(); } +#ifdef FIX_FLOAT_1601_DIRAC_REND_ON_RESET_PREV_SEED + IF( h_dirac_output_synthesis_state->first_sf_after_reset ) + { + /* Do not smooth with zero history value after reset */ + set32_fx( alpha, ONE_IN_Q31, num_freq_bands ); + } +#endif + /*-----------------------------------------------------------------* * compute gains *-----------------------------------------------------------------*/ @@ -2526,6 +2550,16 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( p_gains_diff++; } } +#ifdef FIX_FLOAT_1601_DIRAC_REND_ON_RESET_PREV_SEED + + IF( h_dirac_output_synthesis_state->first_sf_after_reset ) + { + Copy32( gains_dir, h_dirac_output_synthesis_state->gains_dir_prev_fx, imult1616( num_freq_bands, nchan_out_woLFE ) ); + Copy32( gains_diff, h_dirac_output_synthesis_state->gains_diff_prev_fx, imult1616( num_freq_bands, nchan_out_woLFE ) ); + h_dirac_output_synthesis_state->first_sf_after_reset = 0; + move16(); + } +#endif /*-----------------------------------------------------------------* * gain interpolation and output streams diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index aa224aee1..79f8d1238 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -342,6 +342,10 @@ typedef struct dirac_output_synthesis_state_structure Word16 cy_cross_dir_smooth_prev_len; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ Word16 cy_auto_diff_smooth_prev_len; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ +#ifdef FIX_FLOAT_1601_DIRAC_REND_ON_RESET_PREV_SEED + Word16 first_sf_after_reset; /* Flag for different prev value handling after renderer reset */ + +#endif } DIRAC_OUTPUT_SYNTHESIS_STATE; /* MASA stereo transport signal type detection structure */ -- GitLab From 9c08d8072b564b9b58fa170b5e89ae72b3b03787 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 8 Jun 2026 14:21:00 +0300 Subject: [PATCH 2/2] Clang format --- lib_rend/ivas_dirac_output_synthesis_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index b988f23c9..e35ede75f 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2011,7 +2011,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( b = L_sub( ONE_IN_Q31, a ); /* Temporal smoothing coefficient */ #ifdef FIX_FLOAT_1601_STEREO_TYPE_ON_RESET_PREV_SEED - IF ( h_dirac_output_synthesis_state->first_sf_after_reset ) + IF( h_dirac_output_synthesis_state->first_sf_after_reset ) { /* Do not smooth with zero history value after reset */ a = ONE_IN_Q31; -- GitLab