diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index ddcd6ef15f9fc5cdb0947df6c57dbe7988be13f1..74564416501e240c6b9b655eb6e3b7bf754ac3c2 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -697,13 +697,13 @@ static ivas_error compute_t60_coeffs_fx( ELSE { tmp = BASOP_Util_Divide3232_Scale( L_deposit_h( loop_delay_sec_fx ), pParams->pRt60_fx[bin_idx], &e ); - IF( LT_16( e, -1 ) ) + IF( LT_16( e, -6 ) ) { target_gains_db_fx[bin_idx] = min120q8; } ELSE { - tmp = shr( tmp, sub( 5, e ) ); // scaling tmp to Q15 + tmp = shr_sat( tmp, sub( 5, e ) ); // scaling tmp to Q15 target_gains_db_fx[bin_idx] = mult( shr( min120q8, 1 ), tmp ); // Q8 } } @@ -996,6 +996,12 @@ static ivas_error calc_jot_t60_coeffs_fx( L_tmp = BASOP_util_Pow2( L_deposit_h( tmp_fx ), exph, &e ); lin_gain_hf_fx = extract_l( L_shr( L_tmp, sub( 16, e ) ) ); + IF( EQ_16( lin_gain_hf_fx, 0 ) ) + { + lin_gain_hf_fx = 1; // Using minimum value to avoid division by zero + move16(); + } + /* call low-pass iir shelf */ calc_low_shelf_first_order_filter_fx( pCoeffB_fx, pCoeffA_fx, f0_fx, lin_gain_lf_fx, lin_gain_hf_fx ); return IVAS_ERR_OK;