From 73cf73e918b255999d4c863453905925523d25ad Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 27 May 2025 15:25:44 +0530 Subject: [PATCH] Fix for wrong q-updation for LEtot in analy_sp, ltv crash fix --- lib_com/swb_tbe_com_fx.c | 4 ++-- lib_enc/analy_sp_fx.c | 2 +- lib_enc/ivas_core_pre_proc_front_fx.c | 2 +- lib_enc/ivas_front_vad_fx.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 08bbd6362..96d07e7ef 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5971,7 +5971,7 @@ void non_linearity_ivas_fx( } - IF( GT_16( max_val, shl( 1, Q_inp ) ) ) + IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ @@ -6045,7 +6045,7 @@ void non_linearity_ivas_fx( max_val = s_max( max_val, tmp ); } - IF( GT_16( max_val, shl( 1, Q_inp ) ) ) + IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) ) { exp = norm_s( max_val ); tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */ diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c index dc59ec752..7062a3090 100644 --- a/lib_enc/analy_sp_fx.c +++ b/lib_enc/analy_sp_fx.c @@ -860,7 +860,7 @@ static void ivas_find_enr( * Find the total energy over the input bandwidth *-----------------------------------------------------------------*/ - etot = *LEtot; // *q_band + etot = *LEtot; // *q_band+1 move64(); FOR( i = min_band; i <= max_band; i++ ) { diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index f1e6b2193..be208296d 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1453,7 +1453,7 @@ ivas_error pre_proc_front_ivas_fx( test(); IF( lr_vad_enabled && st->idchan == 0 ) { - ivas_long_enr_fx( st, -1, localVAD_HE_SAD, high_lpn_flag, hCPE->hFrontVad, CPE_CHANNELS, localVAD_HE_SAD_LR, Etot_LR_fx ); + ivas_long_enr_fx( st, -256 /*-1 q8*/, localVAD_HE_SAD, high_lpn_flag, hCPE->hFrontVad, CPE_CHANNELS, localVAD_HE_SAD_LR, Etot_LR_fx ); Copy32( fr_bands_LR_fx[0] + NB_BANDS, hCPE->hFrontVad[0]->hNoiseEst->enrO_fx, NB_BANDS ); // fr_bands_LR_fx_q hCPE->hFrontVad[0]->hNoiseEst->q_enrO = fr_bands_LR_fx_q[0]; diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c index f2b3adece..a4baf6a00 100644 --- a/lib_enc/ivas_front_vad_fx.c +++ b/lib_enc/ivas_front_vad_fx.c @@ -758,7 +758,7 @@ ivas_error front_vad_spar_fx( ivas_smc_gmm_fx( st, NULL, localVAD_HE_SAD[0], Etot_fx_0, lsp_new_fx, cor_map_sum_fx, epsP_fx, PS_fx, non_sta_fx, relE_fx, &high_lpn_flag, flag_spitch, Qfact_PS, Q_esp, hSpMusClas->past_PS_Q ); /* long-term energy update */ - ivas_long_enr_fx( st, -1, localVAD_HE_SAD[0], high_lpn_flag, &hFrontVad, 1, localVAD_HE_SAD, Etot_fx ); + ivas_long_enr_fx( st, -256 /*-1 q8*/, localVAD_HE_SAD[0], high_lpn_flag, &hFrontVad, 1, localVAD_HE_SAD, Etot_fx ); /* increase ini_frame counter */ hFrontVad->ini_frame = s_min( add( hFrontVad->ini_frame, 1 ), MAX_FRAME_COUNTER ); /* Q0 */ -- GitLab