diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 4e1d09560ff519859c7bb48a1c79fd183579af71..1e88b7fd5cd6091d8a65450e5290291181313410 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -61,6 +61,10 @@ #define IVAS_REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define IVAS_ER_LIST_HEIGHT 1.6f #define IVAS_DEFAULT_AEID 65535 +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION +#define IVAS_LISTENER_POSITION_MAX 327.67f +#endif + /* JBM constants for adaptive-playout */ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ diff --git a/lib_com/options.h b/lib_com/options.h index 6bfe63675545869d26b63960f5671f6c88f9fb20..ce02a4742156c8a3c67fd3f8eaad6009ad89c69b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,6 +172,7 @@ #define USE_RTPDUMP /* FhG: RTPDUMP format (rtptools standard) instead of custom format */ #define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* Expose Payload Type setting in RTP Header */ +#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION /* Eri: Basop issue 2023: Distance attenuation scaling, synch with BASOP updates and adding clamping of distance att input and listener position */ #define FIX_1574_EFAP_CODE_LINT /* FhG: issue 1574: Code quality fixes in ivas_efap.c */ #define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS /* Nokia: float issue 1569: fix render config checks in renderer */ #define FIX_1571_BFI_COPY_ARRAY_CORRECT_LEN /* FhG: issue 1571: use correct channel signal length for copying signal to buffer */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0afec7310f1d418fba7b53751caff22a671d131a..8b111588b60d2a1a285051cac612eef7cccb8169 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -49,6 +49,14 @@ #endif #include "wmc_auto.h" +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + /*---------------------------------------------------------------------* * Local structs *---------------------------------------------------------------------*/ @@ -2601,9 +2609,15 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return error; } +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION + hHeadTrackData->Pos[subframe_idx].x = max( min( IVAS_LISTENER_POSITION_MAX, Pos.x ), -IVAS_LISTENER_POSITION_MAX ); + hHeadTrackData->Pos[subframe_idx].y = max( min( IVAS_LISTENER_POSITION_MAX, Pos.y ), -IVAS_LISTENER_POSITION_MAX ); + hHeadTrackData->Pos[subframe_idx].z = max( min( IVAS_LISTENER_POSITION_MAX, Pos.z ), -IVAS_LISTENER_POSITION_MAX ); +#else hHeadTrackData->Pos[subframe_idx].x = Pos.x; hHeadTrackData->Pos[subframe_idx].y = Pos.y; hHeadTrackData->Pos[subframe_idx].z = Pos.z; +#endif hHeadTrackData->sr_pose_pred_axis = rot_axis; hIvasDec->updateOrientation = true; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 41d3e1044ed0625b5418c7e691fa69f91cba847f..789c0358af1dd57ea085b8a621e86b5eac735606 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -71,6 +71,12 @@ #define IVAS_ER_LIST_ORIGIN_X 0.0f #define IVAS_ER_LIST_ORIGIN_Y 0.0f +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION +#define DIST_ATT_MAX_MAXDIST 63.0f +#define DIST_ATT_MAX_REFDIST 6.3f +#define DIST_ATT_MAX_ROLLOFF 4.0f +#endif + #ifndef TRUE #define TRUE 1 #endif @@ -1331,11 +1337,20 @@ ivas_error RenderConfigReader_checkValues( } } +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION + /* Verify range of distance attenuation parameters: refDist: 0.0 <= distAtt[1] <= 6.3 */ + /* maxDist: distAtt[1] <= distAtt[0] <= 63.0 */ + /* rollOffFactor: 0 <= distAtt[2] <= 4.0 */ + hRenderConfig->distAtt[1] = min( max( 0, hRenderConfig->distAtt[1] ), DIST_ATT_MAX_REFDIST ); + hRenderConfig->distAtt[0] = min( max( hRenderConfig->distAtt[1], hRenderConfig->distAtt[0] ), DIST_ATT_MAX_MAXDIST ); + hRenderConfig->distAtt[2] = min( max( 0.0f, hRenderConfig->distAtt[2] ), DIST_ATT_MAX_ROLLOFF ); +#else /* Verify range of distance attenuation parameters: 0.1 <= distAtt[0] <= distAtt[1] */ /* 0.0 <= distAtt[2] <= 10.0 */ hRenderConfig->distAtt[0] = max( 0.1f, hRenderConfig->distAtt[0] ); hRenderConfig->distAtt[1] = max( hRenderConfig->distAtt[0], hRenderConfig->distAtt[1] ); hRenderConfig->distAtt[2] = max( 0.0f, min( 10.0f, hRenderConfig->distAtt[2] ) ); +#endif /* Verify range of directivity patterns */ for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ ) diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index 68f43bc8a6b87b33dfebb875fcb5938ceb2562f4..24d0acaffe047c1342a61cfc0da1ca49e9c1ed15 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -35,6 +35,16 @@ #include #include +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif +#endif + struct RotFileReader { @@ -125,9 +135,15 @@ ivas_error HeadRotationFileReading( pQuaternion->z = z; if ( pPos != NULL ) { +#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION + pPos->x = min( max( -IVAS_LISTENER_POSITION_MAX, posx ), IVAS_LISTENER_POSITION_MAX ); + pPos->y = min( max( -IVAS_LISTENER_POSITION_MAX, posy ), IVAS_LISTENER_POSITION_MAX ); + pPos->z = min( max( -IVAS_LISTENER_POSITION_MAX, posz ), IVAS_LISTENER_POSITION_MAX ); +#else pPos->x = posx; pPos->y = posy; pPos->z = posz; +#endif } return IVAS_ERR_OK;