Loading lib_rend/ivas_reverb.c +111 −2 Original line number Diff line number Diff line Loading @@ -1037,7 +1037,9 @@ static ivas_error setup_FDN_branches( { int16_t nr_coefs, branch_idx, channel_idx; ivas_error error; #ifndef FIX_1053_REVERB_RECONFIGURATION float *pCoef_a, *pCoef_b; #endif error = IVAS_ERR_OK; /* initialize feedback branches */ Loading @@ -1059,6 +1061,7 @@ static ivas_error setup_FDN_branches( { for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) { #ifndef FIX_1053_REVERB_RECONFIGURATION pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; Loading @@ -1066,7 +1069,7 @@ static ivas_error setup_FDN_branches( { return error; } #endif if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) { return error; Loading @@ -1091,12 +1094,19 @@ static ivas_error setup_FDN_branches( } #ifdef FIX_1053_REVERB_RECONFIGURATION /*------------------------------------------------------------------------- * ivas_reverb_open() * * Allocate and initialize FDN reverberation handle *------------------------------------------------------------------------*/ #else /*------------------------------------------------------------------------- * ivas_reverb_open() * * Allocate and initialize Crend reverberation handle *------------------------------------------------------------------------*/ #endif ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES Loading @@ -1111,7 +1121,14 @@ ivas_error ivas_reverb_open( ) { ivas_error error; #ifdef FIX_1053_REVERB_RECONFIGURATION REVERB_HANDLE pState = *hReverb; int16_t nr_coefs, branch_idx; float *pCoef_a, *pCoef_b; #else REVERB_HANDLE pState = NULL; #endif int16_t bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; ivas_reverb_params_t params; rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; Loading @@ -1129,17 +1146,47 @@ ivas_error ivas_reverb_open( predelay_bf_len = output_frame; nr_fc_input = hRenderConfig->roomAcoustics.nBands; #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* Allocate main reverb. handle */ if ( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator " ); } } #else /* Allocate main reverb. handle */ if ( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Reverberator " ); } #endif if ( ( error = set_base_config( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) { return error; } #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* Allocate memory for feedback delay lines */ for ( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { if ( ( pState->loop_delay_buffer[loop_idx] = (float *) malloc( params.pLoop_delays[loop_idx] * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } } /* Allocate memory for the pre-delay delay line */ if ( ( pState->pPredelay_buffer = (float *) malloc( output_frame * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } } #else /* Allocate memory for feedback delay lines */ for ( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { Loading @@ -1154,20 +1201,26 @@ ivas_error ivas_reverb_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); } #endif pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; set_fft_and_datablock_sizes( pState, subframe_len ); nr_fc_fft_filter = ( pState->fft_size >> 1 ) + 1; /* === 'Control logic': compute the reverb processing parameters from the === */ /* === room, source and listener acoustic information provided in the reverb config === */ /* Setting up shared temporary buffers for fc, RT60, DSR, etc. */ #ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_avg_pwr_response_l = &pFft_wf_filter_ch0[0][0]; params.pHrtf_avg_pwr_response_r = params.pHrtf_avg_pwr_response_l + nr_fc_fft_filter; #endif params.pRt60 = &pFft_wf_filter_ch1[0][0]; params.pDsr = params.pRt60 + nr_fc_fft_filter; params.pFc = &pState->fft_filter_color_0.fft_spectrum[0]; #ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_inter_aural_coherence = &pState->fft_filter_color_1.fft_spectrum[0]; #endif /* Note: these temp buffers can only be used before the final step of the FFT filter design : */ /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */ Loading Loading @@ -1209,7 +1262,15 @@ ivas_error ivas_reverb_open( } /* set up input downmix */ #ifdef FIX_1053_REVERB_RECONFIGURATION if (*hReverb == NULL) { pState->dmx_gain = calc_dmx_gain(); } #else /* set up input downmix */ pState->dmx_gain = calc_dmx_gain(); #endif /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ calc_predelay( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay, output_Fs ); Loading @@ -1233,6 +1294,20 @@ ivas_error ivas_reverb_open( /* Compute the window used for FFT filters */ ivas_reverb_define_window_fft( pTime_window, transition_start, transition_length, nr_fc_fft_filter ); #ifdef FIX_1053_REVERB_RECONFIGURATION /* === Copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ if ( *hReverb == NULL ) { pState->do_corr_filter = params.do_corr_filter; /* clear & init jot reverb fft filters */ if ( ( error = initialize_reverb_filters( pState ) ) != IVAS_ERR_OK ) { return error; } } #else /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ Loading @@ -1244,6 +1319,8 @@ ivas_error ivas_reverb_open( { return error; } #endif if ( pState->do_corr_filter ) { Loading Loading @@ -1276,6 +1353,37 @@ ivas_error ivas_reverb_open( return error; } #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* init predelay */ ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); /* set up feedback delay network */ if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) { return error; } } else { pState->predelay_line.Delay = params.pre_delay; } nr_coefs = params.t60_filter_order + 1; for ( branch_idx = 0; branch_idx < params.nr_loops; branch_idx++ ) { pCoef_a = ¶ms.pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = ¶ms.pT60_filter_coeff[2 * nr_coefs * branch_idx]; if ( ( error = set_t60_filter( pState, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) { return error; } } #else /* init predelay */ ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); Loading @@ -1284,6 +1392,7 @@ ivas_error ivas_reverb_open( { return error; } #endif *hReverb = pState; Loading Loading
lib_rend/ivas_reverb.c +111 −2 Original line number Diff line number Diff line Loading @@ -1037,7 +1037,9 @@ static ivas_error setup_FDN_branches( { int16_t nr_coefs, branch_idx, channel_idx; ivas_error error; #ifndef FIX_1053_REVERB_RECONFIGURATION float *pCoef_a, *pCoef_b; #endif error = IVAS_ERR_OK; /* initialize feedback branches */ Loading @@ -1059,6 +1061,7 @@ static ivas_error setup_FDN_branches( { for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) { #ifndef FIX_1053_REVERB_RECONFIGURATION pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; Loading @@ -1066,7 +1069,7 @@ static ivas_error setup_FDN_branches( { return error; } #endif if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) { return error; Loading @@ -1091,12 +1094,19 @@ static ivas_error setup_FDN_branches( } #ifdef FIX_1053_REVERB_RECONFIGURATION /*------------------------------------------------------------------------- * ivas_reverb_open() * * Allocate and initialize FDN reverberation handle *------------------------------------------------------------------------*/ #else /*------------------------------------------------------------------------- * ivas_reverb_open() * * Allocate and initialize Crend reverberation handle *------------------------------------------------------------------------*/ #endif ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES Loading @@ -1111,7 +1121,14 @@ ivas_error ivas_reverb_open( ) { ivas_error error; #ifdef FIX_1053_REVERB_RECONFIGURATION REVERB_HANDLE pState = *hReverb; int16_t nr_coefs, branch_idx; float *pCoef_a, *pCoef_b; #else REVERB_HANDLE pState = NULL; #endif int16_t bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; ivas_reverb_params_t params; rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; Loading @@ -1129,17 +1146,47 @@ ivas_error ivas_reverb_open( predelay_bf_len = output_frame; nr_fc_input = hRenderConfig->roomAcoustics.nBands; #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* Allocate main reverb. handle */ if ( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator " ); } } #else /* Allocate main reverb. handle */ if ( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Reverberator " ); } #endif if ( ( error = set_base_config( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) { return error; } #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* Allocate memory for feedback delay lines */ for ( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { if ( ( pState->loop_delay_buffer[loop_idx] = (float *) malloc( params.pLoop_delays[loop_idx] * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } } /* Allocate memory for the pre-delay delay line */ if ( ( pState->pPredelay_buffer = (float *) malloc( output_frame * sizeof( float ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } } #else /* Allocate memory for feedback delay lines */ for ( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { Loading @@ -1154,20 +1201,26 @@ ivas_error ivas_reverb_open( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); } #endif pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; set_fft_and_datablock_sizes( pState, subframe_len ); nr_fc_fft_filter = ( pState->fft_size >> 1 ) + 1; /* === 'Control logic': compute the reverb processing parameters from the === */ /* === room, source and listener acoustic information provided in the reverb config === */ /* Setting up shared temporary buffers for fc, RT60, DSR, etc. */ #ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_avg_pwr_response_l = &pFft_wf_filter_ch0[0][0]; params.pHrtf_avg_pwr_response_r = params.pHrtf_avg_pwr_response_l + nr_fc_fft_filter; #endif params.pRt60 = &pFft_wf_filter_ch1[0][0]; params.pDsr = params.pRt60 + nr_fc_fft_filter; params.pFc = &pState->fft_filter_color_0.fft_spectrum[0]; #ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_inter_aural_coherence = &pState->fft_filter_color_1.fft_spectrum[0]; #endif /* Note: these temp buffers can only be used before the final step of the FFT filter design : */ /* before calls to ivas_reverb_calc_correl_filters(...) or to ivas_reverb_calc_color_filters(...) */ Loading Loading @@ -1209,7 +1262,15 @@ ivas_error ivas_reverb_open( } /* set up input downmix */ #ifdef FIX_1053_REVERB_RECONFIGURATION if (*hReverb == NULL) { pState->dmx_gain = calc_dmx_gain(); } #else /* set up input downmix */ pState->dmx_gain = calc_dmx_gain(); #endif /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ calc_predelay( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay, output_Fs ); Loading @@ -1233,6 +1294,20 @@ ivas_error ivas_reverb_open( /* Compute the window used for FFT filters */ ivas_reverb_define_window_fft( pTime_window, transition_start, transition_length, nr_fc_fft_filter ); #ifdef FIX_1053_REVERB_RECONFIGURATION /* === Copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ if ( *hReverb == NULL ) { pState->do_corr_filter = params.do_corr_filter; /* clear & init jot reverb fft filters */ if ( ( error = initialize_reverb_filters( pState ) ) != IVAS_ERR_OK ) { return error; } } #else /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ Loading @@ -1244,6 +1319,8 @@ ivas_error ivas_reverb_open( { return error; } #endif if ( pState->do_corr_filter ) { Loading Loading @@ -1276,6 +1353,37 @@ ivas_error ivas_reverb_open( return error; } #ifdef FIX_1053_REVERB_RECONFIGURATION if ( *hReverb == NULL ) { /* init predelay */ ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); /* set up feedback delay network */ if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) { return error; } } else { pState->predelay_line.Delay = params.pre_delay; } nr_coefs = params.t60_filter_order + 1; for ( branch_idx = 0; branch_idx < params.nr_loops; branch_idx++ ) { pCoef_a = ¶ms.pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; pCoef_b = ¶ms.pT60_filter_coeff[2 * nr_coefs * branch_idx]; if ( ( error = set_t60_filter( pState, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) { return error; } } #else /* init predelay */ ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); Loading @@ -1284,6 +1392,7 @@ ivas_error ivas_reverb_open( { return error; } #endif *hReverb = pState; Loading