From 567a49bd331ae330ab55f432d7384bb0eeb2ec59 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sat, 16 Nov 2024 14:58:13 +0530 Subject: [PATCH] Fix for 3GPP issue 973: Yet another waveform discrepency in decoding received SBA packets with 15% FER - 2 link #973 --- lib_dec/FEC_HQ_phase_ecu_fx.c | 37 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 7d4cfd9ae..690011d0e 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -1456,6 +1456,7 @@ static void ivas_spec_ana_fx( Word16 window_corr, window_corr_step; Word16 currPlocs, endPlocs, nJacob, k, i; Word32 sig, noise, st_point, end_point; + Word32 xfp_32[3]; // Q + 16 move16(); // LprotLog2Minus1 move16(); // hamm_len2 @@ -1692,9 +1693,9 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ { - fraction = imax_fx( &xfp[*pPlocs], -1 ); /* in Q15 */ - acc = L_deposit_h( *pPlocs ); - *pPlocsi++ = L_mac( acc, fraction, 1 ); + Copy_Scale_sig_16_32( &xfp[*pPlocs], xfp_32, 3, Q16 ); // Q + 16 + acc = L_deposit_h( *pPlocs ); // Q16 + *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); pPlocs++; n = sub( n, 1 ); @@ -1703,11 +1704,11 @@ static void ivas_spec_ana_fx( test(); IF( n > 0 && EQ_16( *pPlocs, 1 ) ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ { - fraction = imax_fx( &xfp[*pPlocs - 1], -1 ); /* in Q15 */ - acc = L_deposit_h( *pPlocs - 1 ); - *pPlocsi++ = L_mac( acc, fraction, 1 ); + Copy_Scale_sig_16_32( &xfp[*pPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 + acc = L_deposit_h( sub( *pPlocs, 1 ) ); // Q16 + *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); - currPlocs = *pPlocs++; + currPlocs = *pPlocs++; // Q16 move16(); n = sub( n, 1 ); } @@ -1730,10 +1731,10 @@ static void ivas_spec_ana_fx( FOR( k = 0; k < nJacob; k++ ) { fraction = ivas_imax2_jacobsen_mag_fx( &( X_sav[currPlocs - 1] ), &( X_sav[Lprot - 1 - currPlocs] ) ); /* in Q15 */ - acc = L_deposit_h( currPlocs ); - *pPlocsi++ = L_mac( acc, fraction, 1 ); + acc = L_deposit_h( currPlocs ); // Q16 + *pPlocsi++ = L_mac( acc, fraction, 1 ); // Q16 move32(); - currPlocs = *pPlocs++; + currPlocs = *pPlocs++; // Q16 move16(); } n = sub( n, nJacob ); @@ -1749,11 +1750,11 @@ static void ivas_spec_ana_fx( IF( EQ_16( currPlocs, ( sub( Lprot2_1, DELTA_CORR_F0_INT ) ) ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ { - fraction = imax_fx( &xfp[currPlocs - 1], 0 ); /* in Q15 */ - acc = L_deposit_h( sub( currPlocs, 1 ) ); - *pPlocsi++ = L_mac( acc, fraction, 1 ); + Copy_Scale_sig_16_32( &xfp[currPlocs - 1], xfp_32, 3, Q16 ); // Q + 16 + acc = L_deposit_h( sub( currPlocs, 1 ) ); // Q16 + *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); - currPlocs = *pPlocs++; + currPlocs = *pPlocs++; // Q16 move16(); n = sub( n, 1 ); } @@ -1763,11 +1764,11 @@ static void ivas_spec_ana_fx( * whould point */ IF( n > 0 ) /* fs/2 which makes special case . */ { - fraction = imax_fx( &xfp[currPlocs - 2], 0 ); /* in Q15 */ - acc = L_deposit_h( sub( currPlocs, 2 ) ); - *pPlocsi++ = L_mac( acc, fraction, 1 ); + Copy_Scale_sig_16_32( &xfp[currPlocs - 2], xfp_32, 3, Q16 ); // Q + 16 + acc = L_deposit_h( sub( currPlocs, 2 ) ); // Q16 + *pPlocsi++ = L_add( acc, L_shl( imax_pos_fx( xfp_32 ) /* Q15 */, 1 ) ); // Q16 move32(); - currPlocs = *pPlocs++; + currPlocs = *pPlocs++; // Q16 move16(); n = sub( n, 1 ); } -- GitLab