From d54356dbd9cac9465c27cd246e5532221a804708 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 9 Sep 2025 11:22:44 +0200 Subject: [PATCH 1/4] Fix offset in renderer directivity, found in BASOP. This syncs the code with the BASOP --- lib_rend/ivas_objectRenderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 6e836e141c..06896f2c06 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -726,7 +726,7 @@ ivas_error ivas_td_binaural_open_ext( if ( NULL != hRendCfg ) { #ifdef NONBE_1377_REND_DIRATT_CONF - ism_number = id & 0x00FF; /* Exctract ISM number from ID */ + ism_number = ( id & 0x00FF ) - 1; /* Extract ISM number from ID */ directivity = hRendCfg->directivity + 3 * ism_number; #else directivity = hRendCfg->directivity; -- GitLab From ca7b3a430bba47cd40302c29389c89e7b615778a Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 9 Sep 2025 14:32:58 +0200 Subject: [PATCH 2/4] Add id in renderer configuration struct --- lib_com/common_api_types.h | 4 ++++ lib_rend/ivas_objectRenderer.c | 8 ++------ lib_rend/ivas_prot_rend.h | 4 ++-- lib_rend/ivas_render_config.c | 4 ++++ lib_rend/lib_rend.c | 17 ++++++++++++++--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index f5b13c0dea..056a8d9da5 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -337,6 +337,10 @@ typedef struct _IVAS_RENDER_CONFIG ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; float directivity[IVAS_MAX_NUM_OBJECTS * 3]; float distAtt[3]; +#ifdef NONBE_1377_REND_DIRATT_CONF + int16_t object_id[IVAS_MAX_NUM_OBJECTS]; + int16_t number_of_objects; +#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 06896f2c06..10946f0b3c 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -680,8 +680,8 @@ ivas_error ivas_td_binaural_open_ext( RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, #ifdef NONBE_1377_REND_DIRATT_CONF - const int32_t outFs, /* i: output sampling rate */ - const IVAS_REND_InputId id /* i: ISM ID */ + const int32_t outFs, /* i: output sampling rate */ + const int16_t ism_number /* i: ISM number */ ) #else const int32_t outFs ) @@ -692,9 +692,6 @@ ivas_error ivas_td_binaural_open_ext( IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; -#ifdef NONBE_1377_REND_DIRATT_CONF - int16_t ism_number; -#endif float *distAtt = NULL; float *directivity = NULL; @@ -726,7 +723,6 @@ ivas_error ivas_td_binaural_open_ext( if ( NULL != hRendCfg ) { #ifdef NONBE_1377_REND_DIRATT_CONF - ism_number = ( id & 0x00FF ) - 1; /* Extract ISM number from ID */ directivity = hRendCfg->directivity + 3 * ism_number; #else directivity = hRendCfg->directivity; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 2617bae683..354076e8d8 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -662,8 +662,8 @@ ivas_error ivas_td_binaural_open_ext( RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, #ifdef NONBE_1377_REND_DIRATT_CONF - const int32_t outFs, /* i: output sampling rate */ - const IVAS_REND_InputId id /* i: ISM ID */ + const int32_t output_Fs, /* i: output sampling rate */ + const int16_t ism_number /* i: ISM number */ #else const int32_t output_Fs #endif diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index c3a39b426e..1e9bed9b10 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -136,6 +136,10 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->distAtt[1] = 1.0f; /* Default ref dist */ ( *hRenderConfig )->distAtt[2] = 1.0f; /* Default rolloff factor */ +#ifdef NONBE_1377_REND_DIRATT_CONF + ( *hRenderConfig )->number_of_objects = 0; +#endif + /* ISAR-related parameters */ ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE; ( *hRenderConfig )->split_rend_config.dof = 3; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4d12d71e39..656d6c75f8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1569,6 +1569,9 @@ static ivas_error setRendInputActiveIsm( AUDIO_CONFIG outConfig; input_ism *inputIsm; int16_t i; +#ifdef NONBE_1377_REND_DIRATT_CONF + int16_t ism_number; +#endif inputIsm = (input_ism *) input; rendCtx = inputIsm->base.ctx; @@ -1609,7 +1612,11 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { #ifdef NONBE_1377_REND_DIRATT_CONF - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, id ) ) != IVAS_ERR_OK ) + ism_number = hRendCfg->number_of_objects; + hRendCfg->object_id[ism_number] = id; + hRendCfg->number_of_objects++; + + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -1621,7 +1628,7 @@ static ivas_error setRendInputActiveIsm( for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { #ifdef NONBE_1377_REND_DIRATT_CONF - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, id ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -1643,7 +1650,11 @@ static ivas_error setRendInputActiveIsm( else { #ifdef NONBE_1377_REND_DIRATT_CONF - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, id ) ) != IVAS_ERR_OK ) + ism_number = hRendCfg->number_of_objects; + hRendCfg->object_id[ism_number] = id; + hRendCfg->number_of_objects++; + + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif -- GitLab From 64a77f08e39587a14d93408ace303147ffe63c07 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 9 Sep 2025 22:01:53 +0200 Subject: [PATCH 3/4] Change to object id within inputIsm structs --- apps/renderer.c | 3 +++ lib_com/common_api_types.h | 4 --- lib_rend/ivas_objectRenderer.c | 4 +-- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/ivas_render_config.c | 4 --- lib_rend/lib_rend.c | 48 ++++++++++++++++++++++++---------- lib_rend/lib_rend.h | 6 +++++ 7 files changed, 46 insertions(+), 25 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 26c4b349d2..18e0f838e3 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1228,6 +1228,9 @@ int main( { masaIds[i] = 0u; } +#ifdef NONBE_1377_REND_DIRATT_CONF + IVAS_REND_SetObjectIDs( hIvasRend ); +#endif for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i ) { diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 056a8d9da5..f5b13c0dea 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -337,10 +337,6 @@ typedef struct _IVAS_RENDER_CONFIG ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; float directivity[IVAS_MAX_NUM_OBJECTS * 3]; float distAtt[3]; -#ifdef NONBE_1377_REND_DIRATT_CONF - int16_t object_id[IVAS_MAX_NUM_OBJECTS]; - int16_t number_of_objects; -#endif } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 10946f0b3c..d016ed0da4 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -681,7 +681,7 @@ ivas_error ivas_td_binaural_open_ext( LSSETUP_CUSTOM_STRUCT *customLsInput, #ifdef NONBE_1377_REND_DIRATT_CONF const int32_t outFs, /* i: output sampling rate */ - const int16_t ism_number /* i: ISM number */ + const int16_t object_id /* i: Object ID */ ) #else const int32_t outFs ) @@ -723,7 +723,7 @@ ivas_error ivas_td_binaural_open_ext( if ( NULL != hRendCfg ) { #ifdef NONBE_1377_REND_DIRATT_CONF - directivity = hRendCfg->directivity + 3 * ism_number; + directivity = hRendCfg->directivity + 3 * object_id; #else directivity = hRendCfg->directivity; #endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 354076e8d8..32c2992c1a 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -663,7 +663,7 @@ ivas_error ivas_td_binaural_open_ext( LSSETUP_CUSTOM_STRUCT *customLsInput, #ifdef NONBE_1377_REND_DIRATT_CONF const int32_t output_Fs, /* i: output sampling rate */ - const int16_t ism_number /* i: ISM number */ + const int16_t object_id /* i: Object ID */ #else const int32_t output_Fs #endif diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 1e9bed9b10..c3a39b426e 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -136,10 +136,6 @@ ivas_error ivas_render_config_init_from_rom( ( *hRenderConfig )->distAtt[1] = 1.0f; /* Default ref dist */ ( *hRenderConfig )->distAtt[2] = 1.0f; /* Default rolloff factor */ -#ifdef NONBE_1377_REND_DIRATT_CONF - ( *hRenderConfig )->number_of_objects = 0; -#endif - /* ISAR-related parameters */ ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE; ( *hRenderConfig )->split_rend_config.dof = 3; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 656d6c75f8..645a23f2c8 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -122,6 +122,9 @@ typedef struct float nonDiegeticPanGain; OMASA_ANA_HANDLE hOMasa; uint16_t total_num_objects; +#ifdef NONBE_1377_REND_DIRATT_CONF + int16_t object_id; +#endif float ism_metadata_delay_ms; } input_ism; @@ -1569,9 +1572,6 @@ static ivas_error setRendInputActiveIsm( AUDIO_CONFIG outConfig; input_ism *inputIsm; int16_t i; -#ifdef NONBE_1377_REND_DIRATT_CONF - int16_t ism_number; -#endif inputIsm = (input_ism *) input; rendCtx = inputIsm->base.ctx; @@ -1612,11 +1612,7 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { #ifdef NONBE_1377_REND_DIRATT_CONF - ism_number = hRendCfg->number_of_objects; - hRendCfg->object_id[ism_number] = id; - hRendCfg->number_of_objects++; - - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, inputIsm->object_id ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -1628,7 +1624,7 @@ static ivas_error setRendInputActiveIsm( for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { #ifdef NONBE_1377_REND_DIRATT_CONF - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, inputIsm->object_id ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -1650,11 +1646,7 @@ static ivas_error setRendInputActiveIsm( else { #ifdef NONBE_1377_REND_DIRATT_CONF - ism_number = hRendCfg->number_of_objects; - hRendCfg->object_id[ism_number] = id; - hRendCfg->number_of_objects++; - - if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, ism_number ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, inputIsm->object_id ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_td_binaural_open_ext( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -3970,6 +3962,34 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return IVAS_ERR_OK; } +#ifdef NONBE_1377_REND_DIRATT_CONF +/*-------------------------------------------------------------------* + * IVAS_REND_SetObjectIDs() + * + * + *-------------------------------------------------------------------*/ + +ivas_error IVAS_REND_SetObjectIDs( + IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ +) +{ + int16_t i; + + /* Validate function arguments */ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + hIvasRend->inputsIsm[i].object_id = i; + } + + return IVAS_ERR_OK; +} +#endif + /*-------------------------------------------------------------------* * IVAS_REND_SetInputGain() diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index ac9516521d..4df7d85961 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -152,6 +152,12 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( const IVAS_CUSTOM_LS_DATA layout /* i : custom loudspeaker layout for input */ ); +#ifdef NONBE_1377_REND_DIRATT_CONF +ivas_error IVAS_REND_SetObjectIDs( + IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ +); +#endif + ivas_error IVAS_REND_SetInputGain( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ -- GitLab From dfdff212d7078c53c02c951284f8154de93523af Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Tue, 9 Sep 2025 22:05:11 +0200 Subject: [PATCH 4/4] Merge with main and clang format --- lib_rend/ivas_objectRenderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index d016ed0da4..f0fb90fe4e 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -680,7 +680,7 @@ ivas_error ivas_td_binaural_open_ext( RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, #ifdef NONBE_1377_REND_DIRATT_CONF - const int32_t outFs, /* i: output sampling rate */ + const int32_t outFs, /* i: output sampling rate */ const int16_t object_id /* i: Object ID */ ) #else -- GitLab