From 4f89e38130f04dc71f72be03322ca68f5d0a3c7a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 29 Jun 2025 20:02:29 +0200 Subject: [PATCH 1/5] usage of W_shl_sat_l() --- lib_com/options.h | 2 ++ lib_dec/ivas_dirac_dec_fx.c | 4 ++++ lib_enc/ivas_enc_cov_handler_fx.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4fcc4a03e..405a71cc0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,4 +102,6 @@ #define ISSUE_1751_replace_shl_ro /*FhG: replace shl_ro by overflow-free alternatives*/ #define ISSUE_1770_replace_shr_ro /* FhG: replace by non-overflow-alternative - BE */ +#define FIX_1735_W_SHL_SAT_L /* FhG: Usage of W_shl_sat_l() */ + #endif diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index ba7741712..69983cbf2 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -2009,7 +2009,11 @@ void ivas_dirac_dec_set_md_map( tmp_fx = W_add_nosat( tmp_fx, W_deposit32_l( L_deposit_l( hSpatParamRendCom->render_to_md_map[slot_idx_abs] ) ) ); slot_idx_abs = add( slot_idx_abs, 1 ); } +#ifdef FIX_1735_W_SHL_SAT_L + iDiv_and_mod_32( W_shl_sat_l( tmp_fx, 16 ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 ); +#else iDiv_and_mod_32( W_extract_l( W_shl_nosat( tmp_fx, 16 ) ), hSpatParamRendCom->subframe_nbslots[sf_idx], &quo, &rem, 0 ); +#endif hSpatParamRendCom->render_to_md_map[sf_idx] = add( round_fx( quo ), hSpatParamRendCom->dirac_read_idx ) % hSpatParamRendCom->dirac_md_buffer_length; move16(); } diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index 495e6caa1..db2125de7 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -224,7 +224,11 @@ static Word16 ivas_spar_get_activeW_flag_fx( q_shift = Q31; move16(); q_shift = W_norm( bb_var_64bit[ch] ); +#ifdef FIX_1735_W_SHL_SAT_L + bb_var[ch] = W_shl_sat_l( bb_var_64bit[ch], sub( q_shift, 32 ) ); /* q_bb_var[ch] + sub( q_shift, 32 ) */ +#else bb_var[ch] = W_extract_l( W_shl_nosat( bb_var_64bit[ch], sub( q_shift, 32 ) ) ); /* q_bb_var[ch] + sub( q_shift, 32 ) */ +#endif move32(); q_bb_var[ch] = add( q_bb_var[ch], sub( q_shift, 32 ) ); move16(); -- GitLab From b49b11c8b9097eacb19f403a644caaf9fcf209f0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Sun, 29 Jun 2025 20:07:08 +0200 Subject: [PATCH 2/5] formatting --- lib_enc/ivas_enc_cov_handler_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_enc_cov_handler_fx.c b/lib_enc/ivas_enc_cov_handler_fx.c index db2125de7..8b4509f49 100644 --- a/lib_enc/ivas_enc_cov_handler_fx.c +++ b/lib_enc/ivas_enc_cov_handler_fx.c @@ -568,7 +568,7 @@ static void ivas_band_cov_fx( pV_re[k] = W_shl_sat_l( pV_re_64bit[k], q_shift_tmp ); //(q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32) move32(); #else - pV_re[k] = W_extract_l( W_shl_nosat( pV_re_64bit[k], q_shift_tmp ) ); //(q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32) + pV_re[k] = W_extract_l( W_shl_nosat( pV_re_64bit[k], q_shift_tmp ) ); //(q_In_FR[i1] + q_In_FR[j1]) + (q_shift - 32) move32(); #endif /* perform rounding towards lower value for negative results */ -- GitLab From b1bbee2105e14cef6ca90e0f851ee3e0eef3a680 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 30 Jun 2025 11:07:16 +0200 Subject: [PATCH 3/5] also address lib_enc/analy_sp_fx.c --- lib_enc/analy_sp_fx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 8541decd8..6a55bff93 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -320,8 +320,12 @@ static void find_enr_dft_ivas_fx( bin_cnt = add( bin_cnt, 1 ); } - /* normalization per frequency bin */ + /* normalization per frequency bin */ +#ifdef FIX_1735_W_SHL_SAT_L + band_fx[i] = W_shl_sat_l( band_ener, -add( 32 - Q16, shift ) ); // *q_band +#else band_fx[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band +#endif move32(); /* per band energy without E_MIN */ -- GitLab From 7a3f492790180d2eb1ba153f5656d1032214a927 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 30 Jun 2025 11:21:15 +0200 Subject: [PATCH 4/5] formatting --- lib_enc/analy_sp_fx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 6a55bff93..8e18883c7 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -320,11 +320,11 @@ static void find_enr_dft_ivas_fx( bin_cnt = add( bin_cnt, 1 ); } - /* normalization per frequency bin */ + /* normalization per frequency bin */ #ifdef FIX_1735_W_SHL_SAT_L - band_fx[i] = W_shl_sat_l( band_ener, -add( 32 - Q16, shift ) ); // *q_band + band_fx[i] = W_shl_sat_l( band_ener, -add( 32 - Q16, shift ) ); // *q_band #else - band_fx[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band + band_fx[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band #endif move32(); -- GitLab From 938ce84fd228dbdb1c92f4d271fbb19afe85ae8c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Mon, 30 Jun 2025 20:02:05 +0200 Subject: [PATCH 5/5] addressing comment --- lib_enc/analy_sp_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index 8e18883c7..0d42e5ff2 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -322,7 +322,7 @@ static void find_enr_dft_ivas_fx( /* normalization per frequency bin */ #ifdef FIX_1735_W_SHL_SAT_L - band_fx[i] = W_shl_sat_l( band_ener, -add( 32 - Q16, shift ) ); // *q_band + band_fx[i] = W_shl_sat_l( band_ener, sub( Q16 - 32, shift ) ); // *q_band #else band_fx[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band #endif -- GitLab