From c481ec66eedc41edf39bdcaaa594f45baab975ba Mon Sep 17 00:00:00 2001 From: Anjaneyulu Sana Date: Tue, 18 Feb 2025 20:23:14 +0530 Subject: [PATCH] Updates for multi_harm_ivas_fx to improve precision --- lib_enc/multi_harm_fx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c index 641c35979..86fe541bb 100644 --- a/lib_enc/multi_harm_fx.c +++ b/lib_enc/multi_harm_fx.c @@ -379,6 +379,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni { Word16 i, j, k, L, stemp, N_mins, ind_mins[L_FFT / 4], *pt_mins, harm; Word16 S[L_FFT / 2], flor, step, tmp16, tmp2, Expx2, Expy2; + Word32 tmp2_32; Word16 corx2, cory2, corxy, cor, cor_map[L_FFT / 2], *pt1, *pt2, cor_strong; Word32 L_acc; Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum; @@ -621,7 +622,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni *------------------------------------------------------------------*/ Lcor_map_LT_sum = L_deposit_l( 0 ); - tmp2 = 0; + tmp2_32 = 0; move16(); cor_strong = 0; @@ -633,7 +634,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni FOR( i = 0; i < L; i++ ) { /* tmp2 += S[i]; */ - tmp2 = add( tmp2, shl( S[i], 1 ) ); /* tmp2 in Q8; max value is 128) */ + tmp2_32 = L_add( tmp2_32, cor_map[i] ); /* tmp2_32 in Q15; max value is 128) */ /* *pt1 = M_ALPHA_FX * *pt1 + (1-M_ALPHA_FX) * *pt2++ */ *pt1 = mac_r( L_mult( ONE_MINUS_M_ALPHA, *pt2 ), M_ALPHA_FX, *pt1 ); @@ -651,6 +652,7 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni pt1++; pt2++; } + tmp2 = L_shr_sat( tmp2_32, 7 ); // q15-> q8 IF( EQ_16( bwidth, NB ) ) { -- GitLab