From 4239e4dfe96c03361dcff6da4d0c534136df8e76 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Mon, 11 Aug 2025 11:44:58 +0300 Subject: [PATCH] Port float MR 1765 to float reference. --- apps/decoder.c | 2 ++ apps/renderer.c | 2 ++ lib_com/common_api_types.h | 2 ++ lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 8 ++++++++ lib_dec/lib_dec.c | 4 ++++ lib_rend/ivas_dirac_dec_binaural_functions.c | 14 +++++++++++++- lib_rend/ivas_render_config.c | 2 ++ lib_rend/ivas_reverb.c | 6 ++++++ lib_rend/lib_rend.c | 17 +++++++++++++++++ 10 files changed, 57 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index a091cbe30..93f810434 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -686,7 +686,9 @@ int main( #endif goto cleanup; } +#ifndef FIX_587_DEFAULT_REVERB renderConfig.roomAcoustics.override = true; +#endif } /* ISAR frame size is set from command line, not renderer config file. * This will be ignored if output format is not split rendering. */ diff --git a/apps/renderer.c b/apps/renderer.c index f00fbd26d..5fd153351 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1106,7 +1106,9 @@ int main( #endif goto cleanup; } +#ifndef FIX_587_DEFAULT_REVERB renderConfig.roomAcoustics.override = 1; +#endif } /* ISAR frame size is set from command line, not renderer config file. diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index d6960671d..ce12d5db6 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -300,7 +300,9 @@ typedef enum typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { +#ifndef FIX_587_DEFAULT_REVERB int16_t override; +#endif int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ diff --git a/lib_com/options.h b/lib_com/options.h index 0d656624d..7c3827bf5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -203,6 +203,7 @@ #define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ #define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */ +#define FIX_587_DEFAULT_REVERB /* Philips: issue 587: inconsistent default reverb parameters across renderers */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index fd7c313db..67c0be985 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1053,6 +1053,9 @@ ivas_error ivas_binRenderer_open( int16_t convBand, chIdx, k; #endif ivas_error error; +#ifdef FIX_587_DEFAULT_REVERB + const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; +#endif error = IVAS_ERR_OK; @@ -1192,7 +1195,12 @@ ivas_error ivas_binRenderer_open( /* Allocate memories needed for reverb module */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { +#ifdef FIX_587_DEFAULT_REVERB + pRoomAcoustics = ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ? &( st_ivas->hRenderConfig->roomAcoustics ) : NULL; + if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b6e424853..1884186ce 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2089,7 +2089,9 @@ static ivas_error copyRendererConfigStruct( break; } #endif +#ifndef FIX_587_DEFAULT_REVERB hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; +#endif hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; @@ -2185,7 +2187,9 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; } #endif +#ifndef FIX_587_DEFAULT_REVERB hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; +#endif hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 9c92a9d3d..0aab6f660 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -154,7 +154,9 @@ ivas_error ivas_dirac_dec_init_binaural_data( ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; int16_t num_poses, pos_idx; - +#ifdef FIX_587_DEFAULT_REVERB + const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; +#endif num_poses = 1; if ( st_ivas->hSplitBinRend != NULL ) { @@ -235,10 +237,16 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#ifdef FIX_587_DEFAULT_REVERB + pRoomAcoustics = NULL; +#endif } else { set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_587_DEFAULT_REVERB + pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics ); +#endif } #else mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); @@ -257,7 +265,11 @@ ivas_error ivas_dirac_dec_init_binaural_data( if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF +#ifdef FIX_587_DEFAULT_REVERB + if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin->parametricReverberationTimes, st_ivas->hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 7ab194970..6a6ac6130 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -112,7 +112,9 @@ ivas_error ivas_render_config_init_from_rom( #ifdef DEBUGGING ( *hRenderConfig )->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; #endif +#ifndef FIX_587_DEFAULT_REVERB ( *hRenderConfig )->roomAcoustics.override = FALSE; +#endif ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_PRE_DELAY; ( *hRenderConfig )->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_INPUT_DELAY; diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index b8afc9520..5c3a4d645 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1179,7 +1179,9 @@ ivas_error ivas_reverb_open( #ifdef DEBUGGING pState->pConfig.renderer_type_override = hRenderConfig->renderer_type_override; #endif +#ifndef FIX_587_DEFAULT_REVERB pState->pConfig.roomAcoustics.override = hRenderConfig->roomAcoustics.override; +#endif pState->pConfig.roomAcoustics.nBands = hRenderConfig->roomAcoustics.nBands; if ( hRenderConfig->roomAcoustics.use_er == 1 ) @@ -1967,7 +1969,11 @@ ivas_error ivas_binaural_reverb_init( error = IVAS_ERR_OK; +#ifdef FIX_587_DEFAULT_REVERB + if ( roomAcoustics != NULL ) +#else if ( ( roomAcoustics != NULL ) && roomAcoustics->override ) +#endif { revTimes = t60; revEne = ene; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e5f94fc2f..4bd233487 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4170,7 +4170,9 @@ int16_t IVAS_REND_GetRenderConfig( break; } #endif +#ifndef FIX_587_DEFAULT_REVERB hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; +#endif hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; @@ -4230,7 +4232,9 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->renderer_type_override = renderConfig.renderer_type_override; #endif +#ifndef FIX_587_DEFAULT_REVERB hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; +#endif hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; @@ -8285,6 +8289,9 @@ static ivas_error ivas_masa_ext_rend_parambin_init( ivas_error error; float frequency_axis[CLDFB_NO_CHANNELS_MAX]; int16_t pos_idx; +#ifdef FIX_587_DEFAULT_REVERB + const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics; +#endif error = IVAS_ERR_OK; @@ -8363,10 +8370,16 @@ static ivas_error ivas_masa_ext_rend_parambin_init( if ( *inputMasa->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); +#ifdef FIX_587_DEFAULT_REVERB + pRoomAcoustics = NULL; +#endif } else { set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_587_DEFAULT_REVERB + pRoomAcoustics = &( hRendCfg->roomAcoustics ); +#endif } #else mvr2r( ( *phHrtfParambin )->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); @@ -8378,7 +8391,11 @@ static ivas_error ivas_masa_ext_rend_parambin_init( if ( hDiracDecBin->hReverb == NULL && pos_idx == 0 ) /* open reverb only for the main direction */ { #ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF +#ifdef FIX_587_DEFAULT_REVERB + if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes, ( *phHrtfParambin )->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRendCfg->roomAcoustics ), output_Fs, hHrtfParambin->parametricReverberationTimes, hHrtfParambin->parametricReverberationEneCorrections ) ) != IVAS_ERR_OK ) #endif -- GitLab