From 162e90bd169022f992808ca66c36dd1bf3f60d7b Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Mon, 16 Jun 2025 13:24:04 +0200 Subject: [PATCH 01/17] Added compiler switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 51319adce..779a2d8f2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -140,7 +140,7 @@ /* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define FIX_1008_EXTORIENT_TARGET_INTERPOLATION /* FhG: issue #1008, external orientation init was wrong for 5ms */ - +#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ /* #################### End BASOP porting switches ############################ */ #endif -- GitLab From 57f24420afe3cf68a718670caf28b9a7954dbbe1 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Mon, 16 Jun 2025 16:34:55 +0200 Subject: [PATCH 02/17] mid-port updates --- lib_com/options.h | 2 +- lib_dec/ivas_rom_dec.h | 2 + lib_rend/ivas_reverb_fx.c | 4 +- lib_rend/ivas_stat_rend.h | 4 + lib_rend/lib_rend_fx.c | 146 +++++++++++++++++++++++++++++++- lib_util/render_config_reader.c | 6 ++ 6 files changed, 161 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 779a2d8f2..c7cdb899f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -112,7 +112,7 @@ #define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ -//#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ +#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT #define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ #define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 84c1a94a0..b2df85c55 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -90,10 +90,12 @@ extern const UWord16 *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4]; extern const Word16 dirac_dithering_azi_scale_fx[DIRAC_DIFFUSE_LEVELS]; extern const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS]; +#ifndef FIX_1053_REVERB_RECONFIGURATION /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ extern const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11]; +#endif /*----------------------------------------------------------------------* * MC ParamUpmix ROM tables diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 74c2a0c0a..a8555c397 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -141,13 +141,15 @@ typedef struct ivas_reverb_params_t // 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 Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ Word32 *pHrtf_inter_aural_coherence_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ const Word32 *pHrtf_avg_pwr_response_l_const_fx; /* The HRTF set's average left ear power response */ const Word32 *pHrtf_avg_pwr_response_r_const_fx; /* The HRTF set's average right ear power response */ const Word32 *pHrtf_inter_aural_coherence_const_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ +#endif + Word16 do_corr_filter; /* Flag indicating whether correlation filters should be used. */ /* Correlation only supported and needed for binaural playback (i.e. */ /* when nr_outputs != 2 correlation filtering is never supported). */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c93f62396..a7e7e1907 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -589,6 +589,10 @@ typedef struct ivas_binaural_reverb_struct UWord32 binRend_RandNext; Word16 highestBinauralCoherenceBin; +#ifndef FIX_1053_REVERB_RECONFIGURATION + float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; +#endif + Word32 dmxmtx_fx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; Word32 foa_enc_fx[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 562b35a6a..48ca1b7dd 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -5048,8 +5048,17 @@ Word16 IVAS_REND_FeedRenderConfig( ) { RENDER_CONFIG_HANDLE hRenderConfig; +#ifdef FIX_1053_REVERB_RECONFIGURATION + UWord16 i; + input_ism *pIsmInput; + input_masa *pMasaInput; + input_mc *pMcInput; + input_sba *pSbaInput; + ivas_error error; +#else #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error error; +#endif #endif test(); @@ -5086,6 +5095,141 @@ Word16 IVAS_REND_FeedRenderConfig( Copy32( renderConfig.roomAcoustics.AbsCoeff_fx, hRenderConfig->roomAcoustics.AbsCoeff_fx, 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( EQ32( pIsmInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Skip inactive inputs */ + continue; + } + if ( pIsmInput->hReverb != NULL ) + { + IF( NE_32( ( 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 + IF( NE_32( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) +#endif + { + return error; + } + } + } + + /* MASA inputs */ + for ( i = 0, pMasaInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pMasaInput ) + { + IF( EQ32( pMasaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Skip inactive inputs */ + continue; + } + + 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 ); + IF( NE_32( ( 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 ); + IF( NE_32( ( 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 ); + IF( NE_32( ( 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; + } + } + } + } + + /* Multi-channel inputs */ + for ( i = 0, pMcInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pMcInput ) + { + IF( EQ32( pMcInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Skip inactive inputs */ + continue; + } + + if ( pMcInput->hReverb != NULL ) + { + IF( NE_32( ( 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 ) + { + IF( NE_32( ( 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 ) + { + IF( NE_32( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif + } + + /* SBA inputs */ + for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput ) + { + IF ( EQ32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + /* Skip inactive inputs */ + continue; + } + +#ifdef SPLIT_REND_WITH_HEAD_ROT + if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) + { + IF ( NE_32( ( 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 ) + { + IF (NE_32( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif + } +#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 */ @@ -9257,7 +9401,7 @@ static ivas_error getSamplesInternal( hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, #endif hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index dae55f18c..f30e22f99 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2725,6 +2725,12 @@ ivas_error RenderConfigReader_getAcousticEnvironment( pAcEnv->AbsCoeff_fx[j] = (Word32) ( pRenderConfigReader->pAE[n].pEarlyReflections->pAbsCoeff[j] * ONE_IN_Q30 ); } } +#ifdef FIX_1053_REVERB_RECONFIGURATION + else + { + pAcEnv->use_er = false; + } +#endif return IVAS_ERR_OK; } } -- GitLab From 44fc7229300829b4dad802cc98ac0519f13179a0 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Wed, 18 Jun 2025 10:20:40 +0200 Subject: [PATCH 03/17] compiler switches --- lib_rend/ivas_reverb_fx.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index a8555c397..a758a7ad3 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -150,9 +150,9 @@ typedef struct ivas_reverb_params_t const Word32 *pHrtf_inter_aural_coherence_const_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ #endif - Word16 do_corr_filter; /* Flag indicating whether correlation filters should be used. */ - /* Correlation only supported and needed for binaural playback (i.e. */ - /* when nr_outputs != 2 correlation filtering is never supported). */ + Word16 do_corr_filter; /* Flag indicating whether correlation filters should be used. */ + /* Correlation only supported and needed for binaural playback (i.e. */ + /* when nr_outputs != 2 correlation filtering is never supported). */ } ivas_reverb_params_t; /*------------------------------------------------------------------------------------------* @@ -1415,7 +1415,9 @@ static ivas_error setup_FDN_branches_fx( { Word16 nr_coefs, branch_idx, channel_idx; ivas_error error; +#ifndef FIX_1053_REVERB_RECONFIGURATION Word16 *pCoef_a, *pCoef_b; +#endif error = IVAS_ERR_OK; /* initialize feedback branches */ @@ -1439,6 +1441,7 @@ static ivas_error setup_FDN_branches_fx( { FOR( branch_idx = 0; branch_idx < pParams->nr_loops; branch_idx++ ) { +#ifndef FIX_1053_REVERB_RECONFIGURATION pCoef_b = &pParams->pT60_filter_coeff_fx[shl( i_mult( nr_coefs, branch_idx ), 1 )]; /*Q14*/ pCoef_a = &pParams->pT60_filter_coeff_fx[add( shl( i_mult( nr_coefs, branch_idx ), 1 ), nr_coefs )]; /*Q14*/ @@ -1446,7 +1449,7 @@ static ivas_error setup_FDN_branches_fx( { return error; } - +#endif IF( NE_32( ( error = set_feedback_delay_fx( hReverb, branch_idx, pParams->pLoop_delays[branch_idx] ) ), IVAS_ERR_OK ) ) { return error; @@ -1468,12 +1471,20 @@ static ivas_error setup_FDN_branches_fx( return error; } + +#ifdef FIX_1053_REVERB_RECONFIGURATION +/*------------------------------------------------------------------------- + * ivas_reverb_open_fx() + * + * Allocate and initialize FDN reverberation handle + *------------------------------------------------------------------------*/ +#else /*------------------------------------------------------------------------- * ivas_reverb_open_fx() * * Allocate and initialize Crend reverberation handle *------------------------------------------------------------------------*/ - +#endif ivas_error ivas_reverb_open_fx( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES @@ -1487,7 +1498,11 @@ ivas_error ivas_reverb_open_fx( const int32_t output_Fs ) { ivas_error error; +#ifdef FIX_1053_REVERB_RECONFIGURATION + +#else REVERB_HANDLE pState = NULL; +#endif Word16 bin_idx, subframe_len, output_frame, predelay_bf_len, loop_idx, i; ivas_reverb_params_t params; Word32 pColor_target_l_fx[RV_LENGTH_NR_FC]; -- GitLab From bc41f5890166c98a29abb831cf8b49d23bb98523 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:36:03 +0200 Subject: [PATCH 04/17] activated binary hrtf compiler switch + changes in ivas_reverb_fx.c --- lib_com/options.h | 2 +- lib_rend/ivas_reverb_fx.c | 114 +++++++++++++++++++++++++++++++++++--- 2 files changed, 106 insertions(+), 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 310fbafc3..6d32bf4e9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,7 +106,7 @@ #define FIX_1372_ISAR_POST_REND #define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ -//#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ +#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT #define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ #define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 271101cf3..6bcb13a2f 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -142,13 +142,13 @@ typedef struct ivas_reverb_params_t // 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 - Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ - Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ - Word32 *pHrtf_inter_aural_coherence_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ + Word32 *pHrtf_avg_pwr_response_l_fx; /* The HRTF set's average left ear power response */ + Word32 *pHrtf_avg_pwr_response_r_fx; /* The HRTF set's average right ear power response */ + Word32 *pHrtf_inter_aural_coherence_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ +#endif const Word32 *pHrtf_avg_pwr_response_l_const_fx; /* The HRTF set's average left ear power response */ const Word32 *pHrtf_avg_pwr_response_r_const_fx; /* The HRTF set's average right ear power response */ const Word32 *pHrtf_inter_aural_coherence_const_fx; /* The HRTF set's inter-aural coherence for diffuse sound */ -#endif Word16 do_corr_filter; /* Flag indicating whether correlation filters should be used. */ /* Correlation only supported and needed for binaural playback (i.e. */ @@ -1499,7 +1499,9 @@ ivas_error ivas_reverb_open_fx( { ivas_error error; #ifdef FIX_1053_REVERB_RECONFIGURATION - + REVERB_HANDLE pState = *hReverb; + UWord16 nr_coefs, branch_idx; + Word16 *pCoef_a, *pCoef_b; #else REVERB_HANDLE pState = NULL; #endif @@ -1521,17 +1523,44 @@ ivas_error ivas_reverb_open_fx( move16(); nr_fc_input = hRenderConfig->roomAcoustics.nBands; +#ifdef FIX_1053_REVERB_RECONFIGURATION + IF( *hReverb == NULL ) + { + 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( NE_32( ( error = set_base_config_fx( ¶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_fx[loop_idx] = (Word32 *) malloc( params.pLoop_delays[loop_idx] * sizeof( Word32 ) ) ) == NULL ); + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); + } + } + /* Allocate memory for the pre-delay line */ + IF( ( pState->pPredelay_buffer_fx = (Word32 *) malloc( output_frame * sizeof( Word32 ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); + } + } +#else /* Allocate memory for feedback delay lines */ FOR( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { @@ -1546,21 +1575,26 @@ ivas_error ivas_reverb_open_fx( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CREND Reverberator" ); } - +#endif pState->nr_of_branches = IVAS_REV_MAX_NR_BRANCHES; move16(); set_fft_and_datablock_sizes_fx( pState, subframe_len ); + nr_fc_fft_filter = add( extract_l( L_shr( pState->fft_size, 1 ) ), 1 ); /* === 'Control logic': compute the reverb processing parameters from the === */ /* === room, source and listener acoustic information provided in the reverb config === */ /* Setting up shared temporary buffers for fc, RT60, DSR, etc. */ +#ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_avg_pwr_response_l_fx = &pFft_wf_filter_ch0_fx[0][0]; params.pHrtf_avg_pwr_response_r_fx = params.pHrtf_avg_pwr_response_l_fx + nr_fc_fft_filter; +#endif params.pRt60_fx = &pFft_wf_filter_ch1_fx[0][0]; params.pDsr_fx = params.pRt60_fx + nr_fc_fft_filter; params.pFc_fx = &pState->fft_filter_color_0.fft_spectrum_fx[0]; +#ifndef FIX_1053_REVERB_RECONFIGURATION params.pHrtf_inter_aural_coherence_fx = &pState->fft_filter_color_1.fft_spectrum_fx[0]; +#endif set32_fx( pState->fft_filter_color_1.fft_spectrum_fx, 0, RV_FILTER_MAX_FFT_SIZE ); /* 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(...) */ @@ -1619,8 +1653,15 @@ ivas_error ivas_reverb_open_fx( move32(); } +#ifdef FIX_1053_REVERB_RECONFIGURATION + IF( *hReverb == NULL ) + { + pState->dmx_gain_fx = calc_dmx_gain_fx(); + } +#else /* set up input downmix */ pState->dmx_gain_fx = calc_dmx_gain_fx(); +#endif /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ calc_predelay_fx( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay_fx, output_Fs ); @@ -1668,6 +1709,25 @@ ivas_error ivas_reverb_open_fx( /* Compute the window used for FFT filters */ ivas_reverb_define_window_fft_fx( pTime_window_fx, transition_start, transition_length, nr_fc_fft_filter ); + +#ifdef FIX_1053_REVERB_RECONFIGURATION + /* === Copy parameters from ivas_reverb_params_t into DSP blocks === */ + /* === to be used for subsequent audio signal processing === */ + if ( *hReverb == NULL ) + { + pState->do_corr_filter = params.do_corr_filter; + move16(); + + /* clear & init jot reverb fft filters */ + IF( NE_32( ( error = initialize_reverb_filters_fx( pState ) ), IVAS_ERR_OK ) ) + { + return error; + } + Word16 q_pFft_wf_filter_ch0_fx = 23, q_pFft_wf_filter_ch1_fx = 23; + move16(); + move16(); + } +#else /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ /* === to be used for subsequent audio signal processing === */ @@ -1682,6 +1742,8 @@ ivas_error ivas_reverb_open_fx( Word16 q_pFft_wf_filter_ch0_fx = 23, q_pFft_wf_filter_ch1_fx = 23; move16(); move16(); +#endif + IF( pState->do_corr_filter ) { /* Computing correlation filters on the basis of target IA coherence */ @@ -1744,9 +1806,12 @@ ivas_error ivas_reverb_open_fx( pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); } - +#ifndef FIX_1053_REVERB_RECONFIGURATION Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ - Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ +#else + Scale_sig32( params.pHrtf_inter_aural_coherence_const_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ +#endif + Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ /* Copying the computed FFT colorations filters to the fft_filter components */ IF( NE_32( ( error = set_color_fft_filter_fx( pState, 0, pFft_wf_filter_ch0_fx ) ), IVAS_ERR_OK ) ) @@ -1759,6 +1824,36 @@ ivas_error ivas_reverb_open_fx( return error; } +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( *hReverb == NULL ) + { + /* init predelay */ + ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer_fx, 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_fx[2 * nr_coefs * branch_idx + nr_coefs]; + pCoef_b = ¶ms.pT60_filter_coeff_fx[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_fx, params.pre_delay, predelay_bf_len ); @@ -1767,6 +1862,7 @@ ivas_error ivas_reverb_open_fx( { return error; } +#endif #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES free( pDsr_e ); free( pRt60_e ); -- GitLab From 5036625a5145eeffb912f3cf8d5954d38956cf25 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 12:45:53 +0200 Subject: [PATCH 05/17] Correct placement of compiler switch --- lib_rend/ivas_reverb_fx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 6bcb13a2f..ca500218b 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1723,9 +1723,6 @@ ivas_error ivas_reverb_open_fx( { return error; } - Word16 q_pFft_wf_filter_ch0_fx = 23, q_pFft_wf_filter_ch1_fx = 23; - move16(); - move16(); } #else /* === Now, copy parameters from ivas_reverb_params_t into DSP blocks === */ @@ -1739,10 +1736,12 @@ ivas_error ivas_reverb_open_fx( { return error; } +#endif + Word16 q_pFft_wf_filter_ch0_fx = 23, q_pFft_wf_filter_ch1_fx = 23; move16(); move16(); -#endif + IF( pState->do_corr_filter ) { -- GitLab From 64a70446820fd1adc0943908e63cdc2a027e7066 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:53:03 +0200 Subject: [PATCH 06/17] Code formatting + build issues solved --- apps/decoder.c | 196 ++++++++++++++++++++++++- apps/renderer.c | 187 ++++++++++++++++++++++- lib_dec/ivas_binRenderer_internal_fx.c | 27 +++- lib_dec/ivas_rom_dec_fx.c | 4 +- lib_rend/ivas_prot_rend_fx.h | 4 +- lib_rend/ivas_reverb_fx.c | 4 +- lib_rend/lib_rend_fx.c | 22 +-- 7 files changed, 421 insertions(+), 23 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 76bd23bbf..2ac4ea042 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -80,6 +80,18 @@ 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; @@ -119,7 +131,11 @@ typedef struct IVAS_DEC_COMPLEXITY_LEVEL complexityLevel; bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; +#ifdef FIX_1053_REVERB_RECONFIGURATION + AcousticEnvironmentSequence aeSequence; +#else uint16_t acousticEnvironmentId; +#endif int16_t Opt_dpid_on; uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; @@ -385,9 +401,14 @@ 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, 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_fx, 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; @@ -508,7 +529,11 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + 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 { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -518,7 +543,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", arg.acousticEnvironmentId ); +#endif goto cleanup; } renderConfig.roomAcoustics.override = true; @@ -786,6 +815,14 @@ cleanup: free( pcmBuf ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + if ( arg.aeSequence.count > 0 ) + { + free( arg.aeSequence.pID ); + free( arg.aeSequence.pValidity ); + } +#endif + if ( arg.hrtfReaderEnabled ) { IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); @@ -975,7 +1012,15 @@ static bool parseCmdlIVAS_dec( arg->non_diegetic_pan_gain = 0.f; arg->tsmEnabled = false; arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS; +#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; @@ -1297,11 +1342,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 ) { @@ -1525,7 +1649,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 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 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" ); @@ -1864,6 +1996,32 @@ static ivas_error decodeG192( int16_t vec_pos_update, vec_pos_len; SplitFileReadWrite *splitRendWriter = NULL; +#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; @@ -2030,6 +2188,38 @@ 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 ) ); + goto cleanup; + } + } + } +#endif if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK ) { if ( error == IVAS_ERR_END_OF_FILE ) @@ -2388,6 +2578,10 @@ static ivas_error decodeG192( cleanup: +#ifdef FIX_1053_REVERB_RECONFIGURATION + RenderConfigReader_close( &renderConfigReader ); +#endif + split_rend_reader_writer_close( &splitRendWriter ); AudioFileWriter_close( &afWriter ); MasaFileWriter_close( &masaWriter ); diff --git a/apps/renderer.c b/apps/renderer.c index 8d7cb86c9..33b221158 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -143,6 +143,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]; @@ -178,7 +189,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 @@ -303,10 +318,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", @@ -371,7 +388,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 }, }; @@ -764,6 +785,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; #ifdef WMOPS @@ -1200,7 +1224,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 ) { @@ -1210,7 +1239,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; @@ -1653,6 +1686,41 @@ 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 + numSamplesRead = 0; /* Read the input data */ @@ -2109,6 +2177,15 @@ cleanup: { free( bitsBufferData ); } + +#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 ) { MasaFileReader_close( &masaReaders[i] ); @@ -2571,6 +2648,93 @@ static bool parseLfePositionConfig( return true; } +#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 ) @@ -2678,7 +2842,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; } @@ -2848,12 +3020,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_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index 75b746ae7..a97266a2e 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -49,6 +49,21 @@ #define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (Word16) ceil( 0.5f * hBinRenConvModule->numTaps ) #define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (Word16) ceil( 0.4f * hBinRenConvModule->numTaps ) #define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps ) + +#ifdef FIX_1053_REVERB_RECONFIGURATION +/*----------------------------------------------------------------------------------* + * Local constants + *----------------------------------------------------------------------------------*/ + +#define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 ) +/* Downmix table for sparse frequency domain reverberator*/ +const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = { + // Q31 + { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 }, + { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff }, +}; +#endif + /*------------------------------------------------------------------------- * ivas_binRenderer_filterModule_fx() * @@ -936,10 +951,14 @@ static void ivas_binaural_obtain_DMX_fx( FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ ) { +#ifdef FIX_1053_REVERB_RECONFIGURATION + Word32 dmxConst = dmxmtx_table_fx[chOutIdx][chIdx]; +#else Word32 dmxConst = hBinRenderer->hReverb->dmxmtx_fx[chOutIdx][chIdx]; move32(); +#endif - FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) + FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { FOR( k = 0; k < numTimeSlots; k++ ) { @@ -1185,7 +1204,11 @@ ivas_error ivas_binRenderer_open_fx( ) { BINAURAL_RENDERER_HANDLE hBinRenderer; +#ifdef FIX_1053_REVERB_RECONFIGURATION + Word16 convBand, k; +#else Word16 convBand, chIdx, k; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -1357,6 +1380,7 @@ ivas_error ivas_binRenderer_open_fx( /* initialize the dmx matrix */ #ifdef NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM +#ifndef FIX_1053_REVERB_RECONFIGURATION IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) ) { FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) @@ -1368,6 +1392,7 @@ ivas_error ivas_binRenderer_open_fx( } } } +#endif #else FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { diff --git a/lib_dec/ivas_rom_dec_fx.c b/lib_dec/ivas_rom_dec_fx.c index 6f75230c9..63b1cb6a8 100644 --- a/lib_dec/ivas_rom_dec_fx.c +++ b/lib_dec/ivas_rom_dec_fx.c @@ -373,7 +373,7 @@ const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS] = * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef FIX_1053_REVERB_RECONFIGURATION /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ @@ -383,7 +383,7 @@ const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11] = { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 }, { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff }, }; - +#endif /*----------------------------------------------------------------------* diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 96774b44f..17f691267 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -969,9 +969,9 @@ ivas_error ivas_binaural_reverb_open_parambin( void ivas_binaural_reverb_close_fx( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ); -void ivas_binaural_reverb_close( +/*void ivas_binaural_reverb_close( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ -); +//); void ivas_binaural_reverb_processSubframe_fx( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index ca500218b..a812c01a7 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1830,7 +1830,7 @@ ivas_error ivas_reverb_open_fx( ivas_rev_delay_line_init( &( pState->predelay_line ), pState->pPredelay_buffer_fx, params.pre_delay, predelay_bf_len ); /* set up feedback delay network */ - if ( ( error = setup_FDN_branches( pState, ¶ms ) ) != IVAS_ERR_OK ) + if ( ( error = setup_FDN_branches_fx( pState, ¶ms ) ) != IVAS_ERR_OK ) { return error; } @@ -2740,7 +2740,7 @@ ivas_error ivas_binaural_reverb_open_parambin( #endif /*------------------------------------------------------------------------- - * ivas_binaural_reverb_close() + * ivas_binaural_reverb_close_fx() * * Close binaural room reverberator handle *------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 2bd01f73a..4137bd325 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -4853,21 +4853,21 @@ Word16 IVAS_REND_FeedRenderConfig( /* ISM inputs */ for ( i = 0, pIsmInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pIsmInput ) { - IF( EQ32( pIsmInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( EQ_32( pIsmInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; } if ( pIsmInput->hReverb != NULL ) { - IF( NE_32( ( error = ivas_reverb_open( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &pIsmInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) { - IF( NE_32( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -4877,7 +4877,7 @@ Word16 IVAS_REND_FeedRenderConfig( /* MASA inputs */ for ( i = 0, pMasaInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pMasaInput ) { - IF( EQ32( pMasaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( EQ_32( pMasaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; @@ -4887,7 +4887,7 @@ Word16 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_close_fx( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); IF( NE_32( ( 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; @@ -4895,7 +4895,7 @@ Word16 IVAS_REND_FeedRenderConfig( } if ( pMasaInput->hMasaExtRend->hReverb != NULL ) { - ivas_binaural_reverb_close( &pMasaInput->hMasaExtRend->hReverb ); + ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hReverb ); IF( NE_32( ( 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; @@ -4907,7 +4907,7 @@ Word16 IVAS_REND_FeedRenderConfig( /* Multi-channel inputs */ for ( i = 0, pMcInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pMcInput ) { - IF( EQ32( pMcInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( EQ_32( pMcInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; @@ -4915,14 +4915,14 @@ Word16 IVAS_REND_FeedRenderConfig( if ( pMcInput->hReverb != NULL ) { - IF( NE_32( ( error = ivas_reverb_open( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &pMcInput->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } } if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - IF( NE_32( ( error = ivas_reverb_open( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -4932,14 +4932,14 @@ Word16 IVAS_REND_FeedRenderConfig( /* SBA inputs */ for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput ) { - IF ( EQ32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF ( EQ_32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; } if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - IF ( NE_32( ( error = ivas_reverb_open( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF ( NE_32( ( error = ivas_reverb_open_fx( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From c4d63348c1bce479db52b11fa58223e9b34bfed7 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:54:26 +0200 Subject: [PATCH 07/17] deactivated compiler switch (binary hrtf MR must be merged first) --- lib_com/options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6d32bf4e9..cc2eb3468 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,7 +106,7 @@ #define FIX_1372_ISAR_POST_REND #define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */ -#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ +//#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT #define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ #define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ @@ -125,7 +125,7 @@ /* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define FIX_1008_EXTORIENT_TARGET_INTERPOLATION /* FhG: issue #1008, external orientation init was wrong for 5ms */ -#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ +//#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ #define FIX_1009_ISM_NONDIEGETIC_PANNING /* FhG: issue #1009: use correct object buffer for ISM1 non-diegetic pan */ #define NONBE_FIX_1012_1013_JBM_FLUSH_BUFFER /* FhG: issues #1012, 1013: JBM flush function uses wrong output buffer */ #define FIX_998_UNUSED_FUNCTION /* FhG: issue 998: delete unused funtion ivas_dirac_dec_get_response_split_order */ -- GitLab From 3a0c98c407fbf56ce4025d1ef165af999b824409 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:02:50 +0200 Subject: [PATCH 08/17] clang fixes --- lib_dec/ivas_binRenderer_internal_fx.c | 2 +- lib_rend/lib_rend_fx.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c index a97266a2e..7a0fb1236 100644 --- a/lib_dec/ivas_binRenderer_internal_fx.c +++ b/lib_dec/ivas_binRenderer_internal_fx.c @@ -958,7 +958,7 @@ static void ivas_binaural_obtain_DMX_fx( move32(); #endif - FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) + FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ ) { FOR( k = 0; k < numTimeSlots; k++ ) { diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 4137bd325..ac994484f 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -4932,14 +4932,14 @@ Word16 IVAS_REND_FeedRenderConfig( /* SBA inputs */ for ( i = 0, pSbaInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pSbaInput ) { - IF ( EQ_32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + IF( EQ_32( pSbaInput->base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { /* Skip inactive inputs */ continue; } if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { - IF ( NE_32( ( error = ivas_reverb_open_fx( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { return error; } @@ -8906,7 +8906,7 @@ static ivas_error getSamplesInternal( if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.isar_frame_size_ms, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From 13bedfe424f441cc7c6510d609c5401fb0fa20f9 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:27:40 +0200 Subject: [PATCH 09/17] Resolved warning in comment --- lib_rend/ivas_prot_rend_fx.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 17f691267..3a9ef2767 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -969,9 +969,6 @@ ivas_error ivas_binaural_reverb_open_parambin( void ivas_binaural_reverb_close_fx( REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ ); -/*void ivas_binaural_reverb_close( - REVERB_STRUCT_HANDLE *hReverb /* i/o: binaural reverb handle */ -//); void ivas_binaural_reverb_processSubframe_fx( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ -- GitLab From 056f2b0805b275f3c7725877f317a9e2c9fd09ed Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:05:36 +0200 Subject: [PATCH 10/17] Activated compiler swithces + fixed logical errors --- lib_com/options.h | 6 +++--- lib_rend/lib_rend_fx.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 08badf966..9f8112be4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,10 +111,10 @@ #define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT -//#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ +#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ #endif -//#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ +#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ #define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ #define FIX_INV_DIFFUSE_WEIGHT /* Orange : Fix error in energy compensation in late binaural */ @@ -126,7 +126,7 @@ /* #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF */ /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define FIX_1008_EXTORIENT_TARGET_INTERPOLATION /* FhG: issue #1008, external orientation init was wrong for 5ms */ -//#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ +#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ #define FIX_1009_ISM_NONDIEGETIC_PANNING /* FhG: issue #1009: use correct object buffer for ISM1 non-diegetic pan */ #define NONBE_FIX_1012_1013_JBM_FLUSH_BUFFER /* FhG: issues #1012, 1013: JBM flush function uses wrong output buffer */ #define FIX_998_UNUSED_FUNCTION /* FhG: issue 998: delete unused funtion ivas_dirac_dec_get_response_split_order */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index ac994484f..4452cb545 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -4865,7 +4865,7 @@ Word16 IVAS_REND_FeedRenderConfig( return error; } } - if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) + if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend[0] != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { @@ -4885,7 +4885,7 @@ Word16 IVAS_REND_FeedRenderConfig( if ( pMasaInput->hMasaExtRend != NULL ) { - if ( pMasaInput->hMasaExtRend->hDiracDecBin != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) + if ( pMasaInput->hMasaExtRend->hDiracDecBin[0] != NULL && pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb != NULL ) { ivas_binaural_reverb_close_fx( &pMasaInput->hMasaExtRend->hDiracDecBin[0]->hReverb ); IF( NE_32( ( 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 ) ) @@ -4920,7 +4920,7 @@ Word16 IVAS_REND_FeedRenderConfig( return error; } } - if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) + if ( pMcInput->crendWrapper != NULL && pMcInput->crendWrapper->hCrend[0] && pMcInput->crendWrapper->hCrend[0]->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pMcInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pMcInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { @@ -4937,7 +4937,7 @@ Word16 IVAS_REND_FeedRenderConfig( /* Skip inactive inputs */ continue; } - if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) + if ( pSbaInput->crendWrapper != NULL && pSbaInput->crendWrapper->hCrend[0] != NULL && pSbaInput->crendWrapper->hCrend[0]->hReverb != NULL ) { IF( NE_32( ( error = ivas_reverb_open_fx( &pSbaInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pSbaInput->base.ctx.pOutSampleRate ) ), IVAS_ERR_OK ) ) { -- GitLab From bd80606ebe5180f1ea5207d411e3a9347754ae1f Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:24:17 +0200 Subject: [PATCH 11/17] Fixed logical errors --- lib_rend/ivas_reverb_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 223fe81ba..4e56ec49d 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1548,7 +1548,7 @@ ivas_error ivas_reverb_open_fx( /* Allocate memory for feedback delay lines */ FOR( loop_idx = 0; loop_idx < IVAS_REV_MAX_NR_BRANCHES; loop_idx++ ) { - IF( ( pState->loop_delay_buffer_fx[loop_idx] = (Word32 *) malloc( params.pLoop_delays[loop_idx] * sizeof( Word32 ) ) ) == NULL ); + IF( ( pState->loop_delay_buffer_fx[loop_idx] = (Word32 *) malloc( params.pLoop_delays[loop_idx] * sizeof( Word32 ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for FDN Reverberator" ); } -- GitLab From 98f08092efc13e69827a7587cee288d4e1f11a14 Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Wed, 25 Jun 2025 17:50:08 +0200 Subject: [PATCH 12/17] Fixed logical errors --- apps/decoder.c | 2 +- lib_rend/ivas_reverb_fx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 70df7930f..39e57329c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -403,7 +403,7 @@ 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, + 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_fx, 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_fx, diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 4e56ec49d..cbb1afdbe 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1826,7 +1826,7 @@ ivas_error ivas_reverb_open_fx( #ifndef FIX_1053_REVERB_RECONFIGURATION Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ #else - Scale_sig32( params.pHrtf_inter_aural_coherence_const_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ + Scale_sig32( (Word32 *) params.pHrtf_inter_aural_coherence_const_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ #endif Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ -- GitLab From 656afa5c3e9a2b20e3ff21ff348e0ff61ac841de Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 7 Jul 2025 08:08:21 +0200 Subject: [PATCH 13/17] Removed redundant lines of code --- lib_rend/ivas_reverb_fx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index cbb1afdbe..c1f85796a 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1825,10 +1825,8 @@ ivas_error ivas_reverb_open_fx( } #ifndef FIX_1053_REVERB_RECONFIGURATION Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ -#else - Scale_sig32( (Word32 *) params.pHrtf_inter_aural_coherence_const_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ -#endif Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ +#endif /* Copying the computed FFT colorations filters to the fft_filter components */ IF( NE_32( ( error = set_color_fft_filter_fx( pState, 0, pFft_wf_filter_ch0_fx ) ), IVAS_ERR_OK ) ) -- GitLab From 5e106f0ae9075db5ab409c74c3fc9ea852e26005 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 7 Jul 2025 08:28:57 +0200 Subject: [PATCH 14/17] FIX_1053_REVERB_RECONFIGURATION reactivated, clang formatting --- lib_com/options.h | 1 + lib_rend/ivas_reverb_fx.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 494cb1909..3145ca22d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -124,6 +124,7 @@ #define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */ #define NONBE_FIX_1034_DRY_MASA_RATIOS /* Nokia: Fix issue 1034, use of wrong numDir state. */ #define NONBE_FIX_1021_ISM_BRIR_RS_FLUSH /* FhG: issue #1021: fix ISM with JBM and RS renderer flushing*/ +#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic swithcing of acoustic environment */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 3ca946372..53b955536 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1844,7 +1844,7 @@ ivas_error ivas_reverb_open_fx( } #ifndef FIX_1053_REVERB_RECONFIGURATION Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ - Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ + Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ #endif /* Copying the computed FFT colorations filters to the fft_filter components */ -- GitLab From ab8521783ebb554555c39b2fb6112a6e09695172 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 7 Jul 2025 16:27:06 +0200 Subject: [PATCH 15/17] Scaling the coloration FFT --- lib_rend/ivas_reverb_fx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 53b955536..01966be87 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1842,7 +1842,10 @@ ivas_error ivas_reverb_open_fx( pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); } -#ifndef FIX_1053_REVERB_RECONFIGURATION +#ifdef FIX_1053_REVERB_RECONFIGURATION + Scale_sig32( pFft_wf_filter_ch0_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ + Scale_sig32( pFft_wf_filter_ch1_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ +#else Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ #endif -- GitLab From 6b82dad73368b477b04924ac97591d0083a9ab32 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 9 Jul 2025 08:59:00 +0200 Subject: [PATCH 16/17] Removed redundant scaling of reverb coloration FFT parameters --- lib_rend/ivas_reverb_fx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_rend/ivas_reverb_fx.c b/lib_rend/ivas_reverb_fx.c index 01966be87..53b955536 100644 --- a/lib_rend/ivas_reverb_fx.c +++ b/lib_rend/ivas_reverb_fx.c @@ -1842,10 +1842,7 @@ ivas_error ivas_reverb_open_fx( pFft_wf_filter_ch1_fx[i][1] = L_shl( pFft_wf_filter_ch1_fx[i][1], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); } -#ifdef FIX_1053_REVERB_RECONFIGURATION - Scale_sig32( pFft_wf_filter_ch0_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ - Scale_sig32( pFft_wf_filter_ch1_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ -#else +#ifndef FIX_1053_REVERB_RECONFIGURATION Scale_sig32( params.pHrtf_inter_aural_coherence_fx, nr_fc_fft_filter, 4 ); /*Scaling ( *hReverb )->fft_filter_color_0.fft_spectrum_fx to Q31*/ Scale_sig32( params.pFc_fx, nr_fc_fft_filter, 17 ); /*Scaling ( *hReverb )->fft_filter_color_1.fft_spectrum_fx to Q31*/ #endif -- GitLab From e15146e585472d29e033eddb09ac88945cca46fb Mon Sep 17 00:00:00 2001 From: Devansh Kandpal <43807487+mrkandpal@users.noreply.github.com> Date: Mon, 4 Aug 2025 17:46:10 +0200 Subject: [PATCH 17/17] AEID complier switch --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 3d10e83cd..29e50fb6d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,7 +115,7 @@ #define NONBE_FIX_1045_ISM_BITRATE_SWITCHING /* Eri: Difference between ROM/File HRTF in ISM bitrate switching */ #define NONBE_FIX_1065_ISM_MD_HANDLE /* VA: issue 1065: Allocate only the necessary number of ISM MD decoder handles. */ #define NONBE_FIX_1028_1DB_TCX_LEVEL_DROP /* VA: Harmonize the logic setting LP weighting factor between TCX encoder and TCX decoder */ - +#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */ /* #################### End BASOP porting switches ############################ */ #endif -- GitLab