diff --git a/apps/renderer.c b/apps/renderer.c index a01cb40c231bec33e04a32d8b4d3ce0d544cd0de..b843a718b15f1c56af992d64b81b8491c14c98f8 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1189,6 +1189,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/options.h b/lib_com/options.h index 5971079660860676f3ab1b3a3a783961c4cc0327..0c4477f3524e554bfd8619cbbe14663cc483a767 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define NONBE_FIX_1143_MASA_BRSW /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */ #define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */ #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.c b/lib_rend/ivas_objectRenderer.c index 1b5a7d0493224bcf0d653b67f8a030c91f8efe59..879aa5e90fcf6dc2903ba71382346ddd38659bbc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -518,13 +518,16 @@ ivas_error TDREND_Update_object_positions( const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ) { +#ifndef NONBE_1377_REND_DIRATT_CONF TDREND_DirAtten_t *DirAtten_p; +#endif int16_t nS; float Pos[3]; float Dir[3]; 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++ ) @@ -541,10 +544,12 @@ ivas_error TDREND_Update_object_positions( return error; } +#ifndef NONBE_1377_REND_DIRATT_CONF if ( ( error = TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; } +#endif if ( hIsmMetaData[nS]->non_diegetic_flag ) { @@ -654,7 +659,13 @@ ivas_error ivas_td_binaural_open_ext( AUDIO_CONFIG inConfig, 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 int16_t object_id /* i: Object ID */ +) +#else const int32_t outFs ) +#endif { int16_t nchan_transport; AUDIO_CONFIG transport_config; @@ -691,7 +702,11 @@ ivas_error ivas_td_binaural_open_ext( if ( NULL != hRendCfg ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + directivity = hRendCfg->directivity + 3 * object_id; +#else directivity = hRendCfg->directivity; +#endif distAtt = hRendCfg->distAtt; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 1e8ffa6bc9a248395faa3aa7de127de5b6715c90..6d6f0c141723f9f4fcb69d0b4eaeca7c5d5ea217 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -641,7 +641,12 @@ ivas_error ivas_td_binaural_open_ext( const AUDIO_CONFIG inConfig, RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, +#ifdef NONBE_1377_REND_DIRATT_CONF + const int32_t output_Fs, /* i: output sampling rate */ + const int16_t object_id /* i: Object ID */ +#else const int32_t output_Fs +#endif ); void ivas_td_binaural_close( diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 68d5d45587947310d29272fe629699c22a7ce0e3..628421352a518481a370efdc58825a0cbe25c72a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -119,6 +119,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; @@ -1326,7 +1329,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, 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 { return error; } @@ -1334,7 +1341,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 ( ( 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 { return error; } @@ -1352,7 +1363,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, 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 { return error; } @@ -2107,7 +2122,11 @@ static ivas_error initMcBinauralRendering( if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) { +#ifdef NONBE_1377_REND_DIRATT_CONF + if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -2117,7 +2136,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 ( ( error = ivas_td_binaural_open_ext( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate, 0 ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_td_binaural_open_ext( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -3595,6 +3618,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 8e3353b1b88f0530fa0d10a8a81f724fee97fe44..463e1a88220f98460ebcbdb8158a957c1e575cd6 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -145,6 +145,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 */