From 13d73c6f9c88c2f2af7e99574ec5ba1528857088 Mon Sep 17 00:00:00 2001 From: norvell Date: Wed, 10 Sep 2025 21:03:36 +0200 Subject: [PATCH] Merge branch '2005_basop_Port_2240_rend_config_error' into 'main' [Non-BE][Rend Non-BE][Split Non-BE]Port MR2240 - Renderer configuration error in IVAS_dec and IVAS_rend See merge request sa4/audio/ivas-basop!2216 (cherry picked from commit f9a6af470acc89a640f67d795543b638ea70fe1a) 79fd098b Add NONBE_1377_REND_DIRATT_CONF to address Issue 1377: Error in directivity... 0ee85a5e Merge with main 0990f0fb Fix under NONBE_1377_REND_DIRATT_CONF 05ba3d7f Add id in renderer configuration struct f340cc8c Change to object id within inputIsm structs 06e93899 Merge branch 'main' into 2005_basop_Port_2240_rend_config_error b2445acf Add missing const qualifier Co-authored-by: norvell --- apps/renderer.c | 3 ++ lib_com/common_api_types.h | 1 - lib_com/options.h | 1 + lib_rend/ivas_objectRenderer_fx.c | 15 +++++++-- lib_rend/ivas_prot_rend_fx.h | 3 ++ lib_rend/lib_rend.h | 6 ++++ lib_rend/lib_rend_fx.c | 51 +++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 3 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index be10447a0..ad6d21c90 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1278,6 +1278,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 66f2c2d74..664f552c0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -343,7 +343,6 @@ typedef struct _IVAS_RENDER_CONFIG Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15} float distAtt[3]; Word32 distAtt_fx[3]; /* {Q27, Q30, Q30} */ - } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct diff --git a/lib_com/options.h b/lib_com/options.h index 6ee32a76e..e364adbd7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -96,6 +96,7 @@ #define FIX_1984_SAT_IN_PSYCHAD /* VA: Issue 1984: proposal to fix an assert */ #define NONBE_FIX_1376_MDCT_CONCEALMENT /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */ +#define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index 850debb72..0eb73f018 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -604,13 +604,16 @@ ivas_error TDREND_Update_object_positions_fx( const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ) { +#ifndef NONBE_1377_REND_DIRATT_CONF TDREND_DirAtten_t *DirAtten_p; +#endif Word16 nS; Word32 Pos_fx[3]; // Q25 Word32 Dir_fx[3]; // Q30 ivas_error error; - +#ifndef NONBE_1377_REND_DIRATT_CONF DirAtten_p = hBinRendererTd->DirAtten_p; +#endif /* For each source, write the frame data to the source object*/ FOR( nS = 0; nS < num_src; nS++ ) @@ -635,11 +638,12 @@ ivas_error TDREND_Update_object_positions_fx( { return error; } - +#ifndef NONBE_1377_REND_DIRATT_CONF IF( NE_32( ( error = TDREND_MIX_SRC_SetDirAtten_fx( hBinRendererTd, nS, DirAtten_p ) ), IVAS_ERR_OK ) ) { return error; } +#endif IF( hIsmMetaData[nS]->non_diegetic_flag ) { @@ -790,6 +794,9 @@ ivas_error ivas_td_binaural_open_ext_fx( RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const Word32 outFs, +#ifdef NONBE_1377_REND_DIRATT_CONF + const Word16 object_id, /* i: Object ID */ +#endif Word16 *SrcInd, Word16 *num_src ) { @@ -839,7 +846,11 @@ ivas_error ivas_td_binaural_open_ext_fx( if ( NULL != hRendCfg ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + directivity_fx = hRendCfg->directivity_fx + 3 * object_id; /* Address calculation -- no BASOPs */ +#else directivity_fx = hRendCfg->directivity_fx; +#endif distAtt_fx = hRendCfg->distAtt_fx; } diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 84af7ab1c..fb4b51ff0 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -687,6 +687,9 @@ ivas_error ivas_td_binaural_open_ext_fx( RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const Word32 output_Fs, +#ifdef NONBE_1377_REND_DIRATT_CONF + const Word16 object_id, /* i : Object ID */ +#endif Word16 *SrcInd, Word16 *num_src ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 05b78f670..65cd20af3 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -147,6 +147,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_fx( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index c74d77bf9..7b2b73855 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -131,6 +131,9 @@ typedef struct Word32 nonDiegeticPanGain_fx; /* Q31 */ OMASA_ANA_HANDLE hOMasa; UWord16 total_num_objects; +#ifdef NONBE_1377_REND_DIRATT_CONF + Word16 object_id; +#endif Word32 ism_metadata_delay_ms_fx; /* Q0 */ } input_ism; @@ -1493,7 +1496,11 @@ static ivas_error setRendInputActiveIsm( test(); IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, inputIsm->object_id, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -1526,7 +1533,11 @@ static ivas_error setRendInputActiveIsm( /* Open TD renderer wrappers */ FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, inputIsm->object_id, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->splitTdRendWrappers[i], inConfig, hRendCfg, NULL, *inputIsm->base.ctx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -1560,7 +1571,11 @@ static ivas_error setRendInputActiveIsm( } ELSE { +#ifdef NONBE_1377_REND_DIRATT_CONF + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, inputIsm->object_id, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -2512,7 +2527,11 @@ static ivas_error initMcBinauralRendering( { Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; +#ifdef NONBE_1377_REND_DIRATT_CONF + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, 0, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -2548,7 +2567,11 @@ static ivas_error initMcBinauralRendering( /* Open TD renderer wrappers */ FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, 0, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -4176,6 +4199,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() * -- GitLab