diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index aa3e4195d4dc6730ac09b6c6f160b29753f9456a..55e47f45308a8132da7610641563d1215594649d 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 07a74facabfe2e5b2062fa36328ee1b998532a49..352115551355a69f31f152b386581c8370b7ea87 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 0956286d33f33dd098191c5591285ceb24b9dc32..1c8aef1b5d4a48373c6255605d8515e8b2156210 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 285f06c26fc353862691073c1c5d508deb861457..5587962c9d9e3b635fd81bcfff6be4b7815cf72f 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 a847853f99a1c7ab6e6ab230ebeeb1202c677b33..b19b389dfae54cc3775f5c17a501448d11405fc6 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