From b30ef4a883e416f71aa9c5e5f7f0e6961f824dce Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 23 Jun 2025 09:46:12 +0530 Subject: [PATCH] Fix for spectral holes by rearranging LPC to LSF conversion, LTV crash issue fix --- lib_enc/inov_enc_fx.c | 2 +- lib_enc/swb_tbe_enc_fx.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c index d019bf474..01ba794ea 100644 --- a/lib_enc/inov_enc_fx.c +++ b/lib_enc/inov_enc_fx.c @@ -661,7 +661,7 @@ Word16 inov_encode_ivas_fx( { FOR( k = 0; k < L_SUBFR - i; k++ ) { - y2[i + k] = add_sat( y2[i + k], round_fx( L_shl( L_mult( code[i], h2[k] ), sh ) ) ); // Q9 Added saturation: needs to be rechecked + y2[i + k] = add_sat( y2[i + k], round_fx_sat( L_shl_sat( L_mult( code[i], h2[k] ), sh ) ) ); // Q9 Added saturation: needs to be rechecked move16(); } } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index b001f8693..08c920c4a 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -3107,6 +3107,14 @@ void swb_tbe_enc_ivas_fx( /* stab_check = a2lsp( lsf_shb, lpc_shb, LPC_SHB_ORDER ); */ + /* LPC to LSP conversion */ + /* LPC: Q12, LSP: Q15 */ + E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); + + /* LSP to LSF conversion */ + /* LSP: Q15, LSF: Q15 */ + E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); + test(); test(); IF( ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) ) || st_fx->ini_frame == 0 ) @@ -3124,14 +3132,6 @@ void swb_tbe_enc_ivas_fx( // mvr2r( hBWE_TD->prev_lsp_shb, lsf_shb, LPC_SHB_ORDER ); // } - /* LPC to LSP conversion */ - /* LPC: Q12, LSP: Q15 */ - E_LPC_a_lsp_conversion( lpc_shb_fx, lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); - - /* LSP to LSF conversion */ - /* LSP: Q15, LSF: Q15 */ - E_LPC_lsp_lsf_conversion( lsp_shb_fx, lsf_shb_fx, LPC_SHB_ORDER ); - Copy( lsp_shb_fx, hBWE_TD->prev_lsp_shb_fx, LPC_SHB_ORDER ); Copy( lsf_shb_fx, lsf_shb_orig_fx, LPC_SHB_ORDER ); -- GitLab