Loading lib_rend/ivas_reverb_fx.c +15 −54 Original line number Diff line number Diff line Loading @@ -123,9 +123,7 @@ typedef struct ivas_reverb_params_t Word16 pT60_filter_coeff_fx[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Filters [][] in feedback loops, controlling T60. */ Word32 *pFc_fx; /* Center frequencies for FFT filter design */ Word32 *pRt60_fx; /* RT60 values at these frequencies */ Word16 *pRt60_e; /* exponents for RT60 values at these frequencies */ Word32 *pDsr_fx; /* DSR values at these frequencies */ Word16 *pDsr_e; /* DSR values at these frequencies */ Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ Loading Loading @@ -634,7 +632,6 @@ static ivas_error compute_t60_coeffs_fx( Word32 freq_Nyquist_fx = L_shr( output_Fs, 1 ); Word16 target_gains_db_fx[RV_LENGTH_NR_FC]; // Q8 Word16 norm_f_fx[RV_LENGTH_NR_FC]; Word32 *targetT60_fx, *pFc_fx; Word16 *pCoeffs_a_fx, *pCoeffs_b_fx; Word16 e; const Word16 min120q8 = -30720; // -120 in Q8 Loading @@ -656,8 +653,6 @@ static ivas_error compute_t60_coeffs_fx( FOR( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) { Word16 loop_delay_sec_fx_exp; 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 Loading Loading @@ -694,23 +689,9 @@ static ivas_error compute_t60_coeffs_fx( move16(); // Word16 val = target_gains_db_exp[0]; FOR( Word16 i = 1; i < nr_fc_fft_filter; i++ ) { //Should not be required after condensation //val = s_max( val, target_gains_db_exp[i] ); //val stores the gratest value of target_gains_db_exp } FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { //Should not be required after condensation // target_gains_db_fx[i] = shr( target_gains_db_fx[i], sub( val, target_gains_db_exp[i] ) ); move16(); } Word16 val = 7; //IF( NE_32( ( error = calc_jot_t60_coeffs_fx( target_gains_db_fx, val, tf_T60_len, norm_f_fx, pCoeffs_a_fx, pCoeffs_b_fx, extract_l( freq_Nyquist_fx ) ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = calc_jot_t60_coeffs_fx( target_gains_db_fx, val, tf_T60_len, norm_f_fx, pCoeffs_a_fx, pCoeffs_b_fx, extract_l( freq_Nyquist_fx ) ) ), IVAS_ERR_OK ) ) { return error; } Loading Loading @@ -1274,8 +1255,7 @@ static void set_reverb_acoustic_data_fx( Word16 bin_idx; Word32 ln_1e6_inverted_fx, delay_diff_fx, L_tmp; Word32 exp_argument_fx, tmp; Word16 tmp_flag, exp_argument_e; Word16 pow_exp, tmp_exp; Word16 pow_exp, exp_argument_e; Word32 *pFc_input_fx = pRoomAcoustics->pFc_input_fx; Word32 *pAcoustic_rt60_fx = pRoomAcoustics->pAcoustic_rt60_fx; Loading @@ -1283,9 +1263,7 @@ static void set_reverb_acoustic_data_fx( Word32 *pFc_fx = pParams->pFc_fx; Word32 *pRt60_fx = pParams->pRt60_fx; Word16 *pRt60_e = pParams->pRt60_e; // should not be required; Word32 *pDsr_fx = pParams->pDsr_fx; Word16 *pDsr_e = pParams->pDsr_e; // should not be required /* interpolate input table data for T60 and DSR to the FFT filter grid */ Loading Loading @@ -1482,24 +1460,9 @@ ivas_error ivas_reverb_open_fx( /* set up reverb acoustic data on the basis of HRTF data and renderer config */ Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 2 ); Word16 *pRt60_e = (Word16 *) malloc( sizeof( Word16 ) * nr_fc_fft_filter ); // Should be removed Word16 *pDsr_e = (Word16 *) malloc( sizeof( Word16 ) * nr_fc_fft_filter ); // Should be removed params.pRt60_e = pRt60_e; // Should be removed params.pDsr_e = pDsr_e; // Should be removed set_reverb_acoustic_data_fx( ¶ms, &hRenderConfig->roomAcoustics, nr_fc_input, nr_fc_fft_filter ); // Not needed after adjusting the interpolate and scaling functions to output dsr in Q31, T60 in Q26 /*Scale_sig32( params.pFc_fx, nr_fc_fft_filter, -2 ); FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pRt60_fx[i] = L_abs( params.pRt60_fx[i] ); move32(); params.pDsr_fx[i] = L_abs( params.pDsr_fx[i] ); move32(); }*/ params.pHrtf_avg_pwr_response_l_const_fx = hHrtfStatistics->average_energy_l; params.pHrtf_avg_pwr_response_r_const_fx = hHrtfStatistics->average_energy_r; params.pHrtf_inter_aural_coherence_const_fx = hHrtfStatistics->inter_aural_coherence; Loading Loading @@ -1532,8 +1495,8 @@ ivas_error ivas_reverb_open_fx( return error; } /* Compute target levels (gains) for the coloration filters */ Word32 *pHrtf_avg_pwr_response_l_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); Word32 *pHrtf_avg_pwr_response_r_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); Word32 *pHrtf_avg_pwr_response_l_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); // not required Word32 *pHrtf_avg_pwr_response_r_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); // not required Word16 lenT60_filter_coeff = add( params.t60_filter_order, 1 ); lenT60_filter_coeff = add( i_mult( shl( lenT60_filter_coeff, 1 ), sub( params.nr_loops, 1 ) ), add( lenT60_filter_coeff, 2 ) ); Word32 *pT60_filter_coeff = (Word32 *) malloc( ( lenT60_filter_coeff ) * sizeof( Word32 * ) ); Loading @@ -1541,16 +1504,14 @@ ivas_error ivas_reverb_open_fx( FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pDsr_fx[i] = L_shl( params.pDsr_fx[i], params.pDsr_e[i] ); // Pointless - should be elminiated if mantissa and exponent notation is removed move32(); pHrtf_avg_pwr_response_l_const[i] = params.pHrtf_avg_pwr_response_l_const_fx[i]; /*Q28*/ pHrtf_avg_pwr_response_l_const[i] = params.pHrtf_avg_pwr_response_l_const_fx[i]; /*Q28*/ // Not required - contamination move32(); pHrtf_avg_pwr_response_r_const[i] = params.pHrtf_avg_pwr_response_r_const_fx[i]; /*Q23+5*/ pHrtf_avg_pwr_response_r_const[i] = params.pHrtf_avg_pwr_response_r_const_fx[i]; /*Q23+5*/ // Not required - contamination move32(); } FOR( i = 0; i < lenT60_filter_coeff; i++ ) { pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); // needed because calc_color_levels() uses 32-bit representaion of T60_filter_coefficients move32(); } ivas_reverb_calc_color_levels_fx( output_Fs, nr_fc_fft_filter, params.nr_loops, params.pFc_fx, params.pDsr_fx, pHrtf_avg_pwr_response_l_const, pHrtf_avg_pwr_response_r_const, Loading Loading
lib_rend/ivas_reverb_fx.c +15 −54 Original line number Diff line number Diff line Loading @@ -123,9 +123,7 @@ typedef struct ivas_reverb_params_t Word16 pT60_filter_coeff_fx[MAX_NR_OUTPUTS * IVAS_REV_MAX_NR_BRANCHES * IVAS_REV_MAX_IIR_FILTER_LENGTH]; /* Filters [][] in feedback loops, controlling T60. */ Word32 *pFc_fx; /* Center frequencies for FFT filter design */ Word32 *pRt60_fx; /* RT60 values at these frequencies */ Word16 *pRt60_e; /* exponents for RT60 values at these frequencies */ Word32 *pDsr_fx; /* DSR values at these frequencies */ Word16 *pDsr_e; /* DSR values at these frequencies */ Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ Loading Loading @@ -634,7 +632,6 @@ static ivas_error compute_t60_coeffs_fx( Word32 freq_Nyquist_fx = L_shr( output_Fs, 1 ); Word16 target_gains_db_fx[RV_LENGTH_NR_FC]; // Q8 Word16 norm_f_fx[RV_LENGTH_NR_FC]; Word32 *targetT60_fx, *pFc_fx; Word16 *pCoeffs_a_fx, *pCoeffs_b_fx; Word16 e; const Word16 min120q8 = -30720; // -120 in Q8 Loading @@ -656,8 +653,6 @@ static ivas_error compute_t60_coeffs_fx( FOR( loop_idx = 0; loop_idx < pParams->nr_loops; loop_idx++ ) { Word16 loop_delay_sec_fx_exp; 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 Loading Loading @@ -694,23 +689,9 @@ static ivas_error compute_t60_coeffs_fx( move16(); // Word16 val = target_gains_db_exp[0]; FOR( Word16 i = 1; i < nr_fc_fft_filter; i++ ) { //Should not be required after condensation //val = s_max( val, target_gains_db_exp[i] ); //val stores the gratest value of target_gains_db_exp } FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { //Should not be required after condensation // target_gains_db_fx[i] = shr( target_gains_db_fx[i], sub( val, target_gains_db_exp[i] ) ); move16(); } Word16 val = 7; //IF( NE_32( ( error = calc_jot_t60_coeffs_fx( target_gains_db_fx, val, tf_T60_len, norm_f_fx, pCoeffs_a_fx, pCoeffs_b_fx, extract_l( freq_Nyquist_fx ) ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = calc_jot_t60_coeffs_fx( target_gains_db_fx, val, tf_T60_len, norm_f_fx, pCoeffs_a_fx, pCoeffs_b_fx, extract_l( freq_Nyquist_fx ) ) ), IVAS_ERR_OK ) ) { return error; } Loading Loading @@ -1274,8 +1255,7 @@ static void set_reverb_acoustic_data_fx( Word16 bin_idx; Word32 ln_1e6_inverted_fx, delay_diff_fx, L_tmp; Word32 exp_argument_fx, tmp; Word16 tmp_flag, exp_argument_e; Word16 pow_exp, tmp_exp; Word16 pow_exp, exp_argument_e; Word32 *pFc_input_fx = pRoomAcoustics->pFc_input_fx; Word32 *pAcoustic_rt60_fx = pRoomAcoustics->pAcoustic_rt60_fx; Loading @@ -1283,9 +1263,7 @@ static void set_reverb_acoustic_data_fx( Word32 *pFc_fx = pParams->pFc_fx; Word32 *pRt60_fx = pParams->pRt60_fx; Word16 *pRt60_e = pParams->pRt60_e; // should not be required; Word32 *pDsr_fx = pParams->pDsr_fx; Word16 *pDsr_e = pParams->pDsr_e; // should not be required /* interpolate input table data for T60 and DSR to the FFT filter grid */ Loading Loading @@ -1482,24 +1460,9 @@ ivas_error ivas_reverb_open_fx( /* set up reverb acoustic data on the basis of HRTF data and renderer config */ Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 2 ); Word16 *pRt60_e = (Word16 *) malloc( sizeof( Word16 ) * nr_fc_fft_filter ); // Should be removed Word16 *pDsr_e = (Word16 *) malloc( sizeof( Word16 ) * nr_fc_fft_filter ); // Should be removed params.pRt60_e = pRt60_e; // Should be removed params.pDsr_e = pDsr_e; // Should be removed set_reverb_acoustic_data_fx( ¶ms, &hRenderConfig->roomAcoustics, nr_fc_input, nr_fc_fft_filter ); // Not needed after adjusting the interpolate and scaling functions to output dsr in Q31, T60 in Q26 /*Scale_sig32( params.pFc_fx, nr_fc_fft_filter, -2 ); FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pRt60_fx[i] = L_abs( params.pRt60_fx[i] ); move32(); params.pDsr_fx[i] = L_abs( params.pDsr_fx[i] ); move32(); }*/ params.pHrtf_avg_pwr_response_l_const_fx = hHrtfStatistics->average_energy_l; params.pHrtf_avg_pwr_response_r_const_fx = hHrtfStatistics->average_energy_r; params.pHrtf_inter_aural_coherence_const_fx = hHrtfStatistics->inter_aural_coherence; Loading Loading @@ -1532,8 +1495,8 @@ ivas_error ivas_reverb_open_fx( return error; } /* Compute target levels (gains) for the coloration filters */ Word32 *pHrtf_avg_pwr_response_l_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); Word32 *pHrtf_avg_pwr_response_r_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); Word32 *pHrtf_avg_pwr_response_l_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); // not required Word32 *pHrtf_avg_pwr_response_r_const = (Word32 *) malloc( nr_fc_fft_filter * sizeof( Word32 * ) ); // not required Word16 lenT60_filter_coeff = add( params.t60_filter_order, 1 ); lenT60_filter_coeff = add( i_mult( shl( lenT60_filter_coeff, 1 ), sub( params.nr_loops, 1 ) ), add( lenT60_filter_coeff, 2 ) ); Word32 *pT60_filter_coeff = (Word32 *) malloc( ( lenT60_filter_coeff ) * sizeof( Word32 * ) ); Loading @@ -1541,16 +1504,14 @@ ivas_error ivas_reverb_open_fx( FOR( i = 0; i < nr_fc_fft_filter; i++ ) { params.pDsr_fx[i] = L_shl( params.pDsr_fx[i], params.pDsr_e[i] ); // Pointless - should be elminiated if mantissa and exponent notation is removed move32(); pHrtf_avg_pwr_response_l_const[i] = params.pHrtf_avg_pwr_response_l_const_fx[i]; /*Q28*/ pHrtf_avg_pwr_response_l_const[i] = params.pHrtf_avg_pwr_response_l_const_fx[i]; /*Q28*/ // Not required - contamination move32(); pHrtf_avg_pwr_response_r_const[i] = params.pHrtf_avg_pwr_response_r_const_fx[i]; /*Q23+5*/ pHrtf_avg_pwr_response_r_const[i] = params.pHrtf_avg_pwr_response_r_const_fx[i]; /*Q23+5*/ // Not required - contamination move32(); } FOR( i = 0; i < lenT60_filter_coeff; i++ ) { pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); // needed because calc_color_levels() uses 32-bit representaion of T60_filter_coefficients move32(); } ivas_reverb_calc_color_levels_fx( output_Fs, nr_fc_fft_filter, params.nr_loops, params.pFc_fx, params.pDsr_fx, pHrtf_avg_pwr_response_l_const, pHrtf_avg_pwr_response_r_const, Loading