From f7dd18eba9ce40245a2c991516ee52527fb86ffe Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Fri, 9 Aug 2024 13:51:19 +0200 Subject: [PATCH 1/7] Use HRTF convolution for BINUARAL_ROOM_REVERB output config with FastConv renderer --- lib_com/options.h | 1 + lib_dec/ivas_output_config.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 9401a6f974..5cfbe5c0e9 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define FIX_1152_UNINIT_VAL_IN_ITD_VAD_COMPUTATION /* FhG: fix uninitialized value being used in ITD VAD mid signal computation that does not affect synthesis, but crashes BASOPs */ #define FIX_1157_OBSOLETE_DMX_TABLE /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */ #define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */ +#define FIX_1158_FASTCONV_REVERB_HRTF /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 44a10edbe2..a3e62b9702 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -141,7 +141,11 @@ void ivas_renderer_select( { *internal_config = IVAS_AUDIO_CONFIG_HOA3; +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#else if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) +#endif { *renderer_type = RENDERER_BINAURAL_FASTCONV; } -- GitLab From df7ef84a7263ce48283b8dc3fbe95b605b807242 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Wed, 21 Aug 2024 11:19:35 +0200 Subject: [PATCH 2/7] Use default FastConv reverberation times in association with BRIRs, parametric reverberation times otherwise --- lib_dec/ivas_binRenderer_internal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 50d7214713..a64674bf80 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1058,9 +1058,22 @@ static ivas_error ivas_binaural_hrtf_open( { HrtfFastConv->fastconvReverberationEneCorrections[i] = fastconvReverberationEneCorrections[i] * scaleFactor; } +#else +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); + mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); + } + else + { + mvr2r( parametricReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); + mvr2r( parametricReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); + } #else mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); +#endif #endif *hHrtfFastConv = HrtfFastConv; -- GitLab From f4c69ba9009c47c2c66ae4ecb2a47054a9e96ca5 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Thu, 22 Aug 2024 10:38:52 +0200 Subject: [PATCH 3/7] Reverting the change related to setting default reverberation times, energies --- lib_dec/ivas_binRenderer_internal.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index a64674bf80..50d7214713 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1058,22 +1058,9 @@ static ivas_error ivas_binaural_hrtf_open( { HrtfFastConv->fastconvReverberationEneCorrections[i] = fastconvReverberationEneCorrections[i] * scaleFactor; } -#else -#ifdef FIX_1158_FASTCONV_REVERB_HRTF - if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); - mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); - } - else - { - mvr2r( parametricReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); - mvr2r( parametricReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); - } #else mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); -#endif #endif *hHrtfFastConv = HrtfFastConv; -- GitLab From cb8d2012b537fb94a9d293b8006fcc1a230209c9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 22 Aug 2024 10:45:02 +0200 Subject: [PATCH 4/7] [fix] load default renderer config in absence of a custom one for BINAURAL_ROOM_REVERB so that the room acoustics parameters are consistent --- apps/decoder.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 1b6b7e5d57..1ac9a7d5f9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -419,6 +419,15 @@ int main( goto cleanup; } } +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + /* supply default renderer config for BINAURAL_ROOM_REVERB */ + IVAS_RENDER_CONFIG_DATA renderConfig; + IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); + IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ); + } +#endif /*------------------------------------------------------------------------------------------* * Configure the decoder -- GitLab From 24cdbd36005219ce47aab5dc81d17870c02807df Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Mon, 26 Aug 2024 12:40:13 +0200 Subject: [PATCH 5/7] Cleanup and consolidation of rendering configuration processing --- apps/decoder.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 1ac9a7d5f9..c6a535207d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -400,6 +400,8 @@ int main( } } +#ifndef FIX_1158_FASTCONV_REVERB_HRTF + /*------------------------------------------------------------------------------------------* * Open renderer configuration reader file *------------------------------------------------------------------------------------------*/ @@ -419,14 +421,6 @@ int main( goto cleanup; } } -#ifdef FIX_1158_FASTCONV_REVERB_HRTF - else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - /* supply default renderer config for BINAURAL_ROOM_REVERB */ - IVAS_RENDER_CONFIG_DATA renderConfig; - IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); - IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ); - } #endif /*------------------------------------------------------------------------------------------* @@ -615,6 +609,17 @@ int main( goto cleanup; } +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); + + 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; + } + +#endif + if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); @@ -683,6 +688,19 @@ int main( goto cleanup; } } +#ifdef FIX_1158_FASTCONV_REVERB_HRTF + else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + /* supply default renderer config for BINAURAL_ROOM_REVERB */ + IVAS_RENDER_CONFIG_DATA renderConfig; + IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); + 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 /*------------------------------------------------------------------------------------------* * Load custom loudspeaker layout data -- GitLab From 3251ba95e90334e7cf009033b7c5831142b0936e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 28 Aug 2024 10:42:40 +0200 Subject: [PATCH 6/7] [revert] feeding default reverb config in decoder.c - this should already be handled inside the application --- apps/decoder.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 1ac9a7d5f9..1b6b7e5d57 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -419,15 +419,6 @@ int main( goto cleanup; } } -#ifdef FIX_1158_FASTCONV_REVERB_HRTF - else if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - /* supply default renderer config for BINAURAL_ROOM_REVERB */ - IVAS_RENDER_CONFIG_DATA renderConfig; - IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); - IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ); - } -#endif /*------------------------------------------------------------------------------------------* * Configure the decoder -- GitLab From 2b42f4798c076597b36819ab195c6b2be1223cd9 Mon Sep 17 00:00:00 2001 From: Marek Szczerba Date: Thu, 29 Aug 2024 14:49:18 +0200 Subject: [PATCH 7/7] Removed redundant call to IVAS_DEC_GetDefaultRenderConfig() function --- apps/decoder.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index fb9c75e80e..d8889fcb9e 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -609,14 +609,11 @@ int main( } #ifdef FIX_1158_FASTCONV_REVERB_HRTF - IVAS_DEC_GetDefaultRenderConfig( &renderConfig ); - 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; } - #endif if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK ) -- GitLab