Loading lib_rend/ivas_dirac_dec_binaural_functions.c +1 −1 Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #endif { /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac ) ) != IVAS_ERR_OK ) { return error; } Loading lib_rend/ivas_prot_rend.h +10 −1 Original line number Diff line number Diff line Loading @@ -915,7 +915,8 @@ ivas_error ivas_binaural_reverb_open_parambin( const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin, /* i : Parametric binauralizer HRTF handle */ const float *lr_energy_and_iac[] /* i : precomuputed lr energies and iac */ ); void ivas_binaural_reverb_close( Loading Loading @@ -1102,6 +1103,14 @@ ivas_error ivas_reverb_prepare_cldfb_params( float *pOutput_t60, float *pOutput_ene ); ivas_error ivas_reverb_prepare_cldfb_params_parametric( IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const int32_t output_Fs, const float *avg_pwr_l, const float *avg_pwr_r, float *pOutput_t60, float *pOutput_ene ); void ivas_reverb_interpolate_acoustic_data( const int16_t input_table_size, const float *pInput_fc, Loading lib_rend/ivas_reverb.c +8 −6 Original line number Diff line number Diff line Loading @@ -1940,7 +1940,8 @@ ivas_error ivas_binaural_reverb_open_parambin( const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin, /* i : Parametric binauralizer HRTF handle */ const float *lr_energy_and_iac[] /* i : precomuputed lr energies and iac */ ) { ivas_error error; Loading @@ -1956,11 +1957,12 @@ ivas_error ivas_binaural_reverb_open_parambin( { revTimes = t60; revEne = ene; /* Todo Philips: This needs a suitable function for ParamBin here. */ // if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, internal_config, false, sampling_rate, t60, ene ) ) != IVAS_ERR_OK ) // { // return error; // } if ( ( error = ivas_reverb_prepare_cldfb_params_parametric( roomAcoustics, sampling_rate, lr_energy_and_iac[0], lr_energy_and_iac[1], t60, ene ) ) != IVAS_ERR_OK ) { return error; } preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); } else Loading lib_rend/ivas_reverb_utils.c +81 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,87 @@ ivas_error ivas_reverb_prepare_cldfb_params( } /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_parametric_set_energies() * * Function gets the precalculated left/right energies in FFT spectrum and computes avarage * left/right energies to CLDFB bin center frequencies. *-----------------------------------------------------------------------------------------*/ static void ivas_reverb_parametric_set_energies( const float *avg_pwr_l, const float *avg_pwr_r, const int32_t sampling_rate, float *avg_pwr_l_out, float *avg_pwr_r_out ) { int16_t freq_idx; const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); float input_fc[FFT_SPECTRUM_SIZE]; float output_fc[CLDFB_NO_CHANNELS_MAX]; for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) { input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( FFT_SPECTRUM_SIZE - 1 ) ); } for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } ivas_reverb_interpolate_acoustic_data( FFT_SPECTRUM_SIZE, input_fc, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_l_out, avg_pwr_r_out ); } /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_prepare_cldfb_params_parametric() * * Prepares reverb parameters for CLDFB-based parametric reverberator *-----------------------------------------------------------------------------------------*/ ivas_error ivas_reverb_prepare_cldfb_params_parametric( IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const int32_t output_Fs, const float *avg_pwr_l, const float *avg_pwr_r, float *pOutput_t60, float *pOutput_ene ) { int16_t idx; float fc[CLDFB_NO_CHANNELS_MAX]; float delay_diff, ln_1e6_inverted, exp_argument; const float dist = DEFAULT_SRC_DIST; const float dmx_gain_2 = 4.0f * EVS_PI * dist * dist / 0.001f; ivas_error error; for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); } ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); /* adjust DSR for the delay difference */ delay_diff = pInput_params->inputPreDelay - pInput_params->acousticPreDelay; ln_1e6_inverted = 1.0f / logf( 1e06f ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { exp_argument = delay_diff / ( pOutput_t60[idx] * ln_1e6_inverted ); /* Limit exponent to approx +/-100 dB in case of incoherent value of delay_diff, to prevent overflow */ exp_argument = min( exp_argument, 23.0f ); exp_argument = max( exp_argument, -23.0f ); pOutput_ene[idx] *= expf( exp_argument ); } float avg_pwr_l_out[CLDFB_NO_CHANNELS_MAX]; float avg_pwr_r_out[CLDFB_NO_CHANNELS_MAX]; ivas_reverb_parametric_set_energies( avg_pwr_l, avg_pwr_r, output_Fs, avg_pwr_l_out, avg_pwr_r_out ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { pOutput_ene[idx] *= 0.5f * ( avg_pwr_l_out[idx] + avg_pwr_r_out[idx] ) * dmx_gain_2; } return IVAS_ERR_OK; } /*-----------------------------------------------------------------------------------------* * Function ivas_cldfb_convolver() * Loading lib_rend/lib_rend.c +1 −1 Original line number Diff line number Diff line Loading @@ -8976,7 +8976,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #endif { /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin, NULL ) ) != IVAS_ERR_OK ) { return error; } Loading Loading
lib_rend/ivas_dirac_dec_binaural_functions.c +1 −1 Original line number Diff line number Diff line Loading @@ -235,7 +235,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( #endif { /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac ) ) != IVAS_ERR_OK ) { return error; } Loading
lib_rend/ivas_prot_rend.h +10 −1 Original line number Diff line number Diff line Loading @@ -915,7 +915,8 @@ ivas_error ivas_binaural_reverb_open_parambin( const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin, /* i : Parametric binauralizer HRTF handle */ const float *lr_energy_and_iac[] /* i : precomuputed lr energies and iac */ ); void ivas_binaural_reverb_close( Loading Loading @@ -1102,6 +1103,14 @@ ivas_error ivas_reverb_prepare_cldfb_params( float *pOutput_t60, float *pOutput_ene ); ivas_error ivas_reverb_prepare_cldfb_params_parametric( IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const int32_t output_Fs, const float *avg_pwr_l, const float *avg_pwr_r, float *pOutput_t60, float *pOutput_ene ); void ivas_reverb_interpolate_acoustic_data( const int16_t input_table_size, const float *pInput_fc, Loading
lib_rend/ivas_reverb.c +8 −6 Original line number Diff line number Diff line Loading @@ -1940,7 +1940,8 @@ ivas_error ivas_binaural_reverb_open_parambin( const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const int32_t sampling_rate, /* i : sampling rate */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ const HRTFS_PARAMBIN_HANDLE hHrtfParambin, /* i : Parametric binauralizer HRTF handle */ const float *lr_energy_and_iac[] /* i : precomuputed lr energies and iac */ ) { ivas_error error; Loading @@ -1956,11 +1957,12 @@ ivas_error ivas_binaural_reverb_open_parambin( { revTimes = t60; revEne = ene; /* Todo Philips: This needs a suitable function for ParamBin here. */ // if ( ( error = ivas_reverb_prepare_cldfb_params( roomAcoustics, hHrtfFastConv, internal_config, false, sampling_rate, t60, ene ) ) != IVAS_ERR_OK ) // { // return error; // } if ( ( error = ivas_reverb_prepare_cldfb_params_parametric( roomAcoustics, sampling_rate, lr_energy_and_iac[0], lr_energy_and_iac[1], t60, ene ) ) != IVAS_ERR_OK ) { return error; } preDelay = (int16_t) roundf( 48000.0f * roomAcoustics->acousticPreDelay / CLDFB_NO_CHANNELS_MAX ); } else Loading
lib_rend/ivas_reverb_utils.c +81 −0 Original line number Diff line number Diff line Loading @@ -127,6 +127,87 @@ ivas_error ivas_reverb_prepare_cldfb_params( } /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_parametric_set_energies() * * Function gets the precalculated left/right energies in FFT spectrum and computes avarage * left/right energies to CLDFB bin center frequencies. *-----------------------------------------------------------------------------------------*/ static void ivas_reverb_parametric_set_energies( const float *avg_pwr_l, const float *avg_pwr_r, const int32_t sampling_rate, float *avg_pwr_l_out, float *avg_pwr_r_out ) { int16_t freq_idx; const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); float input_fc[FFT_SPECTRUM_SIZE]; float output_fc[CLDFB_NO_CHANNELS_MAX]; for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) { input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( FFT_SPECTRUM_SIZE - 1 ) ); } for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } ivas_reverb_interpolate_acoustic_data( FFT_SPECTRUM_SIZE, input_fc, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_l_out, avg_pwr_r_out ); } /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_prepare_cldfb_params_parametric() * * Prepares reverb parameters for CLDFB-based parametric reverberator *-----------------------------------------------------------------------------------------*/ ivas_error ivas_reverb_prepare_cldfb_params_parametric( IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const int32_t output_Fs, const float *avg_pwr_l, const float *avg_pwr_r, float *pOutput_t60, float *pOutput_ene ) { int16_t idx; float fc[CLDFB_NO_CHANNELS_MAX]; float delay_diff, ln_1e6_inverted, exp_argument; const float dist = DEFAULT_SRC_DIST; const float dmx_gain_2 = 4.0f * EVS_PI * dist * dist / 0.001f; ivas_error error; for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); } ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); /* adjust DSR for the delay difference */ delay_diff = pInput_params->inputPreDelay - pInput_params->acousticPreDelay; ln_1e6_inverted = 1.0f / logf( 1e06f ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { exp_argument = delay_diff / ( pOutput_t60[idx] * ln_1e6_inverted ); /* Limit exponent to approx +/-100 dB in case of incoherent value of delay_diff, to prevent overflow */ exp_argument = min( exp_argument, 23.0f ); exp_argument = max( exp_argument, -23.0f ); pOutput_ene[idx] *= expf( exp_argument ); } float avg_pwr_l_out[CLDFB_NO_CHANNELS_MAX]; float avg_pwr_r_out[CLDFB_NO_CHANNELS_MAX]; ivas_reverb_parametric_set_energies( avg_pwr_l, avg_pwr_r, output_Fs, avg_pwr_l_out, avg_pwr_r_out ); for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { pOutput_ene[idx] *= 0.5f * ( avg_pwr_l_out[idx] + avg_pwr_r_out[idx] ) * dmx_gain_2; } return IVAS_ERR_OK; } /*-----------------------------------------------------------------------------------------* * Function ivas_cldfb_convolver() * Loading
lib_rend/lib_rend.c +1 −1 Original line number Diff line number Diff line Loading @@ -8976,7 +8976,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init( #endif { /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin, NULL ) ) != IVAS_ERR_OK ) { return error; } Loading