From 1c0b4da0c2261c0916b9ae96a4a04b76cb1174af Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 31 Mar 2024 13:52:56 +0530 Subject: [PATCH] Issue fix: 719, 720, 721 and 722 issue fixes --- lib_com/mslvq_com_fx.c | 2 +- lib_dec/ivas_stereo_cng_dec.c | 21 ++++++++++++++++----- lib_dec/ivas_stereo_dft_dec_fx.c | 2 +- lib_dec/ivas_stereo_switching_dec.c | 4 ++-- lib_dec/pit_dec_fx.c | 1 - 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index aa3e4195d..55e47f453 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -1250,7 +1250,7 @@ void deindex_lvq_SHB_fx( /* find idx_leader */ i = 1; - WHILE (index >= table_no_cv[i]) + WHILE (index > table_no_cv[i]) { i++; } diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 07a74faca..352115551 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1467,12 +1467,23 @@ void stereo_cna_update_params_fx( temp_res_q = 0; c_fx = BASOP_Util_Divide3232_Scale((Word32)enrL_fx, (Word32)enrR_fx, &temp_res_q); c_q = 15 - temp_res_q + (y_q - x_q); + + Word32 one_in_c_q ; + IF (GT_16( c_q, 31 ) ) + { + c_q = 31; + c_fx = L_shr_sat(c_fx, c_q - 31); + one_in_c_q = ONE_IN_Q31; + } + ELSE + { + one_in_c_q = L_shl_sat(1, c_q); + } - Word32 one_in_c_q = L_shl(1 , c_q); - Word32 num_c_fx = L_sub(c_fx, one_in_c_q); - Word32 denom_c_fx = L_add(c_fx, one_in_c_q); - Word16 num_c_headroom = norm_l(L_sub(c_fx, one_in_c_q)); - Word16 denom_c_headroom = norm_l(L_add(c_fx, one_in_c_q)); + Word32 num_c_fx = L_sub_sat(c_fx, one_in_c_q); + Word32 denom_c_fx = L_add_sat(c_fx, one_in_c_q); + Word16 num_c_headroom = norm_l(L_sub_sat(c_fx, one_in_c_q)); + Word16 denom_c_headroom = norm_l(L_add_sat(c_fx, one_in_c_q)); Word16 min_headroom_left = num_c_headroom < denom_c_headroom ? num_c_headroom : denom_c_headroom; temp_res_q = 0; c_ILD_fx = BASOP_Util_Divide3232_Scale(L_shl_sat(num_c_fx, min_headroom_left), L_shl_sat(denom_c_fx, min_headroom_left), &temp_res_q); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 0956286d3..1c8aef1b5 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -3097,7 +3097,7 @@ void stereo_dft_dec_sid_coh_fx( FOR( i = 0; i < b; i++ ) { - pred_fx = add( pred_fx, mult( ( *pptr_fx++ ), shl( cohBandq_fx[i], 2 ) ) ); /*q-13*/ + pred_fx = add( pred_fx, shl(mult( ( *pptr_fx++ ), cohBandq_fx[i] ), 2) ); /*q-13*/ } /* Weighted intra/inter-frame prediction */ pred_fx = add( mult( alpha_fx, pred_fx ), mult( sub( 32767, alpha_fx ), coh_fx[b] ) ); /*q-13*/ diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 285f06c26..5587962c9 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -4015,13 +4015,13 @@ void stereo_switching_dec( } ELSE { - IF( hCPE->hStereoDftDmx->prevTargetGain_fx == ONE_IN_Q29 ) + IF( hCPE->hStereoTCA->prevTargetGain_fx == ONE_IN_Q29 ) { tmpF_fx = ONE_IN_Q27; } ELSE { - Word16 temp_b = (Word16) L_shr( hCPE->hStereoDftDmx->prevTargetGain_fx, 16 ); + Word16 temp_b = (Word16) L_shr( hCPE->hStereoTCA->prevTargetGain_fx, 16 ); Word16 temp_b_q = 2; tmpF_fx = Inv16( temp_b, &temp_b_q ); tmpF_fx = L_shl( tmpF_fx, ( 31 - 4 ) - ( 15 - temp_b_q ) ); diff --git a/lib_dec/pit_dec_fx.c b/lib_dec/pit_dec_fx.c index a847853f9..b19b389df 100644 --- a/lib_dec/pit_dec_fx.c +++ b/lib_dec/pit_dec_fx.c @@ -779,7 +779,6 @@ Word16 pit_decode_ivas_fx( /* o : floating pitch value move16(); move16(); } - printf( "function not tested yet\n" ); } #endif ELSE -- GitLab