diff --git a/CMakeLists.txt b/CMakeLists.txt index 7beb46c45129b2cae7d076830f99cae494e417ea..5f1659d6fbc39dd583dfe4998471ffb31f0d8b10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,7 @@ file(GLOB libDecSrcs "lib_dec/*.c") file(GLOB libDecHeaders "lib_dec/*.h") add_library(lib_dec ${libDecSrcs} ${libDecHeaders}) target_link_libraries(lib_dec lib_com lib_rend lib_debug lib_isar) -target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar lib_util) +target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") @@ -175,7 +175,7 @@ target_include_directories(lib_util PRIVATE lib_lc3plus lib_isar) if(NOT WMOPS) add_executable(ivas_lc3plus_unit_test scripts/split_rendering/lc3plus_float/ivas_lc3plus_unit_test.c) - target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_com lib_debug lib_isar) + target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_com lib_debug lib_isar) endif() file(GLOB libISARSrcs "lib_isar/*.c") diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index 5f60decb0897b11ebf8cc0f4c70413da41322f0e..3c7ea3e597de37d9377fc8ad745a158d37ca713c 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -68,7 +68,7 @@ Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) EnableFastChecks @@ -109,7 +109,7 @@ Neither false false - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) true diff --git a/apps/encoder.c b/apps/encoder.c index dc051562c9f54d4004dc3ff9d0f999d2bfd4acc4..38fbbba44363dfaa2f419b8dac1ea96c78f41e20 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -834,10 +834,10 @@ int main( /* scene orientation */ if ( sceneOrientationFileReader ) { - PIDATA_TS *piDataTs = &ivasRtp.piData[ivasRtp.nWrittenPiData++]; + IVAS_PIDATA_TS *piDataTs = &ivasRtp.piData[ivasRtp.nWrittenPiData++]; IVAS_PIDATA_ORIENTATION *scene = &piDataTs->data.scene; - memset( piDataTs, 0, sizeof( PIDATA_TS ) ); + memset( piDataTs, 0, sizeof( IVAS_PIDATA_TS ) ); scene->size = sizeof( IVAS_PIDATA_ORIENTATION ); scene->piDataType = IVAS_PI_SCENE_ORIENTATION; @@ -851,10 +851,10 @@ int main( /* device orientation */ if ( deviceOrientationFileReader ) { - PIDATA_TS *piDataTs = &ivasRtp.piData[ivasRtp.nWrittenPiData++]; + IVAS_PIDATA_TS *piDataTs = &ivasRtp.piData[ivasRtp.nWrittenPiData++]; IVAS_PIDATA_ORIENTATION *device = &piDataTs->data.deviceUnCompensated; - memset( piDataTs, 0, sizeof( PIDATA_TS ) ); + memset( piDataTs, 0, sizeof( IVAS_PIDATA_TS ) ); device->size = sizeof( IVAS_PIDATA_ORIENTATION ); device->piDataType = IVAS_PI_DEVICE_ORIENTATION_COMPENSATED; diff --git a/apps/encoder_fmtsw.c b/apps/encoder_fmtsw.c index 9c347dffb4eb4650b22ca212a443d1ad90497fb7..dabdfd9a546a27aadf9745cd51da23ece155fae3 100644 --- a/apps/encoder_fmtsw.c +++ b/apps/encoder_fmtsw.c @@ -942,10 +942,10 @@ int encoder_main( /* scene orientation */ if ( sceneOrientationFileReader ) { - PIDATA_TS *piDataTs = &ivasRtp->piData[ivasRtp->nWrittenPiData++]; + IVAS_PIDATA_TS *piDataTs = &ivasRtp->piData[ivasRtp->nWrittenPiData++]; IVAS_PIDATA_ORIENTATION *scene = &piDataTs->data.scene; - memset( piDataTs, 0, sizeof( PIDATA_TS ) ); + memset( piDataTs, 0, sizeof( IVAS_PIDATA_TS ) ); scene->size = sizeof( IVAS_PIDATA_ORIENTATION ); scene->piDataType = IVAS_PI_SCENE_ORIENTATION; @@ -959,10 +959,10 @@ int encoder_main( /* device orientation */ if ( deviceOrientationFileReader ) { - PIDATA_TS *piDataTs = &ivasRtp->piData[ivasRtp->nWrittenPiData++]; + IVAS_PIDATA_TS *piDataTs = &ivasRtp->piData[ivasRtp->nWrittenPiData++]; IVAS_PIDATA_ORIENTATION *device = &piDataTs->data.deviceUnCompensated; - memset( piDataTs, 0, sizeof( PIDATA_TS ) ); + memset( piDataTs, 0, sizeof( IVAS_PIDATA_TS ) ); device->size = sizeof( IVAS_PIDATA_ORIENTATION ); device->piDataType = IVAS_PI_DEVICE_ORIENTATION_COMPENSATED; diff --git a/ci/build_codec_sanitizers_linux.sh b/ci/build_codec_sanitizers_linux.sh index 11bfa29004cc885e32271ccce94b025728453526..f76a345f5e40147173b55ed7ace1a6a68bfa76c0 100755 --- a/ci/build_codec_sanitizers_linux.sh +++ b/ci/build_codec_sanitizers_linux.sh @@ -28,9 +28,11 @@ # accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and # the United Nations Convention on Contracts on the International Sales of Goods. +set -euxo pipefail + if [ ! -d "lib_com" ]; then - echo "not in root directory! - please run in IVAS root" - exit 1 + echo "not in root directory! - please run in IVAS root" + exit 1 fi # CI linux container would do this, can stay commented if clang (v13) is in your path diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index ad74f9136cad5e6544a2cdf92084b31297cd02d9..ab9ae0ad3343a61714792a70eadcbc9b71ec7131 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -38,6 +38,7 @@ #include "options.h" #include #include +#include #include "ivas_error.h" /*----------------------------------------------------------------------------------* @@ -190,6 +191,7 @@ typedef struct ivas_hrtf_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; typedef struct ivas_hrtf_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; typedef struct ivas_hrtf_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; typedef struct ivas_hrtf_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE; + typedef struct ivas_cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; @@ -232,6 +234,7 @@ typedef enum _ivas_binaural_renderer_type } IVAS_BIN_RENDERER_TYPE; + /*----------------------------------------------------------------------------------* * Split rendering API constants, structures, and enums *----------------------------------------------------------------------------------*/ @@ -269,7 +272,6 @@ typedef enum } ISAR_SPLIT_REND_CODEC; - typedef struct _ISAR_SPLIT_REND_BITS_DATA { uint8_t *bits_buf; @@ -305,20 +307,11 @@ typedef struct _ISAR_SPLIT_REND_CONFIG } ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE; + /*----------------------------------------------------------------------------------* * Renderer API structures and enums *----------------------------------------------------------------------------------*/ -#ifdef DEBUGGING -typedef enum -{ - IVAS_RENDER_TYPE_OVERRIDE_NONE, - IVAS_RENDER_TYPE_OVERRIDE_CREND, - IVAS_RENDER_TYPE_OVERRIDE_FASTCONV - -} IVAS_RENDER_TYPE_OVERRIDE; - -#endif typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { uint16_t aeID; /* Acoustic environment ID*/ @@ -362,4 +355,464 @@ typedef struct } IVAS_REND_AudioBuffer; + +/*----------------------------------------------------------------------------------* + * RTP API structures and enums + *----------------------------------------------------------------------------------*/ + +/* IVAS PI Data Types */ +typedef enum +{ + /* Forward direction PI types */ + IVAS_PI_SCENE_ORIENTATION, /* orientation of audio scene in unit quaternions */ + IVAS_PI_DEVICE_ORIENTATION_COMPENSATED, /* orientation of device in unit quaternions (compensated) */ + IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED, /* orientation of device in unit quaternions (un-compensated) */ + IVAS_PI_ACOUSTIC_ENVIRONMENT, /* describe the acoustic environment */ + IVAS_PI_AUDIO_DESCRIPTION, /* audio content description (voice/music/ambiance) */ + IVAS_PI_ISM_NUM, /* Number of objects */ + IVAS_PI_ISM_ID, /* id of each object */ + IVAS_PI_ISM_GAIN, /* gain of each object */ + IVAS_PI_ISM_ORIENTATION, /* orientation of each object */ + IVAS_PI_ISM_POSITION, /* position of each object */ + IVAS_PI_ISM_POSITION_COMPACT, /* position of each object in compact representation */ + IVAS_PI_ISM_DISTANCE_ATTENUATION, /* distance attenuation for each object */ + IVAS_PI_ISM_DIRECTIVITY, /* directivity of each object */ + IVAS_PI_DIEGETIC_TYPE, /* digetic audio indication */ + IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_INDICATION, /* audio suppression indication */ + IVAS_PI_AUDIO_FOCUS_INDICATION, /* audio focus indication (direction in Quaternions and/or level) */ + + /* Reverse direction PI types */ + IVAS_PI_PLAYBACK_DEVICE_ORIENTATION, /* orientation of the playback device in quaternions */ + 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_REQUEST, /* receiver’s preference with respect to audio suppression */ + 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 */ + IVAS_PI_R_ISM_ORIENTATION, /* editing request for orientation for received object */ + IVAS_PI_R_ISM_POSITION, /* editing request for position for received object */ + IVAS_PI_R_ISM_POSITION_COMPACT, /* editing request for position for received object in a compact representation*/ + IVAS_PI_R_ISM_DIRECTION, /* editing request for direction for received object */ + IVAS_PI_RESERVED27, /* reserved */ + IVAS_PI_RESERVED28, /* reserved */ + IVAS_PI_RESERVED29, /* reserved */ + IVAS_PI_NO_DATA = 31, /* Indicates an empty PI data frame */ + IVAS_PI_MAX_ID /* Max number of PI data IDs supprted */ + +} IVAS_PI_TYPE; + +/* orientation data corresponding to any of the following pi data types :- + * - IVAS_PI_SCENE_ORIENTATION + * - IVAS_PI_DEVICE_ORIENTATION_COMPENSATED + * - IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED + * - IVAS_PI_PLAYBACK_DEVICE_ORIENTATION + * - IVAS_PI_HEAD_ORIENTATION + * - IVAS_PI_R_ISM_ORIENTATION + * + * piDataType is used to identify the correct pi data type contained here + */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_SCENE_ORIENTATION) */ + uint32_t piDataType; /* one of supported orientation data types */ + IVAS_QUATERNION orientation; /* orientation data expressed as quartenions */ + +} IVAS_PIDATA_ORIENTATION; + +/* Acoustic environment corresponding to IVAS_PI_ACOUSTIC_ENVIRONMENT + * + * acoustic environment ID + * late reverb parameters + * - RT60 – indicating the time that it takes for the reflections to reduce 60 dB in energy level, per frequency band + * - DSR – diffuse to source signal energy ratio, per frequency band + * - Pre-delay – delay at which the computation of DSR values was performed + * early reflections + * - 3D rectangular virtual room dimensions + * - Broadband energy absorption coefficient per wall surface + */ +typedef enum +{ + IVAS_PI_AE_LOW, /* center frequency 25 Hz */ + IVAS_PI_AE_MID, /* center frequency 250 Hz */ + IVAS_PI_AE_HIGH, /* center frequency 2.5 kHz */ + IVAS_PI_AE_NUM_BANDS /* number of ae bands */ + +} IVAS_PI_AE_BANDS; + +typedef enum +{ + IVAS_PI_AE_LOW_FREQ = 25, + IVAS_PI_AE_MID_FREQ = 250, + IVAS_PI_AE_HIGH_FREQ = 2500 + +} IVAS_PI_AE_BANDS_FREQ; + +typedef enum +{ + IVAS_PI_AE_FRONT, + IVAS_PI_AE_BACK, + IVAS_PI_AE_LEFT, + IVAS_PI_AE_RIGHT, + IVAS_PI_AE_CEILING, + IVAS_PI_AE_FLOOR, + IVAS_PI_AE_NUM_SURFACE + +} IVAS_PI_AE_SURFACE; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ACOUSTIC_ENV) */ + uint32_t piDataType; /* IVAS_PI_ACOUSTIC_ENVIRONMENT */ + bool availLateReverb; /* AE contains only late reverb parameters */ + bool availEarlyReflections; /* AE containing late reverb and simplified early reflections */ + uint8_t aeid; /* seven-bit acoustic environment identifier */ + + /* only valid if availLateReverb==true or availEarlyReflections==true */ + float rt60[IVAS_PI_AE_NUM_BANDS]; /* time for the reflections to reduce 60 dB per band in seconds */ + float dsr[IVAS_PI_AE_NUM_BANDS]; /* diffuse to source signal energy ratio per band in dB */ + + /* only valid if availEarlyReflections==true */ + IVAS_VECTOR3 roomDimensions; /* room dimensions in meters length (x), width (y), height (z) */ + float absorbCoeffs[IVAS_PI_AE_NUM_SURFACE]; /* absorption coefficients for all surfaces */ + +} IVAS_PIDATA_ACOUSTIC_ENV; + +/* Audio Description corresponding to IVAS_PI_AUDIO_DESCRIPTION + * Describe the following audio decriptors per object/type :- + * - audio content type is speech/music/ambiance + * - if audio rendering is editable + * - if stereo audio is binaural + * + * number of valid entries decide on basis of audio format:- + * - Stereo/SBA/MASA = 1 entry + * - MultiChannel = 2 entries (1 for center channel + 1 for all other channels) + * - ISM = Number of Object entries ( 1 per object ) + * - OMASA/OSBA = 1 + Num Discrete Coded Objects + * + */ +typedef struct +{ + bool speech; /* audio has voice/speech */ + bool music; /* audio has music */ + bool ambiance; /* audio has background ambiance */ + bool editable; /* rendering audio metadata is editable */ + bool binaural; /* stereo stream is binaural */ + +} IVAS_AUDIO_ID; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_AUDIO_DESC) */ + uint32_t piDataType; /* IVAS_PI_AUDIO_DESCRIPTION */ + uint32_t nValidEntries; /* Number of valid audio IDs */ + IVAS_AUDIO_ID audioId[1 + IVAS_MAX_NUM_OBJECTS]; /* audio id as per format */ + +} IVAS_PIDATA_AUDIO_DESC; + +/* ISM specific PI data related to PI types : - + * + * - IVAS_PI_ISM_NUM + * - IVAS_PI_ISM_ID + * - IVAS_PI_ISM_GAIN + * - IVAS_PI_ISM_ORIENTATION + * - IVAS_PI_ISM_POSITION + * - IVAS_PI_ISM_DISTANCE_ATTENUATION + * - IVAS_PI_ISM_DIRECTIVITY + */ + +/* Number of ISMs */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_NUM) */ + uint32_t piDataType; /* IVAS_PI_ISM_NUM */ + uint32_t numObjects; /* Number of ISM */ + +} IVAS_PIDATA_ISM_NUM; + +/* ISM ID */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_ID) */ + uint32_t piDataType; /* IVAS_PI_ISM_ID */ + uint16_t numObjects; /* number of objects */ + uint8_t id[IVAS_MAX_NUM_OBJECTS]; /* 8-bit ISM id of object */ + +} IVAS_PIDATA_ISM_ID; + +/* ISM gain */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_GAIN) */ + uint32_t piDataType; /* IVAS_PI_ISM_GAIN */ + uint16_t numObjects; /* number of objects */ + int8_t dB[IVAS_MAX_NUM_OBJECTS]; /* ISM gain in dB per object [-96, +3] */ + +} IVAS_PIDATA_ISM_GAIN; + +/* ISM orientation */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_ORIENTATION) */ + uint32_t piDataType; /* IVAS_PI_ISM_ORIENTATION */ + uint16_t numObjects; /* number of objects */ + IVAS_QUATERNION orientation[IVAS_MAX_NUM_OBJECTS]; /* Orientation of audio objects in ISM(s) */ + +} IVAS_PIDATA_ISM_ORIENTATION; + +/* ISM position */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_POSITION) */ + uint32_t piDataType; /* IVAS_PI_ISM_POSITION */ + uint16_t numObjects; /* number of objects */ + IVAS_VECTOR3 position[IVAS_MAX_NUM_OBJECTS]; /* Position of audio objects in ISM(s) */ + +} IVAS_PIDATA_ISM_POSITION; + +/* ISM distance attenuation comprising of following gains per ISM + * - reference distance + * - maximum distance + * - roll-off factor + */ +typedef struct +{ + float ref_dist; /* reference distance in meters */ + float max_dist; /* maximum distance in meters */ + float roll; /* roll-off factor values */ + +} IVAS_DIST_ATTEN; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_ATTENUATION) */ + uint32_t piDataType; /* IVAS_PI_ISM_DISTANCE_ATTENUATION */ + uint16_t numObjects; /* number of objects */ + IVAS_DIST_ATTEN distAtten[IVAS_MAX_NUM_OBJECTS]; /* Distance attenuation of audio objects */ + +} IVAS_PIDATA_ISM_ATTENUATION; + +/* ISM Directivity comprising of following per ISM :- + * - inner cone angle determines the size of the main cone directed to the front of the object + * - outer cone angle determines the size of the outer (back) cone + * - outer attenuation gain determines the attenuation outside the outer cone + */ +typedef struct +{ + uint16_t innerConeAngle; /* inner cone angle in degrees (0 - 360) */ + uint16_t outerConeAngle; /* outer cone angle in degrees (0 - 360) */ + float outerAttenuationdB; /* attenuation outside the outer cone in dB */ + +} IVAS_ISM_DIRECTIVITY; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_DIRECTIVITY) */ + uint32_t piDataType; /* IVAS_PI_ISM_DIRECTIVITY */ + uint16_t numObjects; /* number of objects */ + IVAS_ISM_DIRECTIVITY directivity[IVAS_MAX_NUM_OBJECTS]; /* Directivity of audio objects */ +} IVAS_PIDATA_ISM_DIRECTIVITY; + +/* Diegetic and non-diegetic indication flag as per audio format + * + * number of valid entries decided on basis of audio format:- + * - Stereo/SBA/MASA/MultiChannel = 1 entry + * - ISM = Number of Object entries ( 1 per object ) + * - OMASA/OSBA = 1 (last) + Num Discrete Coded Objects + */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_DIEGETIC) */ + uint32_t piDataType; /* IVAS_PI_DIEGETIC_TYPE */ + bool isDiegetic[1 + IVAS_MAX_NUM_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_MAX_AUDIO_FOCUS, /* Apply max audio focus */ + IVAS_FLVL_DEFAULT_AUDIO_FOCUS, /* Default audio focus */ + IVAS_FLVL_NO_PREFERENCE, /* No preference / No indication */ + +} 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; + +/* Position data corresponding to any of the following pi data types :- + * - IVAS_PI_LISTENER_POSITION + * - IVAS_PI_R_ISM_POSITION + * + * piDataType is used to identify the correct pi data type contained here + */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_POSITION) */ + uint32_t piDataType; /* one of supported position data types */ + IVAS_VECTOR3 position; /* Position data */ + +} IVAS_PIDATA_POSITION; + +/* Dynamic Audio Suppression describes receiver’s preference with respect to the + * type of audio content that should be enhanced and the amount of suppression to + * be applied to the background noise + */ +typedef enum +{ + IVAS_SLI_MIN_SUPPRESSION = 0, /* Apply min suppression */ + IVAS_SLI_SUPPRESSION_LEVEL_1, /* Suppression level 1 */ + IVAS_SLI_SUPPRESSION_LEVEL_2, /* Suppression level 2 */ + IVAS_SLI_SUPPRESSION_LEVEL_3, /* Suppression level 3 */ + IVAS_SLI_SUPPRESSION_LEVEL_4, /* Suppression level 4 */ + IVAS_SLI_SUPPRESSION_LEVEL_5, /* Suppression level 5 */ + IVAS_SLI_SUPPRESSION_LEVEL_6, /* Suppression level 6 */ + IVAS_SLI_SUPPRESSION_LEVEL_7, /* Suppression level 7 */ + IVAS_SLI_SUPPRESSION_LEVEL_8, /* Suppression level 8 */ + IVAS_SLI_SUPPRESSION_LEVEL_9, /* Suppression level 9 */ + IVAS_SLI_SUPPRESSION_LEVEL_10, /* Suppression level 10 */ + IVAS_SLI_SUPPRESSION_LEVEL_11, /* Suppression level 11 */ + IVAS_SLI_MAX_SUPPRESSION, /* Apply max suppression */ + IVAS_SLI_NO_SUPPRESSION, /* Apply no suppression */ + IVAS_SLI_DEFAULT_SUPPRESSION, /* Apply default suppression */ + IVAS_SLI_NO_PREFERENCE, /* No preference / No indication */ + +} IVAS_SLI; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_DYNAMIC_SUPPRESSION) */ + uint32_t piDataType; /* IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_REQUEST or IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_INDICATION */ + bool speech; /* receiver's preference is voice/speech */ + bool music; /* receiver's preference is music */ + bool ambiance; /* receiver's preference is background ambiance */ + IVAS_SLI sli; /* suppression level indicator [0, 15] */ + +} IVAS_PIDATA_DYNAMIC_SUPPRESSION; + +/* Reverse PI latency calculated as the elapsed time between the sent reverse PI data + * and received forward PI data. It is based on the receiving device experiencing the + * result of its sent data by receiving the corresponding data in forward direction as + * forward PI data + */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_REVERSE_PI_LATENCY) */ + uint32_t piDataType; /* IVAS_PI_PI_LATENCY */ + IVAS_PI_TYPE type; /* Reverse PI used for computation of Latency */ + int32_t latency; /* Latency as 27-bit int on RTP Clock @ 16KHz */ + +} IVAS_PIDATA_REVERSE_PI_LATENCY; + +/* ISM specific PI data editing requests */ + +/* ISM ID in editing requests */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_ID) */ + uint32_t piDataType; /* IVAS_PI_R_ISM_ID */ + uint8_t id; /* 8-bit ISM id of object to edit */ + +} IVAS_PIDATA_ISM_EDIT_ID; + +/* Editing request for ISM gain */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_GAIN) */ + uint32_t piDataType; /* IVAS_PI_R_ISM_GAIN */ + int8_t dB; /* Preferred ISM gain in dB [-96, +3] */ + +} IVAS_PIDATA_ISM_EDIT_GAIN; + +/* Editing request for ISM orientation */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_ORIENTATION) */ + uint32_t piDataType; /* IVAS_PI_R_ISM_ORIENTATION */ + IVAS_QUATERNION orientation; /* orientation editing request for received ISM */ + +} IVAS_PIDATA_ISM_EDIT_ORIENTATION; + +/* Editing request for ISM direction */ +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_DIRECTION) */ + uint32_t piDataType; /* IVAS_PI_R_ISM_DIRECTION */ + float azimuth; /* azimuth angle in degrees [-180, 180] */ + float elevation; /* elevation angle in degrees [-90°, 90°] */ + +} IVAS_PIDATA_ISM_EDIT_DIRECTION; + +typedef struct +{ + size_t size; /* sizeof(IVAS_PIDATA_NO_DATA) */ + uint32_t piDataType; /* IVAS_PI_NO_DATA */ + +} IVAS_PIDATA_NO_DATA; + +typedef union +{ + IVAS_PIDATA_ORIENTATION scene; + IVAS_PIDATA_ORIENTATION deviceCompensated; + IVAS_PIDATA_ORIENTATION deviceUnCompensated; + IVAS_PIDATA_ACOUSTIC_ENV acousticEnv; + IVAS_PIDATA_AUDIO_DESC audioDesc; + IVAS_PIDATA_ISM_NUM ismNum; + IVAS_PIDATA_ISM_ID ismId; + IVAS_PIDATA_ISM_GAIN ismGain; + IVAS_PIDATA_ISM_ORIENTATION ismOrientation; + IVAS_PIDATA_ISM_POSITION ismPosition; + IVAS_PIDATA_ISM_POSITION ismPositionCompact; + IVAS_PIDATA_ISM_ATTENUATION ismAttenuation; + IVAS_PIDATA_ISM_DIRECTIVITY ismDirectivity; + IVAS_PIDATA_DIEGETIC digeticIndicator; + IVAS_PIDATA_DYNAMIC_SUPPRESSION dynSuppressionIndication; + IVAS_PIDATA_AUDIO_FOCUS focusIndication; + IVAS_PIDATA_ORIENTATION playbackOrientation; + IVAS_PIDATA_ORIENTATION headOrientation; + IVAS_PIDATA_POSITION listnerPosition; + IVAS_PIDATA_DYNAMIC_SUPPRESSION dynSuppressionRequest; + IVAS_PIDATA_AUDIO_FOCUS focusRequest; + IVAS_PIDATA_REVERSE_PI_LATENCY piLatency; + IVAS_PIDATA_ISM_EDIT_ID ismEditId; + IVAS_PIDATA_ISM_EDIT_GAIN ismEditGain; + IVAS_PIDATA_ISM_EDIT_ORIENTATION ismEditOrientation; + IVAS_PIDATA_POSITION ismEditPosition; + IVAS_PIDATA_POSITION ismEditPositionCompact; + IVAS_PIDATA_ISM_EDIT_DIRECTION ismEditDirection; + IVAS_PIDATA_NO_DATA noPiData; + +} IVAS_PIDATA; + +typedef struct pidata_ts_struct +{ + IVAS_PIDATA data; + uint32_t timestamp; + +} IVAS_PIDATA_TS; + #endif /* COMMON_API_TYPES_H */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 102c73becc1115acb22c2158fed651ed52999443..8ffb9ba776eb91803a0fe84839af6d5e46191b5c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -41,7 +41,6 @@ #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" #include "jbm_pcmdsp_fifo.h" -#include "ivas_rtp_pi_data.h" #include #include #ifdef DEBUGGING @@ -5733,7 +5732,7 @@ static void setDiegeticInputPI( ivas_error IVAS_DEC_FeedPiDataToDecoder( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - hPiDataTs piData, /* i : PI data received in rtp packet */ + IVAS_PIDATA_TS *piData, /* i : PI data received in rtp packet */ uint32_t numPiData /* i : number of PI data received in rtp packet */ ) { diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index e9c866e3b63aebdd1ad883c57a786453349ccaaa..7ed631b5b9b474f14b400aa6edf5ae51466b869a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -63,7 +63,6 @@ typedef enum _IVAS_DEC_COMPLEXITY_LEVEL IVAS_DEC_COMPLEXITY_LEVEL_THREE = 3 } IVAS_DEC_COMPLEXITY_LEVEL; - typedef enum _IVAS_DEC_PCM_TYPE { IVAS_DEC_PCM_INT16, @@ -86,7 +85,6 @@ typedef enum _IVAS_DEC_BS_FORMAT } IVAS_DEC_BS_FORMAT; typedef struct IVAS_DEC *IVAS_DEC_HANDLE; -typedef struct pidata_ts_struct *hPiDataTs; #ifdef SUPPORT_JBM_TRACEFILE /* Callback function for JBM tracefile writing */ @@ -540,7 +538,7 @@ ivas_error IVAS_DEC_GetJbmData( ivas_error IVAS_DEC_FeedPiDataToDecoder( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - hPiDataTs piData, /* i : PI data received in rtp packet */ + IVAS_PIDATA_TS *piData, /* i : PI data received in rtp packet */ uint32_t numPiData /* i : number of PI data received in rtp packet */ ); diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index 8c06948635a876ce5a2c2c59fbd9bc67ae00b0f1..6635f6168c932480420693c914a3e4eb1f61e478 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -151,9 +151,9 @@ static const char *const PiDataNames[IVAS_PI_MAX_ID] = { }; void IVAS_RTP_LogPiData( - FILE *f_piDataOut, /* i/o : Output json file handle to dump PI data for debug/test */ - const PIDATA_TS *piData, /* i : PI Data + Timestamp array containing all PI data in current packet */ - uint32_t nPiDataPresent /* i : Number of valid elements in the piData array */ + FILE *f_piDataOut, /* i/o : Output json file handle to dump PI data for debug/test */ + const IVAS_PIDATA_TS *piData, /* i : PI Data + Timestamp array containing all PI data in current packet */ + uint32_t nPiDataPresent /* i : Number of valid elements in the piData array */ ) { uint16_t n; @@ -174,7 +174,7 @@ void IVAS_RTP_LogPiData( while ( nPiDataPresent-- > 0 ) { - const PIDATA_TS *cur = piData++; + const IVAS_PIDATA_TS *cur = piData++; if ( timestamp != ( ~0u ) && timestamp != cur->timestamp ) { @@ -494,10 +494,10 @@ void IVAS_RTP_LogPiData( } void IVAS_RTP_WriteExtPiData( - FILE *f_piDataOut, /* i/o : Output csv file handle to dump PI data for external output */ - const PIDATA_TS *piData, /* i : PI Data + Timestamp array containing all PI data in current packet */ - uint32_t nPiDataPresent, /* i : Number of valid elements in the piData array */ - uint16_t numObj /* i : Number of objects */ + FILE *f_piDataOut, /* i/o : Output csv file handle to dump PI data for external output */ + const IVAS_PIDATA_TS *piData, /* i : PI Data + Timestamp array containing all PI data in current packet */ + uint32_t nPiDataPresent, /* i : Number of valid elements in the piData array */ + uint16_t numObj /* i : Number of objects */ ) { if ( f_piDataOut == NULL || piData == NULL || nPiDataPresent == 0 ) @@ -509,7 +509,7 @@ void IVAS_RTP_WriteExtPiData( while ( nPiDataPresent-- > 0 ) { - const PIDATA_TS *cur = piData++; + const IVAS_PIDATA_TS *cur = piData++; /* The writing follows the pattern of: timestamp, PI DATA TYPE, PI DATA */ @@ -943,7 +943,7 @@ ivas_error IVAS_RTP_WriteNextFrame( while ( rtp->nWrittenPiData > 0 ) { - PIDATA_TS *piDataTs = &rtp->piData[nProcPiData++]; + IVAS_PIDATA_TS *piDataTs = &rtp->piData[nProcPiData++]; if ( ( error = IVAS_RTP_PACK_PushPiData( rtp->hPack, (const IVAS_PIDATA_GENERIC *) &piDataTs->data ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while pushing scene orientation\n", ivas_error_to_string( error ) ); @@ -1014,7 +1014,7 @@ ivas_error IVAS_RTP_ReadNextFrame( /* Pre-read all PI data */ while ( rtp->numPiDataInPacket != 0 ) { - PIDATA_TS *piData = &rtp->piData[rtp->nReadPiData]; + IVAS_PIDATA_TS *piData = &rtp->piData[rtp->nReadPiData]; if ( ( error = IVAS_RTP_UNPACK_PullNextPiData( rtp->hUnpack, (IVAS_PIDATA_GENERIC *) &piData->data, sizeof( piData->data ), &piData->timestamp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "failed to pull PI Data, error = %s\n", ivas_error_to_string( error ) ); diff --git a/lib_util/ivas_rtp_file.h b/lib_util/ivas_rtp_file.h index ce2cc183d08775460bac3bf62cfa6040372eb134..f5c5dc70e3a68e2a07123baa827563e6304fa44f 100644 --- a/lib_util/ivas_rtp_file.h +++ b/lib_util/ivas_rtp_file.h @@ -42,7 +42,7 @@ typedef struct IVAS_RTP_FILE *IVAS_RTP_FILE_HANDLE; typedef struct { uint8_t packet[NOMINAL_BUFFER_SIZE( IVAS_MAX_FRAMES_PER_RTP_PACKET )]; - PIDATA_TS piData[IVAS_PI_MAX_ID * IVAS_MAX_FRAMES_PER_RTP_PACKET]; + IVAS_PIDATA_TS piData[IVAS_PI_MAX_ID * IVAS_MAX_FRAMES_PER_RTP_PACKET]; IVAS_RTP_FILE_HANDLE hRtpFile; FILE *f_piDataOut; @@ -73,8 +73,8 @@ ivas_error IVAS_RTP_READER_Init( IVAS_RTP *rtp, const char *inputBitstreamFilena void IVAS_RTP_Term( IVAS_RTP *rtp ); ivas_error IVAS_RTP_WriteNextFrame( IVAS_RTP *rtp, uint8_t *au, const IVAS_RTP_SR_INFO *srInfo, int16_t auSizeBits, bool isMono, bool forcePacket ); ivas_error IVAS_RTP_ReadNextFrame( IVAS_RTP *rtp, uint8_t *au, int16_t *auSizeBits, uint32_t *rtpTimeStamp, uint16_t *rtpSequenceNumber, uint32_t *nextPacketRcvTime_ms, IVAS_RTP_SR_INFO *srInfo, bool *qBit ); -void IVAS_RTP_LogPiData( FILE *f_piDataOut, const PIDATA_TS *piData, uint32_t nPiDataPresent ); -void IVAS_RTP_WriteExtPiData( FILE *f_piDataOut, const PIDATA_TS *piData, uint32_t nPiDataPresent, uint16_t numObj ); +void IVAS_RTP_LogPiData( FILE *f_piDataOut, const IVAS_PIDATA_TS *piData, uint32_t nPiDataPresent ); +void IVAS_RTP_WriteExtPiData( FILE *f_piDataOut, const IVAS_PIDATA_TS *piData, uint32_t nPiDataPresent, uint16_t numObj ); const char *IVAS_RTP_GetExtPiFilePath( IVAS_RTP *rtp ); uint16_t IVAS_RTP_OwnRandom( uint16_t *seed ); diff --git a/lib_util/ivas_rtp_payload.c b/lib_util/ivas_rtp_payload.c index f027ed40121ae2510dc623e2052b3de97d4436d2..bc2a3737831be2e8742905f744e3a6c4bce99fbb 100644 --- a/lib_util/ivas_rtp_payload.c +++ b/lib_util/ivas_rtp_payload.c @@ -131,7 +131,7 @@ typedef struct typedef struct PIDATA_NODE { struct PIDATA_NODE *next; /* next node is first element */ - PIDATA data; /* unpacked pi data per frame */ + IVAS_PIDATA data; /* unpacked pi data per frame */ uint32_t timestamp; /* rtp timestamp of this frame */ } PIDATA_NODE; @@ -979,7 +979,7 @@ ivas_error IVAS_RTP_PACK_PushPiData( if ( data == NULL || data->piDataType >= IVAS_PI_NO_DATA || /* NO_PI_DATA cannot be provided by user, it is generated in packing */ - data->size > sizeof( PIDATA ) ) + data->size > sizeof( IVAS_PIDATA ) ) { return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong PI Data provided" ); } diff --git a/lib_util/ivas_rtp_pi_data.c b/lib_util/ivas_rtp_pi_data.c index 353256ca37904e27c75ae0bfba03d289a7515b12..e1b2d98ace320b1c6eae5a4a5e306c43f01d74f7 100644 --- a/lib_util/ivas_rtp_pi_data.c +++ b/lib_util/ivas_rtp_pi_data.c @@ -1740,7 +1740,7 @@ ivas_error PI_UnPackData( uint8_t piDataType, uint32_t piSize, const uint8_t *pi return IVAS_ERR_OK; } -/* PIDATA Tables */ +/* IVAS_PIDATA Tables */ const float mapRT60[1u << NBITS_RT60] = { 0.01f, 0.0126f, 0.0159f, 0.02f, 0.0252f, 0.0317f, 0.04f, 0.0504f, 0.0635f, 0.08f, 0.1008f, 0.1270f, 0.16f, 0.2016f, 0.2540f, 0.32f, diff --git a/lib_util/ivas_rtp_pi_data.h b/lib_util/ivas_rtp_pi_data.h index 47e0f070e3b182a4f8d57463c89de8efef132a24..d1c10a591a7152fe002bc80c986ddb47c436f908 100644 --- a/lib_util/ivas_rtp_pi_data.h +++ b/lib_util/ivas_rtp_pi_data.h @@ -43,437 +43,4 @@ #define REVERSE_ISM_DIRECTION_AZIMUTH_STEP_INV 1.4222222222f #define REVERSE_ISM_DIRECTION_ELEVATION_STEP_INV 0.7055555556f -/* IVAS PI Data Types */ -typedef enum -{ - /* Forward direction PI types */ - IVAS_PI_SCENE_ORIENTATION, /* orientation of audio scene in unit quaternions */ - IVAS_PI_DEVICE_ORIENTATION_COMPENSATED, /* orientation of device in unit quaternions (compensated) */ - IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED, /* orientation of device in unit quaternions (un-compensated) */ - IVAS_PI_ACOUSTIC_ENVIRONMENT, /* describe the acoustic environment */ - IVAS_PI_AUDIO_DESCRIPTION, /* audio content description (voice/music/ambiance) */ - IVAS_PI_ISM_NUM, /* Number of objects */ - IVAS_PI_ISM_ID, /* id of each object */ - IVAS_PI_ISM_GAIN, /* gain of each object */ - IVAS_PI_ISM_ORIENTATION, /* orientation of each object */ - IVAS_PI_ISM_POSITION, /* position of each object */ - IVAS_PI_ISM_POSITION_COMPACT, /* position of each object in compact representation */ - IVAS_PI_ISM_DISTANCE_ATTENUATION, /* distance attenuation for each object */ - IVAS_PI_ISM_DIRECTIVITY, /* directivity of each object */ - IVAS_PI_DIEGETIC_TYPE, /* digetic audio indication */ - IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_INDICATION, /* audio suppression indication */ - IVAS_PI_AUDIO_FOCUS_INDICATION, /* audio focus indication (direction in Quaternions and/or level) */ - - /* Reverse direction PI types */ - IVAS_PI_PLAYBACK_DEVICE_ORIENTATION, /* orientation of the playback device in quaternions */ - 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_REQUEST, /* receiver’s preference with respect to audio suppression */ - 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 */ - IVAS_PI_R_ISM_ORIENTATION, /* editing request for orientation for received object */ - IVAS_PI_R_ISM_POSITION, /* editing request for position for received object */ - IVAS_PI_R_ISM_POSITION_COMPACT, /* editing request for position for received object in a compact representation*/ - IVAS_PI_R_ISM_DIRECTION, /* editing request for direction for received object */ - IVAS_PI_RESERVED27, /* reserved */ - IVAS_PI_RESERVED28, /* reserved */ - IVAS_PI_RESERVED29, /* reserved */ - IVAS_PI_NO_DATA = 31, /* Indicates an empty PI data frame */ - IVAS_PI_MAX_ID /* Max number of PI data IDs supprted */ -} IVAS_PI_TYPE; - -/* cartesian coordinates (X,Y,Z) in 3D space */ -typedef struct -{ - float x, y, z; -} IVAS_COORDINATE; - -/* orientation data corresponding to any of the following pi data types :- - * - IVAS_PI_SCENE_ORIENTATION - * - IVAS_PI_DEVICE_ORIENTATION_COMPENSATED - * - IVAS_PI_DEVICE_ORIENTATION_UNCOMPENSATED - * - IVAS_PI_PLAYBACK_DEVICE_ORIENTATION - * - IVAS_PI_HEAD_ORIENTATION - * - IVAS_PI_R_ISM_ORIENTATION - * - * piDataType is used to identify the correct pi data type contained here - */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_SCENE_ORIENTATION) */ - uint32_t piDataType; /* one of supported orientation data types */ - IVAS_QUATERNION orientation; /* orientation data expressed as quartenions */ -} IVAS_PIDATA_ORIENTATION; - -/* Acoustic environment corresponding to IVAS_PI_ACOUSTIC_ENVIRONMENT - * - * acoustic environment ID - * late reverb parameters - * - RT60 – indicating the time that it takes for the reflections to reduce 60 dB in energy level, per frequency band - * - DSR – diffuse to source signal energy ratio, per frequency band - * - Pre-delay – delay at which the computation of DSR values was performed - * early reflections - * - 3D rectangular virtual room dimensions - * - Broadband energy absorption coefficient per wall surface - */ -typedef enum -{ - IVAS_PI_AE_LOW, /* center frequency 25 Hz */ - IVAS_PI_AE_MID, /* center frequency 250 Hz */ - IVAS_PI_AE_HIGH, /* center frequency 2.5 kHz */ - IVAS_PI_AE_NUM_BANDS /* number of ae bands */ -} IVAS_PI_AE_BANDS; - -typedef enum -{ - IVAS_PI_AE_LOW_FREQ = 25, - IVAS_PI_AE_MID_FREQ = 250, - IVAS_PI_AE_HIGH_FREQ = 2500 -} IVAS_PI_AE_BANDS_FREQ; - -typedef enum -{ - IVAS_PI_AE_FRONT, - IVAS_PI_AE_BACK, - IVAS_PI_AE_LEFT, - IVAS_PI_AE_RIGHT, - IVAS_PI_AE_CEILING, - IVAS_PI_AE_FLOOR, - IVAS_PI_AE_NUM_SURFACE -} IVAS_PI_AE_SURFACE; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ACOUSTIC_ENV) */ - uint32_t piDataType; /* IVAS_PI_ACOUSTIC_ENVIRONMENT */ - bool availLateReverb; /* AE contains only late reverb parameters */ - bool availEarlyReflections; /* AE containing late reverb and simplified early reflections */ - uint8_t aeid; /* seven-bit acoustic environment identifier */ - - /* only valid if availLateReverb==true or availEarlyReflections==true */ - float rt60[IVAS_PI_AE_NUM_BANDS]; /* time for the reflections to reduce 60 dB per band in seconds */ - float dsr[IVAS_PI_AE_NUM_BANDS]; /* diffuse to source signal energy ratio per band in dB */ - - /* only valid if availEarlyReflections==true */ - IVAS_COORDINATE roomDimensions; /* room dimensions in meters length (x), width (y), height (z) */ - float absorbCoeffs[IVAS_PI_AE_NUM_SURFACE]; /* absorption coefficients for all surfaces */ -} IVAS_PIDATA_ACOUSTIC_ENV; - -/* Audio Description corresponding to IVAS_PI_AUDIO_DESCRIPTION - * Describe the following audio decriptors per object/type :- - * - audio content type is speech/music/ambiance - * - if audio rendering is editable - * - if stereo audio is binaural - * - * number of valid entries decide on basis of audio format:- - * - Stereo/SBA/MASA = 1 entry - * - MultiChannel = 2 entries (1 for center channel + 1 for all other channels) - * - ISM = Number of Object entries ( 1 per object ) - * - OMASA/OSBA = 1 + Num Discrete Coded Objects - * - */ -typedef struct -{ - bool speech; /* audio has voice/speech */ - bool music; /* audio has music */ - bool ambiance; /* audio has background ambiance */ - bool editable; /* rendering audio metadata is editable */ - bool binaural; /* stereo stream is binaural */ -} IVAS_AUDIO_ID; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_AUDIO_DESC) */ - uint32_t piDataType; /* IVAS_PI_AUDIO_DESCRIPTION */ - uint32_t nValidEntries; /* Number of valid audio IDs */ - IVAS_AUDIO_ID audioId[1 + IVAS_MAX_NUM_OBJECTS]; /* audio id as per format */ -} IVAS_PIDATA_AUDIO_DESC; - -/* ISM specific PI data related to PI types : - - * - * - IVAS_PI_ISM_NUM - * - IVAS_PI_ISM_ID - * - IVAS_PI_ISM_GAIN - * - IVAS_PI_ISM_ORIENTATION - * - IVAS_PI_ISM_POSITION - * - IVAS_PI_ISM_DISTANCE_ATTENUATION - * - IVAS_PI_ISM_DIRECTIVITY - */ - -/* Number of ISMs */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_NUM) */ - uint32_t piDataType; /* IVAS_PI_ISM_NUM */ - uint32_t numObjects; /* Number of ISM */ -} IVAS_PIDATA_ISM_NUM; - -/* ISM ID */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_ID) */ - uint32_t piDataType; /* IVAS_PI_ISM_ID */ - uint16_t numObjects; /* number of objects */ - uint8_t id[IVAS_MAX_NUM_OBJECTS]; /* 8-bit ISM id of object */ -} IVAS_PIDATA_ISM_ID; - -/* ISM gain */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_GAIN) */ - uint32_t piDataType; /* IVAS_PI_ISM_GAIN */ - uint16_t numObjects; /* number of objects */ - int8_t dB[IVAS_MAX_NUM_OBJECTS]; /* ISM gain in dB per object [-96, +3] */ -} IVAS_PIDATA_ISM_GAIN; - -/* ISM orientation */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_ORIENTATION) */ - uint32_t piDataType; /* IVAS_PI_ISM_ORIENTATION */ - uint16_t numObjects; /* number of objects */ - IVAS_QUATERNION orientation[IVAS_MAX_NUM_OBJECTS]; /* Orientation of audio objects in ISM(s) */ -} IVAS_PIDATA_ISM_ORIENTATION; - -/* ISM position */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_POSITION) */ - uint32_t piDataType; /* IVAS_PI_ISM_POSITION */ - uint16_t numObjects; /* number of objects */ - IVAS_COORDINATE position[IVAS_MAX_NUM_OBJECTS]; /* Position of audio objects in ISM(s) */ -} IVAS_PIDATA_ISM_POSITION; - -/* ISM distance attenuation comprising of following gains per ISM - * - reference distance - * - maximum distance - * - roll-off factor - */ -typedef struct -{ - float ref_dist; /* reference distance in meters */ - float max_dist; /* maximum distance in meters */ - float roll; /* roll-off factor values */ -} IVAS_DIST_ATTEN; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_ATTENUATION) */ - uint32_t piDataType; /* IVAS_PI_ISM_DISTANCE_ATTENUATION */ - uint16_t numObjects; /* number of objects */ - IVAS_DIST_ATTEN distAtten[IVAS_MAX_NUM_OBJECTS]; /* Distance attenuation of audio objects */ -} IVAS_PIDATA_ISM_ATTENUATION; - -/* ISM Directivity comprising of following per ISM :- - * - inner cone angle determines the size of the main cone directed to the front of the object - * - outer cone angle determines the size of the outer (back) cone - * - outer attenuation gain determines the attenuation outside the outer cone - */ -typedef struct -{ - uint16_t innerConeAngle; /* inner cone angle in degrees (0 - 360) */ - uint16_t outerConeAngle; /* outer cone angle in degrees (0 - 360) */ - float outerAttenuationdB; /* attenuation outside the outer cone in dB */ -} IVAS_ISM_DIRECTIVITY; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_DIRECTIVITY) */ - uint32_t piDataType; /* IVAS_PI_ISM_DIRECTIVITY */ - uint16_t numObjects; /* number of objects */ - IVAS_ISM_DIRECTIVITY directivity[IVAS_MAX_NUM_OBJECTS]; /* Directivity of audio objects */ -} IVAS_PIDATA_ISM_DIRECTIVITY; - -/* Diegetic and non-diegetic indication flag as per audio format - * - * number of valid entries decided on basis of audio format:- - * - Stereo/SBA/MASA/MultiChannel = 1 entry - * - ISM = Number of Object entries ( 1 per object ) - * - OMASA/OSBA = 1 (last) + Num Discrete Coded Objects - */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_DIEGETIC) */ - uint32_t piDataType; /* IVAS_PI_DIEGETIC_TYPE */ - bool isDiegetic[1 + IVAS_MAX_NUM_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_MAX_AUDIO_FOCUS, /* Apply max audio focus */ - IVAS_FLVL_DEFAULT_AUDIO_FOCUS, /* Default audio focus */ - IVAS_FLVL_NO_PREFERENCE, /* No preference / No indication */ -} 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; - -/* Position data corresponding to any of the following pi data types :- - * - IVAS_PI_LISTENER_POSITION - * - IVAS_PI_R_ISM_POSITION - * - * piDataType is used to identify the correct pi data type contained here - */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_POSITION) */ - uint32_t piDataType; /* one of supported position data types */ - IVAS_COORDINATE position; /* Position data */ -} IVAS_PIDATA_POSITION; - -/* Dynamic Audio Suppression describes receiver’s preference with respect to the - * type of audio content that should be enhanced and the amount of suppression to - * be applied to the background noise - */ -typedef enum -{ - IVAS_SLI_MIN_SUPPRESSION = 0, /* Apply min suppression */ - IVAS_SLI_SUPPRESSION_LEVEL_1, /* Suppression level 1 */ - IVAS_SLI_SUPPRESSION_LEVEL_2, /* Suppression level 2 */ - IVAS_SLI_SUPPRESSION_LEVEL_3, /* Suppression level 3 */ - IVAS_SLI_SUPPRESSION_LEVEL_4, /* Suppression level 4 */ - IVAS_SLI_SUPPRESSION_LEVEL_5, /* Suppression level 5 */ - IVAS_SLI_SUPPRESSION_LEVEL_6, /* Suppression level 6 */ - IVAS_SLI_SUPPRESSION_LEVEL_7, /* Suppression level 7 */ - IVAS_SLI_SUPPRESSION_LEVEL_8, /* Suppression level 8 */ - IVAS_SLI_SUPPRESSION_LEVEL_9, /* Suppression level 9 */ - IVAS_SLI_SUPPRESSION_LEVEL_10, /* Suppression level 10 */ - IVAS_SLI_SUPPRESSION_LEVEL_11, /* Suppression level 11 */ - IVAS_SLI_MAX_SUPPRESSION, /* Apply max suppression */ - IVAS_SLI_NO_SUPPRESSION, /* Apply no suppression */ - IVAS_SLI_DEFAULT_SUPPRESSION, /* Apply default suppression */ - IVAS_SLI_NO_PREFERENCE, /* No preference / No indication */ -} IVAS_SLI; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_DYNAMIC_SUPPRESSION) */ - uint32_t piDataType; /* IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_REQUEST or IVAS_PI_DYNAMIC_AUDIO_SUPPRESSION_INDICATION */ - bool speech; /* receiver's preference is voice/speech */ - bool music; /* receiver's preference is music */ - bool ambiance; /* receiver's preference is background ambiance */ - IVAS_SLI sli; /* suppression level indicator [0, 15] */ -} IVAS_PIDATA_DYNAMIC_SUPPRESSION; - -/* Reverse PI latency calculated as the elapsed time between the sent reverse PI data - * and received forward PI data. It is based on the receiving device experiencing the - * result of its sent data by receiving the corresponding data in forward direction as - * forward PI data - */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_REVERSE_PI_LATENCY) */ - uint32_t piDataType; /* IVAS_PI_PI_LATENCY */ - IVAS_PI_TYPE type; /* Reverse PI used for computation of Latency */ - int32_t latency; /* Latency as 27-bit int on RTP Clock @ 16KHz */ -} IVAS_PIDATA_REVERSE_PI_LATENCY; - -/* ISM specific PI data editing requests */ - -/* ISM ID in editing requests */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_ID) */ - uint32_t piDataType; /* IVAS_PI_R_ISM_ID */ - uint8_t id; /* 8-bit ISM id of object to edit */ -} IVAS_PIDATA_ISM_EDIT_ID; - -/* Editing request for ISM gain */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_GAIN) */ - uint32_t piDataType; /* IVAS_PI_R_ISM_GAIN */ - int8_t dB; /* Preferred ISM gain in dB [-96, +3] */ -} IVAS_PIDATA_ISM_EDIT_GAIN; - -/* Editing request for ISM orientation */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_ORIENTATION) */ - uint32_t piDataType; /* IVAS_PI_R_ISM_ORIENTATION */ - IVAS_QUATERNION orientation; /* orientation editing request for received ISM */ -} IVAS_PIDATA_ISM_EDIT_ORIENTATION; - -/* Editing request for ISM direction */ -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_ISM_EDIT_DIRECTION) */ - uint32_t piDataType; /* IVAS_PI_R_ISM_DIRECTION */ - float azimuth; /* azimuth angle in degrees [-180, 180] */ - float elevation; /* elevation angle in degrees [-90°, 90°] */ -} IVAS_PIDATA_ISM_EDIT_DIRECTION; - -typedef struct -{ - size_t size; /* sizeof(IVAS_PIDATA_NO_DATA) */ - uint32_t piDataType; /* IVAS_PI_NO_DATA */ -} IVAS_PIDATA_NO_DATA; - - -typedef union -{ - IVAS_PIDATA_ORIENTATION scene; - IVAS_PIDATA_ORIENTATION deviceCompensated; - IVAS_PIDATA_ORIENTATION deviceUnCompensated; - IVAS_PIDATA_ACOUSTIC_ENV acousticEnv; - IVAS_PIDATA_AUDIO_DESC audioDesc; - IVAS_PIDATA_ISM_NUM ismNum; - IVAS_PIDATA_ISM_ID ismId; - IVAS_PIDATA_ISM_GAIN ismGain; - IVAS_PIDATA_ISM_ORIENTATION ismOrientation; - IVAS_PIDATA_ISM_POSITION ismPosition; - IVAS_PIDATA_ISM_POSITION ismPositionCompact; - IVAS_PIDATA_ISM_ATTENUATION ismAttenuation; - IVAS_PIDATA_ISM_DIRECTIVITY ismDirectivity; - IVAS_PIDATA_DIEGETIC digeticIndicator; - IVAS_PIDATA_DYNAMIC_SUPPRESSION dynSuppressionIndication; - IVAS_PIDATA_AUDIO_FOCUS focusIndication; - - IVAS_PIDATA_ORIENTATION playbackOrientation; - IVAS_PIDATA_ORIENTATION headOrientation; - IVAS_PIDATA_POSITION listnerPosition; - IVAS_PIDATA_DYNAMIC_SUPPRESSION dynSuppressionRequest; - IVAS_PIDATA_AUDIO_FOCUS focusRequest; - IVAS_PIDATA_REVERSE_PI_LATENCY piLatency; - IVAS_PIDATA_ISM_EDIT_ID ismEditId; - IVAS_PIDATA_ISM_EDIT_GAIN ismEditGain; - IVAS_PIDATA_ISM_EDIT_ORIENTATION ismEditOrientation; - IVAS_PIDATA_POSITION ismEditPosition; - IVAS_PIDATA_POSITION ismEditPositionCompact; - IVAS_PIDATA_ISM_EDIT_DIRECTION ismEditDirection; - IVAS_PIDATA_NO_DATA noPiData; -} PIDATA; - -typedef struct pidata_ts_struct -{ - PIDATA data; - uint32_t timestamp; -} PIDATA_TS; - #endif /* IVAS_RTP_PI_DATA_H */