Loading lib_rend/ivas_prot_rend_fx.h +14 −0 Original line number Diff line number Diff line Loading @@ -1158,6 +1158,20 @@ void ivas_reverb_interpolate_acoustic_data_fx( Word16 *pOutput_t60_e, //output e Word16 *pOutput_dsr_e //output e ); #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT void ivas_reverb_interpolate_energies_fx( const Word16 input_table_size, const Word32 *pInput_fc, //input in Q16 const Word32 *pInput_ene_l, //input in Q28 const Word32 *pInput_ene_r, //input in Q28 const Word16 output_table_size, const Word32 *pOutput_fc, Word32 *pOutput_ene_l_m, // output m Word32 *pOutput_ene_r_m, // output m Word16 *pOutput_ene_l_e, //output e Word16 *pOutput_ene_r_e //output e ); #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES void ivas_reverb_get_hrtf_set_properties_fx( Word32 **ppHrtf_set_L_re, Loading lib_rend/ivas_reverb_filter_design_fx.c +83 −0 Original line number Diff line number Diff line Loading @@ -920,6 +920,89 @@ void ivas_reverb_interpolate_acoustic_data_fx( return; } #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT /*-------------------------------------------------------------------* * ivas_reverb_interpolate_energies_fx() * * Interpolates data from the input average energy to the FFT pFilter uniform grid * Note: the fc frequencies both for the input and the output must be in the ascending order *-------------------------------------------------------------------*/ void ivas_reverb_interpolate_energies_fx( const Word16 input_table_size, const Word32 *pInput_fc, // input in Q16 const Word32 *pInput_ene_l, // input in Q28 const Word32 *pInput_ene_r, // input in Q28 const Word16 output_table_size, const Word32 *pOutput_fc, // Q16 Word32 *pOutput_ene_l_m, Word32 *pOutput_ene_r_m, Word16 *pOutput_ene_l_e, Word16 *pOutput_ene_r_e ) { Word16 input_idx, output_idx; Word32 rel_offset; Word16 rel_offset_e; input_idx = 0; move16(); FOR( output_idx = 0; output_idx < output_table_size; output_idx++ ) { /* if the bin frequency is lower than the 1st frequency point in the input table, take this 1st point */ IF( LT_32( pOutput_fc[output_idx], pInput_fc[0] ) ) { input_idx = 0; move16(); rel_offset = 0; move32(); rel_offset_e = 0; move16(); } ELSE { /* if the bin frequency is higher than the last frequency point in the input table, take this last point */ IF( GT_32( pOutput_fc[output_idx], pInput_fc[input_table_size - 1] ) ) { input_idx = sub( input_table_size, 2 ); rel_offset = ONE_IN_Q30; // Q30; move32(); rel_offset_e = 1; move16(); } /* otherwise use linear interpolation between 2 consecutive points in the input table */ ELSE { WHILE( GT_32( pOutput_fc[output_idx], pInput_fc[input_idx + 1] ) ) { input_idx = add( input_idx, 1 ); } rel_offset = BASOP_Util_Divide3232_Scale( L_sub( pOutput_fc[output_idx], pInput_fc[input_idx] ), L_sub( pInput_fc[input_idx + 1], pInput_fc[input_idx] ), &rel_offset_e ); // q15 rel_offset = L_shl_sat( rel_offset, add( 16, rel_offset_e ) ); rel_offset_e = 0; move16(); } } Word32 mult1; Word16 mult_e = 0; move16(); mult1 = Mpy_32_32( rel_offset, L_sub( pInput_ene_l[input_idx + 1], pInput_ene_l[input_idx] ) ); pOutput_ene_l_m[output_idx] = BASOP_Util_Add_Mant32Exp( pInput_ene_l[input_idx], 3, mult1, add( 3, rel_offset_e ), &mult_e ); // 31 - (31 - rel_offset_e + 28 - 31) move32(); pOutput_ene_l_e[output_idx] = mult_e; move16(); mult1 = Mpy_32_32( rel_offset, L_sub( pInput_ene_r[input_idx + 1], pInput_ene_r[input_idx] ) ); pOutput_ene_r_m[output_idx] = BASOP_Util_Add_Mant32Exp( pInput_ene_r[input_idx], 3, mult1, add( 3, rel_offset_e ), &mult_e ); // 31 - (31 - rel_offset_e + 28 - 31) move32(); pOutput_ene_r_e[output_idx] = mult_e; move16(); } return; } #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /*-------------------------------------------------------------------* Loading lib_rend/ivas_reverb_utils_fx.c +30 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( float avg_pwr_right_fft[FFT_SPECTRUM_SIZE]; #endif float input_fc[FFT_SPECTRUM_SIZE]; #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT Word32 input_fc_fx[FFT_SPECTRUM_SIZE]; Word32 output_fc_fx[CLDFB_NO_CHANNELS_MAX]; Word32 avg_pwr_left_fx[CLDFB_NO_CHANNELS_MAX]; Word16 avg_pwr_left_e[CLDFB_NO_CHANNELS_MAX]; Word32 avg_pwr_right_fx[CLDFB_NO_CHANNELS_MAX]; Word16 avg_pwr_right_e[CLDFB_NO_CHANNELS_MAX]; const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES ivas_error error; Loading @@ -320,7 +329,17 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( for ( freq_idx = 0; freq_idx < avg_pwr_len; freq_idx++ ) { input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( avg_pwr_len - 1 ) ); #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT input_fc_fx[freq_idx] = input_fc[freq_idx] * ONE_IN_Q16; #endif } #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc_fx[freq_idx] = ( ( freq_idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; } #endif #else for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) { Loading @@ -329,6 +348,7 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( #endif #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT Word32 *input_fc_fx = (Word32 *) malloc( 60 * sizeof( Word32 ) ); Loading @@ -337,7 +357,9 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( Word16 *avg_pwr_right_e = (Word16 *) malloc( avg_pwr_len * sizeof( Word16 ) ); Word32 *avg_pwr_left_fx = (Word32 *) malloc( avg_pwr_len * sizeof( Word32 ) ); Word32 *avg_pwr_right_fx = (Word32 *) malloc( avg_pwr_len * sizeof( Word32 ) ); #endif #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT for ( int i = 0; i < 60; i++ ) { input_fc_fx[i] = (Word32) input_fc[i] * ( 1 << 16 ); Loading @@ -347,9 +369,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( { output_fc_fx[i] = (Word32) input_fc[i] * ONE_IN_Q16; } #endif #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT ivas_reverb_interpolate_energies_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); #else ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); #endif for ( int i = 0; i < 60; i++ ) { Loading @@ -357,12 +385,14 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( avg_pwr_right[i] = (float) fabs( me2f( avg_pwr_right_fx[i], avg_pwr_right_e[i] ) ); } #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT free( input_fc_fx ); free( output_fc_fx ); free( avg_pwr_left_e ); free( avg_pwr_right_e ); free( avg_pwr_left_fx ); free( avg_pwr_right_fx ); #endif #else if ( ( error = ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ) ) != IVAS_ERR_OK ) Loading Loading
lib_rend/ivas_prot_rend_fx.h +14 −0 Original line number Diff line number Diff line Loading @@ -1158,6 +1158,20 @@ void ivas_reverb_interpolate_acoustic_data_fx( Word16 *pOutput_t60_e, //output e Word16 *pOutput_dsr_e //output e ); #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT void ivas_reverb_interpolate_energies_fx( const Word16 input_table_size, const Word32 *pInput_fc, //input in Q16 const Word32 *pInput_ene_l, //input in Q28 const Word32 *pInput_ene_r, //input in Q28 const Word16 output_table_size, const Word32 *pOutput_fc, Word32 *pOutput_ene_l_m, // output m Word32 *pOutput_ene_r_m, // output m Word16 *pOutput_ene_l_e, //output e Word16 *pOutput_ene_r_e //output e ); #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES void ivas_reverb_get_hrtf_set_properties_fx( Word32 **ppHrtf_set_L_re, Loading
lib_rend/ivas_reverb_filter_design_fx.c +83 −0 Original line number Diff line number Diff line Loading @@ -920,6 +920,89 @@ void ivas_reverb_interpolate_acoustic_data_fx( return; } #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT /*-------------------------------------------------------------------* * ivas_reverb_interpolate_energies_fx() * * Interpolates data from the input average energy to the FFT pFilter uniform grid * Note: the fc frequencies both for the input and the output must be in the ascending order *-------------------------------------------------------------------*/ void ivas_reverb_interpolate_energies_fx( const Word16 input_table_size, const Word32 *pInput_fc, // input in Q16 const Word32 *pInput_ene_l, // input in Q28 const Word32 *pInput_ene_r, // input in Q28 const Word16 output_table_size, const Word32 *pOutput_fc, // Q16 Word32 *pOutput_ene_l_m, Word32 *pOutput_ene_r_m, Word16 *pOutput_ene_l_e, Word16 *pOutput_ene_r_e ) { Word16 input_idx, output_idx; Word32 rel_offset; Word16 rel_offset_e; input_idx = 0; move16(); FOR( output_idx = 0; output_idx < output_table_size; output_idx++ ) { /* if the bin frequency is lower than the 1st frequency point in the input table, take this 1st point */ IF( LT_32( pOutput_fc[output_idx], pInput_fc[0] ) ) { input_idx = 0; move16(); rel_offset = 0; move32(); rel_offset_e = 0; move16(); } ELSE { /* if the bin frequency is higher than the last frequency point in the input table, take this last point */ IF( GT_32( pOutput_fc[output_idx], pInput_fc[input_table_size - 1] ) ) { input_idx = sub( input_table_size, 2 ); rel_offset = ONE_IN_Q30; // Q30; move32(); rel_offset_e = 1; move16(); } /* otherwise use linear interpolation between 2 consecutive points in the input table */ ELSE { WHILE( GT_32( pOutput_fc[output_idx], pInput_fc[input_idx + 1] ) ) { input_idx = add( input_idx, 1 ); } rel_offset = BASOP_Util_Divide3232_Scale( L_sub( pOutput_fc[output_idx], pInput_fc[input_idx] ), L_sub( pInput_fc[input_idx + 1], pInput_fc[input_idx] ), &rel_offset_e ); // q15 rel_offset = L_shl_sat( rel_offset, add( 16, rel_offset_e ) ); rel_offset_e = 0; move16(); } } Word32 mult1; Word16 mult_e = 0; move16(); mult1 = Mpy_32_32( rel_offset, L_sub( pInput_ene_l[input_idx + 1], pInput_ene_l[input_idx] ) ); pOutput_ene_l_m[output_idx] = BASOP_Util_Add_Mant32Exp( pInput_ene_l[input_idx], 3, mult1, add( 3, rel_offset_e ), &mult_e ); // 31 - (31 - rel_offset_e + 28 - 31) move32(); pOutput_ene_l_e[output_idx] = mult_e; move16(); mult1 = Mpy_32_32( rel_offset, L_sub( pInput_ene_r[input_idx + 1], pInput_ene_r[input_idx] ) ); pOutput_ene_r_m[output_idx] = BASOP_Util_Add_Mant32Exp( pInput_ene_r[input_idx], 3, mult1, add( 3, rel_offset_e ), &mult_e ); // 31 - (31 - rel_offset_e + 28 - 31) move32(); pOutput_ene_r_e[output_idx] = mult_e; move16(); } return; } #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /*-------------------------------------------------------------------* Loading
lib_rend/ivas_reverb_utils_fx.c +30 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( float avg_pwr_right_fft[FFT_SPECTRUM_SIZE]; #endif float input_fc[FFT_SPECTRUM_SIZE]; #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT Word32 input_fc_fx[FFT_SPECTRUM_SIZE]; Word32 output_fc_fx[CLDFB_NO_CHANNELS_MAX]; Word32 avg_pwr_left_fx[CLDFB_NO_CHANNELS_MAX]; Word16 avg_pwr_left_e[CLDFB_NO_CHANNELS_MAX]; Word32 avg_pwr_right_fx[CLDFB_NO_CHANNELS_MAX]; Word16 avg_pwr_right_e[CLDFB_NO_CHANNELS_MAX]; const Word16 cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); #endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES ivas_error error; Loading @@ -320,7 +329,17 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( for ( freq_idx = 0; freq_idx < avg_pwr_len; freq_idx++ ) { input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( avg_pwr_len - 1 ) ); #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT input_fc_fx[freq_idx] = input_fc[freq_idx] * ONE_IN_Q16; #endif } #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc_fx[freq_idx] = ( ( freq_idx << 1 ) + 1 ) * cldfb_freq_halfstep * ONE_IN_Q16; } #endif #else for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) { Loading @@ -329,6 +348,7 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( #endif #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT Word32 *input_fc_fx = (Word32 *) malloc( 60 * sizeof( Word32 ) ); Loading @@ -337,7 +357,9 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( Word16 *avg_pwr_right_e = (Word16 *) malloc( avg_pwr_len * sizeof( Word16 ) ); Word32 *avg_pwr_left_fx = (Word32 *) malloc( avg_pwr_len * sizeof( Word32 ) ); Word32 *avg_pwr_right_fx = (Word32 *) malloc( avg_pwr_len * sizeof( Word32 ) ); #endif #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT for ( int i = 0; i < 60; i++ ) { input_fc_fx[i] = (Word32) input_fc[i] * ( 1 << 16 ); Loading @@ -347,9 +369,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( { output_fc_fx[i] = (Word32) input_fc[i] * ONE_IN_Q16; } #endif #ifdef FIX_1741_REVERB_TIMES_Q_FORMAT ivas_reverb_interpolate_energies_fx( avg_pwr_len, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); #else ivas_reverb_interpolate_acoustic_data_fx( FFT_SPECTRUM_SIZE, input_fc_fx, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc_fx, avg_pwr_left_fx, avg_pwr_right_fx, avg_pwr_left_e, avg_pwr_right_e ); #endif for ( int i = 0; i < 60; i++ ) { Loading @@ -357,12 +385,14 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( avg_pwr_right[i] = (float) fabs( me2f( avg_pwr_right_fx[i], avg_pwr_right_e[i] ) ); } #ifndef FIX_1741_REVERB_TIMES_Q_FORMAT free( input_fc_fx ); free( output_fc_fx ); free( avg_pwr_left_e ); free( avg_pwr_right_e ); free( avg_pwr_left_fx ); free( avg_pwr_right_fx ); #endif #else if ( ( error = ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ) ) != IVAS_ERR_OK ) Loading