From 7effe8d15672031c64917f23a3b89ff25354e022 Mon Sep 17 00:00:00 2001 From: hsd Date: Fri, 12 May 2023 15:58:25 +0200 Subject: [PATCH 1/3] Moved HEAD_ORIENT_TRK_T to common_api_types.h to avoid including the private ivas_cnst.h header in the decoder/renderer APIs --- lib_com/common_api_types.h | 10 ++++++++++ lib_com/ivas_cnst.h | 11 +---------- lib_dec/lib_dec.h | 4 ---- lib_rend/lib_rend.h | 6 +++++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 61c68eae5d..3f0f8b305b 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -93,6 +93,16 @@ typedef struct float x, y, z; } IVAS_VECTOR3; +#ifdef FIX_439_OTR_PARAMS +typedef enum +{ + HEAD_ORIENT_TRK_NONE, + HEAD_ORIENT_TRK_REF, + HEAD_ORIENT_TRK_AVG, + HEAD_ORIENT_TRK_REF_VEC, + HEAD_ORIENT_TRK_REF_VEC_LEV +} HEAD_ORIENT_TRK_T; +#endif typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d764ad95e9..b107631d7e 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1595,21 +1595,12 @@ typedef enum } SFX_OpMode_t; +#ifndef FIX_439_OTR_PARAMS /*----------------------------------------------------------------------------------* * Orientation tracking constants *----------------------------------------------------------------------------------*/ /* Orientation tracking types */ -#ifdef FIX_439_OTR_PARAMS -typedef enum -{ - HEAD_ORIENT_TRK_NONE, - HEAD_ORIENT_TRK_REF, - HEAD_ORIENT_TRK_AVG, - HEAD_ORIENT_TRK_REF_VEC, - HEAD_ORIENT_TRK_REF_VEC_LEV -} HEAD_ORIENT_TRK_T; -#else #define IVAS_ORIENT_TRK_NONE 0 #define IVAS_ORIENT_TRK_REF 1 #define IVAS_ORIENT_TRK_AVG 2 diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index df67102e2c..069137fddd 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -34,12 +34,8 @@ #define LIB_DEC_H #include "common_api_types.h" -#ifdef FIX_439_OTR_PARAMS -#include "ivas_cnst.h" -#endif #include - /*---------------------------------------------------------------------* * Decoder enums *---------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 1e9d41fd38..9d9ed3555a 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -250,7 +250,11 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const uint8_t otrMode /* i : Orientation tracking mode */ +#ifdef FIX_439_OTR_PARAMS + HEAD_ORIENT_TRK_T otrMode /* i : Head orientation tracking mode */ +#else + const uint8_t otrMode /* i : Orientation tracking mode */ +#endif ); ivas_error IVAS_REND_SetReferenceRotation( -- GitLab From 1173116fccec4b253fab20d20b4b2976ab07fbf4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 15 May 2023 09:20:54 +0200 Subject: [PATCH 2/3] harmonize parameter names; add "const" to fucntion input parameters --- apps/decoder.c | 1 + apps/renderer.c | 31 ++++++++++++++++++++++++------- lib_dec/lib_dec.c | 10 +++++----- lib_dec/lib_dec.h | 2 +- lib_rend/ivas_orient_trk.c | 24 +++++++++++++++++++++--- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/ivas_stat_rend.h | 2 +- lib_rend/lib_rend.c | 6 +++--- lib_rend/lib_rend.h | 8 ++++---- 9 files changed, 61 insertions(+), 25 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a24c177c84..1942fe7cfa 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -189,6 +189,7 @@ int main( /*------------------------------------------------------------------------------------------* * Open decoder handle *------------------------------------------------------------------------------------------*/ + #ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.no_diegetic_pan ) ) != IVAS_ERR_OK ) #else diff --git a/apps/renderer.c b/apps/renderer.c index 1477e2279e..68300d2950 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -135,7 +135,11 @@ typedef struct char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; +#ifdef FIX_439_OTR_PARAMS + int8_t orientation_tracking; +#else int8_t orientationTracking; +#endif float noDiegeticPan; bool delayCompensationEnabled; bool quietModeEnabled; @@ -708,7 +712,11 @@ int main( } } +#ifdef FIX_439_OTR_PARAMS + if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1367,7 +1375,12 @@ static bool parseDiegeticPan( static bool parseOrientationTracking( char *value, - int8_t *tracking_type ) +#ifdef FIX_439_OTR_PARAMS + int8_t *orientation_tracking +#else + int8_t *tracking_type +#endif +) { to_upper( value ); @@ -1375,7 +1388,7 @@ static bool parseOrientationTracking( if ( strcmp( value, "NONE" ) == 0 ) { #ifdef FIX_439_OTR_PARAMS - *tracking_type = HEAD_ORIENT_TRK_NONE; + *orientation_tracking = HEAD_ORIENT_TRK_NONE; #else *tracking_type = IVAS_ORIENT_TRK_NONE; #endif @@ -1383,7 +1396,7 @@ static bool parseOrientationTracking( else if ( strcmp( value, "REF" ) == 0 ) { #ifdef FIX_439_OTR_PARAMS - *tracking_type = HEAD_ORIENT_TRK_REF; + *orientation_tracking = HEAD_ORIENT_TRK_REF; #else *tracking_type = IVAS_ORIENT_TRK_REF; #endif @@ -1391,7 +1404,7 @@ static bool parseOrientationTracking( else if ( strcmp( value, "AVG" ) == 0 ) { #ifdef FIX_439_OTR_PARAMS - *tracking_type = HEAD_ORIENT_TRK_AVG; + *orientation_tracking = HEAD_ORIENT_TRK_AVG; #else *tracking_type = IVAS_ORIENT_TRK_AVG; #endif @@ -1399,7 +1412,7 @@ static bool parseOrientationTracking( else if ( strcmp( value, "REF_VEC" ) == 0 ) { #ifdef FIX_439_OTR_PARAMS - *tracking_type = HEAD_ORIENT_TRK_REF_VEC; + *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC; #else *tracking_type = IVAS_ORIENT_TRK_REF_VEC; #endif @@ -1407,7 +1420,7 @@ static bool parseOrientationTracking( else if ( strcmp( value, "REF_VEC_LEV" ) == 0 ) { #ifdef FIX_439_OTR_PARAMS - *tracking_type = HEAD_ORIENT_TRK_REF_VEC_LEV; + *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV; #else *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; #endif @@ -1635,7 +1648,7 @@ static CmdlnArgs defaultArgs( clearString( args.renderConfigFilePath ); #ifdef FIX_439_OTR_PARAMS - args.orientationTracking = HEAD_ORIENT_TRK_NONE; + args.orientation_tracking = HEAD_ORIENT_TRK_NONE; #else args.orientationTracking = IVAS_ORIENT_TRK_NONE; #endif @@ -1739,7 +1752,11 @@ static void parseOption( break; case CmdLnOptionId_orientationTracking: assert( numOptionValues == 1 ); +#ifdef FIX_439_OTR_PARAMS + if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) ) +#else if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) ) +#endif { fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] ); exit( -1 ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 85bcd76c55..bb00dc6559 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -109,8 +109,8 @@ static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int /* may return an error but may still have allocated memory - thus run Close also in case of error to release memory */ ivas_error IVAS_DEC_Open( - IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ - const IVAS_DEC_MODE mode, /* i : compatibility mode (EVS or IVAS) */ + IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ + const IVAS_DEC_MODE mode, /* i : compatibility mode (EVS or IVAS) */ #ifndef FIX_439_OTR_PARAMS const int16_t orientation_tracking, /* i : orientation tracking type */ #endif @@ -402,9 +402,9 @@ ivas_error IVAS_DEC_Configure( const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T orientationTracking, /* i : head orientation tracking mode */ + const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ #endif - const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ + const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ ) { Decoder_Struct *st_ivas; @@ -453,7 +453,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; #ifdef FIX_439_OTR_PARAMS - hDecoderConfig->orientation_tracking = orientationTracking; + hDecoderConfig->orientation_tracking = orientation_tracking; #endif hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 069137fddd..091f50ca23 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -132,7 +132,7 @@ ivas_error IVAS_DEC_Configure( const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T orientationTracking, /* i : head orientation tracking mode */ + const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ #endif const int16_t renderConfigEnabled /* i : enable Renderer config. file for binaural output */ ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index de4b589c14..ae646b4d5c 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -407,7 +407,7 @@ ivas_error ivas_orient_trk_Init( /* set safe default tracking mode */ #ifdef FIX_439_OTR_PARAMS - pOTR->trackingType = HEAD_ORIENT_TRK_NONE; + pOTR->orientation_tracking = HEAD_ORIENT_TRK_NONE; #else pOTR->trackingType = OTR_TRACKING_NONE; #endif @@ -423,9 +423,9 @@ ivas_error ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T trackingType /* i/o: orientation tracking type */ + const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ #else const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ #endif @@ -435,7 +435,12 @@ ivas_error ivas_orient_trk_SetTrackingType( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + +#ifdef FIX_439_OTR_PARAMS + pOTR->orientation_tracking = orientation_tracking; +#else pOTR->trackingType = trackingType; +#endif return IVAS_ERR_OK; } @@ -485,7 +490,12 @@ ivas_error ivas_orient_trk_GetMainOrientation( { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } + +#ifdef FIX_439_OTR_PARAMS + switch ( pOTR->orientation_tracking ) +#else switch ( pOTR->trackingType ) +#endif { #ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: @@ -561,7 +571,11 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } +#ifdef FIX_439_OTR_PARAMS + switch ( pOTR->orientation_tracking ) +#else switch ( pOTR->trackingType ) +#endif { #ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: @@ -638,7 +652,11 @@ ivas_error ivas_orient_trk_Process( result = IVAS_ERR_OK; +#ifdef FIX_439_OTR_PARAMS + switch ( pOTR->orientation_tracking ) +#else switch ( pOTR->trackingType ) +#endif { #ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 55ff934168..34d4edc65a 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -874,7 +874,7 @@ ivas_error ivas_orient_trk_Init( ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T trackingType /* i : orientation tracking type */ + const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ #else const OTR_TRACKING_T trackingType /* i : orientation tracking type */ #endif diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 230fda130a..a987a1f835 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -229,7 +229,7 @@ typedef struct EFAP typedef struct ivas_orient_trk_state_t { #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T trackingType; + HEAD_ORIENT_TRK_T orientation_tracking; #else OTR_TRACKING_T trackingType; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e889900fe4..2fb8ba6753 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3858,14 +3858,14 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T otrMode /* i : Head orientation tracking mode */ + const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ #else - const uint8_t otrMode /* i : Orientation tracking mode */ + const uint8_t otrMode /* i : Orientation tracking mode */ #endif ) { #ifdef FIX_439_OTR_PARAMS - return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, otrMode ); + return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); #else OTR_TRACKING_T mode; ivas_error error; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 9d9ed3555a..8e681c3832 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -228,8 +228,8 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ); ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ ); int16_t IVAS_REND_GetRenderConfig( @@ -245,13 +245,13 @@ int16_t IVAS_REND_FeedRenderConfig( ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot[RENDERER_HEAD_POSITIONS_PER_FRAME], /* i : head orientations for next rendering call */ - const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ + const IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME] /* i : listener positions for next rendering call */ ); ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ #ifdef FIX_439_OTR_PARAMS - HEAD_ORIENT_TRK_T otrMode /* i : Head orientation tracking mode */ + const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ #else const uint8_t otrMode /* i : Orientation tracking mode */ #endif -- GitLab From 5b2ea567d1151c8bdfb47106a88501657d9469fb Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 15 May 2023 09:28:06 +0200 Subject: [PATCH 3/3] fix compilation warning --- lib_dec/lib_dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index bb00dc6559..9a18cbf356 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2021,6 +2021,8 @@ static ivas_error printConfigInfo_dec( case HEAD_ORIENT_TRK_REF_VEC_LEV: fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); break; + default: + break; } } #else -- GitLab