Loading lib_rend/ivas_reverb_fx.c +62 −61 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ static Word16 wrap_rad_fixed( #define MAX_NR_OUTPUTS ( 2 ) #ifdef FIX_1942_ASSERTION_LOWSHELF #define M60Q8 ( -15360 ) //-60 in Q8 #define M60Q9 ( -30720 ) //-60 in Q9 #define M120Q8 ( -30720 ) //-120 in Q8 #endif Loading Loading @@ -696,8 +696,10 @@ static ivas_error compute_t60_coeffs_fx( loop_delay_sec_fx = BASOP_Util_Divide3232_Scale( pParams->pLoop_delays[loop_idx], output_Fs, &e ); loop_delay_sec_fx = shl( loop_delay_sec_fx, e ); // Q15 FOR( bin_idx = 0; bin_idx < tf_T60_len; bin_idx++ ){ IF( EQ_32( pParams->pRt60_fx[bin_idx], 0 ) ){ FOR( bin_idx = 0; bin_idx < tf_T60_len; bin_idx++ ) { IF( EQ_32( pParams->pRt60_fx[bin_idx], 0 ) ) { // If RT60 is 0, target gain is -120dB #ifdef FIX_1942_ASSERTION_LOWSHELF target_gains_db_fx[bin_idx] = M120Q8; Loading @@ -709,31 +711,32 @@ static ivas_error compute_t60_coeffs_fx( { tmp = BASOP_Util_Divide3232_Scale( L_deposit_h( loop_delay_sec_fx ), pParams->pRt60_fx[bin_idx], &e ); #ifdef FIX_1942_ASSERTION_LOWSHELF tmp_e = sub( add( e, 0 ), 5 ); // L_deposit_h( loop_delay_sec_fx ):Q31, pParams->pRt60_fx[bin_idx]:Q26 target_gains_db_fx[bin_idx] = mult( M60Q8, tmp ); tmp_e = sub( add( e, 0 ), 5 ); // L_deposit_h( loop_delay_sec_fx ):Q0.31, pParams->pRt60_fx[bin_idx]:Q5.26 target_gains_db_fx[bin_idx] = mult( M60Q9, tmp ); tmp_e = add( tmp_e, 6 ); // + Q6.9(Q9) // gain < - 120 ? -120: gain IF( GT_16( tmp_e, 0 ) ) // target_gains_db_fx:Q8+Qtmp --> if(Q8+Qtmp < Q8) = if(Qtmp < 0) = if(tmp_e > 0) IF( GT_16( tmp_e, 7 ) ) // Q7.8(Q8) { IF( LT_16( target_gains_db_fx[bin_idx], shr( M120Q8, tmp_e ) ) ) IF( LT_16( target_gains_db_fx[bin_idx], shr( M120Q8, tmp_e - 7 ) ) ) { target_gains_db_fx[bin_idx] = M120Q8; // Q8 move16(); } ELSE { target_gains_db_fx[bin_idx] = shl( target_gains_db_fx[bin_idx], tmp_e ); // Q8, gain must be less than 128 target_gains_db_fx[bin_idx] = shl_r( target_gains_db_fx[bin_idx], tmp_e - 7 ); // Q8, gain must be less than 128 } } ELSE { target_gains_db_fx[bin_idx] = shl( target_gains_db_fx[bin_idx], tmp_e ); // Q8, gain must be less than 128 target_gains_db_fx[bin_idx] = shl_r( target_gains_db_fx[bin_idx], tmp_e - 7 ); // Q8, gain must be less than 128 IF( LT_16( target_gains_db_fx[bin_idx], M120Q8 ) ) { target_gains_db_fx[bin_idx] = M120Q8; // Q8 move16(); } } } #else IF( LT_16( e, -1 ) ) { Loading @@ -744,9 +747,7 @@ static ivas_error compute_t60_coeffs_fx( tmp = shr( tmp, sub( 5, e ) ); // scaling tmp to Q15 target_gains_db_fx[bin_idx] = mult( shr( min120q8, 1 ), tmp ); // Q8 } #endif } #ifndef FIX_1942_ASSERTION_LOWSHELF // gain < - 120 ? -120: gain IF( LT_16( target_gains_db_fx[bin_idx], -30720 ) ) { Loading Loading
lib_rend/ivas_reverb_fx.c +62 −61 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ static Word16 wrap_rad_fixed( #define MAX_NR_OUTPUTS ( 2 ) #ifdef FIX_1942_ASSERTION_LOWSHELF #define M60Q8 ( -15360 ) //-60 in Q8 #define M60Q9 ( -30720 ) //-60 in Q9 #define M120Q8 ( -30720 ) //-120 in Q8 #endif Loading Loading @@ -696,8 +696,10 @@ static ivas_error compute_t60_coeffs_fx( loop_delay_sec_fx = BASOP_Util_Divide3232_Scale( pParams->pLoop_delays[loop_idx], output_Fs, &e ); loop_delay_sec_fx = shl( loop_delay_sec_fx, e ); // Q15 FOR( bin_idx = 0; bin_idx < tf_T60_len; bin_idx++ ){ IF( EQ_32( pParams->pRt60_fx[bin_idx], 0 ) ){ FOR( bin_idx = 0; bin_idx < tf_T60_len; bin_idx++ ) { IF( EQ_32( pParams->pRt60_fx[bin_idx], 0 ) ) { // If RT60 is 0, target gain is -120dB #ifdef FIX_1942_ASSERTION_LOWSHELF target_gains_db_fx[bin_idx] = M120Q8; Loading @@ -709,31 +711,32 @@ static ivas_error compute_t60_coeffs_fx( { tmp = BASOP_Util_Divide3232_Scale( L_deposit_h( loop_delay_sec_fx ), pParams->pRt60_fx[bin_idx], &e ); #ifdef FIX_1942_ASSERTION_LOWSHELF tmp_e = sub( add( e, 0 ), 5 ); // L_deposit_h( loop_delay_sec_fx ):Q31, pParams->pRt60_fx[bin_idx]:Q26 target_gains_db_fx[bin_idx] = mult( M60Q8, tmp ); tmp_e = sub( add( e, 0 ), 5 ); // L_deposit_h( loop_delay_sec_fx ):Q0.31, pParams->pRt60_fx[bin_idx]:Q5.26 target_gains_db_fx[bin_idx] = mult( M60Q9, tmp ); tmp_e = add( tmp_e, 6 ); // + Q6.9(Q9) // gain < - 120 ? -120: gain IF( GT_16( tmp_e, 0 ) ) // target_gains_db_fx:Q8+Qtmp --> if(Q8+Qtmp < Q8) = if(Qtmp < 0) = if(tmp_e > 0) IF( GT_16( tmp_e, 7 ) ) // Q7.8(Q8) { IF( LT_16( target_gains_db_fx[bin_idx], shr( M120Q8, tmp_e ) ) ) IF( LT_16( target_gains_db_fx[bin_idx], shr( M120Q8, tmp_e - 7 ) ) ) { target_gains_db_fx[bin_idx] = M120Q8; // Q8 move16(); } ELSE { target_gains_db_fx[bin_idx] = shl( target_gains_db_fx[bin_idx], tmp_e ); // Q8, gain must be less than 128 target_gains_db_fx[bin_idx] = shl_r( target_gains_db_fx[bin_idx], tmp_e - 7 ); // Q8, gain must be less than 128 } } ELSE { target_gains_db_fx[bin_idx] = shl( target_gains_db_fx[bin_idx], tmp_e ); // Q8, gain must be less than 128 target_gains_db_fx[bin_idx] = shl_r( target_gains_db_fx[bin_idx], tmp_e - 7 ); // Q8, gain must be less than 128 IF( LT_16( target_gains_db_fx[bin_idx], M120Q8 ) ) { target_gains_db_fx[bin_idx] = M120Q8; // Q8 move16(); } } } #else IF( LT_16( e, -1 ) ) { Loading @@ -744,9 +747,7 @@ static ivas_error compute_t60_coeffs_fx( tmp = shr( tmp, sub( 5, e ) ); // scaling tmp to Q15 target_gains_db_fx[bin_idx] = mult( shr( min120q8, 1 ), tmp ); // Q8 } #endif } #ifndef FIX_1942_ASSERTION_LOWSHELF // gain < - 120 ? -120: gain IF( LT_16( target_gains_db_fx[bin_idx], -30720 ) ) { Loading