From 3d72a4bd319d4c7fac565cca03295019f3e724f3 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 17 Sep 2025 18:24:20 +0300 Subject: [PATCH 1/7] Apply diegetic PI data in rendering --- apps/decoder.c | 9 +++++++++ lib_dec/ivas_objectRenderer_internal.c | 12 ++++++++++++ lib_dec/lib_dec.c | 25 ++++++++++++++++++++++++ lib_dec/lib_dec.h | 7 +++++++ lib_rend/ivas_objectRenderer.c | 27 ++++++++++++++++++++++++++ lib_rend/ivas_prot_rend.h | 6 ++++++ lib_rend/ivas_rotation.c | 25 ++++++++++++++++++++++++ lib_rend/ivas_stat_rend.h | 4 ++++ 8 files changed, 115 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index f2f0e31b3d..a28d5d6023 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -534,6 +534,15 @@ static ivas_error IVAS_RTP_ApplyPiData( IVAS_RTP *rtp, IVAS_DEC_HANDLE hIvasDec, } break; +#ifdef RTP_S4_251135_CR26253_0016_REV1 + case IVAS_PI_DIEGETIC_TYPE: + { + DEBUG_PRINT( stdout, "PI_DIEGETIC_TYPE : %d, %d, %d, %d, %d\n", piData->data.digeticIndicator.isDiegetic[0], piData->data.digeticIndicator.isDiegetic[1], piData->data.digeticIndicator.isDiegetic[2], piData->data.digeticIndicator.isDiegetic[3], piData->data.digeticIndicator.isDiegetic[4] ); + IVAS_DEC_setDiegeticInputPI( hIvasDec, piData->data.digeticIndicator.isDiegetic ); + } + break; + +#endif default: { fprintf( stderr, "Unhandled PI data of type : %s\n", PiDataNames[piDataType] ); diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ff47b1b9a7..353c15d43c 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -206,14 +206,26 @@ ivas_error ivas_td_binaural_renderer_sf( hIsmMetaData[nS] = &ismMetaData[nS]; } +#ifdef RTP_S4_251135_CR26253_0016_REV1 + if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) +#else if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) +#endif { return error; } } else { +#ifdef RTP_S4_251135_CR26253_0016_REV1 + if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL, + ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) +#else if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 4d27cb168e..b46def86e4 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3827,6 +3827,31 @@ void IVAS_DEC_resetExternalOrientations( } +#endif +#ifdef RTP_S4_251135_CR26253_0016_REV1 +/*---------------------------------------------------------------------* + * IVAS_DEC_setDiegeticInput( ) + * + * Set isDiegeticInput flag for combined orientation handle based on PI data. + *---------------------------------------------------------------------*/ + +void IVAS_DEC_setDiegeticInputPI( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const bool *diegeticPIValues /* i : diegetic values for the input stream */ +) +{ + if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL ) + { + int8_t i; + for ( i = 0; i < 4; i++ ) + { + hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPI[i] = diegeticPIValues[i]; + } + hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPISet = true; + } +} + + #endif /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_IsEmpty( ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 2e98d9e0f1..caed7bd54b 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -349,6 +349,13 @@ void IVAS_DEC_resetExternalOrientations( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); +#endif +#ifdef RTP_S4_251135_CR26253_0016_REV1 +void IVAS_DEC_setDiegeticInputPI( + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const bool *diegeticPIValues /* i : diegetic values for the input stream */ +); + #endif /* Setter functions - apply changes to decoder configuration */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index f0fb90fe4e..c467838971 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -363,7 +363,13 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( subframe_idx == ism_md_subframe_update ) { /* Update object position(s) */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 + if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData, + ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPI : NULL, + ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) +#else if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -531,7 +537,13 @@ ivas_error TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 + const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ + const bool *isDiegeticInputPI, /* i : diegetic values for the input streams from the PI data */ + const bool isDiegeticInputPISet /* i : is diegetic values obtained from PI data */ +#else const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ +#endif ) { #ifndef NONBE_1377_REND_DIRATT_CONF @@ -544,6 +556,9 @@ ivas_error TDREND_Update_object_positions( #ifndef NONBE_1377_REND_DIRATT_CONF DirAtten_p = hBinRendererTd->DirAtten_p; #endif +#ifdef RTP_S4_251135_CR26253_0016_REV1 + bool isDiegeticSrcPI; +#endif /* For each source, write the frame data to the source object*/ for ( nS = 0; nS < num_src; nS++ ) @@ -571,7 +586,19 @@ ivas_error TDREND_Update_object_positions( return error; } +#ifdef RTP_S4_251135_CR26253_0016_REV1 + isDiegeticSrcPI = false; + if ( isDiegeticInputPISet && isDiegeticInputPI != NULL ) + { + if ( isDiegeticInputPI[nS] ) + { + isDiegeticSrcPI = true; + } + } + if ( hIsmMetaData[nS]->non_diegetic_flag || !isDiegeticSrcPI ) +#else if ( hIsmMetaData[nS]->non_diegetic_flag ) +#endif { Pos[0] = 0; Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 937923c338..e3d205cd25 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -691,7 +691,13 @@ ivas_error TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 + const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ + const bool *isDiegeticInputPI, /* i : diegetic values for the input streams from the PI data */ + const bool isDiegeticInputPISet /* i : is diegetic values obtained from PI data */ +#else const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ +#endif ); void BSplineModelEvalDealloc( diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 9a1d74581d..05fb92cd18 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -862,6 +862,14 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->subframe_idx = 0; ( *hCombinedOrientationData )->subframe_size = (int16_t) ( fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); ( *hCombinedOrientationData )->cur_subframe_samples_rendered = 0; +#ifdef RTP_S4_251135_CR26253_0016_REV1 + + for ( i = 0; i < 4; i++ ) + { + ( *hCombinedOrientationData )->isDiegeticInputPI[i] = true; + } + ( *hCombinedOrientationData )->isDiegeticInputPISet = false; +#endif return IVAS_ERR_OK; } @@ -1023,10 +1031,27 @@ ivas_error combine_external_and_head_orientations( else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) { /* Head rotation only */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 + if ( hCombinedOrientationData->isDiegeticInputPISet && !hCombinedOrientationData->isDiegeticInputPI[0] && !hCombinedOrientationData->isDiegeticInputPI[1] && !hCombinedOrientationData->isDiegeticInputPI[2] && !hCombinedOrientationData->isDiegeticInputPI[3] && !hCombinedOrientationData->isDiegeticInputPI[4] ) + { + for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->Quaternions[i] = identity; + } + } + else + { + for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) + { + hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; + } + } +#else for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; } +#endif } if ( hExtOrientationData != NULL ) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 69fcb30fb8..fb8bf44b83 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -710,6 +710,10 @@ typedef struct ivas_combined_orientation_struct int16_t cur_subframe_samples_rendered; int16_t subframe_idx_start; int16_t cur_subframe_samples_rendered_start; +#ifdef RTP_S4_251135_CR26253_0016_REV1 + bool isDiegeticInputPI[5]; + bool isDiegeticInputPISet; +#endif } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; /*----------------------------------------------------------------------------------* -- GitLab From 4aca7e15cb57d2b40dd553c056279b7502c3dd57 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 24 Sep 2025 15:18:53 +0300 Subject: [PATCH 2/7] Remove diegetic PI interpretation from individual ISM rendering --- lib_dec/ivas_objectRenderer_internal.c | 12 ------------ lib_rend/ivas_objectRenderer.c | 27 -------------------------- lib_rend/ivas_prot_rend.h | 6 ------ 3 files changed, 45 deletions(-) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 353c15d43c..ff47b1b9a7 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -206,26 +206,14 @@ ivas_error ivas_td_binaural_renderer_sf( hIsmMetaData[nS] = &ismMetaData[nS]; } -#ifdef RTP_S4_251135_CR26253_0016_REV1 - if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData, - ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL, - ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) -#else if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) -#endif { return error; } } else { -#ifdef RTP_S4_251135_CR26253_0016_REV1 - if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData, - ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPI : NULL, - ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) -#else if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index c467838971..f0fb90fe4e 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -363,13 +363,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( subframe_idx == ism_md_subframe_update ) { /* Update object position(s) */ -#ifdef RTP_S4_251135_CR26253_0016_REV1 - if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData, - ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPI : NULL, - ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->isDiegeticInputPISet : false ) ) != IVAS_ERR_OK ) -#else if ( ( error = TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -537,13 +531,7 @@ ivas_error TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ -#ifdef RTP_S4_251135_CR26253_0016_REV1 - const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ - const bool *isDiegeticInputPI, /* i : diegetic values for the input streams from the PI data */ - const bool isDiegeticInputPISet /* i : is diegetic values obtained from PI data */ -#else const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#endif ) { #ifndef NONBE_1377_REND_DIRATT_CONF @@ -556,9 +544,6 @@ ivas_error TDREND_Update_object_positions( #ifndef NONBE_1377_REND_DIRATT_CONF DirAtten_p = hBinRendererTd->DirAtten_p; #endif -#ifdef RTP_S4_251135_CR26253_0016_REV1 - bool isDiegeticSrcPI; -#endif /* For each source, write the frame data to the source object*/ for ( nS = 0; nS < num_src; nS++ ) @@ -586,19 +571,7 @@ ivas_error TDREND_Update_object_positions( return error; } -#ifdef RTP_S4_251135_CR26253_0016_REV1 - isDiegeticSrcPI = false; - if ( isDiegeticInputPISet && isDiegeticInputPI != NULL ) - { - if ( isDiegeticInputPI[nS] ) - { - isDiegeticSrcPI = true; - } - } - if ( hIsmMetaData[nS]->non_diegetic_flag || !isDiegeticSrcPI ) -#else if ( hIsmMetaData[nS]->non_diegetic_flag ) -#endif { Pos[0] = 0; Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index e3d205cd25..937923c338 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -691,13 +691,7 @@ ivas_error TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ -#ifdef RTP_S4_251135_CR26253_0016_REV1 - const ISM_METADATA_HANDLE *hIsmMetaData, /* i : Input metadata for ISM objects */ - const bool *isDiegeticInputPI, /* i : diegetic values for the input streams from the PI data */ - const bool isDiegeticInputPISet /* i : is diegetic values obtained from PI data */ -#else const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#endif ); void BSplineModelEvalDealloc( -- GitLab From 116bacde489de22f0a5c202a0477335171278399 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Wed, 24 Sep 2025 16:41:10 +0300 Subject: [PATCH 3/7] Begin audio focus PI implementation --- apps/decoder.c | 36 +++++++++++-- lib_util/ivas_rtp_pi_data.c | 103 +++++++++++++++++++++++++++++++++--- lib_util/ivas_rtp_pi_data.h | 42 +++++++++++++-- tests/rtp/ivasrtp.py | 34 ++++++++++-- tests/rtp/test_rtp.py | 3 +- 5 files changed, 198 insertions(+), 20 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a28d5d6023..df7dcf5168 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -216,8 +216,8 @@ static const char *PiDataNames[IVAS_PI_MAX_ID] = { "SCENE_ORIENTATION", "DEVICE_ORIENTATION_COMPENSATED", "DEVICE_ORIENTATION_UNCOMPENSATED", "ACOUSTIC_ENVIRONMENT", "AUDIO_DESCRIPTION", "ISM_NUM", "ISM_ID", "ISM_GAIN", "ISM_ORIENTATION", "ISM_POSITION", "ISM_DISTANCE_ATTENUATION", "ISM_DIRECTIVITY", "DIEGETIC_TYPE", "RESERVED13", - "RESERVED14", "RESERVED15", "PLAYBACK_DEVICE_ORIENTATION", "HEAD_ORIENTATION", "LISTENER_POSITION", - "DYNAMIC_AUDIO_SUPPRESSION", "AUDIO_FOCUS_DIRECTION", "PI_LATENCY", "R_ISM_ID", "R_ISM_GAIN", + "AUDIO_FOCUS_INDICATION", "RESERVED15", "PLAYBACK_DEVICE_ORIENTATION", "HEAD_ORIENTATION", "LISTENER_POSITION", + "DYNAMIC_AUDIO_SUPPRESSION", "AUDIO_FOCUS_REQUEST", "PI_LATENCY", "R_ISM_ID", "R_ISM_GAIN", "R_ISM_ORIENTATION", "R_ISM_POSITION", "R_ISM_DIRECTION", "RESERVED27", "RESERVED28", "RESERVED29", "RESERVED30", "NO_DATA" }; @@ -261,7 +261,6 @@ static void IVAS_RTP_LogPiData( FILE *f_piDataOut, PIDATA_TS *piData, uint32_t n #ifdef RTP_S4_251135_CR26253_0016_REV1 case IVAS_PI_PLAYBACK_DEVICE_ORIENTATION: case IVAS_PI_HEAD_ORIENTATION: - case IVAS_PI_AUDIO_FOCUS_DIRECTION: case IVAS_PI_R_ISM_ORIENTATION: #endif { @@ -327,6 +326,21 @@ static void IVAS_RTP_LogPiData( FILE *f_piDataOut, PIDATA_TS *piData, uint32_t n fprintf( f_piDataOut, "\t\t\t]\n\t\t}" ); } break; + case IVAS_PI_AUDIO_FOCUS_INDICATION: + { + fprintf( f_piDataOut, "{\n" ); + if ( cur->data.focusIndication.availDirection ) + { + fprintf( f_piDataOut, "\t\t\t\"w\": %f,\n\t\t\t\"x\": %f,\n\t\t\t\"y\": %f,\n\t\t\t\"z\": %f \n\t\t\t", + cur->data.focusIndication.direction.w, cur->data.focusIndication.direction.x, cur->data.focusIndication.direction.y, cur->data.focusIndication.direction.z ); + } + if ( cur->data.focusIndication.availLevel ) + { + fprintf( f_piDataOut, "\t\t\t\"level\": %d", cur->data.focusIndication.flvl ); + } + fprintf( f_piDataOut, "\n\t\t}" ); + } + break; case IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION: { IVAS_PIDATA_DYNAMIC_SUPPRESSION *das = &cur->data.dynSuppression; @@ -339,7 +353,21 @@ static void IVAS_RTP_LogPiData( FILE *f_piDataOut, PIDATA_TS *piData, uint32_t n } break; case IVAS_PI_RESERVED13: - case IVAS_PI_RESERVED14: + case IVAS_PI_AUDIO_FOCUS_REQUEST: + { + fprintf( f_piDataOut, "{\n" ); + if ( cur->data.focusRequest.availDirection ) + { + fprintf( f_piDataOut, "\t\t\t\"w\": %f,\n\t\t\t\"x\": %f,\n\t\t\t\"y\": %f,\n\t\t\t\"z\": %f \n\t\t\t", + cur->data.focusRequest.direction.w, cur->data.focusRequest.direction.x, cur->data.focusRequest.direction.y, cur->data.focusRequest.direction.z ); + } + if ( cur->data.focusRequest.availLevel ) + { + fprintf( f_piDataOut, "\t\t\t\"level\": %d", cur->data.focusRequest.flvl ); + } + fprintf( f_piDataOut, "\n\t\t}" ); + } + break; case IVAS_PI_RESERVED15: case IVAS_PI_RESERVED27: case IVAS_PI_RESERVED28: diff --git a/lib_util/ivas_rtp_pi_data.c b/lib_util/ivas_rtp_pi_data.c index e7dcde8998..24ecabe6e8 100644 --- a/lib_util/ivas_rtp_pi_data.c +++ b/lib_util/ivas_rtp_pi_data.c @@ -132,7 +132,7 @@ static ivas_error packOrientation( const IVAS_PIDATA_GENERIC *piData, uint8_t *b if ( ( piData->piDataType != IVAS_PI_SCENE_ORIENTATION ) && ( piData->piDataType != IVAS_PI_DEVICE_ORIENTATION_COMPENSATED ) && ( piData->piDataType != IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED ) #ifdef RTP_S4_251135_CR26253_0016_REV1 - && ( piData->piDataType != IVAS_PI_PLAYBACK_DEVICE_ORIENTATION ) && ( piData->piDataType != IVAS_PI_HEAD_ORIENTATION ) && ( piData->piDataType != IVAS_PI_AUDIO_FOCUS_DIRECTION ) + && ( piData->piDataType != IVAS_PI_PLAYBACK_DEVICE_ORIENTATION ) && ( piData->piDataType != IVAS_PI_HEAD_ORIENTATION ) #endif /* RTP_S4_251135_CR26253_0016_REV1 */ ) { @@ -544,6 +544,95 @@ static ivas_error unpackDiegetic( const uint8_t *buffer, uint32_t numDataBytes, return IVAS_ERR_OK; } +static ivas_error packAudioFocusCommon( const IVAS_PIDATA_GENERIC *piData, uint8_t *buffer, uint32_t maxDataBytes, uint32_t *nBytesWritten ) +{ + uint32_t nBytes = 0; + uint8_t packedSize = 1; + const IVAS_PIDATA_AUDIO_FOCUS *audioFocus = (const IVAS_PIDATA_AUDIO_FOCUS *) piData; + + *nBytesWritten = 0; + + if ( piData->size != sizeof( IVAS_PIDATA_AUDIO_FOCUS ) ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Incorrect size in PI data of type Audio Focus" ); + } + + if ( audioFocus->availDirection && audioFocus->availLevel ) + { + packedSize = 9; + } + else if ( audioFocus->availDirection ) + { + packedSize = 8; + } + else if ( audioFocus->availLevel ) + { + packedSize = 1; + } + else + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Neither direction or level is available for packing Audio Focus" ); + } + + /* Audio Focus data is packedSize bytes, header is 2 bytes */ + if ( maxDataBytes < (uint32_t) packedSize + 2 ) + { + return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Insufficient space to pack Audio Focus PI data" ); + } + + buffer[nBytes++] = ( audioFocus->piDataType & MASK_5BIT ); /* PF/PM populated during final packing */ + buffer[nBytes++] = packedSize; + + if ( packedSize == 9 || packedSize == 8 ) + { + nBytes = writeInt16( buffer, nBytes, ivasPayload_convertToQ15( audioFocus->direction.w ) ); + nBytes = writeInt16( buffer, nBytes, ivasPayload_convertToQ15( audioFocus->direction.x ) ); + nBytes = writeInt16( buffer, nBytes, ivasPayload_convertToQ15( audioFocus->direction.y ) ); + nBytes = writeInt16( buffer, nBytes, ivasPayload_convertToQ15( audioFocus->direction.z ) ); + } + if ( packedSize == 9 || packedSize == 1) + { + buffer[nBytes++] = ( (uint8_t) audioFocus->flvl & MASK_4BIT ) << 4; + } + + *nBytesWritten = nBytes; + return IVAS_ERR_OK; +} + +static ivas_error unpackAudioFocusCommon( const uint8_t *buffer, uint32_t numDataBytes, IVAS_PIDATA_GENERIC *piData ) +{ + IVAS_PIDATA_AUDIO_FOCUS *audioFocus = (IVAS_PIDATA_AUDIO_FOCUS *) piData; + + /* Audio Focus data is either 1, 8 or 9 bytes */ + if ( numDataBytes != 1 && numDataBytes != 8 && numDataBytes != 9 ) + { + return IVAS_ERROR( IVAS_ERR_RTP_UNPACK_PI_DATA, "Incorrect size to unpack PI data of type Audio Focus" ); + } + + piData->size = sizeof( IVAS_PIDATA_AUDIO_FOCUS ); + audioFocus->availDirection = ( numDataBytes >= 8 ); + audioFocus->availLevel = ( numDataBytes == 1 || numDataBytes == 9 ); + + if ( numDataBytes == 1 ) + { + audioFocus->flvl = ( buffer[0] >> 4 ); + } + else + { + audioFocus->direction.w = FLOAT_FROM_Q15( readInt16( &buffer[0] ) ); + audioFocus->direction.x = FLOAT_FROM_Q15( readInt16( &buffer[2] ) ); + audioFocus->direction.y = FLOAT_FROM_Q15( readInt16( &buffer[4] ) ); + audioFocus->direction.z = FLOAT_FROM_Q15( readInt16( &buffer[6] ) ); + + if ( numDataBytes == 9 ) + { + audioFocus->flvl = ( buffer[8] >> 4 ); + } + } + + return IVAS_ERR_OK; +} + #endif /* RTP_S4_251135_CR26253_0016_REV1 */ @@ -570,14 +659,14 @@ static const PACK_PI_FN packPiDataFuntions[IVAS_PI_MAX_ID] = { packUnsupportedData, /* DIEGETIC_TYPE */ #endif packUnsupportedData, /* RESERVED13 */ - packUnsupportedData, /* RESERVED14 */ + packAudioFocusCommon,/* AUDIO_FOCUS_INDICATION */ packUnsupportedData, /* RESERVED15 */ #ifdef RTP_S4_251135_CR26253_0016_REV1 packOrientation, /* PLAYBACK_DEVICE_ORIENTATION */ packOrientation, /* HEAD_ORIENTATION */ packListenerPosition, /* LISTENER_POSITION */ packDynamicSuppression, /* DYNAMIC_AUDIO_SUPPRESSION */ - packOrientation, /* AUDIO_FOCUS_DIRECTION */ + packAudioFocusCommon, /* AUDIO_FOCUS_REQUEST */ #else packUnsupportedData, /* PLAYBACK_DEVICE_ORIENTATION */ packUnsupportedData, /* HEAD_ORIENTATION */ @@ -625,14 +714,14 @@ static const UNPACK_PI_FN unpackPiDataFuntions[IVAS_PI_MAX_ID] = { unpackUnsupportedData, /* DIEGETIC_TYPE */ #endif unpackUnsupportedData, /* RESERVED13 */ - unpackUnsupportedData, /* RESERVED14 */ + unpackAudioFocusCommon,/* AUDIO_FOCUS_INDICATION */ unpackUnsupportedData, /* RESERVED15 */ #ifdef RTP_S4_251135_CR26253_0016_REV1 unpackOrientation, /* PLAYBACK_DEVICE_ORIENTATION */ unpackOrientation, /* HEAD_ORIENTATION */ unpackListenerPosition, /* LISTENER_POSITION */ unpackDynamicSuppression, /* DYNAMIC_AUDIO_SUPPRESSION */ - unpackOrientation, /* AUDIO_FOCUS_DIRECTION */ + unpackAudioFocusCommon, /* AUDIO_FOCUS_REQUEST */ #else unpackUnsupportedData, /* PLAYBACK_DEVICE_ORIENTATION */ unpackUnsupportedData, /* HEAD_ORIENTATION */ @@ -672,13 +761,13 @@ static const uint32_t maxPiDataSize[IVAS_PI_MAX_ID] = { 8, /* IVAS_PI_ISM_DIRECTIVITY */ 1, /* IVAS_PI_DIEGETIC_TYPE */ 0, /* IVAS_PI_RESERVED13 */ - 0, /* IVAS_PI_RESERVED14 */ + 9, /* IVAS_PI_AUDIO_FOCUS_INDICATION */ 0, /* IVAS_PI_RESERVED15 */ 8, /* IVAS_PI_PLAYBACK_DEVICE_ORIENTATION */ 8, /* IVAS_PI_HEAD_ORIENTATION */ 6, /* IVAS_PI_LISTENER_POSITION */ 2, /* IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION */ - 8, /* IVAS_PI_AUDIO_FOCUS_DIRECTION */ + 9, /* IVAS_PI_AUDIO_FOCUS_REQUEST */ 4, /* IVAS_PI_PI_LATENCY */ 1, /* IVAS_PI_R_ISM_ID */ 1, /* IVAS_PI_R_ISM_GAIN */ diff --git a/lib_util/ivas_rtp_pi_data.h b/lib_util/ivas_rtp_pi_data.h index 3be265bb87..aad50dd6b6 100644 --- a/lib_util/ivas_rtp_pi_data.h +++ b/lib_util/ivas_rtp_pi_data.h @@ -64,7 +64,7 @@ extern "C" IVAS_PI_ISM_DIRECTIVITY, /* directivity of each object */ IVAS_PI_DIEGETIC_TYPE, /* digetic audio indication */ IVAS_PI_RESERVED13, /* reserved */ - IVAS_PI_RESERVED14, /* reserved */ + IVAS_PI_AUDIO_FOCUS_INDICATION, /* audio focus indication (direction in Quaternions and/or level) */ IVAS_PI_RESERVED15, /* reserved */ /* Reverse direction PI types */ @@ -72,7 +72,7 @@ extern "C" IVAS_PI_HEAD_ORIENTATION, /* head orientation of the listener in Quaternions */ IVAS_PI_LISTENER_POSITION, /* position of the listener in 3D space */ IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION, /* receiver’s preference with respect to audio suppression */ - IVAS_PI_AUDIO_FOCUS_DIRECTION, /* direction of interest for the listener in Quaternions */ + IVAS_PI_AUDIO_FOCUS_REQUEST, /* direction of interest for the listener in Quaternions and/or audio focus level */ IVAS_PI_PI_LATENCY, /* round-trip latency for PI frames */ IVAS_PI_R_ISM_ID, /* id of an object for editing */ IVAS_PI_R_ISM_GAIN, /* editing request for gain factor for received object */ @@ -100,7 +100,6 @@ extern "C" * - IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED * - IVAS_PI_PLAYBACK_DEVICE_ORIENTATION * - IVAS_PI_HEAD_ORIENTATION - * - IVAS_PI_AUDIO_FOCUS_DIRECTION * - IVAS_PI_R_ISM_ORIENTATION * * piDataType is used to identify the correct pi data type contained here @@ -293,6 +292,40 @@ extern "C" bool isDiegetic[1 + IVAS_PI_MAX_OBJECTS]; /* diegetic indication as per audio format */ } IVAS_PIDATA_DIEGETIC; + /* Audio focus direction indicates a direction of interest. + * The audio focus level indicates the amount of suppression applied to the + * directions other than the audio focus direction. + */ + typedef enum + { + IVAS_FLVL_NO_AUDIO_FOCUS = 0, /* Apply no audio focus */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_1, /* Audio focus level 1 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_2, /* Audio focus level 2 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_3, /* Audio focus level 3 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_4, /* Audio focus level 4 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_5, /* Audio focus level 5 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_6, /* Audio focus level 6 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_7, /* Audio focus level 7 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_8, /* Audio focus level 8 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_9, /* Audio focus level 9 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_10, /* Audio focus level 10 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_11, /* Audio focus level 11 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_12, /* Audio focus level 12 */ + IVAS_FLVL_FOCUS_LEVEL_LEVEL_13, /* Audio focus level 13 */ + IVAS_FLVL_DEFAULT_AUDIO_FOCUS, /* Default audio focus */ + IVAS_FLVL_MAX_AUDIO_FOCUS, /* Apply max audio focus */ + } IVAS_FLVL; + + typedef struct + { + size_t size; /* sizeof(IVAS_PIDATA_AUDIO_FOCUS) */ + uint32_t piDataType; /* IVAS_PI_AUDIO_FOCUS_INDCATION or IVAS_PI_AUDIO_FOCUS_REQUEST */ + bool availDirection; /* audio focus contains direction */ + bool availLevel; /* audio focus contains level */ + IVAS_QUATERNION direction; /* direction data expressed as quarternions */ + IVAS_FLVL flvl; /* audio focus level */ + } IVAS_PIDATA_AUDIO_FOCUS; + /* Listener position */ typedef struct { @@ -416,12 +449,13 @@ extern "C" IVAS_PIDATA_ISM_ATTENUATION ismAttenuation; IVAS_PIDATA_ISM_DIRECTIVITY ismDirectivity; IVAS_PIDATA_DIEGETIC digeticIndicator; + IVAS_PIDATA_AUDIO_FOCUS focusIndication; IVAS_PIDATA_ORIENTATION playbackOrientation; IVAS_PIDATA_ORIENTATION headOrientation; IVAS_PIDATA_LISTENER_POSITION listnerPosition; IVAS_PIDATA_DYNAMIC_SUPPRESSION dynSuppression; - IVAS_PIDATA_ORIENTATION focusDirection; + IVAS_PIDATA_AUDIO_FOCUS focusRequest; IVAS_PIDATA_REVERSE_PI_LATENCY piLatency; IVAS_PIDATA_ISM_EDIT_ID ismEditId; IVAS_PIDATA_ISM_EDIT_GAIN ismEditGain; diff --git a/tests/rtp/ivasrtp.py b/tests/rtp/ivasrtp.py index f6923c0077..8a2fd0f87d 100644 --- a/tests/rtp/ivasrtp.py +++ b/tests/rtp/ivasrtp.py @@ -170,13 +170,13 @@ class PIDATAS(str, Enum): ISM_DIRECTIVITY = "ISM_DIRECTIVITY" DIEGETIC_TYPE = "DIEGETIC_TYPE" RESERVED13 = "RESERVED13" - RESERVED14 = "RESERVED14" + AUDIO_FOCUS_INDICATION = "AUDIO_FOCUS_INDICATION" RESERVED15 = "RESERVED15" PLAYBACK_DEVICE_ORIENTATION = "PLAYBACK_DEVICE_ORIENTATION" HEAD_ORIENTATION = "HEAD_ORIENTATION" LISTENER_POSITION = "LISTENER_POSITION" DYNAMIC_AUDIO_SUPPRESSION = "DYNAMIC_AUDIO_SUPPRESSION" - AUDIO_FOCUS_DIRECTION = "AUDIO_FOCUS_DIRECTION" + AUDIO_FOCUS_REQUEST = "AUDIO_FOCUS_REQUEST" PI_LATENCY = "PI_LATENCY" R_ISM_ID = "R_ISM_ID" R_ISM_GAIN = "R_ISM_GAIN" @@ -207,6 +207,24 @@ class SUPPRESSION_LEVEL(int, Enum): SUPPRESSION_LEVEL_14 = 14 SUPPRESSION_LEVEL_MAX = 15 +class AUDIO_FOCUS_LEVEL(int, Enum): + AUDIO_FOCUS_LEVEL_NONE = 0 + AUDIO_FOCUS_LEVEL_1 = 1 + AUDIO_FOCUS_LEVEL_2 = 2 + AUDIO_FOCUS_LEVEL_3 = 3 + AUDIO_FOCUS_LEVEL_4 = 4 + AUDIO_FOCUS_LEVEL_5 = 5 + AUDIO_FOCUS_LEVEL_6 = 6 + AUDIO_FOCUS_LEVEL_7 = 7 + AUDIO_FOCUS_LEVEL_8 = 8 + AUDIO_FOCUS_LEVEL_9 = 9 + AUDIO_FOCUS_LEVEL_10 = 10 + AUDIO_FOCUS_LEVEL_11 = 11 + AUDIO_FOCUS_LEVEL_12 = 12 + AUDIO_FOCUS_LEVEL_13 = 13 + AUDIO_FOCUS_LEVEL_DEFAULT = 14 + AUDIO_FOCUS_LEVEL_NO_PREFERENCE = 15 + @dataclass class RTPHDR: @@ -343,6 +361,14 @@ class ACOUSTIC_ENVIRONMENT: dim: tuple[float, float, float] = () abscoeff: tuple[float, float, float, float, float, float] = () +@dataclass +class AUDIO_FOCUS: + w: float = 0.0 + x: float = 0.0 + y: float = 0.0 + z: float = 0.0 + level: AUDIO_FOCUS_LEVEL = AUDIO_FOCUS_LEVEL.AUDIO_FOCUS_LEVEL_DEFAULT + @dataclass class PIDATA: timestamp: int = 0 @@ -589,13 +615,13 @@ PIDataUnpacker = [ unpackUnsupported, # ISM_DIRECTIVITY unpackDiegetic, # DIEGETIC_TYPE unpackUnsupported, # RESERVED13 - unpackUnsupported, # RESERVED14 + unpackAudioFocusCommon, # AUDIO_FOCUS_INDICATION unpackUnsupported, # RESERVED15 unpackOrientation, # PLAYBACK_DEVICE_ORIENTATION unpackOrientation, # HEAD_ORIENTATION unpackPosition, # LISTENER_POSITION unpackDAS, # DYNAMIC_AUDIO_SUPPRESSION - unpackOrientation, # AUDIO_FOCUS_DIRECTION + unpackAudioFocusCommon, # AUDIO_FOCUS_REQUEST unpackUnsupported, # PI_LATENCY unpackUnsupported, # R_ISM_ID unpackUnsupported, # R_ISM_GAIN diff --git a/tests/rtp/test_rtp.py b/tests/rtp/test_rtp.py index 342e29c8b6..d63dcb9da2 100644 --- a/tests/rtp/test_rtp.py +++ b/tests/rtp/test_rtp.py @@ -164,6 +164,7 @@ def generatePiData(startTs: int, endTs: int) -> dict: someDesc = lambda : AUDIO_DESCRIPTION(isSpeech=bool(random.getrandbits(1)), isMusic=bool(random.getrandbits(1)), isAmbiance=bool(random.getrandbits(1)), isEditable=bool(random.getrandbits(1)), isBinaural=bool(random.getrandbits(1))) someDAS = lambda : DYNAMIC_AUDIO_SUPPRESSION(preferSpeech=bool(random.getrandbits(1)), preferMusic=bool(random.getrandbits(1)), preferAmbiance=bool(random.getrandbits(1)), level=random.randint(0, 15)) someDIG = lambda : DIEGETIC_TYPE(isDigetic=[ bool(random.getrandbits(1)) for _ in range(random.randint(1, 5)) ]) + someAFocus = lambda : AUDIO_FOCUS(w=2*random.random()-1.0, x=2*random.random()-1.0, y=2*random.random()-1.0, z=2*random.random()-1.0, level=random.randint(0, 15)) for ts in range(startTs, endTs, 320): pidata = dict() @@ -172,7 +173,7 @@ def generatePiData(startTs: int, endTs: int) -> dict: pidata["DEVICE_ORIENTATION_UNCOMPENSATED"] = someOrientation() pidata["PLAYBACK_DEVICE_ORIENTATION"] = someOrientation() pidata["HEAD_ORIENTATION"] = someOrientation() - pidata["AUDIO_FOCUS_DIRECTION"] = someOrientation() + pidata["AUDIO_FOCUS_REQUEST"] = someAFocus() pidata["LISTENER_POSITION"] = somePosition() pidata["DYNAMIC_AUDIO_SUPPRESSION"] = someDAS() pidata["AUDIO_DESCRIPTION"] = [someDesc() for n in range(random.randint(1, 5))] -- GitLab From 2a972eabcfce5c394b64cfa9aef12d2ebab9547c Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Thu, 25 Sep 2025 16:14:06 +0300 Subject: [PATCH 4/7] PI tests for audio focus --- apps/decoder.c | 22 ++++++++++++++----- tests/rtp/ivasrtp.py | 42 +++++++++++++++++++++++++---------- tests/rtp/test_rtp.py | 51 ++++++++++++++++++++++++++++++------------- 3 files changed, 83 insertions(+), 32 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index df7dcf5168..da0fdd2fbd 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -328,15 +328,20 @@ static void IVAS_RTP_LogPiData( FILE *f_piDataOut, PIDATA_TS *piData, uint32_t n break; case IVAS_PI_AUDIO_FOCUS_INDICATION: { - fprintf( f_piDataOut, "{\n" ); + fprintf( f_piDataOut, "{" ); if ( cur->data.focusIndication.availDirection ) { - fprintf( f_piDataOut, "\t\t\t\"w\": %f,\n\t\t\t\"x\": %f,\n\t\t\t\"y\": %f,\n\t\t\t\"z\": %f \n\t\t\t", + fprintf( f_piDataOut, "\n\t\t\t\"direction\": {\n" ); + fprintf( f_piDataOut, "\t\t\t\t\t\t\"w\": %f,\n\t\t\t\t\t\t\"x\": %f,\n\t\t\t\t\t\t\"y\": %f,\n\t\t\t\t\t\t\"z\": %f \n\t\t\t}", cur->data.focusIndication.direction.w, cur->data.focusIndication.direction.x, cur->data.focusIndication.direction.y, cur->data.focusIndication.direction.z ); + if ( cur->data.focusIndication.availLevel ) + { + fprintf( f_piDataOut, "," ); + } } if ( cur->data.focusIndication.availLevel ) { - fprintf( f_piDataOut, "\t\t\t\"level\": %d", cur->data.focusIndication.flvl ); + fprintf( f_piDataOut, "\n\t\t\t\"level\": %d", cur->data.focusIndication.flvl ); } fprintf( f_piDataOut, "\n\t\t}" ); } @@ -355,15 +360,20 @@ static void IVAS_RTP_LogPiData( FILE *f_piDataOut, PIDATA_TS *piData, uint32_t n case IVAS_PI_RESERVED13: case IVAS_PI_AUDIO_FOCUS_REQUEST: { - fprintf( f_piDataOut, "{\n" ); + fprintf( f_piDataOut, "{" ); if ( cur->data.focusRequest.availDirection ) { - fprintf( f_piDataOut, "\t\t\t\"w\": %f,\n\t\t\t\"x\": %f,\n\t\t\t\"y\": %f,\n\t\t\t\"z\": %f \n\t\t\t", + fprintf( f_piDataOut, "\n\t\t\t\"direction\": {\n" ); + fprintf( f_piDataOut, "\t\t\t\t\t\t\"w\": %f,\n\t\t\t\t\t\t\"x\": %f,\n\t\t\t\t\t\t\"y\": %f,\n\t\t\t\t\t\t\"z\": %f \n\t\t\t}", cur->data.focusRequest.direction.w, cur->data.focusRequest.direction.x, cur->data.focusRequest.direction.y, cur->data.focusRequest.direction.z ); + if ( cur->data.focusRequest.availLevel ) + { + fprintf( f_piDataOut, "," ); + } } if ( cur->data.focusRequest.availLevel ) { - fprintf( f_piDataOut, "\t\t\t\"level\": %d", cur->data.focusRequest.flvl ); + fprintf( f_piDataOut, "\n\t\t\t\"level\": %d", cur->data.focusRequest.flvl ); } fprintf( f_piDataOut, "\n\t\t}" ); } diff --git a/tests/rtp/ivasrtp.py b/tests/rtp/ivasrtp.py index 8a2fd0f87d..d5b256cf42 100644 --- a/tests/rtp/ivasrtp.py +++ b/tests/rtp/ivasrtp.py @@ -42,7 +42,7 @@ import json import base64 import argparse from pathlib import Path -from typing import cast +from typing import cast, Optional NO_REQ="NO_REQ" @@ -225,7 +225,6 @@ class AUDIO_FOCUS_LEVEL(int, Enum): AUDIO_FOCUS_LEVEL_DEFAULT = 14 AUDIO_FOCUS_LEVEL_NO_PREFERENCE = 15 - @dataclass class RTPHDR: version: int = 2 @@ -363,11 +362,8 @@ class ACOUSTIC_ENVIRONMENT: @dataclass class AUDIO_FOCUS: - w: float = 0.0 - x: float = 0.0 - y: float = 0.0 - z: float = 0.0 - level: AUDIO_FOCUS_LEVEL = AUDIO_FOCUS_LEVEL.AUDIO_FOCUS_LEVEL_DEFAULT + direction: Optional[ORIENTATION] = None + level: Optional[AUDIO_FOCUS_LEVEL] = None @dataclass class PIDATA: @@ -599,6 +595,30 @@ def packAcousticEnv(bitstrm: BitStream, data: any): absCoeff = mapNearestIndex(absorptionCoeffValues, aenv.abscoeff[n]) bitstrm.append(f'uint:2={absCoeff}') +def unpackAudioFocus(bitstrm: ConstBitStream, piSize: int) -> AUDIO_FOCUS: + assert piSize == 1 or piSize == 8 or piSize == 9, "Incorrect PI Data Size for AUDIO_FOCUS" + direction = None + level = None + if piSize == 1: + level = bitstrm.read(4).uint + _ = bitstrm.read(4) + else: + direction = unpackOrientation(bitstrm, 8) + if piSize == 9: + level = bitstrm.read(4).uint + _ = bitstrm.read(4) + + return AUDIO_FOCUS(direction=direction, level=level) + +def packAudioFocus(bitstrm: BitStream, data: any): + assert type(data) == AUDIO_FOCUS, "Diegetic type PI Data expects a data of type AUDIO_FOCUS" + auFocus = cast(AUDIO_FOCUS, data) + if auFocus.direction is not None: + packOrientations(bitstrm, [auFocus.direction]) + if auFocus.level is not None: + bitstrm.append(f'uint:4={auFocus.level}') + bitstrm.append(f'uint:4=0') + PIDataUnpacker = [ unpackOrientation, # SCENE_ORIENTATION, @@ -615,13 +635,13 @@ PIDataUnpacker = [ unpackUnsupported, # ISM_DIRECTIVITY unpackDiegetic, # DIEGETIC_TYPE unpackUnsupported, # RESERVED13 - unpackAudioFocusCommon, # AUDIO_FOCUS_INDICATION + unpackAudioFocus, # AUDIO_FOCUS_INDICATION unpackUnsupported, # RESERVED15 unpackOrientation, # PLAYBACK_DEVICE_ORIENTATION unpackOrientation, # HEAD_ORIENTATION unpackPosition, # LISTENER_POSITION unpackDAS, # DYNAMIC_AUDIO_SUPPRESSION - unpackAudioFocusCommon, # AUDIO_FOCUS_REQUEST + unpackAudioFocus, # AUDIO_FOCUS_REQUEST unpackUnsupported, # PI_LATENCY unpackUnsupported, # R_ISM_ID unpackUnsupported, # R_ISM_GAIN @@ -650,13 +670,13 @@ PIDataPacker = [ packUnsupported, # ISM_DIRECTIVITY packDiegetic, # DIEGETIC_TYPE packUnsupported, # RESERVED13 - packUnsupported, # RESERVED14 + packAudioFocus, # AUDIO_FOCUS_INDICATION packUnsupported, # RESERVED15 packOrientation, # PLAYBACK_DEVICE_ORIENTATION packOrientation, # HEAD_ORIENTATION packPosition, # LISTENER_POSITION packDAS, # DYNAMIC_AUDIO_SUPPRESSION - packOrientation, # AUDIO_FOCUS_DIRECTION + packAudioFocus, # AUDIO_FOCUS_DIRECTION packUnsupported, # PI_LATENCY packUnsupported, # R_ISM_ID packUnsupported, # R_ISM_GAIN diff --git a/tests/rtp/test_rtp.py b/tests/rtp/test_rtp.py index d63dcb9da2..1ed8340ac5 100644 --- a/tests/rtp/test_rtp.py +++ b/tests/rtp/test_rtp.py @@ -102,9 +102,14 @@ def test_rtp_bitstream_evs ( ) -@pytest.mark.parametrize("bitrate", [24400, 80000, 512000]) -@pytest.mark.parametrize("bandwidth", ["WB", "SWB", "FB"]) -@pytest.mark.parametrize("format", ["STEREO", "SBA", "MC", "MASA"]) +#@pytest.mark.parametrize("bitrate", [24400, 80000, 512000]) +#@pytest.mark.parametrize("bandwidth", ["WB", "SWB", "FB"]) +#@pytest.mark.parametrize("format", ["STEREO", "SBA", "MC", "MASA"]) +#@pytest.mark.parametrize("framesPerPacket", [8]) + +@pytest.mark.parametrize("bitrate", [24400]) +@pytest.mark.parametrize("bandwidth", ["SWB"]) +@pytest.mark.parametrize("format", ["MASA"]) @pytest.mark.parametrize("framesPerPacket", [8]) def test_rtp_bitstream_ivas_nodtx ( test_info, @@ -164,21 +169,24 @@ def generatePiData(startTs: int, endTs: int) -> dict: someDesc = lambda : AUDIO_DESCRIPTION(isSpeech=bool(random.getrandbits(1)), isMusic=bool(random.getrandbits(1)), isAmbiance=bool(random.getrandbits(1)), isEditable=bool(random.getrandbits(1)), isBinaural=bool(random.getrandbits(1))) someDAS = lambda : DYNAMIC_AUDIO_SUPPRESSION(preferSpeech=bool(random.getrandbits(1)), preferMusic=bool(random.getrandbits(1)), preferAmbiance=bool(random.getrandbits(1)), level=random.randint(0, 15)) someDIG = lambda : DIEGETIC_TYPE(isDigetic=[ bool(random.getrandbits(1)) for _ in range(random.randint(1, 5)) ]) - someAFocus = lambda : AUDIO_FOCUS(w=2*random.random()-1.0, x=2*random.random()-1.0, y=2*random.random()-1.0, z=2*random.random()-1.0, level=random.randint(0, 15)) + someAuFocusDirLvl = lambda : AUDIO_FOCUS(ORIENTATION(w=2*random.random()-1.0, x=2*random.random()-1.0, y=2*random.random()-1.0, z=2*random.random()-1.0), level=AUDIO_FOCUS_LEVEL(random.randint(0, 15))) + someAuFocusDir = lambda : AUDIO_FOCUS(ORIENTATION(w=2*random.random()-1.0, x=2*random.random()-1.0, y=2*random.random()-1.0, z=2*random.random()-1.0)) + someAuFocusLvl = lambda : AUDIO_FOCUS(level=AUDIO_FOCUS_LEVEL(random.randint(0, 15))) + someAuFocusList = [someAuFocusDirLvl, someAuFocusDir, someAuFocusLvl] for ts in range(startTs, endTs, 320): pidata = dict() - pidata["SCENE_ORIENTATION"] = someOrientation() - pidata["DEVICE_ORIENTATION_COMPENSATED"] = someOrientation() - pidata["DEVICE_ORIENTATION_UNCOMPENSATED"] = someOrientation() - pidata["PLAYBACK_DEVICE_ORIENTATION"] = someOrientation() - pidata["HEAD_ORIENTATION"] = someOrientation() - pidata["AUDIO_FOCUS_REQUEST"] = someAFocus() - pidata["LISTENER_POSITION"] = somePosition() - pidata["DYNAMIC_AUDIO_SUPPRESSION"] = someDAS() - pidata["AUDIO_DESCRIPTION"] = [someDesc() for n in range(random.randint(1, 5))] - pidata["DIEGETIC_TYPE"] = someDIG() - pidata["ACOUSTIC_ENVIRONMENT"] = ACOUSTIC_ENVIRONMENT(aeid=random.randint(0, 127)) + #pidata["SCENE_ORIENTATION"] = someOrientation() + #pidata["DEVICE_ORIENTATION_COMPENSATED"] = someOrientation() + #pidata["DEVICE_ORIENTATION_UNCOMPENSATED"] = someOrientation() + #pidata["PLAYBACK_DEVICE_ORIENTATION"] = someOrientation() + #pidata["HEAD_ORIENTATION"] = someOrientation() + pidata["AUDIO_FOCUS_REQUEST"] = random.choice(someAuFocusList)() + #pidata["LISTENER_POSITION"] = somePosition() + #pidata["DYNAMIC_AUDIO_SUPPRESSION"] = someDAS() + #pidata["AUDIO_DESCRIPTION"] = [someDesc() for n in range(random.randint(1, 5))] + #pidata["DIEGETIC_TYPE"] = someDIG() + #pidata["ACOUSTIC_ENVIRONMENT"] = ACOUSTIC_ENVIRONMENT(aeid=random.randint(0, 127)) data[str(ts)] = pidata return data @@ -225,6 +233,17 @@ def isEqualAcousticEnv(ref: ACOUSTIC_ENVIRONMENT, dut: ACOUSTIC_ENVIRONMENT): for r, d in zip(ref.rt60, dut.rt60): assert r == d, f"Acoustic Env PI Data mismatch in rt60 {r} != {d}" +def isEqualAudioFocus(ref: AUDIO_FOCUS, dut: AUDIO_FOCUS): + if ref.direction is not None or dut.direction is not None: + assert ref.direction is not None, "Audio Focus PI Data missing direction" + assert dut.direction is not None, "Audio Focus PI Data missing direction" + if ref.direction is not None and dut.direction is not None: + assert abs(ref.direction.w - dut.direction.w) < 0.0001, "Audio Focus PI Data mismatch in direction w" + assert abs(ref.direction.x - dut.direction.x) < 0.0001, "Audio Focus PI Data mismatch in direction x" + assert abs(ref.direction.y - dut.direction.y) < 0.0001, "Audio Focus PI Data mismatch in direction y" + assert abs(ref.direction.z - dut.direction.z) < 0.0001, "Audio Focus PI Data mismatch in direction z" + assert ref.level == dut.level, "Audio Focus PI Data mismatch in level" + class CSVREADER: def __init__(self, csvFile: Path): self.rIdx = 0 @@ -448,6 +467,8 @@ def run_rtp_bitstream_tests ( isEqualDiegetic(DIEGETIC_TYPE(**decoded), data) elif type(generatedPIData[ts][pitype]) == ACOUSTIC_ENVIRONMENT: isEqualAcousticEnv(ACOUSTIC_ENVIRONMENT(**decoded), data) + if type(generatedPIData[ts][pitype]) == AUDIO_FOCUS: + isEqualAudioFocus(AUDIO_FOCUS(**decoded), data) elif type(generatedPIData[ts][pitype]) == list: for r, d in zip(generatedPIData[ts][pitype], decodedPiData[ts][pitype]): isEqualAD(AUDIO_DESCRIPTION(**d), r) -- GitLab From 2bf48e36133f091379092dc85e83a4b57f7a3240 Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 26 Sep 2025 11:58:53 +0300 Subject: [PATCH 5/7] Fix audio focus tests --- tests/rtp/test_rtp.py | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/tests/rtp/test_rtp.py b/tests/rtp/test_rtp.py index 1ed8340ac5..4e394ee478 100644 --- a/tests/rtp/test_rtp.py +++ b/tests/rtp/test_rtp.py @@ -102,14 +102,9 @@ def test_rtp_bitstream_evs ( ) -#@pytest.mark.parametrize("bitrate", [24400, 80000, 512000]) -#@pytest.mark.parametrize("bandwidth", ["WB", "SWB", "FB"]) -#@pytest.mark.parametrize("format", ["STEREO", "SBA", "MC", "MASA"]) -#@pytest.mark.parametrize("framesPerPacket", [8]) - -@pytest.mark.parametrize("bitrate", [24400]) -@pytest.mark.parametrize("bandwidth", ["SWB"]) -@pytest.mark.parametrize("format", ["MASA"]) +@pytest.mark.parametrize("bitrate", [24400, 80000, 512000]) +@pytest.mark.parametrize("bandwidth", ["WB", "SWB", "FB"]) +@pytest.mark.parametrize("format", ["STEREO", "SBA", "MC", "MASA"]) @pytest.mark.parametrize("framesPerPacket", [8]) def test_rtp_bitstream_ivas_nodtx ( test_info, @@ -176,17 +171,17 @@ def generatePiData(startTs: int, endTs: int) -> dict: for ts in range(startTs, endTs, 320): pidata = dict() - #pidata["SCENE_ORIENTATION"] = someOrientation() - #pidata["DEVICE_ORIENTATION_COMPENSATED"] = someOrientation() - #pidata["DEVICE_ORIENTATION_UNCOMPENSATED"] = someOrientation() - #pidata["PLAYBACK_DEVICE_ORIENTATION"] = someOrientation() - #pidata["HEAD_ORIENTATION"] = someOrientation() + pidata["SCENE_ORIENTATION"] = someOrientation() + pidata["DEVICE_ORIENTATION_COMPENSATED"] = someOrientation() + pidata["DEVICE_ORIENTATION_UNCOMPENSATED"] = someOrientation() + pidata["PLAYBACK_DEVICE_ORIENTATION"] = someOrientation() + pidata["HEAD_ORIENTATION"] = someOrientation() pidata["AUDIO_FOCUS_REQUEST"] = random.choice(someAuFocusList)() - #pidata["LISTENER_POSITION"] = somePosition() - #pidata["DYNAMIC_AUDIO_SUPPRESSION"] = someDAS() - #pidata["AUDIO_DESCRIPTION"] = [someDesc() for n in range(random.randint(1, 5))] - #pidata["DIEGETIC_TYPE"] = someDIG() - #pidata["ACOUSTIC_ENVIRONMENT"] = ACOUSTIC_ENVIRONMENT(aeid=random.randint(0, 127)) + pidata["LISTENER_POSITION"] = somePosition() + pidata["DYNAMIC_AUDIO_SUPPRESSION"] = someDAS() + pidata["AUDIO_DESCRIPTION"] = [someDesc() for n in range(random.randint(1, 5))] + pidata["DIEGETIC_TYPE"] = someDIG() + pidata["ACOUSTIC_ENVIRONMENT"] = ACOUSTIC_ENVIRONMENT(aeid=random.randint(0, 127)) data[str(ts)] = pidata return data @@ -238,10 +233,10 @@ def isEqualAudioFocus(ref: AUDIO_FOCUS, dut: AUDIO_FOCUS): assert ref.direction is not None, "Audio Focus PI Data missing direction" assert dut.direction is not None, "Audio Focus PI Data missing direction" if ref.direction is not None and dut.direction is not None: - assert abs(ref.direction.w - dut.direction.w) < 0.0001, "Audio Focus PI Data mismatch in direction w" - assert abs(ref.direction.x - dut.direction.x) < 0.0001, "Audio Focus PI Data mismatch in direction x" - assert abs(ref.direction.y - dut.direction.y) < 0.0001, "Audio Focus PI Data mismatch in direction y" - assert abs(ref.direction.z - dut.direction.z) < 0.0001, "Audio Focus PI Data mismatch in direction z" + assert abs(ref.direction['w'] - dut.direction.w) < 0.0001, "Audio Focus PI Data mismatch in direction w" + assert abs(ref.direction['x'] - dut.direction.x) < 0.0001, "Audio Focus PI Data mismatch in direction x" + assert abs(ref.direction['y'] - dut.direction.y) < 0.0001, "Audio Focus PI Data mismatch in direction y" + assert abs(ref.direction['z'] - dut.direction.z) < 0.0001, "Audio Focus PI Data mismatch in direction z" assert ref.level == dut.level, "Audio Focus PI Data mismatch in level" class CSVREADER: @@ -467,7 +462,7 @@ def run_rtp_bitstream_tests ( isEqualDiegetic(DIEGETIC_TYPE(**decoded), data) elif type(generatedPIData[ts][pitype]) == ACOUSTIC_ENVIRONMENT: isEqualAcousticEnv(ACOUSTIC_ENVIRONMENT(**decoded), data) - if type(generatedPIData[ts][pitype]) == AUDIO_FOCUS: + elif type(generatedPIData[ts][pitype]) == AUDIO_FOCUS: isEqualAudioFocus(AUDIO_FOCUS(**decoded), data) elif type(generatedPIData[ts][pitype]) == list: for r, d in zip(generatedPIData[ts][pitype], decodedPiData[ts][pitype]): -- GitLab From fc1241075fd1c3b4fd50d07172e19508301c9a0c Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Fri, 26 Sep 2025 12:21:35 +0300 Subject: [PATCH 6/7] Add flags --- lib_util/ivas_rtp_pi_data.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib_util/ivas_rtp_pi_data.c b/lib_util/ivas_rtp_pi_data.c index 24ecabe6e8..c939c4539c 100644 --- a/lib_util/ivas_rtp_pi_data.c +++ b/lib_util/ivas_rtp_pi_data.c @@ -659,7 +659,11 @@ static const PACK_PI_FN packPiDataFuntions[IVAS_PI_MAX_ID] = { packUnsupportedData, /* DIEGETIC_TYPE */ #endif packUnsupportedData, /* RESERVED13 */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 packAudioFocusCommon,/* AUDIO_FOCUS_INDICATION */ +#else + packUnsupportedData, /* AUDIO_FOCUS_INDICATION */ +#endif packUnsupportedData, /* RESERVED15 */ #ifdef RTP_S4_251135_CR26253_0016_REV1 packOrientation, /* PLAYBACK_DEVICE_ORIENTATION */ @@ -714,7 +718,11 @@ static const UNPACK_PI_FN unpackPiDataFuntions[IVAS_PI_MAX_ID] = { unpackUnsupportedData, /* DIEGETIC_TYPE */ #endif unpackUnsupportedData, /* RESERVED13 */ +#ifdef RTP_S4_251135_CR26253_0016_REV1 unpackAudioFocusCommon,/* AUDIO_FOCUS_INDICATION */ +#else + unpackUnsupportedData, /* AUDIO_FOCUS_INDICATION */ +#endif unpackUnsupportedData, /* RESERVED15 */ #ifdef RTP_S4_251135_CR26253_0016_REV1 unpackOrientation, /* PLAYBACK_DEVICE_ORIENTATION */ -- GitLab From a9cc66bc602f952a946854d6ca72e5494c62462f Mon Sep 17 00:00:00 2001 From: Lauros Pajunen Date: Mon, 29 Sep 2025 10:43:25 +0300 Subject: [PATCH 7/7] Code review, add more descriptive numbering and comments, also disable headtracking with ext orientations --- lib_com/options.h | 2 +- lib_dec/lib_dec.c | 2 +- lib_rend/ivas_rotation.c | 41 +++++++++++++++++++++++++++++++++++++-- lib_rend/ivas_stat_rend.h | 2 +- tests/rtp/ivasrtp.py | 2 +- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 58ca69d570..b1f5965027 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,7 @@ /* ################## Start DEVELOPMENT switches ######################### */ -//#define RTP_S4_251135_CR26253_0016_REV1 /* RTP Pack/Unpack API corresponding to CR 26253 */ +#define RTP_S4_251135_CR26253_0016_REV1 /* RTP Pack/Unpack API corresponding to CR 26253 */ #define IVAS_RTPDUMP /* RTPDUMP writing and reading for IVAS payloads */ /* ################### Start BE switches ################################# */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b46def86e4..c3b7e69a82 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3843,7 +3843,7 @@ void IVAS_DEC_setDiegeticInputPI( if ( hIvasDec->st_ivas->hCombinedOrientationData != NULL ) { int8_t i; - for ( i = 0; i < 4; i++ ) + for ( i = 0; i < (1 + IVAS_MAX_NUM_OBJECTS); i++ ) { hIvasDec->st_ivas->hCombinedOrientationData->isDiegeticInputPI[i] = diegeticPIValues[i]; } diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 05fb92cd18..8b62d7a111 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -864,7 +864,7 @@ ivas_error ivas_combined_orientation_open( ( *hCombinedOrientationData )->cur_subframe_samples_rendered = 0; #ifdef RTP_S4_251135_CR26253_0016_REV1 - for ( i = 0; i < 4; i++ ) + for ( i = 0; i < (1 + IVAS_MAX_NUM_OBJECTS); i++ ) { ( *hCombinedOrientationData )->isDiegeticInputPI[i] = true; } @@ -1030,8 +1030,8 @@ ivas_error combine_external_and_head_orientations( } else if ( hExtOrientationData == NULL && headRotQuaternions != NULL ) { - /* Head rotation only */ #ifdef RTP_S4_251135_CR26253_0016_REV1 + /* Disable head rotation if diegetic PI data indicating non-diegetic audio is received */ if ( hCombinedOrientationData->isDiegeticInputPISet && !hCombinedOrientationData->isDiegeticInputPI[0] && !hCombinedOrientationData->isDiegeticInputPI[1] && !hCombinedOrientationData->isDiegeticInputPI[2] && !hCombinedOrientationData->isDiegeticInputPI[3] && !hCombinedOrientationData->isDiegeticInputPI[4] ) { for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) @@ -1041,12 +1041,14 @@ ivas_error combine_external_and_head_orientations( } else { + /* Head rotation only */ for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; } } #else + /* Head rotation only */ for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ ) { hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; @@ -1128,6 +1130,40 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternion_frozen_head = identity; hCombinedOrientationData->isHeadRotationFrozen = 0; } +#ifdef RTP_S4_251135_CR26253_0016_REV1 + /* Disable head rotation if diegetic PI data indicating non-diegetic audio is received */ + if ( hCombinedOrientationData->isDiegeticInputPISet && !hCombinedOrientationData->isDiegeticInputPI[0] && !hCombinedOrientationData->isDiegeticInputPI[1] && !hCombinedOrientationData->isDiegeticInputPI[2] && !hCombinedOrientationData->isDiegeticInputPI[3] && !hCombinedOrientationData->isDiegeticInputPI[4] ) + { + continue; + } + else + { + /* Use the most recent head rotation */ + if ( hExtOrientationData->enableHeadRotation[i] == 1 ) + { + if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + QuaternionProduct( hCombinedOrientationData->Quaternions[i], headRotQuaternions[i], &hCombinedOrientationData->Quaternions[i] ); + } + else + { + hCombinedOrientationData->Quaternions[i] = headRotQuaternions[i]; + } + } + /* Use the freezed head rotation */ + else if ( hExtOrientationData->enableHeadRotation[i] == 2 ) + { + if ( hExtOrientationData->enableExternalOrientation[i] > 0 ) + { + QuaternionProduct( hCombinedOrientationData->Quaternions[i], hCombinedOrientationData->Quaternion_frozen_head, &hCombinedOrientationData->Quaternions[i] ); + } + else + { + hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; + } + } + } +#else /* Use the most recent head rotation */ if ( hExtOrientationData->enableHeadRotation[i] == 1 ) { @@ -1152,6 +1188,7 @@ ivas_error combine_external_and_head_orientations( hCombinedOrientationData->Quaternions[i] = hCombinedOrientationData->Quaternion_frozen_head; } } +#endif /* Reset the combined orientations to identity */ if ( hExtOrientationData->enableHeadRotation[i] == 0 && hExtOrientationData->enableExternalOrientation[i] == 0 ) diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index fb8bf44b83..3e6270e229 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -711,7 +711,7 @@ typedef struct ivas_combined_orientation_struct int16_t subframe_idx_start; int16_t cur_subframe_samples_rendered_start; #ifdef RTP_S4_251135_CR26253_0016_REV1 - bool isDiegeticInputPI[5]; + bool isDiegeticInputPI[1 + IVAS_MAX_NUM_OBJECTS]; bool isDiegeticInputPISet; #endif } COMBINED_ORIENTATION_DATA, *COMBINED_ORIENTATION_HANDLE; diff --git a/tests/rtp/ivasrtp.py b/tests/rtp/ivasrtp.py index d5b256cf42..1eec45fdce 100644 --- a/tests/rtp/ivasrtp.py +++ b/tests/rtp/ivasrtp.py @@ -611,7 +611,7 @@ def unpackAudioFocus(bitstrm: ConstBitStream, piSize: int) -> AUDIO_FOCUS: return AUDIO_FOCUS(direction=direction, level=level) def packAudioFocus(bitstrm: BitStream, data: any): - assert type(data) == AUDIO_FOCUS, "Diegetic type PI Data expects a data of type AUDIO_FOCUS" + assert type(data) == AUDIO_FOCUS, "Audio focus PI Data expects a data of type AUDIO_FOCUS" auFocus = cast(AUDIO_FOCUS, data) if auFocus.direction is not None: packOrientations(bitstrm, [auFocus.direction]) -- GitLab