From 26efe45b73193477b378a87e214f4ac87ac6d483 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 09:51:55 +0200 Subject: [PATCH 01/28] Initial version supporting runtime reverb reconfiguration --- lib_com/options.h | 2 +- lib_dec/ivas_binRenderer_internal.c | 6 + lib_dec/ivas_init_dec.c | 11 + lib_dec/ivas_ism_dec.c | 12 ++ lib_dec/ivas_rom_dec.c | 3 +- lib_dec/ivas_rom_dec.h | 3 +- lib_dec/lib_dec.c | 29 +++ lib_rend/ivas_crend.c | 12 ++ lib_rend/ivas_prot_rend.h | 13 +- lib_rend/ivas_reverb.c | 311 +++++++++++++++++++++++++++- lib_rend/ivas_stat_rend.h | 3 + lib_rend/lib_rend.c | 122 +++++++++++ 12 files changed, 515 insertions(+), 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 34c6f7410a..9b2d220250 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,7 @@ #define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ #define FIX_1043_JBM_MD_BUFFER /* VA: issue 1043: JBM MD handle allocation is avoided in non-JBM EXT operations */ - +#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 21db31e81a..86e19676b4 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1104,7 +1104,11 @@ ivas_error ivas_binRenderer_open( ) { BINAURAL_RENDERER_HANDLE hBinRenderer; +#ifdef FIX_1053_REVERB_RECONFIGURATION + int16_t convBand, k; +#else int16_t convBand, chIdx, k; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -1260,6 +1264,7 @@ ivas_error ivas_binRenderer_open( return error; } +#ifndef FIX_1053_REVERB_RECONFIGURATION /* initialize the dmx matrix */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { @@ -1268,6 +1273,7 @@ ivas_error ivas_binRenderer_open( hBinRenderer->hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; } } +#endif } else { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7858a2d80c..b8a220450f 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2002,10 +2002,21 @@ ivas_error ivas_init_decoder( } if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index b23b16ca63..a67c7bcd5f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -201,10 +201,22 @@ static ivas_error ivas_ism_bitrate_switching_dec( } if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } } } diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 30779c35de..50e6ed16da 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -390,6 +390,7 @@ const float dirac_dithering_ele_scale[DIRAC_DIFFUSE_LEVELS] = 6.716062e-01f, 1.011804e+00f, 1.796875e+00f, 2.804382e+00f, 4.623130e+00f, 7.802667e+00f, 1.045446e+01f, 1.379538e+01f }; +#ifndef FIX_1053_REVERB_RECONFIGURATION /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ @@ -399,7 +400,7 @@ const float dmxmtx_table[BINAURAL_CHANNELS][11] = { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, }; - +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------* diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index d7c5f9c596..a5cba2f22a 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -96,12 +96,13 @@ extern const uint16_t *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4]; extern const float dirac_dithering_azi_scale[DIRAC_DIFFUSE_LEVELS]; extern const float dirac_dithering_ele_scale[DIRAC_DIFFUSE_LEVELS]; - +#ifndef FIX_1053_REVERB_RECONFIGURATION /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ extern const float dmxmtx_table[BINAURAL_CHANNELS][11]; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT /*----------------------------------------------------------------------* diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index aeb8f84303..8fb3e321d2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2140,6 +2140,35 @@ ivas_error IVAS_DEC_FeedRenderConfig( mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + /* Re-initialize reverb instance if already available */ + /* TD renderer Jot reverberator */ + if ( hIvasDec->st_ivas->hReverb != NULL ) + { + ivas_reverb_init( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + } + + /* CREND Jot reverberator */ + if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb != NULL ) + { + ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + } + + /* DirAC CLDFB reverberator */ + if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ) ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + } + + /* Fastconv CLDFB reverberator */ + if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &(hRenderConfig->roomAcoustics), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + } +#endif + mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e55279c60f..855b0aa01c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1392,10 +1392,22 @@ ivas_error ivas_rend_openCrend( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_init( &( hCrend->hReverb ), hHrtfStatistics, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), hHrtfStatistics, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif if ( hRendCfg->roomAcoustics.use_er == 1 ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7de4ed3e8c..9513ba97c0 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -980,11 +980,22 @@ void ivas_binaural_reverb_processSubframe( ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ - const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ +#ifndef FIX_1053_REVERB_RECONFIGURATION + const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ +#endif const int32_t output_Fs /* i : output sampling rate */ ); +#ifdef FIX_1053_REVERB_RECONFIGURATION +ivas_error ivas_reverb_init( + REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ + const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ + RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ + const int32_t output_Fs /* i : output sampling rate */ +); +#endif + void ivas_reverb_close( REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 1f791df39c..cfbf87fdd9 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -82,6 +82,15 @@ const int16_t default_loop_delay_48k[IVAS_REV_MAX_NR_BRANCHES] = { 2309, 1861, 1 const int16_t default_loop_delay_32k[IVAS_REV_MAX_NR_BRANCHES] = { 1531, 1237, 1013, 839, 709, 613, 541, 479 }; const int16_t default_loop_delay_16k[IVAS_REV_MAX_NR_BRANCHES] = { 769, 619, 509, 421, 353, 307, 269, 239 }; +#ifdef FIX_1053_REVERB_RECONFIGURATION +#define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) +/* Downmix table for sparse frequency domain reverberator */ +const float dmxmtx_table[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { + { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, +}; +#endif + /*------------------------------------------------------------------------------------------* * Local Struct definition *------------------------------------------------------------------------------------------*/ @@ -105,12 +114,14 @@ typedef struct ivas_reverb_params_t float *pFc; /* Center frequencies for FFT filter design */ float *pRt60; /* RT60 values at these frequencies */ float *pDsr; /* DSR values at these frequencies */ - float *pHrtf_avg_pwr_response_l; /* The HRTF set's average left ear power response */ - float *pHrtf_avg_pwr_response_r; /* The HRTF set's average right ear power response */ - float *pHrtf_inter_aural_coherence; /* The HRTF set's inter-aural coherence for diffuse sound */ - const float *pHrtf_avg_pwr_response_l_const; /* The HRTF set's average left ear power response */ - const float *pHrtf_avg_pwr_response_r_const; /* The HRTF set's average right ear power response */ - const float *pHrtf_inter_aural_coherence_const; /* The HRTF set's inter-aural coherence for diffuse sound */ +#ifndef FIX_1053_REVERB_RECONFIGURATION + float *pHrtf_avg_pwr_response_l; /* The HRTF set's average left ear power response */ + float *pHrtf_avg_pwr_response_r; /* The HRTF set's average right ear power response */ + float *pHrtf_inter_aural_coherence; /* The HRTF set's inter-aural coherence for diffuse sound */ +#endif + const float *pHrtf_avg_pwr_response_l_const; /* The HRTF set's average left ear power response */ + const float *pHrtf_avg_pwr_response_r_const; /* The HRTF set's average right ear power response */ + const float *pHrtf_inter_aural_coherence_const; /* The HRTF set's inter-aural coherence for diffuse sound */ int16_t do_corr_filter; /* Flag indicating whether correlation filters should be used. */ /* Correlation only supported and needed for binaural playback (i.e. */ @@ -980,6 +991,59 @@ static ivas_error setup_FDN_branches( float *pCoef_a, *pCoef_b; error = IVAS_ERR_OK; +#ifdef FIX_1053_REVERB_RECONFIGURATION + nr_coefs = pParams->t60_filter_order + 1; + + if ( IVAS_REV_MAX_IIR_FILTER_LENGTH < nr_coefs ) + { + return IVAS_ERR_INTERNAL; + } + + if ( !hReverb->initialized ) + { + /* initialize feedback branches */ + for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) + { + ivas_rev_delay_line_init( &( hReverb->delay_line[branch_idx] ), hReverb->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); + ivas_reverb_iir_filt_init( &( hReverb->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); + hReverb->mixer[0][branch_idx] = 0.0f; + hReverb->mixer[1][branch_idx] = 0.0f; + } + clear_buffers( hReverb ); + + for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) + { + if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = set_feedback_gain( hReverb, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + for ( channel_idx = 0; channel_idx < pParams->nr_outputs; channel_idx++ ) + { + if ( ( error = set_mixer_level( hReverb, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) + { + pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; + pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; + + if ( ( error = set_t60_filter( hReverb, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#else /* initialize feedback branches */ for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { @@ -1026,28 +1090,44 @@ static ivas_error setup_FDN_branches( return error; } } +#endif return error; } +#ifdef FIX_1053_REVERB_RECONFIGURATION +/*------------------------------------------------------------------------- + * ivas_reverb_open() + * + * Allocate Crend 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 */ + REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ +#ifndef FIX_1053_REVERB_RECONFIGURATION const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ - const int32_t output_Fs /* i : output sampling rate */ +#endif + const int32_t output_Fs /* i : output sampling rate */ ) { ivas_error error; REVERB_HANDLE pState = NULL; +#ifdef FIX_1053_REVERB_RECONFIGURATION + int16_t subframe_len, output_frame, loop_idx; +#else int16_t bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; +#endif ivas_reverb_params_t params; +#ifndef FIX_1053_REVERB_RECONFIGURATION rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; rv_fftwf_type_complex pFft_wf_filter_ch1[RV_LENGTH_NR_FC]; float pColor_target_l[RV_LENGTH_NR_FC]; @@ -1056,12 +1136,15 @@ ivas_error ivas_reverb_open( float freq_step; int16_t fft_hist_size, transition_start, transition_length; int16_t nr_fc_input, nr_fc_fft_filter; +#endif error = IVAS_ERR_OK; output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; +#ifndef FIX_1053_REVERB_RECONFIGURATION predelay_bf_len = output_frame; nr_fc_input = hRenderConfig->roomAcoustics.nBands; +#endif /* Allocate main reverb. handle */ if ( ( pState = (REVERB_HANDLE) malloc( sizeof( REVERB_DATA ) ) ) == NULL ) @@ -1091,6 +1174,9 @@ ivas_error ivas_reverb_open( pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; set_fft_and_datablock_sizes( pState, subframe_len ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + pState->initialized = false; +#else nr_fc_fft_filter = ( pState->fft_size >> 1 ) + 1; /* === 'Control logic': compute the reverb processing parameters from the === */ @@ -1208,11 +1294,209 @@ ivas_error ivas_reverb_open( return error; } +#endif *hReverb = pState; return error; } +#ifdef FIX_1053_REVERB_RECONFIGURATION +/*------------------------------------------------------------------------- + * ivas_reverb_init() + * + * initialize Crend reverberation handle + *------------------------------------------------------------------------*/ + +ivas_error ivas_reverb_init( + REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ + const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ + RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ + const int32_t output_Fs /* i : output sampling rate */ +) +{ + ivas_error error; + REVERB_HANDLE pState = NULL; + + int16_t output_frame, predelay_bf_len, nr_fc_fft_filter, bin_idx, nr_fc_input; + float freq_step; + int16_t fft_hist_size, transition_start, transition_length; + ivas_reverb_params_t params; + rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; + rv_fftwf_type_complex pFft_wf_filter_ch1[RV_LENGTH_NR_FC]; + float pColor_target_l[RV_LENGTH_NR_FC]; + float pColor_target_r[RV_LENGTH_NR_FC]; + float pTime_window[RV_FILTER_MAX_FFT_SIZE]; + + error = IVAS_ERR_OK; + + pState = *hReverb; + + output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); + predelay_bf_len = output_frame; + nr_fc_input = hRenderConfig->roomAcoustics.nBands; + + nr_fc_fft_filter = ( pState->fft_size >> 1 ) + 1; + + /* TODO: ugly; base config is now set in both open() and init() calls */ + if ( ( error = set_base_config( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* === '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(...) */ + + /* set the uniform frequency grid for FFT filtering */ + freq_step = 0.5f * output_Fs / ( nr_fc_fft_filter - 1 ); + for ( bin_idx = 0; bin_idx < nr_fc_fft_filter; bin_idx++ ) + { + params.pFc[bin_idx] = freq_step * bin_idx; + } + + set_reverb_acoustic_data( ¶ms, &hRenderConfig->roomAcoustics, nr_fc_input, nr_fc_fft_filter ); + params.pHrtf_avg_pwr_response_l_const = hHrtfStatistics->average_energy_l; + params.pHrtf_avg_pwr_response_r_const = hHrtfStatistics->average_energy_r; + params.pHrtf_inter_aural_coherence_const = hHrtfStatistics->inter_aural_coherence; + + /* set reverb acoustic configuration based on renderer config */ +#ifdef DEBUGGING + pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; +#endif + pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; + pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; + + if ( hRenderConfig->roomAcoustics.use_er == 1 ) + { + pState->pConfig.roomAcoustics.use_er = hRenderConfig->roomAcoustics.use_er; + pState->pConfig.roomAcoustics.lowComplexity = hRenderConfig->roomAcoustics.lowComplexity; + } + + /* set up input downmix */ +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( !pState->initialized ) + { + pState->dmx_gain = calc_dmx_gain(); + } +#else + 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 ); + + /* set up jot reverb 60 filters - must be set up after set_reverb_acoustic_data() */ + if ( ( error = compute_t60_coeffs( ¶ms, nr_fc_fft_filter, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Compute target levels (gains) for the coloration filters */ + ivas_reverb_calc_color_levels( output_Fs, nr_fc_fft_filter, params.nr_loops, params.pFc, params.pDsr, params.pHrtf_avg_pwr_response_l_const, params.pHrtf_avg_pwr_response_r_const, + params.pLoop_delays, params.pT60_filter_coeff, pColor_target_l, pColor_target_r ); + + /* Defining appropriate windowing parameters for FFT filters to prevent aliasing */ + fft_hist_size = pState->fft_size - pState->fft_subblock_size; + + transition_start = (int16_t) roundf( FFT_FILTER_WND_FLAT_REGION * fft_hist_size ); + transition_length = (int16_t) roundf( FFT_FILTER_WND_TRANS_REGION * fft_hist_size ); + + /* 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 + if ( !pState->initialized ) + { + 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 === */ + + 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; + } +#endif + + if ( pState->do_corr_filter ) + { + /* Computing correlation filters on the basis of target IA coherence */ + ivas_reverb_calc_correl_filters( params.pHrtf_inter_aural_coherence_const, pTime_window, pState->fft_size, 0.0f, pFft_wf_filter_ch0, pFft_wf_filter_ch1 ); + + /* Copying the computed FFT correlation filters to the fft_filter components */ + if ( ( error = set_correl_fft_filter( pState, 0, pFft_wf_filter_ch0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = set_correl_fft_filter( pState, 1, pFft_wf_filter_ch1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* Computing coloration filters on the basis of target responses */ + ivas_reverb_calc_color_filters( pColor_target_l, pColor_target_r, pTime_window, pState->fft_size, 0.0f, pFft_wf_filter_ch0, pFft_wf_filter_ch1 ); + + /* Copying the computed FFT colorations filters to the fft_filter components */ + if ( ( error = set_color_fft_filter( pState, 0, pFft_wf_filter_ch0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = set_color_fft_filter( pState, 1, pFft_wf_filter_ch1 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* init predelay */ +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( !pState->initialized ) + { + ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); + } + else + { + pState->predelay_line.Delay = params.pre_delay; + } +#else + ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); +#endif + + /* set up feedback delay network */ + if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) + { + return error; + } + + pState->initialized = true; + + return error; +} +#endif /*------------------------------------------------------------------------- * ivas_reverb_close() @@ -1826,6 +2110,17 @@ static ivas_error ivas_binaural_reverb_open( ivas_binaural_reverb_setPreDelay( hReverb, preDelay ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + /* initialize the dmx matrix */ + for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) + { + for ( k = 0; k < REVERB_INPUT_DOWNMIX_CHANNELS; k++ ) + { + hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; + } + } +#endif + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 672f264211..0637e4129e 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -839,6 +839,9 @@ typedef struct ivas_reverb_state_t uint16_t fft_subblock_size; /* fft block processing size */ uint16_t num_fft_subblocks; /* number of fft subblocks */ uint16_t full_block_size; /* full block processing size */ +#ifdef FIX_1053_REVERB_RECONFIGURATION + uint16_t initialized; /* Flag indicating whether the reverb structure was initialized before */ +#endif } REVERB_DATA, *REVERB_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index a6ddac23a9..0bc2d27600 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1450,10 +1450,22 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_init( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } +#endif } #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -1463,10 +1475,22 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_init( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } +#endif } else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { @@ -2254,10 +2278,22 @@ static ivas_error initMcBinauralRendering( #endif if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( ( error = ivas_reverb_init( &( inputMc->hReverb ), hHrtfStatistics, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), hHrtfStatistics, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } +#endif } } else if ( !useTDRend && inputMc->crendWrapper == NULL ) @@ -4616,6 +4652,13 @@ int16_t IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; +#ifdef FIX_1053_REVERB_RECONFIGURATION + uint16_t i; + input_ism *pIsmInput; + input_masa *pMasaInput; + input_mc *pMcInput; + input_sba *pSbaInput; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; #endif @@ -4649,6 +4692,85 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } +#ifdef FIX_1053_REVERB_RECONFIGURATION + /* Re-initialize reverb instance if already available */ + /* ISM inputs */ + for ( i = 0, pIsmInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pIsmInput ) + { + if ( pIsmInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + /* Skip inactive inputs */ + continue; + } + if ( pIsmInput->hReverb != NULL ) + { + ivas_reverb_init( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + } + if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) + { + ivas_reverb_init( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + } + } + + /* MASA inputs */ + for ( i = 0, pMasaInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pMasaInput ) + { + if ( pMasaInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + /* Skip inactive inputs */ + continue; + } + + if ( pMasaInput->hMasaExtRend != NULL ) + { + if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin->hReverb != NULL ) + { + ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb ); + ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &(hRenderConfig->roomAcoustics), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + } + if ( pMasaInput->hMasaExtRend->hReverb != NULL ) + { + ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); + ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &(hRenderConfig->roomAcoustics), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + } + } + } + + /* Multi-channel inputs */ + for ( i = 0, pMcInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pMcInput ) + { + if ( pMcInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + /* Skip inactive inputs */ + continue; + } + + if ( pMcInput->hReverb != NULL ) + { + ivas_reverb_init( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + } + if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend->hReverb != NULL ) + { + ivas_reverb_init( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + } + } + + /* SBA inputs */ + for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput ) + { + if ( pSbaInput->base.inConfig == IVAS_AUDIO_CONFIG_INVALID ) + { + /* Skip inactive inputs */ + continue; + } + + if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend->hReverb != NULL ) + { + ivas_reverb_init( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + } + } +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT hRenderConfig->split_rend_config = renderConfig.split_rend_config; /* Overwrite any pose correction settings if 0 DOF (no pose correction) was selected */ -- GitLab From bb298de1080cfcb1d1e8c86068cdb699932e9178 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 12:09:01 +0200 Subject: [PATCH 02/28] Addressing clang issues --- lib_dec/lib_dec.c | 2 +- lib_rend/ivas_reverb.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 8fb3e321d2..cb64b398a2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2165,7 +2165,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &(hRenderConfig->roomAcoustics), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); } #endif diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index cfbf87fdd9..ac292d6946 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1316,7 +1316,7 @@ ivas_error ivas_reverb_init( { ivas_error error; REVERB_HANDLE pState = NULL; - + int16_t output_frame, predelay_bf_len, nr_fc_fft_filter, bin_idx, nr_fc_input; float freq_step; int16_t fft_hist_size, transition_start, transition_length; @@ -1486,11 +1486,11 @@ ivas_error ivas_reverb_init( ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer, params.pre_delay, predelay_bf_len ); #endif - /* set up feedback delay network */ - if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) - { - return error; - } + /* set up feedback delay network */ + if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) + { + return error; + } pState->initialized = true; -- GitLab From cd0a7f0a5a6a4339ae2b855dd71b7605f77a8f40 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 12:11:03 +0200 Subject: [PATCH 03/28] Addressing clang issues --- lib_rend/lib_rend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0bc2d27600..b8426793e2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4726,12 +4726,12 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb ); - ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &(hRenderConfig->roomAcoustics), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); } if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); - ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &(hRenderConfig->roomAcoustics), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); } } } -- GitLab From 1c303ad8c549710a4cebb034f496fbf617328be7 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 12:20:53 +0200 Subject: [PATCH 04/28] Addressing compiler errors --- lib_dec/lib_dec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index cb64b398a2..9c878a8dcc 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2149,23 +2149,23 @@ ivas_error IVAS_DEC_FeedRenderConfig( } /* CREND Jot reverberator */ - if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb != NULL ) + if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && ( hIvasDec->st_ivas->hCrendWrapper->hCrend )->hReverb != NULL ) { - ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_init( &( hIvasDec->st_ivas->hCrendWrapper->hCrend )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* DirAC CLDFB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin->hReverb != NULL ) { - ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin )->hReverb ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); } /* Fastconv CLDFB reverberator */ if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { - ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer )->hReverb ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); } #endif -- GitLab From 94db466c5d912be2d789c7bad7cbb2f6d6c4a1a1 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 13:04:56 +0200 Subject: [PATCH 05/28] Fixes to align with the split-rendering solution --- lib_dec/lib_dec.c | 35 ++++++++++++++++++++++++++++------- lib_rend/lib_rend.c | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9c878a8dcc..ab3032f337 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2142,6 +2142,8 @@ ivas_error IVAS_DEC_FeedRenderConfig( #ifdef FIX_1053_REVERB_RECONFIGURATION /* Re-initialize reverb instance if already available */ + +#ifdef SPLIT_REND_WITH_HEAD_ROT /* TD renderer Jot reverberator */ if ( hIvasDec->st_ivas->hReverb != NULL ) { @@ -2149,23 +2151,42 @@ ivas_error IVAS_DEC_FeedRenderConfig( } /* CREND Jot reverberator */ - if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && ( hIvasDec->st_ivas->hCrendWrapper->hCrend )->hReverb != NULL ) + if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_init( &( hIvasDec->st_ivas->hCrendWrapper->hCrend )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* DirAC CLDFB reverberator */ - if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin->hReverb != NULL ) + if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + } +#else + /* TD renderer Jot reverberator */ + if ( hIvasDec->st_ivas->hReverb != NULL ) + { + ivas_reverb_init( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + } + + /* CREND Jot reverberator */ + if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb != NULL ) { - ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin )->hReverb ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } + /* DirAC CLDFB reverberator */ + if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin->hReverb != NULL ) + { + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ) ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + } +#endif /* Fastconv CLDFB reverberator */ if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { - ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer )->hReverb ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer )->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); + ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); } #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b8426793e2..6906087fa1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4708,7 +4708,11 @@ int16_t IVAS_REND_FeedRenderConfig( } if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + ivas_reverb_init( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); +#else ivas_reverb_init( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); +#endif } } @@ -4723,11 +4727,19 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend != NULL ) { +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) + { + ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); + ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + } +#else if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb ); ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); } +#endif if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); @@ -4749,10 +4761,17 @@ int16_t IVAS_REND_FeedRenderConfig( { ivas_reverb_init( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) + { + ivas_reverb_init( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + } +#else if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend->hReverb != NULL ) { ivas_reverb_init( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); } +#endif } /* SBA inputs */ @@ -4764,10 +4783,17 @@ int16_t IVAS_REND_FeedRenderConfig( continue; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) + { + ivas_reverb_init( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + } +#else if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend->hReverb != NULL ) { ivas_reverb_init( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); } +#endif } #endif -- GitLab From 096796154ed1d5501072e0bfc9ac465fb709ff55 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 3 Apr 2024 15:35:33 +0200 Subject: [PATCH 06/28] Fixes to align with the split-rendering solution --- lib_dec/lib_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ab3032f337..71a378a39e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2151,13 +2151,13 @@ ivas_error IVAS_DEC_FeedRenderConfig( } /* CREND Jot reverberator */ - if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL ) + if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0] != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL ) { ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* DirAC CLDFB reverberator */ - if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) + if ( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); -- GitLab From dca4cf2b2493d52090d48cc7c1da809e67542ab0 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 17 Apr 2024 10:41:51 +0200 Subject: [PATCH 07/28] Reverb opening and initialization related to fix for #1075 --- lib_dec/ivas_init_dec.c | 22 ++++++++++++++++++ lib_dec/ivas_mct_dec.c | 11 +++++++++ lib_dec/ivas_omasa_dec.c | 11 +++++++++ lib_dec/ivas_sba_dec.c | 11 +++++++++ lib_rend/ivas_orient_trk.c | 46 +++++++++++++++++++++++++++++++++++++- 5 files changed, 100 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4e14d4648e..9cea7de426 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2100,10 +2100,21 @@ ivas_error ivas_init_decoder( #ifdef NONBE_FIX_1075 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } #endif @@ -2178,10 +2189,21 @@ ivas_error ivas_init_decoder( #ifdef NONBE_FIX_1075 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } #endif } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 61f00bb851..0c400d75df 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1254,10 +1254,21 @@ static ivas_error ivas_mc_dec_reconfig( #ifdef NONBE_FIX_1075 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } #endif diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 5f6b7e6945..873729aad8 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -387,10 +387,21 @@ ivas_error ivas_omasa_dec_config( #ifdef NONBE_FIX_1075 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } #endif } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 3161d6920d..536b8250dc 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -506,10 +506,21 @@ ivas_error ivas_sba_dec_reconfigure( #ifdef NONBE_FIX_1075 if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } #endif } diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 81cda7dd97..3b73e37df9 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -49,7 +49,9 @@ *------------------------------------------------------------------------------------------*/ #define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ - +#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION +#define COS_ONE_TENTH_DEGREE ( 0.999998476913288f ) +#endif /*------------------------------------------------------------------------------------------* * Local functions @@ -157,12 +159,53 @@ void QuaternionSlerp( const float t, IVAS_QUATERNION *const r ) { +#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION + IVAS_QUATERNION r1, r2; + float phi, sinPhi, cosPhi, s1, s2; + + QuaternionNormalize( q1, &r1 ); + QuaternionNormalize( q2, &r2 ); + + cosPhi = QuaternionDotProduct( r1, r2 ); + + if ( cosPhi < 0 ) + { + cosPhi = -cosPhi; + r2.w = -r2.w; + r2.x = -r2.x; + r2.y = -r2.y; + r2.z = -r2.z; + } + + /* Angle less than one degree, use linear interpolation */ + if ( cosPhi >= COS_ONE_TENTH_DEGREE ) + { + r->w = r1.w + t * ( r2.w - r1.w ); + r->x = r1.x + t * ( r2.x - r1.x ); + r->y = r1.y + t * ( r2.y - r1.y ); + r->z = r1.z + t * ( r2.z - r1.z ); + } + else + { + phi = acosf( cosPhi ); + sinPhi = sinf( phi ); + + s1 = sinf( ( 1 - t ) * phi ); + s2 = sinf( t * phi ); + + r->w = ( s1 * r1.w + s2 * r2.w ) / sinPhi; + r->x = ( s1 * r1.x + s2 * r2.x ) / sinPhi; + r->y = ( s1 * r1.y + s2 * r2.y ) / sinPhi; + r->z = ( s1 * r1.z + s2 * r2.z ) / sinPhi; + } +#else float angle, denom, s, s2; s = QuaternionDotProduct( q1, q2 ); if ( fabsf( s ) >= 1.0f ) { + *r = q2; return; } @@ -177,6 +220,7 @@ void QuaternionSlerp( r->z = ( q1.z * s + q2.z * s2 ) / denom; r->w = ( q1.w * s + q2.w * s2 ) / denom; +#endif QuaternionNormalize( *r, r ); return; -- GitLab From c5146c6c879d86bcc876d957d0db6470a8cae73f Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Fri, 19 Apr 2024 10:27:44 +0200 Subject: [PATCH 08/28] Refactoring reflecting review remarks --- lib_rend/ivas_crend.c | 12 -- lib_rend/ivas_prot_rend.h | 11 -- lib_rend/ivas_reverb.c | 314 +++++++++----------------------------- lib_rend/ivas_stat_rend.h | 4 - lib_rend/lib_rend.c | 52 +------ 5 files changed, 81 insertions(+), 312 deletions(-) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 855b0aa01c..e55279c60f 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1392,22 +1392,10 @@ ivas_error ivas_rend_openCrend( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_reverb_init( &( hCrend->hReverb ), hHrtfStatistics, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), hHrtfStatistics, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif if ( hRendCfg->roomAcoustics.use_er == 1 ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 9513ba97c0..070a3ae67c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -980,21 +980,10 @@ void ivas_binaural_reverb_processSubframe( ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ -#ifndef FIX_1053_REVERB_RECONFIGURATION - const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ - RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ -#endif - const int32_t output_Fs /* i : output sampling rate */ -); - -#ifdef FIX_1053_REVERB_RECONFIGURATION -ivas_error ivas_reverb_init( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ const int32_t output_Fs /* i : output sampling rate */ ); -#endif void ivas_reverb_close( REVERB_HANDLE *hReverb /* i/o: Reverberator handle */ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index ac292d6946..6eb064a63b 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -988,62 +988,11 @@ 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; -#ifdef FIX_1053_REVERB_RECONFIGURATION - nr_coefs = pParams->t60_filter_order + 1; - - if ( IVAS_REV_MAX_IIR_FILTER_LENGTH < nr_coefs ) - { - return IVAS_ERR_INTERNAL; - } - - if ( !hReverb->initialized ) - { - /* initialize feedback branches */ - for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) - { - ivas_rev_delay_line_init( &( hReverb->delay_line[branch_idx] ), hReverb->loop_delay_buffer[branch_idx], init_loop_delay[branch_idx], pParams->pLoop_delays[branch_idx] ); - ivas_reverb_iir_filt_init( &( hReverb->t60[branch_idx] ), IVAS_REV_MAX_IIR_FILTER_LENGTH ); - hReverb->mixer[0][branch_idx] = 0.0f; - hReverb->mixer[1][branch_idx] = 0.0f; - } - clear_buffers( hReverb ); - - for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) - { - if ( ( error = set_feedback_delay( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = set_feedback_gain( hReverb, branch_idx, &( pParams->pLoop_feedback_matrix[branch_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - for ( channel_idx = 0; channel_idx < pParams->nr_outputs; channel_idx++ ) - { - if ( ( error = set_mixer_level( hReverb, channel_idx, &( pParams->pLoop_extract_matrix[channel_idx * pParams->nr_loops] ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - - for ( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) - { - pCoef_a = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx + nr_coefs]; - pCoef_b = &pParams->pT60_filter_coeff[2 * nr_coefs * branch_idx]; - - if ( ( error = set_t60_filter( hReverb, branch_idx, nr_coefs, pCoef_a, pCoef_b ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#else /* initialize feedback branches */ for ( branch_idx = 0; branch_idx < IVAS_REV_MAX_NR_BRANCHES; branch_idx++ ) { @@ -1063,6 +1012,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]; @@ -1070,6 +1020,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 ) { @@ -1090,17 +1041,15 @@ static ivas_error setup_FDN_branches( return error; } } -#endif return error; } - #ifdef FIX_1053_REVERB_RECONFIGURATION /*------------------------------------------------------------------------- * ivas_reverb_open() * - * Allocate Crend reverberation handle + * Allocate and initialize FDN reverberation handle *------------------------------------------------------------------------*/ #else /*------------------------------------------------------------------------- @@ -1111,23 +1060,22 @@ static ivas_error setup_FDN_branches( #endif ivas_error ivas_reverb_open( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ -#ifndef FIX_1053_REVERB_RECONFIGURATION + REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ -#endif - const int32_t output_Fs /* i : output sampling rate */ + const int32_t output_Fs /* i : output sampling rate */ ) { ivas_error error; - REVERB_HANDLE pState = NULL; #ifdef FIX_1053_REVERB_RECONFIGURATION - int16_t subframe_len, output_frame, loop_idx; + REVERB_HANDLE pState = *hReverb; + int16_t nr_coefs, branch_idx; + float *pCoef_a, *pCoef_b; #else - int16_t bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; + REVERB_HANDLE pState = NULL; #endif + int16_t bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx; ivas_reverb_params_t params; -#ifndef FIX_1053_REVERB_RECONFIGURATION rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; rv_fftwf_type_complex pFft_wf_filter_ch1[RV_LENGTH_NR_FC]; float pColor_target_l[RV_LENGTH_NR_FC]; @@ -1136,27 +1084,54 @@ ivas_error ivas_reverb_open( float freq_step; int16_t fft_hist_size, transition_start, transition_length; int16_t nr_fc_input, nr_fc_fft_filter; -#endif error = IVAS_ERR_OK; output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifndef FIX_1053_REVERB_RECONFIGURATION predelay_bf_len = output_frame; nr_fc_input = hRenderConfig->roomAcoustics.nBands; -#endif +#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++ ) { @@ -1171,178 +1146,13 @@ 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 ); -#ifdef FIX_1053_REVERB_RECONFIGURATION - pState->initialized = false; -#else - 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. */ - 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; - 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]; - params.pHrtf_inter_aural_coherence = &pState->fft_filter_color_1.fft_spectrum[0]; - - /* 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(...) */ - - /* set the uniform frequency grid for FFT filtering */ - freq_step = 0.5f * output_Fs / ( nr_fc_fft_filter - 1 ); - for ( bin_idx = 0; bin_idx < nr_fc_fft_filter; bin_idx++ ) - { - params.pFc[bin_idx] = freq_step * bin_idx; - } - - set_reverb_acoustic_data( ¶ms, &hRenderConfig->roomAcoustics, nr_fc_input, nr_fc_fft_filter ); - params.pHrtf_avg_pwr_response_l_const = hHrtfStatistics->average_energy_l; - params.pHrtf_avg_pwr_response_r_const = hHrtfStatistics->average_energy_r; - params.pHrtf_inter_aural_coherence_const = hHrtfStatistics->inter_aural_coherence; - - /* set reverb acoustic configuration based on renderer config */ -#ifdef DEBUGGING - pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; -#endif - pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; - pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; - - if ( hRenderConfig->roomAcoustics.use_er == 1 ) - { - pState->pConfig.roomAcoustics.use_er = hRenderConfig->roomAcoustics.use_er; - pState->pConfig.roomAcoustics.lowComplexity = hRenderConfig->roomAcoustics.lowComplexity; - } - - /* set up input downmix */ - pState->dmx_gain = calc_dmx_gain(); - - /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ - calc_predelay( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay, output_Fs ); - - /* set up jot reverb 60 filters - must be set up after set_reverb_acoustic_data() */ - if ( ( error = compute_t60_coeffs( ¶ms, nr_fc_fft_filter, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* Compute target levels (gains) for the coloration filters */ - ivas_reverb_calc_color_levels( output_Fs, nr_fc_fft_filter, params.nr_loops, params.pFc, params.pDsr, params.pHrtf_avg_pwr_response_l_const, params.pHrtf_avg_pwr_response_r_const, - params.pLoop_delays, params.pT60_filter_coeff, pColor_target_l, pColor_target_r ); - - /* Defining appropriate windowing parameters for FFT filters to prevent aliasing */ - fft_hist_size = pState->fft_size - pState->fft_subblock_size; - - transition_start = (int16_t) roundf( FFT_FILTER_WND_FLAT_REGION * fft_hist_size ); - transition_length = (int16_t) roundf( FFT_FILTER_WND_TRANS_REGION * fft_hist_size ); - - /* Compute the window used for FFT filters */ - ivas_reverb_define_window_fft( pTime_window, transition_start, transition_length, nr_fc_fft_filter ); - - - /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ - /* === to be used for subsequent audio signal processing === */ - - 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; - } - - if ( pState->do_corr_filter ) - { - /* Computing correlation filters on the basis of target IA coherence */ - ivas_reverb_calc_correl_filters( params.pHrtf_inter_aural_coherence_const, pTime_window, pState->fft_size, 0.0f, pFft_wf_filter_ch0, pFft_wf_filter_ch1 ); - - /* Copying the computed FFT correlation filters to the fft_filter components */ - if ( ( error = set_correl_fft_filter( pState, 0, pFft_wf_filter_ch0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = set_correl_fft_filter( pState, 1, pFft_wf_filter_ch1 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Computing coloration filters on the basis of target responses */ - ivas_reverb_calc_color_filters( pColor_target_l, pColor_target_r, pTime_window, pState->fft_size, 0.0f, pFft_wf_filter_ch0, pFft_wf_filter_ch1 ); - - /* Copying the computed FFT colorations filters to the fft_filter components */ - if ( ( error = set_color_fft_filter( pState, 0, pFft_wf_filter_ch0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = set_color_fft_filter( pState, 1, pFft_wf_filter_ch1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* 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; - } - -#endif - *hReverb = pState; - - return error; -} - -#ifdef FIX_1053_REVERB_RECONFIGURATION -/*------------------------------------------------------------------------- - * ivas_reverb_init() - * - * initialize Crend reverberation handle - *------------------------------------------------------------------------*/ - -ivas_error ivas_reverb_init( - REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ - const HRTFS_STATISTICS_HANDLE hHrtfStatistics, /* i : HRTF statistics handle */ - RENDER_CONFIG_HANDLE hRenderConfig, /* i : Renderer configuration handle */ - const int32_t output_Fs /* i : output sampling rate */ -) -{ - ivas_error error; - REVERB_HANDLE pState = NULL; - - int16_t output_frame, predelay_bf_len, nr_fc_fft_filter, bin_idx, nr_fc_input; - float freq_step; - int16_t fft_hist_size, transition_start, transition_length; - ivas_reverb_params_t params; - rv_fftwf_type_complex pFft_wf_filter_ch0[RV_LENGTH_NR_FC]; - rv_fftwf_type_complex pFft_wf_filter_ch1[RV_LENGTH_NR_FC]; - float pColor_target_l[RV_LENGTH_NR_FC]; - float pColor_target_r[RV_LENGTH_NR_FC]; - float pTime_window[RV_FILTER_MAX_FFT_SIZE]; - - error = IVAS_ERR_OK; - - pState = *hReverb; - - output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); - predelay_bf_len = output_frame; - nr_fc_input = hRenderConfig->roomAcoustics.nBands; nr_fc_fft_filter = ( pState->fft_size >> 1 ) + 1; - /* TODO: ugly; base config is now set in both open() and init() calls */ - if ( ( error = set_base_config( ¶ms, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - /* === '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. */ @@ -1387,11 +1197,12 @@ ivas_error ivas_reverb_init( /* set up input downmix */ #ifdef FIX_1053_REVERB_RECONFIGURATION - if ( !pState->initialized ) + 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() */ @@ -1417,7 +1228,9 @@ ivas_error ivas_reverb_init( ivas_reverb_define_window_fft( pTime_window, transition_start, transition_length, nr_fc_fft_filter ); #ifdef FIX_1053_REVERB_RECONFIGURATION - if ( !pState->initialized ) + /* === 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; @@ -1428,7 +1241,6 @@ ivas_error ivas_reverb_init( } } #else - /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ @@ -1472,31 +1284,51 @@ ivas_error ivas_reverb_init( return error; } - /* init predelay */ #ifdef FIX_1053_REVERB_RECONFIGURATION - if ( !pState->initialized ) + 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 ); -#endif /* set up feedback delay network */ if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) { return error; } +#endif - pState->initialized = true; + *hReverb = pState; return error; } -#endif + /*------------------------------------------------------------------------- * ivas_reverb_close() diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 0637e4129e..72818751ac 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -839,10 +839,6 @@ typedef struct ivas_reverb_state_t uint16_t fft_subblock_size; /* fft block processing size */ uint16_t num_fft_subblocks; /* number of fft subblocks */ uint16_t full_block_size; /* full block processing size */ -#ifdef FIX_1053_REVERB_RECONFIGURATION - uint16_t initialized; /* Flag indicating whether the reverb structure was initialized before */ -#endif - } REVERB_DATA, *REVERB_HANDLE; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6906087fa1..b99b636b93 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1450,22 +1450,10 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_reverb_init( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif } #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -1475,22 +1463,10 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_reverb_init( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), hrtfs->hHrtfStatistics, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif } else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { @@ -2278,22 +2254,10 @@ static ivas_error initMcBinauralRendering( #endif if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb == NULL ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_reverb_init( &( inputMc->hReverb ), hHrtfStatistics, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), hHrtfStatistics, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } -#endif } } else if ( !useTDRend && inputMc->crendWrapper == NULL ) @@ -4704,14 +4668,14 @@ int16_t IVAS_REND_FeedRenderConfig( } if ( pIsmInput->hReverb != NULL ) { - ivas_reverb_init( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); } if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_reverb_init( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); #else - ivas_reverb_init( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); #endif } } @@ -4759,17 +4723,17 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMcInput->hReverb != NULL ) { - ivas_reverb_init( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_init( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); } #else if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_init( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); } #endif } @@ -4786,12 +4750,12 @@ int16_t IVAS_REND_FeedRenderConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_init( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); } #else if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_init( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + ivas_reverb_open( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); } #endif } -- GitLab From 83116b0d2668cbfb70d1ef19b50f98a915c63357 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Fri, 19 Apr 2024 10:56:09 +0200 Subject: [PATCH 09/28] Refactoring reflecting review remarks --- lib_dec/ivas_init_dec.c | 33 --------------------------------- lib_dec/ivas_ism_dec.c | 12 ------------ lib_dec/ivas_mct_dec.c | 11 ----------- lib_dec/ivas_omasa_dec.c | 11 ----------- lib_dec/ivas_sba_dec.c | 11 ----------- lib_dec/lib_dec.c | 10 +++++----- 6 files changed, 5 insertions(+), 83 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f1497db8dd..68badb98dd 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2020,21 +2020,10 @@ ivas_error ivas_init_decoder( } if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -2118,21 +2107,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ @@ -2206,21 +2184,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } } } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 3864f460ac..ef13d2463d 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -202,22 +202,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( } if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 82b23d7352..368f6e76b7 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1254,21 +1254,10 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 357fddcb79..cfef5d17ca 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -411,21 +411,10 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 9ddfaabf56..1b676b2a1b 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -506,21 +506,10 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_reverb_init( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#else if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#endif } } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 71a378a39e..b8c21d7639 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2147,16 +2147,16 @@ ivas_error IVAS_DEC_FeedRenderConfig( /* TD renderer Jot reverberator */ if ( hIvasDec->st_ivas->hReverb != NULL ) { - ivas_reverb_init( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* CREND Jot reverberator */ if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0] != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } - /* DirAC CLDFB reverberator */ + /* FB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); @@ -2166,13 +2166,13 @@ ivas_error IVAS_DEC_FeedRenderConfig( /* TD renderer Jot reverberator */ if ( hIvasDec->st_ivas->hReverb != NULL ) { - ivas_reverb_init( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* CREND Jot reverberator */ if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_init( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); } /* DirAC CLDFB reverberator */ -- GitLab From 9289db19d7429f40a34d6475808a945c39ddb470 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 10:10:21 +0200 Subject: [PATCH 10/28] Added support for acoustic environment sequences in command line --- apps/decoder.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 179 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0d795633f1..0f8ad17299 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -90,6 +90,17 @@ static * Local structure for storing cmdln arguments *------------------------------------------------------------------------------------------*/ +#ifdef FIX_1053_REVERB_RECONFIGURATION +typedef struct +{ + uint16_t *pID; + uint16_t *pValidity; + uint16_t count; + uint16_t selected; + uint16_t frameCounter; +} AcousticEnvironmentSequence; +#endif + typedef struct { char *inputBitstreamFilename; @@ -141,7 +152,11 @@ typedef struct uint16_t tsmScale; #endif #endif +#ifdef FIX_1053_REVERB_RECONFIGURATION + AcousticEnvironmentSequence aeSequence; +#else uint16_t acousticEnvironmentId; +#endif int16_t Opt_dpid_on; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; @@ -432,9 +447,13 @@ int main( *------------------------------------------------------------------------------------------*/ asked_frame_size = arg.renderFramesize; +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, + arg.Opt_dpid_on, arg.aeSequence.pID[0], arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) - +#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -658,7 +677,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[0], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) +#else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) +#endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -668,7 +691,11 @@ int main( } else { +#ifdef FIX_1053_REVERB_RECONFIGURATION + fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.aeSequence.pID[0] ); +#else fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); +#endif goto cleanup; } renderConfig.roomAcoustics.override = true; @@ -1090,7 +1117,15 @@ static bool parseCmdlIVAS_dec( arg->tsmScaleFileName = NULL; #endif #endif +#ifdef FIX_1053_REVERB_RECONFIGURATION + arg->aeSequence.count = 0; + arg->aeSequence.pID = NULL; + arg->aeSequence.pValidity = NULL; + arg->aeSequence.selected = 0; + arg->aeSequence.frameCounter = 0; +#else arg->acousticEnvironmentId = 65535; +#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { arg->directivityPatternId[i] = 65535; @@ -1474,11 +1509,90 @@ static bool parseCmdlIVAS_dec( if ( !is_digits_only( argv[i] ) ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + uint16_t k; + char *s = argv[i]; + char *token = argv[i]; + + for ( k = 0; s[k]; ) + { + s[k] == ',' ? k++ : *s++; + } + k++; + + if ( k == 0 ) + { + fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] ); + usage_dec(); + return false; + } + + if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) || + NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) ) + { + fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); + usage_dec(); + return false; + } + + arg->aeSequence.count = k; + + k = 0; + token = strtok( argv[i++], ":" ); + + while ( token != NULL ) + { + if ( !is_number( token ) ) + { + fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); + usage_dec(); + return false; + } + arg->aeSequence.pID[k] = (uint16_t) atoi( token ); + + token = strtok( NULL, "," ); + if ( !is_number( token ) ) + { + fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); + usage_dec(); + return false; + } + arg->aeSequence.pValidity[k] = (uint16_t) atoi( token ); + + token = strtok( NULL, ":" ); + k++; + } + + if ( k != arg->aeSequence.count ) + { + fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] ); + usage_dec(); + return false; + } +#else fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] ); usage_dec(); return false; +#endif } +#ifdef FIX_1053_REVERB_RECONFIGURATION + else + { + /* A single acoustic environment */ + if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) ) ) || + NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) ) ) ) + { + fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); + usage_dec(); + return false; + } + arg->aeSequence.count = 1; + arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] ); + arg->aeSequence.pValidity[0] = 0; + } +#else arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] ); +#endif } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { @@ -1717,7 +1831,15 @@ static void usage_dec( void ) fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" ); fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); + fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); + fprintf( stdout, " without bracesand spaces, with ':' character separating ID from duration and ',' separating\n" ); + fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); + fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); +#else fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); +#endif fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); @@ -2082,6 +2204,31 @@ static ivas_error decodeG192( SplitFileReadWrite *splitRendWriter = NULL; #endif +#ifdef FIX_1053_REVERB_RECONFIGURATION + IVAS_RENDER_CONFIG_DATA renderConfig; + RenderConfigReader *renderConfigReader = NULL; + + if ( arg.renderConfigEnabled ) + { + if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename ); + goto cleanup; + } + + if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } + + if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); + goto cleanup; + } + } +#endif for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; @@ -2291,6 +2438,37 @@ static ivas_error decodeG192( { if ( needNewFrame ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && + arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 ) + { + if ( ++arg.aeSequence.frameCounter >= arg.aeSequence.pValidity[arg.aeSequence.selected] ) + { + if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) + { + arg.aeSequence.selected = 0; + } + arg.aeSequence.frameCounter = 0; + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) + { + if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); + goto cleanup; + } + } + else + { + fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); + goto cleanup; + } + if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + } + } + } +#endif #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING if ( arg.tsmScaleFileEnabled ) -- GitLab From 13edec86e7bc02276176197995d72c4259eac411 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 10:10:58 +0200 Subject: [PATCH 11/28] Added support for acoustic environment sequences in command line --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0f8ad17299..fa6500a9af 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2444,7 +2444,7 @@ static ivas_error decodeG192( { if ( ++arg.aeSequence.frameCounter >= arg.aeSequence.pValidity[arg.aeSequence.selected] ) { - if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) + if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) { arg.aeSequence.selected = 0; } -- GitLab From 70cbfbcc1ecb88cff80f8a839bf06028b8f0f58d Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 10:17:11 +0200 Subject: [PATCH 12/28] clang formatting --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index fa6500a9af..0f8ad17299 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2444,7 +2444,7 @@ static ivas_error decodeG192( { if ( ++arg.aeSequence.frameCounter >= arg.aeSequence.pValidity[arg.aeSequence.selected] ) { - if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) + if ( ++arg.aeSequence.selected >= arg.aeSequence.count ) { arg.aeSequence.selected = 0; } -- GitLab From ca44ea50b3018bdbf1c1a5ebc0d374f35b93db50 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 11:13:01 +0200 Subject: [PATCH 13/28] Fixed handling of unitialized acoustic envrionment ID --- apps/decoder.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0f8ad17299..81f48d9dfe 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -448,8 +448,9 @@ int main( asked_frame_size = arg.renderFramesize; #ifdef FIX_1053_REVERB_RECONFIGURATION + uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, - arg.Opt_dpid_on, arg.aeSequence.pID[0], arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) + arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) @@ -678,7 +679,7 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_1053_REVERB_RECONFIGURATION - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[0], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) #endif @@ -692,7 +693,7 @@ int main( else { #ifdef FIX_1053_REVERB_RECONFIGURATION - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.aeSequence.pID[0] ); + fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); #else fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); #endif -- GitLab From 164320f5adcb2a30c3176b4c0de0a6906c8bef13 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 12:24:34 +0200 Subject: [PATCH 14/28] Freeing acoustic enviornment sequence buffers --- apps/decoder.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 81f48d9dfe..3968097d6c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -903,6 +903,13 @@ cleanup: free( pcmBuf ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + if (arg.aeSequence.count > 0) + { + free( arg.aeSequence.pID ); + free( arg.aeSequence.pValidity ); + } +#endif #ifdef DEBUG_SBA_AUDIO_DUMP IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels ); -- GitLab From 9e07238a6a1fd6ed47d8970e7bf448fa050a1490 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 12:29:21 +0200 Subject: [PATCH 15/28] ... and closing RenderConfigReader as required --- apps/decoder.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 3968097d6c..05f07ebcd1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2924,6 +2924,9 @@ static ivas_error decodeG192( cleanup: +#ifdef FIX_1053_REVERB_RECONFIGURATION + RenderConfigReader_close( &renderConfigReader ); +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT split_rend_reader_writer_close( &splitRendWriter ); #endif -- GitLab From 41e9580635e5b719911f2e65a8ea859d590e8b75 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 12:31:45 +0200 Subject: [PATCH 16/28] clang formatting --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 05f07ebcd1..89017420cf 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -904,7 +904,7 @@ cleanup: free( pcmBuf ); #ifdef FIX_1053_REVERB_RECONFIGURATION - if (arg.aeSequence.count > 0) + if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); free( arg.aeSequence.pValidity ); -- GitLab From 224fbd5b359b7330eebc116615a8574d3fdb5691 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 13:01:22 +0200 Subject: [PATCH 17/28] Added (commented out) test cases for acoustic environment sequences --- scripts/config/self_test.prm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 2e9886b9ff..fab2f87dc6 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1292,6 +1292,14 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/stv51MC48c.wav_MC51_512000_48-16_MC_Config_renderer.tst +// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +//../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst + +// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +//../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst + // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_Config_hospital_patientroom.tst -- GitLab From 24c17dbb5136ff6d7167eddfd30b40af5a48e586 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 22 Apr 2024 16:11:13 +0200 Subject: [PATCH 18/28] Corrected typo in usage --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 89017420cf..97aa337bae 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1842,7 +1842,7 @@ static void usage_dec( void ) #ifdef FIX_1053_REVERB_RECONFIGURATION fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); - fprintf( stdout, " without bracesand spaces, with ':' character separating ID from duration and ',' separating\n" ); + fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #else -- GitLab From 2d0927c482821ea620d4c82c21baa2fcbe7d3ac0 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 23 Apr 2024 11:22:57 +0200 Subject: [PATCH 19/28] Update reflecting review remarks --- apps/decoder.c | 1 + apps/renderer.c | 175 ++++++++++++++++++++++++++++ lib_dec/ivas_binRenderer_internal.c | 1 - lib_dec/lib_dec.c | 39 +++++-- lib_rend/ivas_reverb.c | 3 +- lib_rend/lib_rend.c | 56 +++++++-- readme.txt | 6 +- scripts/config/self_test_ltv.prm | 8 ++ 8 files changed, 267 insertions(+), 22 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 97aa337bae..be1d6bdd9a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2473,6 +2473,7 @@ static ivas_error decodeG192( if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; } } } diff --git a/apps/renderer.c b/apps/renderer.c index 8a9e0b48f8..d23a0dff7e 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -150,6 +150,17 @@ typedef struct IVAS_CUSTOM_LS_DATA outSetupCustom; } OutputConfig; +#ifdef FIX_1053_REVERB_RECONFIGURATION +typedef struct +{ + uint16_t *pID; + uint16_t *pValidity; + uint16_t count; + uint16_t selected; + uint16_t frameCounter; +} AcousticEnvironmentSequence; +#endif + typedef struct { char executableName[RENDERER_MAX_CLI_ARG_LENGTH]; @@ -189,7 +200,11 @@ typedef struct float syncMdDelay; IVAS_RENDER_FRAMESIZE render_framesize; uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS]; +#ifdef FIX_1053_REVERB_RECONFIGURATION + AcousticEnvironmentSequence aeSequence; +#else uint16_t acousticEnvironmentId; +#endif } CmdlnArgs; typedef enum @@ -390,7 +405,11 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_acousticEnvironmentId, .match = "acoustic_environment_id", .matchShort = "aeid", +#ifdef FIX_1053_REVERB_RECONFIGURATION + .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration." +#else .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration", +#endif }, }; @@ -784,6 +803,9 @@ int main( int16_t zeroPadToWrite = 0; int32_t delayTimeScale = 0; int16_t i, numChannels; +#ifdef FIX_1053_REVERB_RECONFIGURATION + uint16_t aeID; +#endif ivas_error error = IVAS_ERR_OK; bool splitBinNeedsNewFrame = true; @@ -1160,7 +1182,12 @@ int main( if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) +#else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) +#endif { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -1170,7 +1197,11 @@ int main( } else { +#ifdef FIX_1053_REVERB_RECONFIGURATION + fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); +#else fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId ); +#endif exit( -1 ); } renderConfig.roomAcoustics.override = 1; @@ -1601,6 +1632,40 @@ int main( num_in_channels = inBuffer.config.numChannels; const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0; +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL && + args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 ) + { + if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] ) + { + IVAS_RENDER_CONFIG_DATA renderConfig; + + if ( ++args.aeSequence.selected >= args.aeSequence.count ) + { + args.aeSequence.selected = 0; + } + args.aeSequence.frameCounter = 0; + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) + { + if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); + goto cleanup; + } + } + else + { + fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] ); + goto cleanup; + } + if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) ); + goto cleanup; + } + } + } +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT numSamplesRead = 0; if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) && splitBinNeedsNewFrame ) @@ -2192,6 +2257,13 @@ cleanup: { free( bitsBufferData ); } +#endif +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( args.aeSequence.count > 0 ) + { + free( args.aeSequence.pID ); + free( args.aeSequence.pValidity ); + } #endif for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { @@ -2673,6 +2745,94 @@ static bool parseLfePositionConfig( } +#ifdef FIX_1053_REVERB_RECONFIGURATION +static bool parseAcousticEnvironmentIds( + const char *value, + AcousticEnvironmentSequence *aeSequence ) +{ + uint16_t k; + char config_string[RENDERER_MAX_METADATA_LINE_LENGTH]; + char *s; + char *token; + + strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH ); + s = config_string; + token = config_string; + + if ( !is_digits_only( config_string ) ) + { + + for ( k = 0; s[k]; ) + { + s[k] == ',' ? k++ : *s++; + } + k++; + + if ( k == 0 ) + { + fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", config_string ); + return false; + } + + if ( NULL == ( aeSequence->pID = malloc( sizeof( uint16_t ) * k ) ) || + NULL == ( aeSequence->pValidity = malloc( sizeof( uint16_t ) * k ) ) ) + { + fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", config_string ); + return false; + } + + aeSequence->count = k; + + k = 0; + + token = strtok( config_string, ":" ); + + while ( token != NULL ) + { + if ( !is_number( token ) ) + { + fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string ); + return false; + } + aeSequence->pID[k] = (uint16_t) atoi( token ); + + token = strtok( NULL, "," ); + if ( !is_number( token ) ) + { + fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string ); + return false; + } + aeSequence->pValidity[k] = (uint16_t) atoi( token ); + + token = strtok( NULL, ":" ); + k++; + } + + if ( k != aeSequence->count ) + { + fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", config_string ); + return false; + } + } + else + { + /* A single acoustic environment */ + if ( NULL == ( aeSequence->pID = malloc( sizeof( uint16_t ) ) ) || + NULL == ( aeSequence->pValidity = malloc( sizeof( uint16_t ) ) ) ) + { + fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", config_string ); + return false; + } + aeSequence->count = 1; + aeSequence->pID[0] = (int16_t) atoi( config_string ); + aeSequence->pValidity[0] = 0; + } + + return true; +} +#endif + + static bool checkRequiredArgs( CmdlnArgs args ) { @@ -2789,7 +2949,15 @@ static CmdlnArgs defaultArgs( args.directivityPatternId[i] = 65535; } +#ifdef FIX_1053_REVERB_RECONFIGURATION + args.aeSequence.count = 0; + args.aeSequence.pID = NULL; + args.aeSequence.pValidity = NULL; + args.aeSequence.selected = 0; + args.aeSequence.frameCounter = 0; +#else args.acousticEnvironmentId = 65535; +#endif return args; } @@ -2961,12 +3129,19 @@ static void parseOption( break; case CmdLnOptionId_acousticEnvironmentId: assert( numOptionValues == 1 ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( !parseAcousticEnvironmentIds( optionValues[0], &args->aeSequence ) ) + { + fprintf( stderr, "Invalid acoustic environment ID specified: %s\n", optionValues[0] ); + } +#else if ( !is_digits_only( optionValues[0] ) ) { fprintf( stderr, "Invalid acousting environment ID specified: %s\n", optionValues[0] ); exit( -1 ); } args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 ); +#endif break; case CmdLnOptionId_syncMdDelay: assert( numOptionValues == 1 ); diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 0920223b9c..a4aeb00224 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1263,7 +1263,6 @@ ivas_error ivas_binRenderer_open( { return error; } - #ifndef FIX_1053_REVERB_RECONFIGURATION /* initialize the dmx matrix */ if ( hBinRenderer->nInChannels != HOA3_CHANNELS ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b8c21d7639..1d7e19c571 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2099,8 +2099,12 @@ ivas_error IVAS_DEC_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; +#ifdef FIX_1053_REVERB_RECONFIGURATION + ivas_error error; +#else #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; +#endif #endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hRenderConfig == NULL ) @@ -2147,46 +2151,67 @@ ivas_error IVAS_DEC_FeedRenderConfig( /* TD renderer Jot reverberator */ if ( hIvasDec->st_ivas->hReverb != NULL ) { - ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + if ( ( error = ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } /* CREND Jot reverberator */ if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0] != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + if ( ( error = ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } /* FB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } #else /* TD renderer Jot reverberator */ if ( hIvasDec->st_ivas->hReverb != NULL ) { - ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + if ( ( error = ivas_reverb_open( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } /* CREND Jot reverberator */ if ( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ); + if ( ( error = ivas_reverb_open( &hIvasDec->st_ivas->hCrendWrapper->hCrend->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } } /* DirAC CLDFB reverberator */ if ( hIvasDec->st_ivas->hDiracDecBin != NULL && hIvasDec->st_ivas->hDiracDecBin->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hDiracDecBin->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif /* Fastconv CLDFB reverberator */ if ( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL ) { ivas_binaural_reverb_close( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) ); - ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 6eb064a63b..7c4f3800d2 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1021,7 +1021,6 @@ 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; @@ -1045,6 +1044,7 @@ static ivas_error setup_FDN_branches( return error; } + #ifdef FIX_1053_REVERB_RECONFIGURATION /*------------------------------------------------------------------------- * ivas_reverb_open() @@ -1205,6 +1205,7 @@ ivas_error ivas_reverb_open( /* 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 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b99b636b93..439a4fd113 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4622,9 +4622,11 @@ int16_t IVAS_REND_FeedRenderConfig( input_masa *pMasaInput; input_mc *pMcInput; input_sba *pSbaInput; -#endif + ivas_error error; +#else #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; +#endif #endif if ( hIvasRend == NULL || hIvasRend->hRendererConfig == NULL ) @@ -4668,15 +4670,21 @@ int16_t IVAS_REND_FeedRenderConfig( } if ( pIsmInput->hReverb != NULL ) { - ivas_reverb_open( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif + { + return error; + } } } @@ -4695,19 +4703,28 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); - ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } #else if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb ); - ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hDiracDecBin->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); - ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ); + if ( ( error = ivas_binaural_reverb_init( &pMasaInput->hMasaExtRend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, pMasaInput->hMasaExtRend->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), *pMasaInput->base.ctx.pOutSampleRate, NULL, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } } } } @@ -4723,17 +4740,26 @@ int16_t IVAS_REND_FeedRenderConfig( if ( pMcInput->hReverb != NULL ) { - ivas_reverb_open( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_open( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } #else if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_open( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif } @@ -4750,12 +4776,18 @@ int16_t IVAS_REND_FeedRenderConfig( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - ivas_reverb_open( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } #else if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend->hReverb != NULL ) { - ivas_reverb_open( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ); + if ( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) + { + return error; + } } #endif } diff --git a/readme.txt b/readme.txt index 25275a7951..415ae41cc9 100644 --- a/readme.txt +++ b/readme.txt @@ -314,7 +314,11 @@ Options: -exof File : External orientation trajectory File for simulation of external orientations -dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration --aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output config. +-aeid ID : Acoustic environment ID (number > 0) or + a sequence thereof in the format [ID1:duration1,ID2:duration2...] + without braces and spaces, with ':' character separating ID from duration and ',' separating + ID and duration pairs, where duration is specified in frames + for BINAURAL_ROOM_REVERB output configuration. -lp Position : Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear (like --gain, -g) and azimuth, elevation are in degrees. If specified, overrides the default behavior which attempts to map input to output LFE channel(s) diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 690d3ed897..4d2e9eed20 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1291,6 +1291,14 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/ltv48_MC51.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/ltv48_MC51.wav_MC51_512000_48-16_MC_Config_renderer.tst +// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +//../IVAS_cod -mc 5_1 512000 48 testv/ltv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst + +// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +//../IVAS_cod -mc 5_1 32000 48 testv/ltv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst + // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_80000_48-48_MC_Config_hospital_patientroom.tst -- GitLab From 5b0e5f3bef87aec91f6f9e56366577b773b10ffa Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 23 Apr 2024 12:13:10 +0200 Subject: [PATCH 20/28] clang formatting --- apps/renderer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index d23a0dff7e..f3770957c0 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -337,10 +337,12 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "lp", .description = "Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear (like --gain, -g) and azimuth, elevation are in degrees.\nIf specified, overrides the default behavior which attempts to map input to output LFE channel(s)", }, - { .id = CmdlnOptionId_lfeMatrix, - .match = "lfe_matrix", - .matchShort = "lm", - .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)" }, + { + .id = CmdlnOptionId_lfeMatrix, + .match = "lfe_matrix", + .matchShort = "lm", + .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)" + }, { .id = CmdLnOptionId_noDelayCmp, .match = "no_delay_compensation", @@ -406,7 +408,7 @@ static const CmdLnParser_Option cliOptions[] = { .match = "acoustic_environment_id", .matchShort = "aeid", #ifdef FIX_1053_REVERB_RECONFIGURATION - .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration." + .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.", #else .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration", #endif -- GitLab From be21ff46a6eb8836add81146af59f3c411691781 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Tue, 23 Apr 2024 12:14:56 +0200 Subject: [PATCH 21/28] clang formatting --- apps/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index f3770957c0..6aaa359af4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -341,7 +341,7 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdlnOptionId_lfeMatrix, .match = "lfe_matrix", .matchShort = "lm", - .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)" + .description = "LFE panning matrix. File (CSV table) containing a matrix of dimensions [ num_input_lfe x num_output_channels ] with elements specifying linear routing gain (like --gain, -g). \nIf specified, overrides the output LFE position option and the default behavior which attempts to map input to output LFE channel(s)", }, { .id = CmdLnOptionId_noDelayCmp, -- GitLab From fd5466f80b28b0d6a32b534c689ce25ebf2187b8 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 08:50:37 +0200 Subject: [PATCH 22/28] Updated ParamBin downmix matrix handling reflecting review remarks --- lib_dec/ivas_binRenderer_internal.c | 19 +++++++++++++------ lib_rend/ivas_reverb.c | 20 -------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index a4aeb00224..e6fa8644d5 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -51,6 +51,19 @@ #endif #include "wmc_auto.h" +#ifdef FIX_1053_REVERB_RECONFIGURATION + +/*------------------------------------------------------------------------- + * Local constants + *------------------------------------------------------------------------*/ + +#define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) + /* Downmix table for sparse frequency domain reverberator */ +const float dmxmtx_table[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { + { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, +}; +#endif /*------------------------------------------------------------------------- * ivas_binRenderer_filterModule() @@ -1104,11 +1117,7 @@ ivas_error ivas_binRenderer_open( ) { BINAURAL_RENDERER_HANDLE hBinRenderer; -#ifdef FIX_1053_REVERB_RECONFIGURATION - int16_t convBand, k; -#else int16_t convBand, chIdx, k; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -1263,7 +1272,6 @@ ivas_error ivas_binRenderer_open( { return error; } -#ifndef FIX_1053_REVERB_RECONFIGURATION /* initialize the dmx matrix */ if ( hBinRenderer->nInChannels != HOA3_CHANNELS ) { @@ -1275,7 +1283,6 @@ ivas_error ivas_binRenderer_open( } } } -#endif } else { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 7c4f3800d2..74b3acd382 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -82,15 +82,6 @@ const int16_t default_loop_delay_48k[IVAS_REV_MAX_NR_BRANCHES] = { 2309, 1861, 1 const int16_t default_loop_delay_32k[IVAS_REV_MAX_NR_BRANCHES] = { 1531, 1237, 1013, 839, 709, 613, 541, 479 }; const int16_t default_loop_delay_16k[IVAS_REV_MAX_NR_BRANCHES] = { 769, 619, 509, 421, 353, 307, 269, 239 }; -#ifdef FIX_1053_REVERB_RECONFIGURATION -#define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) -/* Downmix table for sparse frequency domain reverberator */ -const float dmxmtx_table[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { - { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, -}; -#endif - /*------------------------------------------------------------------------------------------* * Local Struct definition *------------------------------------------------------------------------------------------*/ @@ -1943,17 +1934,6 @@ static ivas_error ivas_binaural_reverb_open( ivas_binaural_reverb_setPreDelay( hReverb, preDelay ); -#ifdef FIX_1053_REVERB_RECONFIGURATION - /* initialize the dmx matrix */ - for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) - { - for ( k = 0; k < REVERB_INPUT_DOWNMIX_CHANNELS; k++ ) - { - hReverb->dmxmtx[chIdx][k] = dmxmtx_table[chIdx][k]; - } - } -#endif - return IVAS_ERR_OK; } -- GitLab From afbfba40d7971525a918851f96ba0cfdae743be5 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 08:53:24 +0200 Subject: [PATCH 23/28] clang formatting --- lib_dec/ivas_binRenderer_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index e6fa8644d5..991251e01c 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -58,7 +58,7 @@ *------------------------------------------------------------------------*/ #define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) - /* Downmix table for sparse frequency domain reverberator */ +/* Downmix table for sparse frequency domain reverberator */ const float dmxmtx_table[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { { 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f }, -- GitLab From 4cabb1527e5d511f1783944f4bcb58d0601764ba Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 09:02:26 +0200 Subject: [PATCH 24/28] Added test cases triggering FastConv renderer --- scripts/config/self_test.prm | 8 ++++++-- scripts/config/self_test_ltv.prm | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index fab2f87dc6..49f88f7bb4 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1292,11 +1292,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/stv51MC48c.wav_MC51_512000_48-16_MC_Config_renderer.tst -// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) //../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit //../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst -// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +// Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) +//../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst + +// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) //../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit //../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 4d2e9eed20..079021ba60 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1291,11 +1291,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/ltv48_MC51.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/ltv48_MC51.wav_MC51_512000_48-16_MC_Config_renderer.tst -// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) //../IVAS_cod -mc 5_1 512000 48 testv/ltv51MC48c.wav bit //../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst -// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence +// Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) +//../IVAS_cod -mc 5_1 64000 48 testv/ltv51MC48c.wav bit +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst + +// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) //../IVAS_cod -mc 5_1 32000 48 testv/ltv51MC48c.wav bit //../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst -- GitLab From 56df34a44489a0d7bf53eaf079100617e8853bbf Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 12:03:09 +0200 Subject: [PATCH 25/28] Replacing downmix matrix variable with direct access to the ROM table --- lib_dec/ivas_binRenderer_internal.c | 6 ++++++ lib_rend/ivas_stat_rend.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 991251e01c..70a4c3d5d8 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -908,7 +908,11 @@ static void ivas_binaural_obtain_DMX( for ( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + float dmxConst = dmxmtx_table[chOutIdx][chIdx]; +#else float dmxConst = hBinRenderer->hReverb->dmxmtx[chOutIdx][chIdx]; +#endif for ( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { @@ -1272,6 +1276,7 @@ ivas_error ivas_binRenderer_open( { return error; } +#ifndef FIX_1053_REVERB_RECONFIGURATION /* initialize the dmx matrix */ if ( hBinRenderer->nInChannels != HOA3_CHANNELS ) { @@ -1283,6 +1288,7 @@ ivas_error ivas_binRenderer_open( } } } +#endif } else { diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 72818751ac..25d1476695 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -485,7 +485,9 @@ typedef struct ivas_binaural_reverb_struct uint32_t binRend_RandNext; int16_t highestBinauralCoherenceBin; +#ifndef FIX_1053_REVERB_RECONFIGURATION float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; +#endif float foa_enc[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; } REVERB_STRUCT, *REVERB_STRUCT_HANDLE; -- GitLab From 5cbd3eb81d7d7da57f56974ea9071010e8a99420 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 12:13:59 +0200 Subject: [PATCH 26/28] Removing unused variable --- lib_dec/ivas_binRenderer_internal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 70a4c3d5d8..065f0e2411 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1121,7 +1121,11 @@ ivas_error ivas_binRenderer_open( ) { BINAURAL_RENDERER_HANDLE hBinRenderer; +#ifdef FIX_1053_REVERB_RECONFIGURATION + int16_t convBand, k; +#else int16_t convBand, chIdx, k; +#endif ivas_error error; error = IVAS_ERR_OK; -- GitLab From f51a1400c01a4fdc75f756064e49ec7a439fc0ad Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 13:11:49 +0200 Subject: [PATCH 27/28] Fix for uninitialized early reflection flag in acoustic environment structure --- lib_util/render_config_reader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index decafb0a46..ffcb1d992a 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2821,6 +2821,12 @@ ivas_error RenderConfigReader_getAcousticEnvironment( pAcEnv->AbsCoeff[j] = pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j]; } } +#ifdef FIX_1053_REVERB_RECONFIGURATION + else + { + pAcEnv->use_er = false; + } +#endif return IVAS_ERR_OK; } } -- GitLab From 0080384c496a0c2802bbc5168ef2a9ea890e3060 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 24 Apr 2024 13:56:32 +0200 Subject: [PATCH 28/28] Increase frequency of acoustic environment changes for short vectors --- scripts/config/self_test.prm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 49f88f7bb4..025323d175 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1294,15 +1294,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 // Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) //../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:200,0:100,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) //../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:100,0:300 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) //../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst +//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:100,2:500,1:200 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit -- GitLab