diff --git a/apps/decoder.c b/apps/decoder.c index 306a813e20fee0231e2aa073d272d6d27f536e14..7118e56c666d987404d6181581ecc1d085d64b6f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -75,22 +75,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ -#define MIN_NUM_BITS_ACTIVE_FRAME 56 -#define NUM_BITS_SID_IVAS_5K2 104 -#define MAX_OUTPUT_PCM_BUFFER_SIZE ( ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) * IVAS_MAX_FRAME_SIZE ) - -#define ORIENT_TRK_NONE ( 0 ) -#define ORIENT_TRK_REF ( 1 ) -#define ORIENT_TRK_AVG ( 2 ) -#define ORIENT_TRK_REF_VEC ( 3 ) -#define ORIENT_TRK_REF_VEC_LEV ( 4 ) - -#ifdef VARIABLE_SPEED_DECODING -#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 +#ifdef DEBUGGING +#define MIN_NUM_BITS_ACTIVE_FRAME 56 +#define NUM_BITS_SID_IVAS_5K2 104 #endif -#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 -#define HEADROTATION_FETCH_FRAMESIZE_MS 5 -#define DEFAULT_FETCH_FRAMESIZE_MS 20 /*------------------------------------------------------------------------------------------* @@ -136,7 +124,7 @@ typedef struct IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; - int16_t orientation_tracking; + IVAS_HEAD_ORIENT_TRK_T orientation_tracking; bool non_diegetic_pan_enabled; float non_diegetic_pan_gain; bool renderConfigEnabled; @@ -195,10 +183,10 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec ); +static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #else static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); +static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); #endif static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); #ifdef DEBUGGING @@ -384,7 +372,7 @@ int main( } /* sanity check */ - if ( arg.orientation_tracking != ORIENT_TRK_REF ) + if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF ) { fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" ); goto cleanup; @@ -411,7 +399,7 @@ int main( } /* sanity check */ - if ( arg.orientation_tracking != ORIENT_TRK_REF_VEC && arg.orientation_tracking != ORIENT_TRK_REF_VEC_LEV ) + if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV ) { fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" ); goto cleanup; @@ -802,9 +790,9 @@ int main( if ( arg.voipMode ) { #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec ); + error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf ); #else - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec ); + error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec, pcmBuf ); #endif } else @@ -1010,6 +998,10 @@ static bool parseCmdlIVAS_dec( int16_t i; char argv_to_upper[FILENAME_MAX]; + /*-----------------------------------------------------------------* + * Set default values + *-----------------------------------------------------------------*/ + #ifdef DEBUGGING float ftmp; @@ -1018,7 +1010,7 @@ static bool parseCmdlIVAS_dec( arg->agcBitstream = NULL; #endif #endif - arg->output_Fs = 48000; + arg->output_Fs = IVAS_MAX_SAMPLING_RATE; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; @@ -1028,7 +1020,7 @@ static bool parseCmdlIVAS_dec( arg->enableHeadRotation = false; arg->headrotTrajFileName = NULL; - arg->orientation_tracking = ORIENT_TRK_NONE; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; arg->enableReferenceRotation = false; arg->headrotTrajFileName = NULL; arg->enableReferenceVectorTracking = false; @@ -1244,9 +1236,9 @@ static bool parseCmdlIVAS_dec( } arg->tsmScale = (uint16_t) tmp; - if ( arg->tsmScale < 50 || arg->tsmScale > 150 ) + if ( arg->tsmScale < IVAS_TIME_SCALE_MIN || arg->tsmScale > IVAS_TIME_SCALE_MAX ) { - fprintf( stderr, "Error: Scaling factor value must be 50 <= fac <= 150!\n\n" ); + fprintf( stderr, "Error: Scaling factor value must be IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX !\n\n" ); usage_dec(); return false; } @@ -1321,23 +1313,23 @@ static bool parseCmdlIVAS_dec( if ( strcmp( argv_to_upper, "NONE" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_NONE; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; } else if ( strcmp( argv_to_upper, "REF" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF; } else if ( strcmp( argv_to_upper, "AVG" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_AVG; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_AVG; } else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF_VEC; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC; } else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 ) { - arg->orientation_tracking = ORIENT_TRK_REF_VEC_LEV; + arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV; } else { @@ -1795,7 +1787,7 @@ static void usage_dec( void ) #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING fprintf( stdout, "-VS fac : Variable Speed mode: change speed of playout fac as integer in percent.\n" ); - fprintf( stdout, " 50 <= fac <= 150; fac<100 faster, fac>100 slower\n" ); + fprintf( stdout, " IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX; fac<100 faster, fac>100 slower\n" ); #endif #endif fprintf( stdout, "-fr L : render frame size in ms L=(5,10,20), default is 20)\n" ); @@ -3168,14 +3160,15 @@ static ivas_error decodeVoIP( #ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE ObjectEditFileReader *objectEditFileReader, #endif - IVAS_DEC_HANDLE hIvasDec ) + IVAS_DEC_HANDLE hIvasDec, + int16_t *pcmBuf ) { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ ivas_error error = IVAS_ERR_OK; uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; - uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; + uint32_t systemTimeInc_ms = (uint32_t) ( 1000 / IVAS_NUM_FRAMES_PER_SEC ); int32_t nFramesFed = 0; uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3]; @@ -3189,7 +3182,6 @@ static ivas_error decodeVoIP( MasaFileWriter *masaWriter = NULL; uint16_t numObj = 0; - int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; AudioFileWriter *afWriter = NULL; #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriter *jbmTraceWriter = NULL; diff --git a/apps/encoder.c b/apps/encoder.c index 4ff6171ddea4ae8f4a245f743a386dc9297800a9..7e5154226196f061b43140f49c7e86cca921f58d 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -170,7 +170,6 @@ typedef struct * Local functions prototypes *------------------------------------------------------------------------------------------*/ -static void initArgStruct( EncArguments *arg ); static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg ); static void usage_enc( void ); static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter ); @@ -223,8 +222,6 @@ int main( reset_mem( USE_BYTES ); #endif - initArgStruct( &arg ); - /*------------------------------------------------------------------------------------------* * Parse command-line arguments *------------------------------------------------------------------------------------------*/ @@ -906,14 +903,29 @@ cleanup: * Local functions *-------------------------------------------------------------------*/ -#define IVAS_DEFAULT_AGC ( 0 ) +/*---------------------------------------------------------------------* + * parseCmdlIVAS_enc() + * + * Encoder command-line parsing + *---------------------------------------------------------------------*/ -static void initArgStruct( EncArguments *arg ) +static bool parseCmdlIVAS_enc( + int16_t argc, + char *argv[], + EncArguments *arg ) { - /* Set default values here */ + int16_t i, j; + char argv_to_upper[FILENAME_MAX]; + char stmp[FILENAME_MAX]; + int32_t tmp; + + /*-----------------------------------------------------------------* + * Set default values + *-----------------------------------------------------------------*/ + arg->inputWavFilename = NULL; arg->outputBitstreamFilename = NULL; - arg->inputFs = 0; + arg->inputFs = IVAS_MAX_SAMPLING_RATE; arg->inputFormat = IVAS_ENC_INPUT_MONO; arg->is_binaural = false; arg->inputFormatConfig.stereoToMonoDownmix = false; @@ -935,9 +947,6 @@ static void initArgStruct( EncArguments *arg ) #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; arg->forcedModeFile = NULL; -#ifdef DEBUG_FORCE_DIR - arg->forcedModeDir = NULL; -#endif #ifdef DEBUG_AGC_ENCODER_CMD_OPTION arg->agc = IVAS_ENC_AGC_UNDEFINED; #endif @@ -950,25 +959,9 @@ static void initArgStruct( EncArguments *arg ) #endif arg->pca = false; - return; -} - - -/*---------------------------------------------------------------------* - * parseCmdlIVAS_enc() - * - * Encoder command-line parsing - *---------------------------------------------------------------------*/ - -static bool parseCmdlIVAS_enc( - int16_t argc, - char *argv[], - EncArguments *arg ) -{ - int16_t i, j; - char argv_to_upper[FILENAME_MAX]; - char stmp[FILENAME_MAX]; - int32_t tmp; + /*-----------------------------------------------------------------* + * Initialization + *-----------------------------------------------------------------*/ if ( argc < 5 ) { diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index fc93d9375519cc6235a7f02ee42adfe4b31d0eb8..f7b3e479f6a526c18aa2c64024d8d56382499cb4 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -920,7 +920,7 @@ int main( memset( outBuffer.data, 0, outBuffer.config.numSamplesPerChannel * outBuffer.config.numChannels * sizeof( float ) ); - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + bitsBufferSize = ISAR_SPLIT_REND_BITS_BUFF_SIZE; if ( bitsBufferSize > 0 ) { diff --git a/apps/renderer.c b/apps/renderer.c index 0c5183cd93d8ec6d016ba1d000d80e3bc70968cd..1a70731cd4350ddd4d1c855c7c56154a77a44435 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -170,7 +170,7 @@ typedef struct char externalOrientationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; - int8_t orientation_tracking; + IVAS_HEAD_ORIENT_TRK_T orientation_tracking; int16_t Opt_Headrotation; int16_t Opt_ExternalOrientation; int16_t nonDiegeticPan; @@ -1477,7 +1477,7 @@ int main( if ( is_split_pre_rend_mode( &args ) ) { - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + bitsBufferSize = ISAR_SPLIT_REND_BITS_BUFF_SIZE; } else { @@ -2312,7 +2312,7 @@ static bool parseRenderFramesize( static bool parseOrientationTracking( char *value, - int8_t *orientation_tracking ) + IVAS_HEAD_ORIENT_TRK_T *orientation_tracking ) { to_upper( value ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index eee9180a70d52c9606d7c5a54ed0d8b127d87fee..90c17ff332c6914fdde014000fb0cfe12f278ddf 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -44,24 +44,27 @@ * Common API constants *----------------------------------------------------------------------------------*/ -#define IVAS_NUM_FRAMES_PER_SEC 50 -#define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) -#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) +#define IVAS_NUM_FRAMES_PER_SEC 50 /* number of frames per second */ +#define IVAS_MAX_SAMPLING_RATE 48000 /* maximum supported sampling rate in Hz */ +#define IVAS_MAX_FRAME_SIZE ( IVAS_MAX_SAMPLING_RATE / IVAS_NUM_FRAMES_PER_SEC ) /* maximum frame buffer length (per channel) in samples */ +#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) /* maximum bits per frame; corresponds to maximum bitrate of 512 kbps */ #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 -#define IVAS_MAX_OUTPUT_CHANNELS 16 +#define IVAS_MAX_OUTPUT_CHANNELS 16 /* Note: there is an exception for OSBA and EXT otuput where it can be 20 (HOA3 + 4 ISM channels) */ #define IVAS_CLDFB_NO_COL_MAX 16 #define IVAS_CLDFB_NO_CHANNELS_MAX 60 +/* Renderer constants */ #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 #define IVAS_ROOM_ABS_COEFF 6 +#define IVAS_REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ +#define IVAS_ER_LIST_HEIGHT 1.6f -/* Maximum buffer length (per channel) in samples */ -#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +/* JBM constants for adaptive-playout */ +#define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ +#define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */ -/* Frame size required when rendering to binaural */ -#define BINAURAL_RENDERING_FRAME_SIZE_MS 5 /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations @@ -183,7 +186,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 cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; +typedef struct ivas_cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; @@ -232,7 +235,7 @@ typedef enum _ivas_binaural_renderer_type #define ISAR_MAX_SPLIT_REND_BITRATE 768000 #define ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) ISAR_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #define ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 -#define SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#define ISAR_SPLIT_REND_BITS_BUFF_SIZE ( ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES + ISAR_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) typedef enum { @@ -310,7 +313,6 @@ typedef enum } IVAS_RENDER_TYPE_OVERRIDE; #endif - typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ @@ -338,6 +340,7 @@ typedef struct _IVAS_RENDER_CONFIG ISAR_SPLIT_REND_CONFIG_DATA split_rend_config; float directivity[IVAS_MAX_NUM_OBJECTS * 3]; float distAtt[3]; + } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; typedef struct @@ -345,12 +348,14 @@ typedef struct int16_t numSamplesPerChannel; int16_t numChannels; int16_t is_cldfb; + } IVAS_REND_AudioBufferConfig; typedef struct { IVAS_REND_AudioBufferConfig config; float *data; + } IVAS_REND_AudioBuffer; #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3456ea29c7d45e8e40860facf570c3db7d523182..0dfee803658d93bfe02c6cd9f5c965e43f555786 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -133,7 +133,7 @@ typedef enum #define MAX_INTERN_CHANNELS 16 /* Maximum number of intern channels (HOA 3rd order) */ #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ #define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ -#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order), == IVAS_MAX_OUTPUT_CHANNELS */ +#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) without separate objects in combined formats */ #define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN 2 /* Maximum number of output channels with non diegetic panning */ #define BINAURAL_CHANNELS 2 /* number of channels for binaural output configuration */ @@ -1494,7 +1494,6 @@ typedef enum #define HRTF_SH_CHANNELS HOA3_CHANNELS #define HRTF_LS_CHANNELS 15 #define HRTF_NUM_BINS 60 -#define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ #define LOW_BIT_RATE_BINAURAL_EQ_BINS 17 /* Number of bins in an EQ applied at low bit rates in binauralization */ #define LOW_BIT_RATE_BINAURAL_EQ_OFFSET 14 /* Offset of bins where the low-bit-rate EQ starts*/ @@ -1737,9 +1736,7 @@ typedef enum *----------------------------------------------------------------------------------*/ #define ER_RADIUS (1.0f) -#define ER_LIST_ORIGIN_X (0.0f) -#define ER_LIST_ORIGIN_Y (0.0f) -#define ER_LIST_HEIGHT (1.6f) +#define ER_LIST_HEIGHT IVAS_ER_LIST_HEIGHT /*----------------------------------------------------------------------------------* diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 622a07eb1f84f4effef66fd4f09ded4af332e43c..4f459ef531af9409ffe1733321edba991b965cad 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -573,7 +573,7 @@ typedef struct } FrameSizeParams; -typedef struct cldfb_filter_bank_struct +typedef struct ivas_cldfb_filter_bank_struct { int16_t no_channels; int16_t no_col; diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 26c380e38a16e5230fc773e090514e64042d1d92..a728cb53d346366279f716c756017a71eda89711 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -39,9 +39,9 @@ #ifndef JBM_PCMDSP_APA_H #define JBM_PCMDSP_APA_H JBM_PCMDSP_APA_H +#include "common_api_types.h" #include -#include -#include "options.h" + /* ******************************************************************************** @@ -50,17 +50,17 @@ */ /* size of IO buffers (a_in[], a_out[]) for apa_exec() */ -#define APA_BUF_PER_CHANNEL ( 960 * 3 ) +#define APA_BUF_PER_CHANNEL ( IVAS_MAX_FRAME_SIZE * 3 ) #define APA_MAX_NUM_CHANNELS 16 #define APA_BUF ( APA_BUF_PER_CHANNEL * APA_MAX_NUM_CHANNELS ) /* min/max sampling rate [Hz] */ #define APA_MIN_RATE 1000 -#define APA_MAX_RATE 48000 +#define APA_MAX_RATE IVAS_MAX_SAMPLING_RATE /* min/max scaling [%] */ -#define APA_MIN_SCALE 50 -#define APA_MAX_SCALE 150 +#define APA_MIN_SCALE IVAS_TIME_SCALE_MIN +#define APA_MAX_SCALE IVAS_TIME_SCALE_MAX #define APA_SM_SURROUND 1 #define APA_SM_LOGARITHMIC 2 diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 9c17b5fa40880ee7a58d04e80285c876a7b9457b..7d1b9e45558cde30b585dfc51f0438568dee1da5 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2787,7 +2787,7 @@ ivas_error IVAS_DEC_GetFormat( /*---------------------------------------------------------------------* - * getInputBufferSize() + * getOutputBufferSize() * * *---------------------------------------------------------------------*/ diff --git a/lib_isar/isar_cnst.h b/lib_isar/isar_cnst.h index 8f2636bdaa743c7e67cef9236bf2a2f6aa1fd098..88a26196aa36b780329b73d4b21c6e80e41be3df 100644 --- a/lib_isar/isar_cnst.h +++ b/lib_isar/isar_cnst.h @@ -110,7 +110,7 @@ typedef enum #define ISAR_SPLIT_REND_ROT_AXIS_BITS 3 #define ISAR_SPLIT_REND_RO_FLAG_BITS 1 -#define IVAS_LC3PLUS_MAX_NUM_DECODERS 2 +#define ISAR_LC3PLUS_MAX_NUM_DECODERS 2 /*----------------------------------------------------------------------------------* * Split rendering bitrate constants diff --git a/lib_isar/isar_lc3plus_dec.c b/lib_isar/isar_lc3plus_dec.c index 7d43ed83bb5d4339b9f469ff8f435b678d78bf81..f097aec143164db122a26a08d6b04a85667ba1ef 100644 --- a/lib_isar/isar_lc3plus_dec.c +++ b/lib_isar/isar_lc3plus_dec.c @@ -66,9 +66,9 @@ ivas_error ISAR_LC3PLUS_DEC_Open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus wrapper handle\n" ); } - if ( config.channels > IVAS_LC3PLUS_MAX_NUM_DECODERS ) + if ( config.channels > ISAR_LC3PLUS_MAX_NUM_DECODERS ) { - return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "Maximum number of channels exceeds IVAS_LC3PLUS_MAX_NUM_DECODERS\n" ); + return IVAS_ERROR( IVAS_ERR_INIT_ERROR, "Maximum number of channels exceeds ISAR_LC3PLUS_MAX_NUM_DECODERS\n" ); } diff --git a/lib_isar/isar_stat.h b/lib_isar/isar_stat.h index acdddd83938c685c31aec5211e335030916cc9d2..587c3c8ea7309fc6a4fe0fe3cbc66dbebfdcd0f8 100644 --- a/lib_isar/isar_stat.h +++ b/lib_isar/isar_stat.h @@ -48,9 +48,9 @@ * ISAR post rend constants *-------------------------------------------------------------------*/ -#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) +#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME_MAX * 2 ) #define MAX_CLDFB_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) -#define MAX_BIN_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) +#define MAX_BIN_BUFFER_LENGTH ( L_FRAME_MAX * BINAURAL_CHANNELS ) #define MAX_CLDFB_BIN_BUFFER_LENGTH ( MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL * BINAURAL_CHANNELS ) /*-------------------------------------------------------------------* diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 9bbee5d1bbdfeabbb86136b180beb181640db659..711be967ddcd57f8d9e92f624fd28cdaa4c07f2d 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1039,8 +1039,8 @@ ivas_error ISAR_POST_REND_FeedInputAudio( cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; - if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } @@ -1653,8 +1653,8 @@ ivas_error ISAR_POST_REND_getSamples( cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; - if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) + if ( outAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index a5ade8027d545428f5b5f2bf77957991cf060fc5..ffb0177946cb9351bfc10a840827b24f01344de1 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -158,9 +158,9 @@ static void ivas_binaural_reverb_setPreDelay( return; } - if ( delaySamples > REVERB_PREDELAY_MAX ) + if ( delaySamples > IVAS_REVERB_PREDELAY_MAX ) { - hReverb->preDelayBufferLength = REVERB_PREDELAY_MAX; + hReverb->preDelayBufferLength = IVAS_REVERB_PREDELAY_MAX; return; } @@ -1787,7 +1787,7 @@ static ivas_error ivas_binaural_reverb_open( hReverb->numBins = numBins; hReverb->blockSize = numCldfbSlotsPerFrame; - for ( k = 0; k < REVERB_PREDELAY_MAX + 1; k++ ) + for ( k = 0; k < IVAS_REVERB_PREDELAY_MAX + 1; k++ ) { set_f( hReverb->preDelayBufferReal[k], 0.0f, hReverb->numBins ); set_f( hReverb->preDelayBufferImag[k], 0.0f, hReverb->numBins ); diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 36a84bd1a111221dae66adbe11e149d092579efc..9c4f590a01d21f0e584af1d8e29277d789171339 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -47,7 +47,6 @@ *-----------------------------------------------------------------------------------------*/ #define DEFAULT_SRC_DIST ( 1.5f ) /* default source distance [m] for reverb dmx factor computing */ -#define MAX_SAMPLING_RATE ( 48000 ) #define CLDFB_CONVOLVER_NTAPS_MAX ( 16 ) #define FFT_SPECTRUM_SIZE ( 1 + ( RV_FILTER_MAX_FFT_SIZE / 2 ) ) @@ -93,7 +92,7 @@ ivas_error ivas_reverb_prepare_cldfb_params( for ( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { - fc[idx] = ( (float) idx + 0.5f ) * ( (float) MAX_SAMPLING_RATE / (float) ( 2 * CLDFB_NO_CHANNELS_MAX ) ); + fc[idx] = ( (float) idx + 0.5f ) * ( (float) IVAS_MAX_SAMPLING_RATE / (float) ( 2 * IVAS_CLDFB_NO_CHANNELS_MAX ) ); } ivas_reverb_interpolate_acoustic_data( pInput_params->nBands, pInput_params->pFc_input, pInput_params->pAcoustic_rt60, pInput_params->pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX, fc, pOutput_t60, pOutput_ene ); @@ -136,7 +135,7 @@ static void ivas_reverb_set_energies( float *avg_pwr_right ) { int16_t freq_idx; - const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); + const int16_t cldfb_freq_halfstep = IVAS_MAX_SAMPLING_RATE / ( 4 * IVAS_CLDFB_NO_CHANNELS_MAX ); float input_fc[FFT_SPECTRUM_SIZE]; float output_fc[CLDFB_NO_CHANNELS_MAX]; @@ -147,9 +146,9 @@ static void ivas_reverb_set_energies( input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( avg_pwr_len - 1 ) ); } - for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) + for ( freq_idx = 0; freq_idx < IVAS_CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } - ivas_reverb_interpolate_acoustic_data( avg_pwr_len, input_fc, avg_pwr_l, avg_pwr_r, CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); + ivas_reverb_interpolate_acoustic_data( avg_pwr_len, input_fc, avg_pwr_l, avg_pwr_r, IVAS_CLDFB_NO_CHANNELS_MAX, output_fc, avg_pwr_left, avg_pwr_right ); } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 396e4e6c64b5dc21ad631d49f407fbc67150cdf3..bba88de8efe8f7b4c322391d13484180fb2b15fa 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -452,8 +452,8 @@ typedef struct ivas_binaural_reverb_struct { float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferReal[IVAS_REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferImag[IVAS_REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 953672fcebf586182bdabc998a0d006ef62af64b..d740eed347e9a4f8b0ce1498e147455472465e5a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -51,7 +51,7 @@ *-------------------------------------------------------------------*/ /* Maximum buffer length (total) in samples. */ -#define MAX_BUFFER_LENGTH ( MAX_BUFFER_LENGTH_PER_CHANNEL * MAX_INPUT_CHANNELS ) +#define MAX_BUFFER_LENGTH ( L_FRAME_MAX * MAX_INPUT_CHANNELS ) #define MAX_BIN_DELAY_SAMPLES 150 /* Maximum supported rendering latency for binaural IRs */ /*-------------------------------------------------------------------* @@ -4013,8 +4013,8 @@ ivas_error IVAS_REND_FeedInputAudio( cldfb2tdSampleFact = ( inputAudio.config.is_cldfb ) ? 2 : 1; - if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); } @@ -5796,7 +5796,7 @@ static ivas_error renderLfeToBinaural( int16_t pose_idx, num_poses; float gain; int16_t ear_idx; - float tmpLfeBuffer[MAX_BUFFER_LENGTH_PER_CHANNEL]; + float tmpLfeBuffer[L_FRAME_MAX]; int16_t frame_size, num_cpy_smpl_cur_frame, num_cpy_smpl_prev_frame; const float *lfeInput; float *writePtr; @@ -7440,8 +7440,8 @@ static ivas_error getSamplesInternal( cldfb2tdSampleFact = ( outAudio.config.is_cldfb ) ? 2 : 1; - if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || - ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) + if ( outAudio.config.numSamplesPerChannel <= 0 || ( L_FRAME_MAX < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || + ( ( L_FRAME_MAX * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) { return IVAS_ERR_INVALID_BUFFER_SIZE; } @@ -7777,8 +7777,7 @@ void IVAS_REND_Close( * *-------------------------------------------------------------------*/ -ivas_error -IVAS_REND_openCldfb( +ivas_error IVAS_REND_openCldfb( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_OUTPUT_CHANNELS], const int16_t num_in_chs, diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 4ed038df97d6858991f8358569e6d384982e4a09..83d4ab426bc092d662d1661fae630aaea97fb986 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -41,12 +41,16 @@ * Renderer constants *---------------------------------------------------------------------*/ -#define RENDERER_MAX_ISM_INPUTS 4 +#define RENDERER_MAX_ISM_INPUTS IVAS_MAX_NUM_OBJECTS #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 #define RENDERER_MAX_INPUT_LFE_CHANNELS 4 +/* Frame size required when rendering to binaural */ +#define BINAURAL_RENDERING_FRAME_SIZE_MS 5 + + /*---------------------------------------------------------------------* * Renderer structures *---------------------------------------------------------------------*/ diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index ca5e6e4963b676da58526fbb30a3cf07d9f34f77..fe5669fa562052c86617471a0254e7df9a8ad65b 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -32,9 +32,7 @@ #include "audio_file_reader.h" #include "tinywavein_c.h" -#include -#include -#include "wmc_auto.h" + struct AudioFileReader { diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index fb7a64c425b6f648667a969290b6086c11158887..321063101959dc6ecab0a60103f1f2de3246a52e 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -32,9 +32,8 @@ #include "audio_file_writer.h" #include "tinywaveout_c.h" -#include #include -#include "wmc_auto.h" + struct AudioFileWriter { diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 01d1f0307ad721fc38ffa53ff338563ab5c792ad..9e5882aee8d9a59b782df9d60e7328fd5fa2b6b8 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -34,7 +34,6 @@ #include #include #include "ivas_prot.h" -#include "prot.h" struct LsCustomFileReader @@ -126,6 +125,13 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( float azi_tmp[IVAS_MAX_OUTPUT_CHANNELS]; float ele_tmp[IVAS_MAX_OUTPUT_CHANNELS]; + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + dup[i] = 0; + azi_tmp[i] = 0.0f; + ele_tmp[i] = 0.0f; + } + if ( *num_azi != *num_ele ) { return LS_CUSTOM_FILEREADER_NUM_SPK_MISMATCH_ERROR; @@ -150,7 +156,6 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( /* Check for and flag duplicate loudspeakers */ dup_count = 0; - set_s( dup, 0, IVAS_MAX_OUTPUT_CHANNELS ); for ( i = 0; i < *num_azi; i++ ) { for ( j = i + 1; j < *num_azi; j++ ) @@ -163,9 +168,6 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( } /* Remove duplicates from array */ - set_zero( azi_tmp, IVAS_MAX_OUTPUT_CHANNELS ); - set_zero( ele_tmp, IVAS_MAX_OUTPUT_CHANNELS ); - for ( i = 0, j = 0; i < *num_azi; i++ ) { if ( dup[i] ) @@ -179,8 +181,11 @@ static LS_CUSTOM_FILEREADER_ERROR CustomLoudspeakerLayout_validate( } ( *num_azi ) -= dup_count; - mvr2r( azi_tmp, azi, IVAS_MAX_OUTPUT_CHANNELS ); - mvr2r( ele_tmp, ele, IVAS_MAX_OUTPUT_CHANNELS ); + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + azi[i] = azi_tmp[i]; + ele[i] = ele_tmp[i]; + } return LS_CUSTOM_FILEREADER_NO_ERROR; } @@ -236,17 +241,19 @@ LS_CUSTOM_FILEREADER_ERROR CustomLsFileReading( char line[200]; /* > (10 chars * IVAS_MAX_OUTPUT_CHANNELS) i.e. "-999, " */ const char *tok; - - int16_t num_azi, num_ele, num_lfe; + int16_t i, num_azi, num_ele, num_lfe; /* initialize variables */ num_azi = 0; num_ele = 0; num_lfe = 0; - set_zero( hLsCustomData->azimuth, IVAS_MAX_OUTPUT_CHANNELS ); - set_zero( hLsCustomData->elevation, IVAS_MAX_OUTPUT_CHANNELS ); - set_s( hLsCustomData->lfe_idx, -1, IVAS_MAX_OUTPUT_CHANNELS ); + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + hLsCustomData->lfe_idx[i] = -1; + hLsCustomData->azimuth[i] = 0.0f; + hLsCustomData->elevation[i] = 0.0f; + } if ( hLsCustomReader->file == NULL ) { diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 9bd5e019defa47658c9d4fabc945345a91fb2e33..c03392efd83d4947c26d7e574bd12b250328953b 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -35,9 +35,7 @@ #include #include #include -#include #include "cmdl_tools.h" -#include "prot.h" /*------------------------------------------------------------------------------------------* @@ -58,9 +56,9 @@ #define ACOUSTIC_DSR_MAX ( 1.0e+2f ) #define ACOUSTIC_DSR_EPSILON ( 1.0e-15f ) #define ACOUSTICPREDELAY_JOTREV_MIN ( SHORTEST_REV_DEL_LINE ) -#define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) FRAMES_PER_SEC ) -#define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * FRAMES_PER_SEC ) ) -#define ACOUSTICPREDELAY_FDREV_MAX ( (float) ( REVERB_PREDELAY_MAX ) / (float) ( 16 * FRAMES_PER_SEC ) ) +#define ACOUSTICPREDELAY_JOTREV_MAX ( SHORTEST_REV_DEL_LINE + 1.0f / (float) IVAS_NUM_FRAMES_PER_SEC ) +#define ACOUSTICPREDELAY_FDREV_MIN ( 1.0f / (float) ( 16 * IVAS_NUM_FRAMES_PER_SEC ) ) +#define ACOUSTICPREDELAY_FDREV_MAX ( (float) ( IVAS_REVERB_PREDELAY_MAX ) / (float) ( 16 * IVAS_NUM_FRAMES_PER_SEC ) ) #define INPUTPREDELAY_MIN ( 0.0f ) #define INPUTPREDELAY_MAX ( 1.0e+2f ) @@ -69,6 +67,25 @@ #define ER_MIN_ABS_COEFF ( 0.0f ) #define ER_MAX_ABS_COEFF ( 1.0f ) +#define IVAS_ER_LIST_ORIGIN_X 0.0f +#define IVAS_ER_LIST_ORIGIN_Y 0.0f + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + + /*------------------------------------------------------------------------------------------* * Local Type definitions *------------------------------------------------------------------------------------------*/ @@ -646,13 +663,36 @@ static ivas_error read_bin_code_word( } } } + return IVAS_ERR_INVALID_RENDER_CONFIG; } + +/*-------------------------------------------------------------------* + * usdequant_rend_cfg() + * + * Uniform scalar de-quantizer routine + *-------------------------------------------------------------------*/ + +static float usdequant_rend_cfg( + const uint32_t idx, /* i : quantizer index */ + const float qlow, /* i : lowest codebook entry (index 0) */ + const float delta /* i : quantization step */ +) +{ + float g; + + g = idx * delta + qlow; + + return ( g ); +} + + /*-----------------------------------------------------------------------------------------* * Function get_bin_count_or_index() * Gets a count or index *-----------------------------------------------------------------------------------------*/ + static ivas_error get_bin_count_or_index( RenderConfigReader *this, /* i/o : Renderer config reader handle */ uint32_t *pResult /* o : Count or index value */ @@ -945,8 +985,11 @@ static ivas_error read_txt_bool( *pTarget = FALSE; return IVAS_ERR_OK; } + return IVAS_ERR_INVALID_RENDER_CONFIG; } + + /*-----------------------------------------------------------------------------------------* * Function get_bin_angle() * Gets an angle value in degrees [0,360] @@ -965,11 +1008,12 @@ static ivas_error get_bin_angle( return error; } - *pResult = usdequant( (int16_t) value, 0.0f, 20.0f ); + *pResult = usdequant_rend_cfg( value, 0.0f, 20.0f ); return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------------------------* * Function get_bin_outer_attenuation () * Gets an outer attenuation value [3.1623e-05,1.0], or in dB: [-90,0] @@ -989,7 +1033,7 @@ static ivas_error get_bin_outer_attenuation( return error; } - logval = usdequant( (int16_t) value, -90.0f, 3.0f ); + logval = usdequant_rend_cfg( value, -90.0f, 3.0f ); att = powf( 10, logval / 20.0f ); *pResult = att; @@ -997,6 +1041,7 @@ static ivas_error get_bin_outer_attenuation( return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------------------------* * Function get_bin_max_dist () * Gets a Maximum Distance value [1.0, 64.0] @@ -1015,11 +1060,12 @@ static ivas_error get_bin_max_dist( return error; } - *pResult = usdequant( (int16_t) value, 1.0f, 1.0f ); + *pResult = usdequant_rend_cfg( value, 1.0f, 1.0f ); return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------------------------* * Function get_bin_ref_dist () * Gets a Reference Distance value [0.1, 6.4] @@ -1038,11 +1084,12 @@ static ivas_error get_bin_ref_dist( return error; } - *pResult = usdequant( (int16_t) value, 0.1f, 0.1f ); + *pResult = usdequant_rend_cfg( value, 0.1f, 0.1f ); return IVAS_ERR_OK; } + /*-----------------------------------------------------------------------------------------* * Function get_bin_rolloff () * Gets a Rollof Factor [0.0, 4.0] @@ -1061,7 +1108,7 @@ static ivas_error get_bin_rolloff( return error; } - *pResult = usdequant( (int16_t) value, 0.0f, 0.1f ); + *pResult = usdequant_rend_cfg( value, 0.0f, 0.1f ); return IVAS_ERR_OK; } @@ -1806,9 +1853,9 @@ static ivas_error RenderConfigReader_readBinary( { return IVAS_ERR_FAILED_ALLOC; } - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = IVAS_ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = IVAS_ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = IVAS_ER_LIST_HEIGHT; } /* Low complexity mode */ @@ -2968,9 +3015,9 @@ ivas_error RenderConfigReader_getAcousticEnvironment( { return IVAS_ERR_FAILED_ALLOC; } - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = ER_LIST_ORIGIN_X; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = ER_LIST_ORIGIN_Y; - pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = ER_LIST_HEIGHT; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->x = IVAS_ER_LIST_ORIGIN_X; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->y = IVAS_ER_LIST_ORIGIN_Y; + pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin->z = IVAS_ER_LIST_HEIGHT; } pAcEnv->ListenerOrigin = *pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin; for ( j = 0; j < IVAS_ROOM_ABS_COEFF; j++ ) @@ -3001,7 +3048,7 @@ ivas_error RenderConfigReader_getDirectivity( float *directivity /* o : Target directivity */ ) { - uint16_t n, m; + uint16_t i, n, m; uint16_t last_specified_id; bool idExists; @@ -3011,7 +3058,7 @@ ivas_error RenderConfigReader_getDirectivity( } if ( pRenderConfigReader->pDP == NULL ) { - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + for ( n = 0; n < IVAS_MAX_NUM_OBJECTS; n++ ) { directivity[n * 3] = 360.0f; directivity[n * 3 + 1] = 360.0f; @@ -3023,7 +3070,7 @@ ivas_error RenderConfigReader_getDirectivity( last_specified_id = id[0]; /* set unpspecified Directivity Patterns ID to last specified ID */ - for ( n = MAX_NUM_OBJECTS - 1; n > 0; n-- ) + for ( n = IVAS_MAX_NUM_OBJECTS - 1; n > 0; n-- ) { if ( id[n] != 65535 ) { @@ -3037,13 +3084,12 @@ ivas_error RenderConfigReader_getDirectivity( last_specified_id = (uint16_t) pRenderConfigReader->pDP[0].id; } - for ( ; n < MAX_NUM_OBJECTS; n++ ) + for ( ; n < IVAS_MAX_NUM_OBJECTS; n++ ) { id[n] = last_specified_id; } - - for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) + for ( n = 0; n < IVAS_MAX_NUM_OBJECTS; n++ ) { idExists = false; for ( m = 0; m < pRenderConfigReader->nDP; m++ ) @@ -3051,7 +3097,11 @@ ivas_error RenderConfigReader_getDirectivity( if ( id[n] == pRenderConfigReader->pDP[m].id ) { idExists = true; - mvr2r( pRenderConfigReader->pDP[m].pDirectivity, directivity + ( n * 3 ), 3 ); + for ( i = 0; i < 3; i++ ) + { + directivity[n * 3 + i] = pRenderConfigReader->pDP[m].pDirectivity[i]; + } + break; } } @@ -3061,9 +3111,11 @@ ivas_error RenderConfigReader_getDirectivity( } } } + return IVAS_ERR_OK; } + /*------------------------------------------------------------------------------------------* * RenderConfigReader_getDistanceAttenuation() * diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index b948a51524b2c6bf4412eb974e51ec8ec529f8f0..f659fbb9fa558c8312f2b8c1c3b909f73b980474 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -33,8 +33,7 @@ #include "rotation_file_reader.h" #include #include -#include -#include "prot.h" +#include struct RotFileReader diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 1573db5a9504c0ffe1ba4735f53f34e3e2fd7d34..f82308edfd8cd72f541091a1f91b3c1235f81773 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -30,10 +30,11 @@ *******************************************************************************************************/ -#include #include "split_rend_bfi_file_reader.h" #include -#include "prot.h" +#include +#include + struct SplitRendBFIFileReader { diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 4a72bc4d3d813e55154991ff5a11bb6f733610ee..17070a63069f95768c209918ccadf6db41e59eac 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -30,10 +30,10 @@ *******************************************************************************************************/ -#include #include "split_render_file_read_write.h" +#include "ivas_error_utils.h" #include -#include "prot.h" +#include /*------------------------------------------------------------------------------------------* diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index e61f80763ddab05f01a294ae510e2059f8d0c6b3..653fc0f2f6f99f6d0d274cbe2adfc63d33123edb 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -32,10 +32,10 @@ #include "tsm_scale_file_reader.h" #include "cmdl_tools.h" -#include #include #include + #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index a6aee3eefb31c7276e2b7e0e1775e34e72da767e..8a46a97d1d2f8920bd5daf2d90283ac13c9087b1 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -31,12 +31,8 @@ *******************************************************************************************************/ #include "vector3_pair_file_reader.h" -#include #include #include -#include -#include "prot.h" -#include "options.h" /* only included to get access to the feature-defines */ struct Vector3PairFileReader diff --git a/readme.txt b/readme.txt index dbb85d7ab0f4bf301cea8b6f5a71ac8280e1c234..f54b6b86355ac4e32f8ea8aef3de6e8f91c2a080 100644 --- a/readme.txt +++ b/readme.txt @@ -399,7 +399,7 @@ Where the first two rows are comma separated azimuth and elevation positions of The output channel ordering is 0, 1, ... N-1. The third row contains an index "LFE0" (zero based) specifying the output channel to which the LFE input will be routed if present. If the third row is omitted, the LFE input is downmixed to all channels with a factor of 1/N. Position is not considered for -the LFE channel. +the LFE channel. Maximum number of supported loudskpeakers N is 16. An example custom loudspeaker layout file is available: ls_setup_16ch_8+4+4.txt