From 5c66dac3241798955f17901ba8969aacff646282 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 4 Jul 2025 21:39:52 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1763: Rate switching MASA with LTV signal has a couple of worse spikes in BASOP decoder Link #1763 --- lib_com/modif_fs_fx.c | 4 ++-- lib_dec/swb_tbe_dec_fx.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index a9b6581ed..46e24e31a 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -1759,8 +1759,8 @@ void interpolate_3_over_1_allpass_fx32( { mem_temp = out[i]; // Qx move32(); - out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2424 ) ); // Qx - // 0.572769 in Q15 -> 18768, 0.074005 in Q15 -> 2424 + out[i] = L_sub_sat( Mpy_32_16_1( L_add_sat( mem[12], mem[11] ), 18768 ), Mpy_32_16_1( L_add_sat( mem_temp, mem[10] ), 2425 ) ); // Qx + // 0.572769 in Q15 -> 18768, 0.074005 in Q15 -> 2425 move32(); mem[10] = mem[11]; // Qx move32(); diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 06da2a83d..c44f7656e 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -1181,8 +1181,9 @@ void ivas_wb_tbe_dec_fx( } ELSE IF( EQ_32( st_fx->output_Fs, 48000 ) ) { - Scale_sig( hBWE_TD->mem_resamp_HB_fx, INTERP_3_1_MEM_LEN, sub( Qx, hBWE_TD->prev_Qx ) ); + Copy_Scale_sig_32_16( hBWE_TD->mem_resamp_HB_fx_32, hBWE_TD->mem_resamp_HB_fx, INTERP_3_1_MEM_LEN, sub( Qx, Q11 ) ); ivas_interpolate_3_over_1_allpass_fx( synth, L_FRAME16k, upsampled_synth, hBWE_TD->mem_resamp_HB_fx ); + Copy_Scale_sig_16_32_no_sat( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, Qx ) ); Copy( upsampled_synth, synth, L_FRAME48k ); } } -- GitLab From 7461e40500642454980701531d2111a98c803229 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 8 Jul 2025 10:58:20 +0530 Subject: [PATCH 2/2] Fix for artefacts observed in Linux --- lib_dec/swb_tbe_dec_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index c44f7656e..61dc3d0c5 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -613,6 +613,7 @@ void ivas_wb_tbe_dec_fx( Word16 error[L_FRAME16k]; Word16 synth_frac[L_FRAME16k]; Word16 upsampled_synth[L_FRAME48k]; + Word32 tmp_synL[L_FRAME48k], upsampled_synth_32fx[L_FRAME48k]; Word32 prev_pow, curr_pow, curr_frame_pow; Word16 curr_frame_pow_exp; Word16 temp, scale, n; @@ -1181,10 +1182,10 @@ void ivas_wb_tbe_dec_fx( } ELSE IF( EQ_32( st_fx->output_Fs, 48000 ) ) { + Copy_Scale_sig_16_32_no_sat( synth, tmp_synL, L_FRAME48k, sub( Q11, Qx ) ); + interpolate_3_over_1_allpass_fx32( tmp_synL, L_FRAME16k, upsampled_synth_32fx, hBWE_TD->mem_resamp_HB_fx_32 ); Copy_Scale_sig_32_16( hBWE_TD->mem_resamp_HB_fx_32, hBWE_TD->mem_resamp_HB_fx, INTERP_3_1_MEM_LEN, sub( Qx, Q11 ) ); - ivas_interpolate_3_over_1_allpass_fx( synth, L_FRAME16k, upsampled_synth, hBWE_TD->mem_resamp_HB_fx ); - Copy_Scale_sig_16_32_no_sat( hBWE_TD->mem_resamp_HB_fx, hBWE_TD->mem_resamp_HB_fx_32, INTERP_3_1_MEM_LEN, sub( Q11, Qx ) ); - Copy( upsampled_synth, synth, L_FRAME48k ); + Copy_Scale_sig_32_16( upsampled_synth_32fx, synth, L_FRAME48k, sub( Qx, Q11 ) ); } } ELSE -- GitLab