From 7470d8dd49e1e3f300ca0fe5909c12b40d73573e Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 9 Apr 2025 18:27:18 +0200 Subject: [PATCH 01/18] revision of common API types --- apps/decoder.c | 46 +++++++++++++---------------------- apps/isar_post_rend.c | 2 +- apps/renderer.c | 6 ++--- lib_com/common_api_types.h | 26 +++++++++----------- lib_com/stat_com.h | 2 +- lib_isar/isar_cnst.h | 2 +- lib_isar/isar_lc3plus_dec.c | 4 +-- lib_isar/isar_stat.h | 4 +-- lib_isar/lib_isar_post_rend.c | 8 +++--- lib_rend/ivas_stat_rend.h | 8 +++--- lib_rend/lib_rend.c | 14 +++++------ lib_rend/lib_rend.h | 6 ++++- 12 files changed, 58 insertions(+), 70 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index f35d12fd0d..f38a96a63a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -69,22 +69,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 /*------------------------------------------------------------------------------------------* @@ -129,7 +117,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; @@ -183,7 +171,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, 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 *hHrtf, 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 *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); 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 static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); @@ -359,7 +347,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; @@ -386,7 +374,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; @@ -757,7 +745,7 @@ int main( if ( arg.voipMode ) { - error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec ); + error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf ); } else { @@ -973,7 +961,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; @@ -1246,23 +1234,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 { @@ -2964,14 +2952,15 @@ static ivas_error decodeVoIP( RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, - 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]; @@ -2985,7 +2974,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/isar_post_rend.c b/apps/isar_post_rend.c index 64aab53ed0..bf08f63796 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -945,7 +945,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 775a9d6ee9..1fb83acc5a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -168,7 +168,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; @@ -1436,7 +1436,7 @@ int main( if ( is_split_pre_rend_mode( &args ) ) { - bitsBufferSize = SPLIT_REND_BITS_BUFF_SIZE; + bitsBufferSize = ISAR_SPLIT_REND_BITS_BUFF_SIZE; } else { @@ -2268,7 +2268,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 7e3e86ec43..a0e3f94607 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -44,9 +44,9 @@ * 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_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) /* maximum frame buffer length (per channel) in samples; corresponds to maximum sampling rate of 48 kHz */ +#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 @@ -57,11 +57,6 @@ #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 #define IVAS_ROOM_ABS_COEFF 6 -/* Maximum buffer length (per channel) in samples */ -#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) - -/* Frame size required when rendering to binaural */ -#define BINAURAL_RENDERING_FRAME_SIZE_MS 5 /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations @@ -174,12 +169,12 @@ typedef enum typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; -typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; +typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; typedef struct ivas_hrtf_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -typedef struct ivas_hrtfs_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE; -typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_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; typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; @@ -228,7 +223,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 { @@ -306,8 +301,8 @@ typedef enum IVAS_RENDER_TYPE_OVERRIDE_FASTCONV } IVAS_RENDER_TYPE_OVERRIDE; -#endif +#endif typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ @@ -350,6 +345,7 @@ typedef struct { IVAS_REND_AudioBufferConfig config; float *data; + } IVAS_REND_AudioBuffer; #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 622a07eb1f..4f459ef531 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_isar/isar_cnst.h b/lib_isar/isar_cnst.h index a2eecd7426..b7065bac4c 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 01296ebaa7..560f34f1c4 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" ); } ( *handle )->num_decs = 0; diff --git a/lib_isar/isar_stat.h b/lib_isar/isar_stat.h index acdddd8393..587c3c8ea7 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 7e050abc06..8287062167 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1037,8 +1037,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" ); } @@ -1652,8 +1652,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_stat_rend.h b/lib_rend/ivas_stat_rend.h index 8969b3188f..54bb490694 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -495,7 +495,7 @@ typedef struct ivas_diffuse_distribution_data_structure } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; /* Parametric binaural renderer HRTF structure */ -typedef struct ivas_hrtfs_parambin_struct +typedef struct ivas_hrtf_parambin_struct { float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; @@ -1026,7 +1026,7 @@ typedef struct } TDREND_MIX_Listener_t; /* HR filter */ -typedef struct TDREND_HRFILT_FiltSet_struct +typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct { int32_t SampleRate; /* Sample rate of the HR filter */ int16_t NumPos; @@ -1245,7 +1245,7 @@ typedef struct ivas_binaural_rendering_struct *------------------------------------------------------------------------------------------*/ /* Fastconv binaural data structure */ -typedef struct ivas_hrtfs_fastconv_struct +typedef struct ivas_hrtf_fastconv_struct { float FASTCONV_latency_s; float ***leftReal; @@ -1263,7 +1263,7 @@ typedef struct ivas_hrtfs_fastconv_struct } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_statistics_struct +typedef struct ivas_hrtf_statistics_struct { const float *average_energy_l; const float *average_energy_r; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e3e5c2faa2..68656b9c1b 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 */ /*-------------------------------------------------------------------* @@ -3956,8 +3956,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" ); } @@ -5727,7 +5727,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; @@ -7355,8 +7355,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; } @@ -7501,7 +7501,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 806f7983a8..f71a1a5384 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 *---------------------------------------------------------------------*/ -- GitLab From 53d119f9f97d6f02ca3125e9e09296ad4e22c34a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 9 Apr 2025 18:34:10 +0200 Subject: [PATCH 02/18] clang-format --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 68656b9c1b..2d77b66ed6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7501,7 +7501,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From d3d11bb810f840650959d13d204c379719da7aa8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Apr 2025 09:59:16 +0200 Subject: [PATCH 03/18] - Define time-scaler constants at one common place - Remove initArgStruct() from the encoder and move the init to parseCmdlIVAS_enc() to follow the decoder structure - Correct IVAS_MAX_OUTPUT_CHANNELS from 16 to 20 - avoid IVAS library includes in lib_util files --- apps/decoder.c | 12 ++-- apps/encoder.c | 48 +++++++------- lib_com/common_api_types.h | 16 +++-- lib_com/ivas_cnst.h | 7 +- lib_dec/jbm_pcmdsp_apa.h | 12 ++-- lib_dec/lib_dec.c | 2 +- lib_rend/ivas_reverb.c | 6 +- lib_rend/ivas_reverb_utils.c | 27 ++++---- lib_rend/ivas_stat_rend.h | 4 +- lib_util/ambi_convert.c | 2 +- lib_util/audio_file_reader.c | 3 - lib_util/audio_file_writer.c | 3 +- lib_util/bitstream_reader.c | 1 - lib_util/ls_custom_file_reader.c | 31 +++++---- lib_util/obj_edit_file_reader.c | 11 +++- lib_util/render_config_reader.c | 85 ++++++++++++++++++------- lib_util/rotation_file_reader.c | 3 +- lib_util/split_rend_bfi_file_reader.c | 6 +- lib_util/split_render_file_read_write.c | 4 +- lib_util/tsm_scale_file_reader.c | 2 +- lib_util/vector3_pair_file_reader.c | 4 -- readme.txt | 2 +- 22 files changed, 171 insertions(+), 120 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index f38a96a63a..0aa043692f 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -943,6 +943,10 @@ static bool parseCmdlIVAS_dec( int16_t i; char argv_to_upper[FILENAME_MAX]; + /*-----------------------------------------------------------------* + * Set default values + *-----------------------------------------------------------------*/ + #ifdef DEBUGGING float ftmp; @@ -951,7 +955,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; @@ -1161,9 +1165,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; } @@ -1645,7 +1649,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" ); diff --git a/apps/encoder.c b/apps/encoder.c index c91acdea23..9bf625bc97 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -154,7 +154,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 ); @@ -207,8 +206,6 @@ int main( reset_mem( USE_BYTES ); #endif - initArgStruct( &arg ); - /*------------------------------------------------------------------------------------------* * Parse command-line arguments *------------------------------------------------------------------------------------------*/ @@ -878,14 +875,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; @@ -919,25 +931,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/lib_com/common_api_types.h b/lib_com/common_api_types.h index a0e3f94607..348f13491e 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -44,18 +44,26 @@ * Common API constants *----------------------------------------------------------------------------------*/ -#define IVAS_NUM_FRAMES_PER_SEC 50 /* number of frames per second */ -#define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) /* maximum frame buffer length (per channel) in samples; corresponds to maximum sampling rate of 48 kHz */ -#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_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 20 #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 + +/* JBM constants for adaptive-playout */ +#define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ +#define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */ /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 8a9e8dea19..d2c2db4900 100755 --- 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 */ @@ -1490,7 +1490,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*/ @@ -1722,9 +1721,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_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index 26c380e38a..a728cb53d3 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 fc5bbc74d4..0f6ff49b34 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2391,7 +2391,7 @@ static int16_t getOutputBufferSize( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { - return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) / FRAMES_PER_SEC ); + return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * IVAS_MAX_OUTPUT_CHANNELS / FRAMES_PER_SEC ); } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 98a46150c1..2811a3c4d0 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; } @@ -1784,7 +1784,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 b2c0fb3cbb..35c2baed77 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -30,16 +30,8 @@ *******************************************************************************************************/ -#include -#include "options.h" -#include "prot.h" #include "ivas_prot_rend.h" -#include "ivas_rom_rend.h" #include -#ifdef DEBUGGING -#include "debug.h" -#endif -#include "wmc_auto.h" /*-----------------------------------------------------------------------------------------* @@ -47,7 +39,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 ) ) @@ -57,6 +48,14 @@ * Local function prototypes *-----------------------------------------------------------------------------------------*/ +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + typedef struct cldfb_convolver_state { const float *filter_taps_left_re[CLDFB_NO_CHANNELS_MAX]; @@ -92,7 +91,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 ); @@ -135,9 +134,9 @@ 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]; + float output_fc[IVAS_CLDFB_NO_CHANNELS_MAX]; const int16_t avg_pwr_len = sampling_rate == 16000 ? LR_IAC_LENGTH_NR_FC_16KHZ : LR_IAC_LENGTH_NR_FC; for ( freq_idx = 0; freq_idx < avg_pwr_len; freq_idx++ ) @@ -145,10 +144,10 @@ 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 54bb490694..e990c336f6 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_util/ambi_convert.c b/lib_util/ambi_convert.c index b8208824a4..282f4a0872 100644 --- a/lib_util/ambi_convert.c +++ b/lib_util/ambi_convert.c @@ -29,7 +29,7 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ -#include + #include #include #include "ambi_convert.h" diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index ca5e6e4963..1b52daaa77 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -32,9 +32,6 @@ #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 fb7a64c425..3210631019 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/bitstream_reader.c b/lib_util/bitstream_reader.c index 45c82ed4c8..a250a34a70 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -33,7 +33,6 @@ #include "bitstream_reader.h" #include "g192.h" #include "mime_io.h" -#include "ivas_error.h" #include "ivas_error_utils.h" #include #include diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 01d1f0307a..48c87a88ea 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,12 @@ 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; } @@ -237,16 +243,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/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index b003110743..9963e722ba 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -30,12 +30,19 @@ the United Nations Convention on Contracts on the International Sales of Goods. *******************************************************************************************************/ +#include "obj_edit_file_reader.h" #include #include -#include "obj_edit_file_reader.h" -#include "prot.h" +#ifndef min +#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) +#endif + +#ifndef max +#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) +#endif + /*-----------------------------------------------------------------------* * ObjectEditFileReader_open() * diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index fed68002a7..dd3e84ac87 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,24 @@ #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 *------------------------------------------------------------------------------------------*/ @@ -945,8 +961,30 @@ static ivas_error read_txt_bool( *pTarget = FALSE; return IVAS_ERR_OK; } + 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_angle() * Gets an angle value in degrees [0,360] @@ -965,7 +1003,7 @@ 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; } @@ -989,7 +1027,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; @@ -1015,7 +1053,7 @@ 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; } @@ -1038,7 +1076,7 @@ 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; } @@ -1061,7 +1099,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; } @@ -1807,9 +1845,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 */ @@ -2971,9 +3009,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++ ) @@ -3004,7 +3042,7 @@ ivas_error RenderConfigReader_getDirectivity( float *directivity /* o : Target directivity */ ) { - uint16_t n, m; + uint16_t n, m, i; uint16_t last_specified_id; bool idExists; @@ -3014,7 +3052,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; @@ -3026,7 +3064,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 ) { @@ -3040,13 +3078,13 @@ 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++ ) @@ -3054,7 +3092,10 @@ 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; } } diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index b948a51524..f659fbb9fa 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 15d5b24d66..70e695048e 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -30,11 +30,11 @@ *******************************************************************************************************/ -#include -#include "options.h" #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 9cc6e4bf7e..3afd068280 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 e61f80763d..653fc0f2f6 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 a6aee3eefb..8a46a97d1d 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 fa9397c31b..9a0b94e5a5 100644 --- a/readme.txt +++ b/readme.txt @@ -397,7 +397,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 20. An example custom loudspeaker layout file is available: ls_setup_16ch_8+4+4.txt -- GitLab From 48c82889a4ba2894d8e04e86120ce7a6204e58c2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Apr 2025 11:16:37 +0200 Subject: [PATCH 04/18] reverb IVAS_MAX_OUTPUT_CHANNELS change --- lib_com/common_api_types.h | 2 +- lib_dec/lib_dec.c | 4 ++-- lib_rend/ivas_reverb_utils.c | 16 ++++++++-------- readme.txt | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 348f13491e..dd1f707ffb 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -51,7 +51,7 @@ #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 -#define IVAS_MAX_OUTPUT_CHANNELS 20 +#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 diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0f6ff49b34..5ce04fb238 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2375,7 +2375,7 @@ ivas_error IVAS_DEC_GetFormat( /*---------------------------------------------------------------------* - * getInputBufferSize() + * getOutputBufferSize() * * *---------------------------------------------------------------------*/ @@ -2391,7 +2391,7 @@ static int16_t getOutputBufferSize( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { - return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * IVAS_MAX_OUTPUT_CHANNELS / FRAMES_PER_SEC ); + return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) / FRAMES_PER_SEC ); } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 35c2baed77..855d47673c 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -30,8 +30,16 @@ *******************************************************************************************************/ +#include +#include "options.h" +#include "prot.h" #include "ivas_prot_rend.h" +#include "ivas_rom_rend.h" #include +#ifdef DEBUGGING +#include "debug.h" +#endif +#include "wmc_auto.h" /*-----------------------------------------------------------------------------------------* @@ -48,14 +56,6 @@ * Local function prototypes *-----------------------------------------------------------------------------------------*/ -#ifndef min -#define min( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) ) -#endif - -#ifndef max -#define max( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) ) -#endif - typedef struct cldfb_convolver_state { const float *filter_taps_left_re[CLDFB_NO_CHANNELS_MAX]; diff --git a/readme.txt b/readme.txt index 9a0b94e5a5..f656e6ee64 100644 --- a/readme.txt +++ b/readme.txt @@ -397,7 +397,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. Maximum number of supported loudskpeakers N is 20. +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 -- GitLab From bda4efb2f13c592743a082d17cb5dcb232e23418 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:42:03 +0200 Subject: [PATCH 05/18] accept LIB_DEC_REVISION --- apps/decoder.c | 44 +--- lib_com/ivas_prot.h | 5 - lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 14 - lib_dec/lib_dec.c | 575 +++++------------------------------------ lib_dec/lib_dec.h | 12 - 6 files changed, 62 insertions(+), 589 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index dbd92244de..8030842f85 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -445,18 +445,14 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; -#ifdef LIB_DEC_REVISION if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, - arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } + if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -756,13 +752,11 @@ int main( } pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) ); -#ifdef LIB_DEC_REVISION if ( pcmBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); goto cleanup; } -#endif /*-----------------------------------------------------------------* * Decoding @@ -1064,30 +1058,18 @@ static bool parseCmdlIVAS_dec( if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) { -#ifdef LIB_DEC_REVISION arg->voipMode = true; -#else - arg->voipMode = 1; -#endif arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; i++; } @@ -1237,10 +1219,8 @@ static bool parseCmdlIVAS_dec( { if ( !is_digits_only( argv[i] ) ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error: Render frame size is invalid or not specified!\n\n" ); usage_dec(); -#endif return false; } @@ -1822,15 +1802,6 @@ static ivas_error initOnFirstGoodFrame( return error; } -#ifndef LIB_DEC_REVISION - int32_t pcmFrameSize; - - if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error ); - return error; - } -#endif if ( isSplitRend ) { /* Open split rendering metadata writer */ @@ -1888,7 +1859,6 @@ static ivas_error initOnFirstGoodFrame( } } -#ifdef LIB_DEC_REVISION int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { @@ -1896,15 +1866,12 @@ static ivas_error initOnFirstGoodFrame( return error; } -#endif int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); -#ifdef LIB_DEC_REVISION if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } -#endif memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) @@ -2119,7 +2086,6 @@ static ivas_error decodeG192( int16_t isSplitRend, isSplitCoded; #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION if ( arg.tsmEnabled ) { if ( ( error = IVAS_DEC_EnableTsm( hIvasDec ) ) != IVAS_ERR_OK ) @@ -2129,7 +2095,6 @@ static ivas_error decodeG192( } } -#endif #endif if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK ) { @@ -3445,12 +3410,7 @@ static ivas_error decodeVoIP( { if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#else - fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error ); - -#endif goto cleanup; } @@ -3462,9 +3422,7 @@ static ivas_error decodeVoIP( if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) { -#ifdef LIB_DEC_REVISION fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); -#endif goto cleanup; } } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fb8973884e..fe69a6610a 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -806,12 +806,7 @@ void ivas_apply_non_diegetic_panning( *----------------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_tc( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : output synthesis signals */ -#endif ); ivas_error ivas_jbm_dec_render( diff --git a/lib_com/options.h b/lib_com/options.h index 23a9a303de..5bb6286cd0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define LIB_DEC_REVISION /* VA: cleaning and simplification of lib_dec.c */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 4d381bc980..9d645cd4ed 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -66,12 +66,7 @@ static void ivas_jbm_masa_sf_to_slot_map( Decoder_Struct *st_ivas, const int16_t *--------------------------------------------------------------------------*/ ivas_error ivas_jbm_dec_tc( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *data /* o : transport channel signals */ -#endif ) { int16_t n, output_frame, nchan_out; @@ -731,16 +726,7 @@ ivas_error ivas_jbm_dec_tc( * Write IVAS transport channels *----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm == 0 ) -#else - if ( st_ivas->hDecoderConfig->Opt_tsm == 1 ) - { - - ivas_syn_output_f( p_output, output_frame, st_ivas->hTcBuffer->nchan_transport_jbm, data ); - } - else -#endif { /* directly copy to tc buffers */ ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, output_frame ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 37b50287ad..e238db2e67 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,9 +55,6 @@ struct IVAS_DEC_VOIP { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */ -#endif JB4_HANDLE hJBM; uint16_t lastDecodedWasActive; JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ @@ -94,9 +91,6 @@ struct IVAS_DEC bool hasBeenFedFrame; bool updateOrientation; uint16_t nSamplesAvailableNext; -#ifndef LIB_DEC_REVISION - int16_t nSamplesRendered; -#endif int16_t nTransportChannelsOld; int16_t amrwb_rfc4867_flag; /* MIME from rfc4867 is used */ int16_t sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */ @@ -114,32 +108,15 @@ struct IVAS_DEC * Local function declarations *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( IVAS_DEC_VOIP *hVoIP ); -#else -static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); -#endif #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif -#ifdef LIB_DEC_REVISION static ivas_error evs_dec_main( Decoder_Struct *st_ivas ); -#else -static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); -#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -#ifdef LIB_DEC_REVISION static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels, const int16_t isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits ); static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ); -#else -static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); -static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, uint16_t *nTcBufferGranularity, uint8_t *nTransportChannels ); -static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf, int16_t *nOutSamples ); -static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); -static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, const IVAS_DEC_PCM_TYPE pcmType, void *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#endif static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType ); static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset ); static ivas_error set_pcm_buffer_to_zero( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int16_t nZeroSamples ); @@ -191,9 +168,6 @@ ivas_error IVAS_DEC_Open( hIvasDec->needNewFrame = false; hIvasDec->nTransportChannelsOld = 0; hIvasDec->nSamplesAvailableNext = 0; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesFrame = 0; hIvasDec->hasBeenFedFrame = false; hIvasDec->hasBeenFedFirstGoodFrame = false; @@ -361,11 +335,7 @@ void IVAS_DEC_Close( if ( ( *phIvasDec )->hVoIP ) { -#ifdef LIB_DEC_REVISION ivas_destroy_handle_VoIP( ( *phIvasDec )->hVoIP ); -#else - IVAS_DEC_Close_VoIP( ( *phIvasDec )->hVoIP ); -#endif ( *phIvasDec )->hVoIP = NULL; } @@ -432,7 +402,6 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( return IVAS_DEC_BS_UNKOWN; } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * create_flush_buffer() @@ -456,8 +425,6 @@ static ivas_error create_flush_buffer( return IVAS_ERR_OK; } -#endif - /*---------------------------------------------------------------------* * IVAS_DEC_Configure( ) @@ -467,12 +434,9 @@ static ivas_error create_flush_buffer( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable TSM */ -#endif + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -531,9 +495,6 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } -#ifndef LIB_DEC_REVISION - hDecoderConfig->Opt_tsm = (int16_t) tsmEnabled; -#endif hDecoderConfig->Opt_LsCustom = (int16_t) customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = (int16_t) enableHeadRotation; hDecoderConfig->orientation_tracking = orientation_tracking; @@ -581,25 +542,6 @@ ivas_error IVAS_DEC_Configure( } hIvasDec->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesAvailableNext = 0; - hIvasDec->nSamplesRendered = 0; - hIvasDec->tsm_scale = 100; - hIvasDec->tsm_max_scaling = 0; - hIvasDec->tsm_quality = 1.0f; - - /* Init flush buffer if necessary (only needed for binaural)*/ - if ( tsmEnabled && ( outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - if ( hIvasDec->flushbuffer == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate JBM flush buffer" ); - } - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -835,9 +777,6 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->lastDecodedWasActive = 0; hIvasDec->hVoIP->hCurrentDataUnit = NULL; -#ifndef LIB_DEC_REVISION - hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif hIvasDec->hVoIP->nSamplesRendered20ms = 0; #define WMC_TOOL_SKIP @@ -868,21 +807,12 @@ ivas_error IVAS_DEC_EnableVoIP( } #endif -#ifdef LIB_DEC_REVISION /* init flush buffer (needed for binaural outputs) */ if ( ( error = create_flush_buffer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in create_flush_buffer , code: %d\n", error ); return error; } -#else - if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) ); - hIvasDec->pcmType = IVAS_DEC_PCM_INT16; - set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ); - } -#endif return IVAS_ERR_OK; } @@ -972,9 +902,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial( hIvasDec->needNewFrame = false; hIvasDec->hasBeenFedFrame = true; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; return IVAS_ERR_OK; @@ -1255,12 +1182,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { ivas_error error; Decoder_Struct *st_ivas; -#ifdef LIB_DEC_REVISION uint16_t nTimeScalerOutSamples; uint8_t nTransportChannels; int16_t nResidualSamples, nSamplesTcsScaled; bool isInitialized_voip; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -1275,13 +1200,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( #endif st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION isInitialized_voip = hIvasDec->apaExecBuffer != NULL; -#endif if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ) /* wait for the first good frame */ { -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * Setup all decoder parts (IVAS decoder, ISAR) *-----------------------------------------------------------------*/ @@ -1290,34 +1212,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { return error; } -#else - uint16_t l_ts, nTimeScalerOutSamples; - uint8_t nTransportChannels; - int16_t nResidualSamples, nSamplesTcsScaled, nOutSamplesElse; - if ( isSplitRend ) - { - if ( ( error = isar_set_split_rend_setup( st_ivas->hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld ) - { - if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif - -#ifdef LIB_DEC_REVISION /*-----------------------------------------------------------------* * IVAS decoder: decode transport channels and metadata *-----------------------------------------------------------------*/ @@ -1343,13 +1238,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( { hIvasDec->hasDecodedFirstGoodFrame = true; } -#else - /* IVAS TC decoder */ - if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif /*-----------------------------------------------------------------* * JBM @@ -1357,7 +1245,6 @@ ivas_error IVAS_DEC_GetSamplesDecoder( if ( st_ivas->hDecoderConfig->Opt_tsm ) { -#ifdef LIB_DEC_REVISION if ( nTransportChannels != hIvasDec->nTransportChannelsOld ) { if ( ( error = apa_setup( hIvasDec, isInitialized_voip, nTransportChannels ) ) != IVAS_ERR_OK ) @@ -1366,16 +1253,13 @@ ivas_error IVAS_DEC_GetSamplesDecoder( } } -#endif if ( apa_set_scale( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef LIB_DEC_REVISION ivas_syn_output_f( hIvasDec->st_ivas->p_output_f, hIvasDec->nSamplesFrame, nTransportChannels, hIvasDec->apaExecBuffer ); -#endif if ( apa_exec( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer, hIvasDec->nSamplesFrame * nTransportChannels, (uint16_t) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) { return IVAS_ERR_UNKNOWN; @@ -1394,14 +1278,7 @@ ivas_error IVAS_DEC_GetSamplesDecoder( * Feed decoded transport channels samples to the renderer *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ); -#else - if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( st_ivas->hDecoderConfig->Opt_tsm ) { @@ -1913,9 +1790,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( ) { ivas_error error; -#ifndef LIB_DEC_REVISION - int16_t nSamplesToRender; -#endif uint16_t nSamplesRendered, nSamplesRendered_loop; uint8_t nOutChannels; Decoder_Struct *st_ivas; @@ -1997,32 +1871,17 @@ ivas_error IVAS_DEC_GetSamplesRenderer( /* check for possible flushed samples from a rate switch */ if ( hIvasDec->nSamplesFlushed > 0 ) { -#ifndef LIB_DEC_REVISION - void *pPcmBuffer; -#endif #ifdef DEBUGGING assert( hIvasDec->pcmType == pcmType ); #endif -#ifdef LIB_DEC_REVISION /* note: offset (rendered samples) is always 0 */ -#else - pPcmBuffer = pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ); -#endif if ( pcmType == IVAS_DEC_PCM_INT16 ) { -#ifdef LIB_DEC_REVISION mvs2s( (int16_t *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvs2s( (int16_t *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } else if ( pcmType == IVAS_DEC_PCM_FLOAT ) { -#ifdef LIB_DEC_REVISION mvr2r( (float *) hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels ); -#else - mvr2r( (float *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels ); -#endif } #ifdef DEBUGGING else @@ -2030,21 +1889,12 @@ ivas_error IVAS_DEC_GetSamplesRenderer( assert( 0 && "wrong PCM type for the flush buffer!" ); } #endif -#ifdef LIB_DEC_REVISION nSamplesRendered = hIvasDec->nSamplesFlushed; -#else - nSamplesRendered += hIvasDec->nSamplesFlushed; -#endif hIvasDec->nSamplesFlushed = 0; } /* render IVAS frames directly to the output buffer */ -#ifdef LIB_DEC_REVISION if ( ( error = ivas_jbm_dec_render( st_ivas, nSamplesAsked - nSamplesRendered, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#else - nSamplesToRender = nSamplesAsked - nSamplesRendered; - if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2289,7 +2139,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * ivas_dec_setup_all() * @@ -2302,19 +2151,6 @@ static ivas_error ivas_dec_setup_all( const int16_t isSplitRend, /* i : split rendering enabled flag */ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_Setup( ) - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_Setup( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t *nTcBufferGranularity, /* o : granularity of the TC Buffer */ - uint8_t *nTransportChannels /* o : number of decoded transport PCM channels */ -) -#endif { ivas_error error; @@ -2335,7 +2171,6 @@ static ivas_error IVAS_DEC_Setup( st_ivas = hIvasDec->st_ivas; -#ifdef LIB_DEC_REVISION /* Setup IVAS split rendering */ if ( isSplitRend ) { @@ -2345,7 +2180,6 @@ static ivas_error IVAS_DEC_Setup( } } -#endif /*----------------------------------------------------------------* * IVAS decoder setup * - read IVAS format signaling @@ -2363,9 +2197,6 @@ static ivas_error IVAS_DEC_Setup( } *nTransportChannels = (uint8_t) st_ivas->hTcBuffer->nchan_transport_jbm; -#ifndef LIB_DEC_REVISION - *nTcBufferGranularity = (uint16_t) st_ivas->hTcBuffer->n_samples_granularity; -#endif /*-----------------------------------------------------------------* * ISAR: @@ -2373,11 +2204,7 @@ static ivas_error IVAS_DEC_Setup( * - reconfigure the ISAR handle in case of bitrate switching (renderer might change) *-----------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION if ( st_ivas->ini_frame == 0 && isSplitRend ) -#else - if ( st_ivas->ini_frame == 0 && ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) ) ) -#endif { if ( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK ) { @@ -2397,146 +2224,6 @@ static ivas_error IVAS_DEC_Setup( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetTcSamples( ) - * - * Main function to decode to PCM data of the transport channels - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetTcSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - float *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - *nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf, NULL ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( hIvasDec->mode == IVAS_DEC_MODE_IVAS ) - { - /* run the main IVAS decoding routine */ - if ( ( error = ivas_jbm_dec_tc( st_ivas, pcmBuf ) ) != IVAS_ERR_OK ) - { - return error; - } - - hIvasDec->isInitialized = true; /* Initialization done in ivas_dec() */ - } - - if ( hIvasDec->hasBeenFedFirstGoodFrame ) - { - hIvasDec->hasDecodedFirstGoodFrame = true; - } - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_Rendered_FeedTcSamples( ) - * - * Feed decoded transport channels samples to the renderer - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_RendererFeedTcSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const int16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call */ - float *pcmBuf /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ -) -{ - Decoder_Struct *st_ivas; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* feed the TCs to the IVAS renderer */ - ivas_jbm_dec_feed_tc_to_renderer( st_ivas, nSamplesForRendering, nSamplesResidual, pcmBuf ); - - return IVAS_ERR_OK; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_GetRenderedSamples( ) - * - * Main function to render the transport channels to PCM output data - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetRenderedSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ - uint16_t *nSamplesRendered, /* o : number of samples rendered */ - uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renderer pipeline */ - const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */ - void *pcmBuf /* o : output synthesis signal */ -) -{ - Decoder_Struct *st_ivas; - ivas_error error; - - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - st_ivas = hIvasDec->st_ivas; - - /* run the main IVAS decoding routine */ - error = ivas_jbm_dec_render( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); - - return error; -} - - -/*---------------------------------------------------------------------* - * IVAS_DEC_GetBufferedNumberOfSamples( ) - * - * Returns the number of objects available in the decoded bitstream - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int16_t *nSamplesBuffered /* o : number of samples still buffered */ -) -{ - *nSamplesBuffered = 0; - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ - if ( hIvasDec->st_ivas->hTcBuffer != NULL ) - { - *nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered; - *nSamplesBuffered += hIvasDec->hVoIP->nSamplesRendered20ms; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * IVAS_DEC_GetNumObjects( ) @@ -2564,6 +2251,7 @@ ivas_error IVAS_DEC_GetNumObjects( is_masa_ism = 1; } } + if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT || hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || is_masa_ism ) { *numObjects = hIvasDec->st_ivas->nchan_ism; @@ -3580,35 +3268,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( return IVAS_ERR_OK; } -#ifndef LIB_DEC_REVISION -/*---------------------------------------------------------------------* - * IVAS_DEC_GetPcmFrameSize( ) - * - * - *---------------------------------------------------------------------*/ - -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -) -{ - if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || pcmFrameSize == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - if ( hIvasDec->hasDecodedFirstGoodFrame ) - { - *pcmFrameSize = hIvasDec->st_ivas->hDecoderConfig->nchan_out * hIvasDec->st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC; - } - else - { - *pcmFrameSize = 0; - } - - return IVAS_ERR_OK; -} -#endif /*---------------------------------------------------------------------* * isSidFrame( ) @@ -3797,7 +3456,6 @@ ivas_error IVAS_DEC_VoIP_SetScale( } #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * IVAS_DEC_EnableTsm( ) @@ -3832,7 +3490,6 @@ ivas_error IVAS_DEC_EnableTsm( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_TSM_SetQuality( ) @@ -3937,19 +3594,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesBuffered = 0; if ( hIvasDec->hasBeenFedFirstGoodFrame ) { -#ifdef LIB_DEC_REVISION /* check if the TC buffer already exists, otherweise nothing is buffered anyway */ if ( st_ivas->hTcBuffer != NULL ) { nSamplesBuffered = st_ivas->hTcBuffer->n_samples_buffered - st_ivas->hTcBuffer->n_samples_rendered; nSamplesBuffered += hVoIP->nSamplesRendered20ms; } -#else - if ( ( error = IVAS_DEC_GetBufferedNumberOfSamples( hIvasDec, &nSamplesBuffered ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } extBufferedSamples = nSamplesBuffered; @@ -4056,9 +3706,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered = 0; -#endif } } @@ -4070,9 +3717,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t nSamplesToZero = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); set_pcm_buffer_to_zero( pcm_buffer_offset( pcmBuf, pcmType, ( *nSamplesRendered ) * nOutChannels ), pcmType, nSamplesToZero * nOutChannels ); *nSamplesRendered += nSamplesToZero; -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesRendered += nSamplesToZero; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesToZero; update_voip_rendered20ms( hIvasDec, nSamplesToZero ); } @@ -4086,17 +3730,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame ) { -#ifndef LIB_DEC_REVISION - uint16_t nSamplesFlushed_ref = hIvasDec->nSamplesFlushed; -#endif if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, 0, NULL ) ) != IVAS_ERR_OK ) { return error; } -#ifndef LIB_DEC_REVISION - hIvasDec->nSamplesFlushed = nSamplesFlushed_ref; -#endif *bitstreamReadDone = false; *parametersAvailableForEditing = true; return IVAS_ERR_OK; @@ -4144,20 +3782,12 @@ static void update_voip_rendered20ms( nSamplesRenderedTotal = hIvasDec->hVoIP->nSamplesRendered20ms + nSamplesRendered; /* we have crossed a 20ms border, reset the time scaling done flag */ -#ifdef LIB_DEC_REVISION if ( nSamplesRenderedTotal >= hIvasDec->nSamplesFrame ) -#else - if ( nSamplesRenderedTotal >= hIvasDec->hVoIP->nSamplesFrame ) -#endif { hIvasDec->timeScalingDone = 0; } -#ifdef LIB_DEC_REVISION hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->nSamplesFrame; -#else - hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame; -#endif return; } @@ -4194,11 +3824,7 @@ ivas_error IVAS_DEC_Flush( error = IVAS_ERR_OK; if ( nSamplesToRender > 0 && hIvasDec->st_ivas->ivas_format != MONO_FORMAT ) { -#ifdef LIB_DEC_REVISION error = ivas_jbm_dec_render( hIvasDec->st_ivas, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcm_type_API_to_internal( pcmType ), pcmBuf ); -#else - error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf ); -#endif } else { @@ -4258,11 +3884,7 @@ ivas_error IVAS_DEC_VoIP_Get_CA_offset( * Deallocate VoIP handle *---------------------------------------------------------------------*/ -#ifdef LIB_DEC_REVISION static void ivas_destroy_handle_VoIP( -#else -static void IVAS_DEC_Close_VoIP( -#endif IVAS_DEC_VOIP *hVoIP /* i/o: VoIP decoder handle */ ) { @@ -4669,31 +4291,18 @@ void IVAS_DEC_PrintDisclaimer( void ) *---------------------------------------------------------------------*/ static ivas_error evs_dec_main( -#ifdef LIB_DEC_REVISION Decoder_Struct *st_ivas /* i : IVAS decoder structure */ -#else - Decoder_Struct *st_ivas, - const int16_t nOutSamples, - float *floatBuf, - int16_t *pcmBuf -#endif ) { DEC_CORE_HANDLE *hCoreCoder; float mixer_left, mixer_rigth; float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#ifdef LIB_DEC_REVISION int16_t ch, nOutSamples; -#else - int16_t ch; -#endif ivas_error error; hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifdef LIB_DEC_REVISION nOutSamples = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#endif mdct_switching_dec( hCoreCoder[0] ); @@ -4755,7 +4364,6 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifdef LIB_DEC_REVISION if ( st_ivas->hDecoderConfig->Opt_tsm ) { /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ @@ -4775,32 +4383,6 @@ static ivas_error evs_dec_main( { ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); } -#else - if ( !st_ivas->hDecoderConfig->Opt_tsm ) - { - ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); - } - else if ( floatBuf != NULL ) - { - /* BE workaround */ - int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; - - /* convert 'float' output data to 'short' */ -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcm_buf_local ); - - mvs2r( pcm_buf_local, floatBuf, nOutSamples * st_ivas->hDecoderConfig->nchan_out ); - } - else - { -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); - } -#endif return IVAS_ERR_OK; } @@ -5000,7 +4582,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef LIB_DEC_REVISION /*---------------------------------------------------------------------* * apa_setup() * @@ -5011,122 +4592,88 @@ static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels ) -#else -/*---------------------------------------------------------------------* - * IVAS_DEC_VoIP_reconfigure() - * - * - *---------------------------------------------------------------------*/ - -static ivas_error IVAS_DEC_VoIP_reconfigure( - IVAS_DEC_HANDLE hIvasDec, - const uint16_t nTransportChannels, - const uint16_t l_ts ) -#endif { int16_t apa_buffer_size; -#ifdef LIB_DEC_REVISION uint16_t l_ts; l_ts = (uint16_t) hIvasDec->st_ivas->hTcBuffer->n_samples_granularity; if ( !isInitialized_voip ) -#else - apa_buffer_size = hIvasDec->nSamplesFrame; - - if ( hIvasDec->apaExecBuffer == NULL ) -#endif { DECODER_CONFIG_HANDLE hDecoderConfig; -#ifndef LIB_DEC_REVISION + uint16_t wss, css; + float startQuality; - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) - { -#endif - uint16_t wss, css; - float startQuality; + startQuality = hIvasDec->tsm_quality; + apa_buffer_size = APA_BUF_PER_CHANNEL; - startQuality = hIvasDec->tsm_quality; - apa_buffer_size = APA_BUF_PER_CHANNEL; + /* get current renderer type*/ + hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; - /* get current renderer type*/ - hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; + if ( hDecoderConfig->output_Fs == 8000 ) + { + wss = 1; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 16000 ) + { + wss = 2; + css = 1; + } + else if ( hDecoderConfig->output_Fs == 32000 ) + { + wss = 4; + css = 2; + } + else if ( hDecoderConfig->output_Fs == 48000 ) + { + wss = 6; + css = 3; + } + else + { + return IVAS_ERR_INIT_ERROR; + } - if ( hDecoderConfig->output_Fs == 8000 ) - { - wss = 1; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 16000 ) - { - wss = 2; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 32000 ) - { - wss = 4; - css = 2; - } - else if ( hDecoderConfig->output_Fs == 48000 ) - { - wss = 6; - css = 3; - } - else - { - return IVAS_ERR_INIT_ERROR; - } + if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || + apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || + apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || + apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || + apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) + { + return IVAS_ERR_INIT_ERROR; + } - if ( apa_init( &hIvasDec->hTimeScaler, nTransportChannels ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hTimeScaler, startQuality, 4, 4 ) != 0 || - apa_set_renderer_granularity( hIvasDec->hTimeScaler, l_ts ) != 0 ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) + { + if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) { return IVAS_ERR_INIT_ERROR; } + } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) - { - if ( apa_set_evs_compat_mode( hIvasDec->hTimeScaler, true ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - } - - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } -#endif + + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } else { -#ifndef LIB_DEC_REVISION - if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) + if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) { -#endif - if ( apa_reconfigure( hIvasDec->hTimeScaler, nTransportChannels, l_ts ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - - /* realloc apa_exe_buffer */ - apa_buffer_size = APA_BUF_PER_CHANNEL; - free( hIvasDec->apaExecBuffer ); - if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } - set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); -#ifndef LIB_DEC_REVISION + return IVAS_ERR_INIT_ERROR; } + /* realloc apa_exe_buffer */ -#endif + apa_buffer_size = APA_BUF_PER_CHANNEL; + free( hIvasDec->apaExecBuffer ); + if ( ( hIvasDec->apaExecBuffer = malloc( sizeof( float ) * apa_buffer_size * nTransportChannels ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); + } + set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } hIvasDec->nTransportChannelsOld = nTransportChannels; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 2a02fd46ec..588399ef2a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -122,9 +122,6 @@ ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */ -#ifndef LIB_DEC_REVISION - const bool tsmEnabled, /* i : enable TSM */ - #endif const IVAS_RENDER_FRAMESIZE renderFramesize,/* i : rendering frame size */ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -298,11 +295,9 @@ ivas_error IVAS_DEC_VoIP_SetScale( ); #ifdef VARIABLE_SPEED_DECODING -#ifdef LIB_DEC_REVISION ivas_error IVAS_DEC_EnableTsm( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ ); -#endif /*! r: error code */ ivas_error IVAS_DEC_TSM_SetQuality( @@ -506,13 +501,6 @@ ivas_error IVAS_DEC_HasDecodedFirstGoodFrame( bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */ ); -#ifndef LIB_DEC_REVISION -/*! r: error code */ -ivas_error IVAS_DEC_GetPcmFrameSize( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - int32_t *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels */ -); -#endif /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ -- GitLab From 42cf0da8c8a96ba8e413f724488374c9de00b73e Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:48:23 +0200 Subject: [PATCH 06/18] accept NONBE_1293_CRASH_FIRST_FRAME_LOST --- apps/isar_post_rend.c | 22 +++------------ lib_com/options.h | 1 - lib_dec/lib_dec.c | 36 ------------------------- lib_isar/lib_isar_post_rend.c | 3 +-- lib_util/split_render_file_read_write.c | 11 +------- lib_util/split_render_file_read_write.h | 8 ------ 6 files changed, 5 insertions(+), 76 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 64aab53ed0..a3a3a5211e 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -985,9 +985,7 @@ int main( while ( 1 ) { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi = 0; -#endif int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; @@ -995,12 +993,10 @@ int main( if ( ( hSplitRendFileReadWrite != NULL ) && splitBinNeedsNewFrame ) { ivas_error error_tmp; + numSamplesRead = (int16_t) inBufferSize; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi ); -#else - error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); -#endif if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) @@ -1067,24 +1063,13 @@ int main( /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - int16_t bfi; -#endif if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } - -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) @@ -1093,7 +1078,6 @@ int main( goto cleanup; } } -#endif for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { diff --git a/lib_com/options.h b/lib_com/options.h index 5bb6286cd0..a92f684b06 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,6 @@ /* all switches in this category should start with "NONBE_" */ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ -#define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ #define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index e238db2e67..2dc859e9cb 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1192,12 +1192,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; isInitialized_voip = hIvasDec->apaExecBuffer != NULL; @@ -1361,14 +1359,12 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasEditableParameters->num_obj = 0; return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1509,12 +1505,10 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif st_ivas = hIvasDec->st_ivas; ism_mode = st_ivas->ism_mode; @@ -1761,9 +1755,7 @@ ivas_error IVAS_DEC_PrepareRenderer( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ -#endif { ivas_dec_prepare_renderer( hIvasDec->st_ivas ); } @@ -1848,20 +1840,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( { hIvasDec->hasBeenFedFrame = false; set_s( pcmBuf, 0, st_ivas->hDecoderConfig->nchan_out * nSamplesAsked ); -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; -#else - hIvasDec->nSamplesRendered += nSamplesAsked; - *nOutSamples = nSamplesAsked; -#endif hIvasDec->nSamplesAvailableNext -= nSamplesAsked; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - hIvasDec->needNewFrame = true; - *needNewFrame = true; - } -#endif } else { @@ -1900,21 +1880,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer( } nSamplesRendered += nSamplesRendered_loop; -#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST - nSamplesToRender -= nSamplesRendered_loop; - if ( hIvasDec->nSamplesAvailableNext == 0 ) - { - *needNewFrame = true; - hIvasDec->needNewFrame = true; - } - else - { - *needNewFrame = false; - } -#endif } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; @@ -1925,7 +1892,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer( *needNewFrame = false; } -#endif *nOutSamples = nSamplesRendered; return IVAS_ERR_OK; @@ -2030,12 +1996,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } -#endif /* change buffer layout */ for ( i = 0; i < numSamplesPerChannelToDecode; ++i ) diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index 7e050abc06..8f62c2f7b2 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -1539,7 +1539,6 @@ static ivas_error renderSplitBinauralWithPostRot( } else { -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; @@ -1549,7 +1548,7 @@ static ivas_error renderSplitBinauralWithPostRot( { splitBinInput->numCachedSamples -= outAudio.config.numSamplesPerChannel; } -#endif + if ( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 9cc6e4bf7e..94fefb8cb3 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -331,20 +331,12 @@ ivas_error split_rend_write_bitstream_to_file( * *-----------------------------------------------------------------------------------------*/ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ) -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ) -#endif { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; @@ -407,13 +399,12 @@ ivas_error split_rend_read_bits_from_file( *bits_read = 0; *bits_written = bit_len; -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST + *bfi = 0; if ( bit_len == 0 ) { *bfi = 1; } -#endif return IVAS_ERR_OK; } diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 4450eeded4..97ff673b36 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -73,20 +73,12 @@ ivas_error split_rend_write_bitstream_to_file( int32_t *bits_written ); /* read split rend coded bits from file */ -#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ); -#else -ivas_error split_rend_read_bits_from_file( - SplitFileReadWrite *hSplitRendFileReadWrite, - uint8_t *bits, - int32_t *bits_read, - int32_t *bits_written ); -#endif /* read split pre rend delay */ ivas_error split_rend_read_pre_rend_delay_ns( -- GitLab From cabb1ba40371805d4780c219d2838fcb42be04cf Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 12:55:39 +0200 Subject: [PATCH 07/18] accept NONBE_1303_REND_GRANULARITY --- lib_com/ivas_prot.h | 9 --- lib_com/options.h | 1 - lib_dec/ivas_init_dec.c | 42 +------------ lib_dec/ivas_ism_dec.c | 20 ------ lib_dec/ivas_ism_param_dec.c | 15 +---- lib_dec/ivas_jbm_dec.c | 29 --------- lib_dec/ivas_masa_dec.c | 31 ---------- lib_dec/ivas_mc_param_dec.c | 7 +-- lib_dec/ivas_mc_paramupmix_dec.c | 7 +-- lib_dec/ivas_mct_dec.c | 20 ------ lib_dec/ivas_objectRenderer_internal.c | 6 -- lib_dec/ivas_output_config.c | 2 - lib_dec/ivas_sba_dec.c | 64 -------------------- lib_dec/ivas_spar_decoder.c | 16 ----- lib_dec/lib_dec.c | 38 +----------- lib_rend/ivas_dirac_dec_binaural_functions.c | 15 ----- 16 files changed, 5 insertions(+), 317 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index fe69a6610a..aff3ad8ec3 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -656,13 +656,11 @@ void ivas_renderer_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef NONBE_1303_REND_GRANULARITY /*! r: secondary binaural renderer type */ RENDERER_TYPE ivas_renderer_secondary_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif ivas_error ivas_mc_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -891,16 +889,9 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( -#ifdef NONBE_1303_REND_GRANULARITY const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ const int32_t output_Fs /* i : sampling rate */ -#else - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const int32_t output_Fs /* i : sampling rate */ -#endif ); ivas_error ivas_jbm_dec_tc_buffer_open( diff --git a/lib_com/options.h b/lib_com/options.h index a92f684b06..c65779e634 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,7 +172,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ -#define NONBE_1303_REND_GRANULARITY /* VA: issue 1303: Renderer granularity revision */ #define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index aac6720870..0d3610065b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2119,6 +2119,7 @@ ivas_error ivas_init_decoder( { return error; } + if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -2126,16 +2127,6 @@ ivas_error ivas_init_decoder( return error; } } -#ifndef NONBE_1303_REND_GRANULARITY - - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -2168,31 +2159,6 @@ ivas_error ivas_init_decoder( } st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifndef NONBE_1303_REND_GRANULARITY - - if ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) - { - granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif } if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -2388,16 +2354,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hTcBuffer == NULL ) { /* no module has yet open the TC buffer, open a default one */ -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e7c793caf3..7472690650 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -122,24 +122,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } -#ifndef NONBE_1303_REND_GRANULARITY - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif if ( st_ivas->ism_mode != last_ism_mode ) { /* EFAP handle */ @@ -307,9 +289,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; -#ifdef NONBE_1303_REND_GRANULARITY tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) { diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 93202b94cf..52e9bd0d4c 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -403,11 +403,7 @@ ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifdef NONBE_1303_REND_GRANULARITY int16_t i, granularity; -#else - int16_t i; -#endif PARAM_ISM_DEC_HANDLE hParamIsmDec; IVAS_OUTPUT_SETUP hOutSetup; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; @@ -543,9 +539,7 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hParamIsmDec = hParamIsmDec; st_ivas->hSpatParamRendCom = hSpatParamRendCom; -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); -#endif if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) { @@ -585,11 +579,7 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -602,11 +592,8 @@ ivas_error ivas_param_ism_dec_open( if ( st_ivas->hTcBuffer == NULL ) { int16_t nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out; -#ifdef NONBE_1303_REND_GRANULARITY + if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 9d645cd4ed..01da98fccb 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2074,7 +2074,6 @@ static void ivas_jbm_dec_copy_tc( /*! r: render granularity */ int16_t ivas_jbm_dec_get_render_granularity( -#ifdef NONBE_1303_REND_GRANULARITY const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type_sec, /* i : secondary renderer type */ const int32_t output_Fs /* i : sampling rate */ @@ -2098,34 +2097,6 @@ int16_t ivas_jbm_dec_get_render_granularity( return render_granularity; } -#else - const RENDERER_TYPE rendererType, /* i : renderer type */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const MC_MODE mc_mode, /* i : MC mode */ - const int32_t output_Fs /* i : sampling rate */ -) -{ - int16_t render_granularity; - - if ( rendererType == RENDERER_BINAURAL_OBJECTS_TD || rendererType == RENDERER_BINAURAL_MIXER_CONV || rendererType == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { - if ( ( ivas_format == MC_FORMAT ) && ( mc_mode == MC_MODE_PARAMUPMIX ) ) - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - else - { - render_granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - else - { - render_granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); - } - - return render_granularity; -} -#endif /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 62e711718a..34d528b0e3 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -696,9 +696,7 @@ ivas_error ivas_masa_dec_open( if ( st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { int16_t nchan_to_allocate, nchan_transport; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -730,13 +728,9 @@ ivas_error ivas_masa_dec_open( nchan_to_allocate++; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_transport, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1483,11 +1477,7 @@ ivas_error ivas_masa_dec_reconfigure( TC_BUFFER_MODE buffer_mode_new; int16_t n_samples_granularity; -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); -#endif buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); tc_nchan_transport = ivas_jbm_dec_get_num_tc_channels( st_ivas ); @@ -1502,27 +1492,6 @@ ivas_error ivas_masa_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifndef NONBE_1303_REND_GRANULARITY - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ - - if ( n_samples_granularity > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) - { - if ( n_samples_granularity < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - } -#endif } else if ( st_ivas->nchan_transport == 1 && ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) ) { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 048f26e379..8b33aebe63 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -437,15 +437,14 @@ ivas_error ivas_param_mc_dec_open( if ( hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { int16_t n_cldfb_slots; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif n_cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; if ( st_ivas->hDecoderConfig->Opt_tsm ) { n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; } + if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); @@ -460,13 +459,9 @@ ivas_error ivas_param_mc_dec_open( if ( st_ivas->hTcBuffer == NULL ) { -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 81bd4023a4..c06e8b3fa1 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -374,9 +374,7 @@ ivas_error ivas_mc_paramupmix_dec_open( { int16_t nchan_to_allocate; int16_t nchan_tc; -#ifdef NONBE_1303_REND_GRANULARITY int16_t granularity; -#endif TC_BUFFER_MODE buffer_mode; buffer_mode = TC_BUFFER_MODE_RENDERER; @@ -394,17 +392,14 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } } + st_ivas->hMCParamUpmix = hMCParamUpmix; return error; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 4c2ace3908..3300eb7965 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -789,24 +789,6 @@ static ivas_error ivas_mc_dec_reconfig( } } -#ifndef NONBE_1303_REND_GRANULARITY - /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv - render what still fits in the new granularity */ - tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ - else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) { st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); @@ -1293,9 +1275,7 @@ static ivas_error ivas_mc_dec_reconfig( tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas ); tc_nchan_allocate_new = tc_nchan_tc_new; tc_nchan_full_new = tc_nchan_tc_new; -#ifdef NONBE_1303_REND_GRANULARITY tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 597480b8ea..ddc99ed2f8 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -61,13 +61,7 @@ ivas_error ivas_td_binaural_open( num_src = st_ivas->nchan_ism; } -#ifdef NONBE_1303_REND_GRANULARITY if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary ) -#else - if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary && - ( st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 - ) -#endif { return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in TD renderer" ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 305d99ef99..a53bc27aa5 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -481,7 +481,6 @@ void ivas_renderer_select( } -#ifdef NONBE_1303_REND_GRANULARITY /*-------------------------------------------------------------------------* * ivas_renderer_secondary_select() * @@ -511,4 +510,3 @@ RENDERER_TYPE ivas_renderer_secondary_select( return renderer_type; } -#endif diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2164e490d4..ade8e11b02 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -163,52 +163,9 @@ ivas_error ivas_sba_dec_reconfigure( /* we may need to flush only for binaural and OSBA and TSM */ if ( st_ivas->ivas_format == SBA_ISM_FORMAT && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { -#ifndef NONBE_1303_REND_GRANULARITY - RENDERER_TYPE renderer_type_new; - int16_t sba_order_internal; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - - /* get new renderer type */ - /* copy the logic from ivas_renderer_select(), because calling this function has too many side effects that would affect the flushing */ - if ( ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) <= 2 ) - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC; - } - else - { - renderer_type_new = RENDERER_BINAURAL_PARAMETRIC_ROOM; - } - } - else - { - if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV; - } - else - { - renderer_type_new = RENDERER_BINAURAL_FASTCONV_ROOM; - } - } - -#endif /* determine new granularity */ -#ifdef NONBE_1303_REND_GRANULARITY granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), st_ivas->hDecoderConfig->output_Fs ); -#else - granularity_new = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - /* this will change anyway only with binaural */ - if ( renderer_type_new == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - granularity_new *= JBM_CLDFB_SLOTS_IN_SUBFRAME; - } -#endif - -#ifdef NONBE_1303_REND_GRANULARITY if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) { /* make sure the changed number of slots in the last subframe is not lost in the following steps */ @@ -218,27 +175,6 @@ ivas_error ivas_sba_dec_reconfigure( } st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; } -#else - /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */ - if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - /* flush already done in IVAS_DEC_ReadFormat() */ - } - else if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* make sure the changed number of slots in the last subframe is not lost in the following steps */ - if ( st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hSpatParamRendCom->subframe_nbslots[st_ivas->hSpatParamRendCom->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; - } - st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1]; - } -#endif } /* save old */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 205bc77859..98dc1ad3fa 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -228,10 +228,6 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate += st_ivas->nchan_ism; } -#ifndef NONBE_1303_REND_GRANULARITY - granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - -#endif if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO ) ) { if ( ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) ) @@ -251,21 +247,9 @@ ivas_error ivas_spar_dec_open( nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifdef NONBE_1303_REND_GRANULARITY granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#else - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && - st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL && - st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - /* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */ - granularity = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); - } - - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2dc859e9cb..045d93fdc4 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -907,7 +907,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial( return IVAS_ERR_OK; } -#ifdef NONBE_1303_REND_GRANULARITY /*---------------------------------------------------------------------* * renderer_type_to_mode() @@ -949,7 +948,6 @@ static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode( return binaural_renderer; } -#endif /*---------------------------------------------------------------------* * IVAS_DEC_ReadFormat( ) @@ -973,11 +971,7 @@ ivas_error IVAS_DEC_ReadFormat( MC_MODE mc_mode_old; int16_t nchan_transport_old; AUDIO_CONFIG intern_config_old, transport_config_old, output_config; -#ifdef NONBE_1303_REND_GRANULARITY RENDERER_TYPE renderer_type_old, renderer_type_sec_new, renderer_type_sec_old; -#else - RENDERER_TYPE renderer_type_old; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -992,13 +986,10 @@ ivas_error IVAS_DEC_ReadFormat( intern_config_old = st_ivas->intern_config; transport_config_old = st_ivas->transport_config; renderer_type_old = st_ivas->renderer_type; -#ifdef NONBE_1303_REND_GRANULARITY renderer_type_sec_old = ivas_renderer_secondary_select( st_ivas ); -#endif output_config = st_ivas->hDecoderConfig->output_config; - if ( st_ivas->ivas_format == MONO_FORMAT ) { return IVAS_ERR_OK; @@ -1018,13 +1009,12 @@ ivas_error IVAS_DEC_ReadFormat( /* Select binaural renderer */ ivas_renderer_select( st_ivas ); -#ifdef NONBE_1303_REND_GRANULARITY *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type ); /* Select secondary binaural renderer (used in combine formats) */ renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); -#else + switch ( st_ivas->renderer_type ) { case RENDERER_BINAURAL_OBJECTS_TD: @@ -1104,7 +1094,6 @@ ivas_error IVAS_DEC_ReadFormat( } } -#ifdef NONBE_1303_REND_GRANULARITY /* JBM: compensate when binaural renderer granularity changes (happens in bitrate switching) */ if ( st_ivas->ini_active_frame > 0 && st_ivas->hDecoderConfig->Opt_tsm && ( ( renderer_type_old != st_ivas->renderer_type ) || @@ -1135,25 +1124,6 @@ ivas_error IVAS_DEC_ReadFormat( return error; } } -#else - if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) || - ( st_ivas->ini_active_frame > 0 && - ( ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) || - ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ism_mode != ISM_SBA_MODE_DISC ) ) ) ) - { - /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv - render what still fits in the new granularity */ - int16_t tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); - st_ivas->nchan_transport = nchan_transport_old; - - if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) - { - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, pcm_type_API_to_internal( hIvasDec->pcmType ), hIvasDec->flushbuffer ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif } } @@ -2915,13 +2885,7 @@ ivas_error IVAS_DEC_HRTF_binary_close( if ( st_ivas->hDecoderConfig->Opt_HRTF_binary && st_ivas->ini_frame > 0 ) { -#ifdef NONBE_1303_REND_GRANULARITY if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) -#else - if ( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && - ( hIvasDec->st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202 - ) -#endif { ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3be1a116d7..cc1bccb131 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -151,12 +151,10 @@ ivas_error ivas_dirac_dec_init_binaural_data( num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses; } -#ifdef NONBE_1303_REND_GRANULARITY output_Fs = st_ivas->hDecoderConfig->output_Fs; nBins = st_ivas->hSpatParamRendCom->num_freq_bands; renderer_type = st_ivas->renderer_type; -#endif for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hDiracDecBin = st_ivas->hDiracDecBin[pos_idx]; @@ -175,11 +173,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( hDiracDecBin->phHrtfParambin = NULL; } -#ifndef NONBE_1303_REND_GRANULARITY - output_Fs = st_ivas->hDecoderConfig->output_Fs; - nBins = st_ivas->hSpatParamRendCom->num_freq_bands; - renderer_type = st_ivas->renderer_type; -#endif for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) @@ -331,15 +324,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( nchan_to_allocate = BINAURAL_CHANNELS + st_ivas->nchan_ism; } -#ifdef NONBE_1303_REND_GRANULARITY n_samples_granularity = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, ivas_renderer_secondary_select( st_ivas ), output_Fs ); -#else - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) - { - n_samples_granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ - } -#endif if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) { -- GitLab From aeb62e4a2d294edda90be9f1b13f588295b150e2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 13:01:02 +0200 Subject: [PATCH 08/18] accept NONBE_1118_EVS_LR_HQ_BITERROR and NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT --- lib_com/ivas_prot.h | 4 +--- lib_com/options.h | 2 -- lib_dec/hq_lr_dec.c | 4 ---- lib_dec/ivas_jbm_dec.c | 6 ++---- lib_dec/ivas_objectRenderer_internal.c | 10 ++-------- lib_dec/ivas_omasa_dec.c | 7 +++---- lib_dec/lib_dec.c | 8 +------- 7 files changed, 9 insertions(+), 32 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index aff3ad8ec3..f5e239f3b0 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5794,14 +5794,12 @@ void ivas_omasa_render_objects_from_mix( const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT void ivas_omasa_gain_masa_tc( - float *output[], /* i/o : output synthesis signal */ + float *output[], /* i/o: output synthesis signal */ const float gainMasa, /* i : gain for MASA transport channels */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ); -#endif void ivas_omasa_dirac_rend_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ diff --git a/lib_com/options.h b/lib_com/options.h index c65779e634..80cd7a383b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,8 +171,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ -#define NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT /* Nokia: issue 1305: Fix OMASA ext output in case of object editing */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index ccb840404f..f9ab923be7 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -635,7 +635,6 @@ void hq_lr_dec( IF( sub( i, highband ) >= 0 ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) { @@ -644,12 +643,10 @@ void hq_lr_dec( return; } -#endif enerH_fx = L_add( enerH_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } ELSE IF( sub( i, lowband ) >= 0 ) { -#ifdef NONBE_1118_EVS_LR_HQ_BITERROR /* safety check in case of bit errors */ if ( Ep_fx[i] > 536788991 /* max(Q30) */ ) { @@ -658,7 +655,6 @@ void hq_lr_dec( return; } -#endif enerL_fx = L_add( enerL_fx, L_shl( Ep_fx[i], 2 ) ); /*Q0 */ } } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 01da98fccb..9b310da630 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2842,13 +2842,12 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /* MASA transport gaining for edited disc OMASA EXT. For ISMs, only metadata is modified */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { ivas_omasa_gain_masa_tc( st_ivas->hTcBuffer->tc, st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->nchan_ism, st_ivas->hTcBuffer->n_samples_available ); } -#endif } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -2924,7 +2923,7 @@ void ivas_dec_prepare_renderer( { ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /* MASA transport gaining for edited param_one OMASA EXT. For ISMs, only metadata is modified. */ if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->hMasaIsmData->masa_gain_is_edited == 1 ) { @@ -2933,7 +2932,6 @@ void ivas_dec_prepare_renderer( v_multc( st_ivas->hTcBuffer->tc[n], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available ); } } -#endif } else { diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ddc99ed2f8..ff47b1b9a7 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -179,11 +179,7 @@ ivas_error ivas_td_binaural_renderer_sf( if ( subframe_idx == ism_md_subframe_update_jbm ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) -#else - if ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { ISM_METADATA_FRAME ismMetaData[MAX_NUM_OBJECTS]; ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS]; @@ -196,7 +192,7 @@ ivas_error ivas_td_binaural_renderer_sf( ismMetaData[nS].yaw = st_ivas->hIsmMetaData[nS]->edited_yaw; ismMetaData[nS].pitch = st_ivas->hIsmMetaData[nS]->edited_pitch; ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag; -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { /* DISC OMASA ISM gaining with TDREND is done in ivas_dec_prepare_renderer()*/ @@ -206,9 +202,7 @@ ivas_error ivas_td_binaural_renderer_sf( { ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; } -#else - ismMetaData[nS].gain = st_ivas->hIsmMetaData[nS]->edited_gain; -#endif + hIsmMetaData[nS] = &ismMetaData[nS]; } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index b468df0439..beaf645fa0 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1322,7 +1322,7 @@ void ivas_omasa_render_objects_from_mix( return; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT + /*--------------------------------------------------------------------------* * ivas_omasa_gain_masa_tc() * @@ -1331,18 +1331,17 @@ void ivas_omasa_render_objects_from_mix( *--------------------------------------------------------------------------*/ void ivas_omasa_gain_masa_tc( - float *output[], /* i/o : output synthesis signal */ + float *output[], /* i/o: output synthesis signal */ const float gainMasa, /* i : gain */ const int16_t nchan_transport_ism, /* i : number of ISM TCs */ const int16_t output_frame /* i : output frame length per channel */ ) { /* Edited OMASA EXT MASA transport gaining */ - for ( int16_t ch = 0; ch < 2; ch++ ) + for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) { v_multc( output[nchan_transport_ism + ch], gainMasa, output[nchan_transport_ism + ch], output_frame ); } return; } -#endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 045d93fdc4..df6cc6998f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1044,7 +1044,6 @@ ivas_error IVAS_DEC_ReadFormat( { *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; } -#endif /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; @@ -1679,13 +1678,12 @@ ivas_error IVAS_DEC_SetEditableParameters( /* Copy edited values to hIsmMetaData struct */ if ( st_ivas->hIsmMetaData[obj] != NULL ) { -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT st_ivas->hIsmMetaData[obj]->edited_azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->edited_elevation = hIvasEditableParameters.ism_metadata[obj].elevation; st_ivas->hIsmMetaData[obj]->edited_yaw = hIvasEditableParameters.ism_metadata[obj].yaw; st_ivas->hIsmMetaData[obj]->edited_pitch = hIvasEditableParameters.ism_metadata[obj].pitch; st_ivas->hIsmMetaData[obj]->edited_radius = hIvasEditableParameters.ism_metadata[obj].radius; -#endif + st_ivas->hIsmMetaData[obj]->azimuth = hIvasEditableParameters.ism_metadata[obj].azimuth; st_ivas->hIsmMetaData[obj]->elevation = hIvasEditableParameters.ism_metadata[obj].elevation; st_ivas->hIsmMetaData[obj]->yaw = hIvasEditableParameters.ism_metadata[obj].yaw; @@ -2407,11 +2405,7 @@ ivas_error IVAS_DEC_GetObjectMetadata( metadata->gainFactor = 1.f; metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag; } -#ifdef NONBE_FIX_1305_OMASA_OBJ_EDIT_EXT else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) -#else - else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) -#endif { metadata->azimuth = st_ivas->hIsmMetaData[objectIdx]->edited_azimuth; metadata->elevation = st_ivas->hIsmMetaData[objectIdx]->edited_elevation; -- GitLab From 67510528c95e4d958dc9e6094df5584ca2aca174 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 13:03:37 +0200 Subject: [PATCH 09/18] typo in comment --- lib_dec/ivas_output_config.c | 2 +- lib_dec/lib_dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index a53bc27aa5..430b57afa2 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -484,7 +484,7 @@ void ivas_renderer_select( /*-------------------------------------------------------------------------* * ivas_renderer_secondary_select() * - * Select IVAS secondary binaural renderer (used in combine formats) + * Select IVAS secondary binaural renderer (used in combined formats) *-------------------------------------------------------------------------*/ /*! r: secondary binaural renderer type */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index df6cc6998f..60a1cda5f3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1011,7 +1011,7 @@ ivas_error IVAS_DEC_ReadFormat( ivas_renderer_select( st_ivas ); *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type ); - /* Select secondary binaural renderer (used in combine formats) */ + /* Select secondary binaural renderer (used in combined formats) */ renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); -- GitLab From 3648217bbe666e7a2be8dae55c94fc1f20fbe613 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 22 Apr 2025 14:02:42 +0200 Subject: [PATCH 10/18] correction (accidentally not removed #else ... #endif code) --- lib_dec/lib_dec.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 60a1cda5f3..12bc47979f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1015,36 +1015,6 @@ ivas_error IVAS_DEC_ReadFormat( renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas ); *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new ); - switch ( st_ivas->renderer_type ) - { - case RENDERER_BINAURAL_OBJECTS_TD: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_TDREND; - break; - case RENDERER_BINAURAL_MIXER_CONV: - case RENDERER_BINAURAL_MIXER_CONV_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_CREND; - break; - case RENDERER_BINAURAL_FASTCONV: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; - break; - case RENDERER_BINAURAL_FASTCONV_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV; - break; - case RENDERER_BINAURAL_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC_ROOM: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_PARAMBIN; - break; - default: - *binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE; - break; - } - - *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE; - if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC && output_config == IVAS_AUDIO_CONFIG_BINAURAL ) - { - *binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_TDREND; - } - /* select HRTF audio configuration to load the right HRTF set for the external binary file */ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; if ( *binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV ) -- GitLab From 5e50eca57b6ef793d80ec060bee3e2fed91c8e4f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Apr 2025 09:34:55 +0200 Subject: [PATCH 11/18] revert basop-specific changes to JBM BE test --- tests/test_be_for_jbm_neutral_dly_profile.py | 25 +++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/test_be_for_jbm_neutral_dly_profile.py b/tests/test_be_for_jbm_neutral_dly_profile.py index 53c585498c..ec67ab22a3 100644 --- a/tests/test_be_for_jbm_neutral_dly_profile.py +++ b/tests/test_be_for_jbm_neutral_dly_profile.py @@ -18,7 +18,7 @@ DTX_OFF = "DTX_OFF" # testcases where DTX is supported TESTCASES_WITH_DTX = [ # stereo - ["stereo", 32000, "STEREO"], + ["stereo", 32000, "EXT"], ["stereo", 48000, "MONO"], ["stereo", 16400, "5_1"], ["stereo", 256000, "7_1_4"], @@ -40,9 +40,8 @@ TESTCASES_WITH_DTX = [ ["MASA1TC", 128000, "EXT"], # SBA ["HOA3", 64000, "BINAURAL"], - ["HOA2", 80000, "HOA2"], - # NOTE: commented because still some bug in BASOP float reference - # ["FOA", 13200, "stereo"], + ["HOA2", 80000, "EXT"], + ["FOA", 13200, "stereo"], ] # testcases with no DTX support @@ -54,30 +53,27 @@ TESTCASES_NO_DTX = [ # McMasa ["MC_5_1", 16400, "BINAURAL_ROOM_IR"], ["MC_7_1_4", 80000, "mono"], - ["MC_5_1_2", 24400, "5_1_2"], + ["MC_5_1_2", 24400, "EXT"], # paramMC ["MC_5_1_2", 48000, "BINAURAL"], - ["MC_7_1", 80000, "7_1"], + ["MC_7_1", 80000, "EXT"], ["MC_7_1_4", 128000, "FOA"], # paramUpmix ["MC_7_1_4", 160000, "stereo"], # discrete MC ["MC_5_1_2", 512000, "BINAURAL_ROOM_REVERB"], - ["MC_7_1", 128000, "7_1"], + ["MC_7_1", 128000, "EXT"], ["MC_7_1_4", 256000, "5_1"], # OMASA ["OMASA_ISM1", 512000, "BINAURAL"], ["OMASA_ISM2", 24400, "MONO"], ["OMASA_ISM3", 80000, "7_1_4"], ["OMASA_ISM4", 64000, "HOA3"], - # NOTE: commented because EXT unsupported currently - # ["OMASA_ISM2", 32000, "EXT"], + ["OMASA_ISM2", 32000, "EXT"], # OSBA ["OSBA_ISM2_HOA2", 64000, "BINAURAL_ROOM_IR"], - # NOTE: commented because still some bug in BASOP float reference - # ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB"], - # NOTE: commented because EXT unsupported currently - # ["OSBA_ISM3_HOA3", 128000, "EXT"], + ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB"], + ["OSBA_ISM3_HOA3", 128000, "EXT"], ["OSBA_ISM2_HOA3", 96000, "5_1"], ["OSBA_ISM1_HOA2", 32000, "mono"], ] @@ -185,9 +181,6 @@ def test_be_for_jbm_neutral_dly_profile_no_dtx( ) -@pytest.mark.skip( - reason="non-BE bug for DTX cases not yet fixed in BASOP ivas-float-update" -) @pytest.mark.parametrize("in_format,bitrate,out_format", TESTCASES_WITH_DTX) def test_be_for_jbm_neutral_dly_profile_with_dtx( in_format, -- GitLab From 82881a810d2e8ae27440d60b72648979c1ed43b5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Apr 2025 09:35:32 +0200 Subject: [PATCH 12/18] revert deletion of readme file --- ...end_sofa_to_rom_table_converter_readme.txt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 scripts/binauralRenderer_interface/ivas_crend_sofa_to_rom_table_converter_readme.txt diff --git a/scripts/binauralRenderer_interface/ivas_crend_sofa_to_rom_table_converter_readme.txt b/scripts/binauralRenderer_interface/ivas_crend_sofa_to_rom_table_converter_readme.txt new file mode 100644 index 0000000000..c3675ab45a --- /dev/null +++ b/scripts/binauralRenderer_interface/ivas_crend_sofa_to_rom_table_converter_readme.txt @@ -0,0 +1,82 @@ +/****************************************************************************************************** + + (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + 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. + +*******************************************************************************************************/ + +Mixer conv sofa to rom table or binary files converter program +------------------------------ + +The sofa to rom format or binary files converter is used to generate the c files (*.h,*.c) or binary files containing the binary representation of the binaural +filters for renderer MIXER_CONV and MIXER_CONV_ROOM + +First, build the converter under scripts/binauralRenderer_interface in VSCode (using CMakeList) or using the following command lines : + - mkdir build + - cd build + - cmake .. + - cmake --build . (option --config=release) + - cd .. + - Test : + - run py run.py (require matplotlib) -> no error and a figure with impulse response shall appear + +Requirements: +------------ + - Python version 3.9.* with pip + - numpy (pip install numpy) + - netCDF4 (pip install netCDF4) + - SofaReader.py file must be in the same folder as the executable generate_crend_ivas_tables + +Usage: +------ +generate_crend_ivas_tables [Options] + +Mandatory parameters : + - Frame size in ms (5 or 20) + - list of sofa files at least one. For rom files generation it is needed : + - one with HRIR with directions of IVAS combined speakers configuration or more + - one with FOA to binaural filters, can be obtain from HRIR using ./matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m matlab script + - one with HOA order 2 to binaural filters, can be obtain from HRIR using ./matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m matlab script + - one with HOA order 3 to binaural filters, can be obtain from HRIR using ./matlab_hrir_generation_scripts/convert_SD2SHD_HRIRs.m matlab script + - one with BRIR filters that directions of IVAS combined speakers configuration or more + +Options : + -lib_rend_path : path where header and c files will be created (if missing rom files not generated). + -binary_files_path : path where binary files will be created (if missing binary files not generated)\n + -binary_common_file_name : common name for binary files that will be created (crend_hrir-53_brir-Fhg for example + -compute_reverb_rom sofa_file_path : if present reverb rom tables and binary files are computed using sofa_file_path as input HRIRs + -brir_optim_config_path config_file_path : if present brir optimisation process uses parameters stored in config_file_path + Configuration example files are provided in folder : + -brir_no_optim.cfg : for exact convolution of the BRIR by IVAS decoder or renderer + -brir_default_optim.cfg : default values BRIR optimisation used by IVAS decoder or renderer + -brir_low_complexity_optim.cfg : values for BRIR optimisation reducing IVAS decoder or renderer complexity + +For example : + +.\\generate_crend_ivas_tables.exe -lib_rend_path ../../lib_rend 5 ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_FOA.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_HOA2.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_HOA3.sofa ./BRIRs_sofa/IIS_BRIR_officialMPEG_Combined.sofa +./generate_crend_ivas_tables -lib_rend_path ../../lib_rend 5 ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_FOA.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_HAO2.sofa ./HRIRs_sofa/HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_48000_HOA3.sofa ./BRIRs_sofa/IIS_BRIR_officialMPEG_Combined.sofa -- GitLab From db972abf523ba5b8e51f875943111d1ae35c3438 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Apr 2025 10:43:12 +0200 Subject: [PATCH 13/18] increase per-testcase timeout for stv sanitizer test --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3fbcc0b1b..e7a8c30475 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: - 'test-branch-vs-input-passthrough' GIT_CLEAN_FLAGS: -ffdxq - TESTCASE_TIMEOUT_STV_SANITIZERS: 180 + TESTCASE_TIMEOUT_STV_SANITIZERS: 240 TESTCASE_TIMEOUT_LTV_SANITIZERS: 2400 BASOP_REFERENCE_BRANCH: "ivas-float-update" SCALE_FACTOR: "3.162" -- GitLab From 55bf8bfa124ecfbd1a3025bfe4c6af50f2c0aca3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Apr 2025 17:18:21 +0200 Subject: [PATCH 14/18] make ret_val=1 overwrite ret_val=123 if crashes occur (ret_val=1) and at the same time a change in complexity numbers is detected (ret_val=123), the number change previously overwrote the crashes so that the global return value did not reflect the crashes --- ci/complexity_measurements/getWmops.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/complexity_measurements/getWmops.sh b/ci/complexity_measurements/getWmops.sh index 148092eb1a..069bf709fa 100755 --- a/ci/complexity_measurements/getWmops.sh +++ b/ci/complexity_measurements/getWmops.sh @@ -135,12 +135,14 @@ else python3 ci/complexity_measurements/genWebpageData.py --wmops_per_op_log ${wmopsFilenameFlc}_WMOPS.csv --rom_log ${log_rom_all} fi -ret_val=0 python3 ${scriptDir}/check_for_changes.py --wmops_logfiles $(ls ${destDir}/wmops/log_wmops_all*.txt) --ram_logfiles $(ls ${destDir}/wmops/log_ram_all*.txt) --rom_logfile ${destDir}/wmops/log_rom_all.txt -if [ "$?" != "0" ]; then - ret_val=123 -elif [ "$ret_val_script" != "0" ]; then +ret_val_changes=$? + +ret_val=0 +if [ "$ret_val_script" != "0" ]; then ret_val=1 +elif [ "$ret_val_changes" != "0" ]; then + ret_val=123 fi exit $ret_val -- GitLab From d62723ca8fb9572ad8a7c0442dfa6a7c7dccf833 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Apr 2025 18:57:45 +0200 Subject: [PATCH 15/18] remove some old debugging output to de-clutter job log --- ci/complexity_measurements/check_for_changes.py | 4 ---- ci/complexity_measurements/getWmops.sh | 1 - 2 files changed, 5 deletions(-) diff --git a/ci/complexity_measurements/check_for_changes.py b/ci/complexity_measurements/check_for_changes.py index 498d0d1a4d..424b474b71 100644 --- a/ci/complexity_measurements/check_for_changes.py +++ b/ci/complexity_measurements/check_for_changes.py @@ -53,10 +53,6 @@ def check_linewise_logfile(filepath, cols): changes_found = True break - if changes_found: - print("Previous log line:", prev) - print("Current log line:", curr) - return changes_found diff --git a/ci/complexity_measurements/getWmops.sh b/ci/complexity_measurements/getWmops.sh index 069bf709fa..8087cae67b 100755 --- a/ci/complexity_measurements/getWmops.sh +++ b/ci/complexity_measurements/getWmops.sh @@ -89,7 +89,6 @@ ret_val_script=$? # for wmops and RAM graphs, split by levels split_suffixes=("_rate_sw" "_level_1" "_level_2" "_level_3") for suffix in "${split_suffixes[@]}"; do - echo "$suffix" wmopsFilenameFlc_split="${wmopsFilenameFlc}_WMOPS${suffix}.csv" wmopsFilenameFlcLast_split="${wmopsFilenameFlcLast}_WMOPS${suffix}.csv" -- GitLab From 31cf2a8980510189792b96b995bba1a0d02f079f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Apr 2025 10:41:55 +0200 Subject: [PATCH 16/18] fix indices for runs variable generation --- ci/complexity_measurements/genWebpageData.py | 9 ++-- .../parseNewsletterRam.py | 44 +++++++++-------- .../parseNewsletterRom.py | 48 +++++++++++-------- .../parseNewsletterWmops.py | 9 ++++ 4 files changed, 64 insertions(+), 46 deletions(-) diff --git a/ci/complexity_measurements/genWebpageData.py b/ci/complexity_measurements/genWebpageData.py index cb46bf056e..f567dd1d23 100644 --- a/ci/complexity_measurements/genWebpageData.py +++ b/ci/complexity_measurements/genWebpageData.py @@ -47,9 +47,6 @@ RUNS_KEYS_WMOPS = RUNS_KEYS_COMMON + [ "worstCaseEnc", "worstCaseDec", "worstCaseCodec", - "worstCaseEncRs", - "worstCaseDecRs", - "worstCaseCodecRs", "fixpointScalingFac", ] RUNS_KEYS_WMOPS_PER_OP = [ @@ -82,9 +79,9 @@ RUNS_KEYS = { "wmops_per_op": RUNS_KEYS_WMOPS_PER_OP, } RUNS_LINE_IDX = { - "wmops": [2, 1, 0, 4, 6, 8, 12, 14, 16, 10, 18], - "rom": [2, 1, 0, 4, 6, 8, 10, 12, 14, 16, 18, 20], - "ram": [2, 1, 0, 4, 6, 9, 11, 14, 16, 18], + "wmops": [2, 1, 0, 18, 4, 6, 8, 10], + "rom": [2, 1, 0, 20, 4, 6, 8, 10, 12, 14, 16, 18], + "ram": [2, 1, 0, 18, 4, 6, 9, 11, 14, 16], "wmops_per_op": [0, 4], } diff --git a/ci/complexity_measurements/parseNewsletterRam.py b/ci/complexity_measurements/parseNewsletterRam.py index b7bb4a8517..c6d10681a4 100755 --- a/ci/complexity_measurements/parseNewsletterRam.py +++ b/ci/complexity_measurements/parseNewsletterRam.py @@ -40,6 +40,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilenameHEAP = sys.argv[1] newsletterFilenameSTACK = sys.argv[2] @@ -135,23 +141,23 @@ for key in ram_table: print( - revision, # string revision $tmp[1] - shortDate, # string shortDate $tmp[2] - fullDate, # string fullDate $tmp[3] - max_total_encdec[1], # value maxTotalRamCodecScore $tmp[4] - max_total_enc[0], # string maxTotalRamEnc $tmp[5] - max_total_enc[1], # value maxTotalRamEnc $tmp[6] - max_total_dec[0], # string maxTotalRamDec $tmp[7] - max_total_dec[1], # value maxTotalRamDecScore $tmp[8] - max_stack_encdec[1], # value maxStackCodecScore $tmp[9] - max_stack_enc[0], # string maxStackEnc $tmp[10] - max_stack_enc[1], # value maxStackEncScore $tmp[11] - max_stack_dec[0], # string maxStackDec $tmp[12] - max_stack_dec[1], # value maxStackDecScore $tmp[13] - max_heap_encdec[1], # value maxHeapCodecScore $tmp[14] - max_heap_enc[0], # string maxHeapEnc $tmp[15] - max_heap_enc[1], # value maxHeapEncScore $tmp[16] - max_heap_dec[0], # string maxHeapDec $tmp[17] - max_heap_dec[1], # value maxHeapDecScore $tmp[19] - newsletterFilenameLast, # string logFile $tmp[19] + revision, # string revision + shortDate, # string shortDate + fullDate, # string fullDate + max_total_encdec[1], # value maxTotalRamCodecScore + max_total_enc[0], # string maxTotalRamEnc + max_total_enc[1], # value maxTotalRamEnc + max_total_dec[0], # string maxTotalRamDec + max_total_dec[1], # value maxTotalRamDecScore + max_stack_encdec[1], # value maxStackCodecScore + max_stack_enc[0], # string maxStackEnc + max_stack_enc[1], # value maxStackEncScore + max_stack_dec[0], # string maxStackDec + max_stack_dec[1], # value maxStackDecScore + max_heap_encdec[1], # value maxHeapCodecScore + max_heap_enc[0], # string maxHeapEnc + max_heap_enc[1], # value maxHeapEncScore + max_heap_dec[0], # string maxHeapDec + max_heap_dec[1], # value maxHeapDecScore + newsletterFilenameLast, # string logFile ) diff --git a/ci/complexity_measurements/parseNewsletterRom.py b/ci/complexity_measurements/parseNewsletterRom.py index 41501282bb..ab61c93a01 100755 --- a/ci/complexity_measurements/parseNewsletterRom.py +++ b/ci/complexity_measurements/parseNewsletterRom.py @@ -41,6 +41,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilenamePROM = sys.argv[1] newsletterFilenameTROM = sys.argv[2] @@ -140,25 +146,25 @@ for key in rom_table: print( - revision, # string revision $tmp[1] - shortDate, # string shortDate $tmp[2] - fullDate, # string fullDate $tmp[3] - max_total_encdec[1], # value maxTotalRomCodecScore $tmp[4] - max_prom_enc[0], # string maxPROMEnc $tmp[5] - max_prom_enc[1], # value maxPROMEncScore $tmp[6] - max_prom_dec[0], # string maxPROMDec $tmp[7] - max_prom_dec[1], # value maxPROMDecScore $tmp[8] - max_prom_com[0], # string maxPROMCom $tmp[9] - max_prom_com[1], # value maxPROMComScore $tmp[10] - max_prom_rend[0], # string maxPROMRend $tmp[11] - max_prom_rend[1], # value maxPROMRendScore $tmp[12] - max_trom_enc[0], # string maxTROMEnc $tmp[13] - max_trom_enc[1], # value maxTROMEncScore $tmp[14] - max_trom_dec[0], # string maxTROMDec $tmp[15] - max_trom_dec[1], # value maxTROMDecScore $tmp[16] - max_trom_com[0], # string maxTROMCom $tmp[17] - max_trom_com[1], # value maxTROMComScore $tmp[18] - max_trom_rend[0], # string maxTROMRend $tmp[19] - max_trom_rend[1], # value maxTROMRendScore $tmp[20] - newsletterFilenameLast, # string logFile $tmp[21] + revision, # string revision + shortDate, # string shortDate + fullDate, # string fullDate + max_total_encdec[1], # value maxTotalRomCodecScore + max_prom_enc[0], # string maxPROMEnc + max_prom_enc[1], # value maxPROMEncScore + max_prom_dec[0], # string maxPROMDec + max_prom_dec[1], # value maxPROMDecScore + max_prom_com[0], # string maxPROMCom + max_prom_com[1], # value maxPROMComScore + max_prom_rend[0], # string maxPROMRend + max_prom_rend[1], # value maxPROMRendScore + max_trom_enc[0], # string maxTROMEnc + max_trom_enc[1], # value maxTROMEncScore + max_trom_dec[0], # string maxTROMDec + max_trom_dec[1], # value maxTROMDecScore + max_trom_com[0], # string maxTROMCom + max_trom_com[1], # value maxTROMComScore + max_trom_rend[0], # string maxTROMRend + max_trom_rend[1], # value maxTROMRendScore + newsletterFilenameLast, # string logFile ) diff --git a/ci/complexity_measurements/parseNewsletterWmops.py b/ci/complexity_measurements/parseNewsletterWmops.py index 4579ccae8f..26635071ba 100755 --- a/ci/complexity_measurements/parseNewsletterWmops.py +++ b/ci/complexity_measurements/parseNewsletterWmops.py @@ -40,6 +40,12 @@ revision = "" shortDate = "" fullDate = "" +""" +The purpose of this script is to convert the csv file output from the IvasBuildAndRunChecks script +into a blank-space separated string which is then appended to an existing file obtained from the last +complexity pipeline run. +""" + if __name__ == "__main__": newsletterFilename = sys.argv[1] newsletterFilenameLast = sys.argv[2] @@ -67,6 +73,9 @@ with open(newsletterFilename, "r") as csvfile: max_total[0] = re.sub(" ", "_", row[0]) max_total[1] = float(row[3]) +# NOTE: there is a repetiion of some values here. This has historical reasons. +# The repeated values are ignored in the later processing, but to not break the file format +# this is kept as is. print( revision, shortDate, -- GitLab From ee5b1eb9309113d98a262355205eb129408e3cda Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Apr 2025 11:08:24 +0200 Subject: [PATCH 17/18] remove some debug output to de-clutter complexity logs --- .gitlab-ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7a8c30475..c333b8e46f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2458,9 +2458,8 @@ coverage-test-on-main-scheduled: - job_id=$(python3 ci/get_id_of_last_job_occurence.py $CI_COMMIT_REF_NAME $CI_JOB_NAME $CI_PROJECT_ID) - echo $job_id - - curl --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip - - unzip artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html - - ls + - curl --silent --show-error --request GET "https://forge.3gpp.org/rep/api/v4/projects/$CI_PROJECT_ID/jobs/$job_id/artifacts" --output artifacts.zip + - unzip -qq artifacts.zip || true # this may fail on first run, when there are no artifacts there and the zip file is actually just "404"-html - public_dir="$CI_JOB_NAME-public" # if is needed to catch case when no artifact is there (first run), similarly as above @@ -2483,7 +2482,6 @@ coverage-test-on-main-scheduled: - fi - fi - - ls wmops - rm artifacts.zip - rm -rf $public_dir @@ -2496,8 +2494,6 @@ coverage-test-on-main-scheduled: - mkdir $public_dir/logs # first move logs - log_files=$(cat $public_dir/graphs*.js | grep logFile | sed "s/.*\(wmops_newsletter_.*\.csv\).*/\1/g") - - echo $log_files - - ls wmops/logs - for f in $log_files; do [ -f wmops/logs/$f ] && mv wmops/logs/$f $public_dir/logs/$f; done # copy index page blueprint - cp ci/complexity_measurements/index_complexity.html ${public_dir}/index.html @@ -2505,7 +2501,6 @@ coverage-test-on-main-scheduled: - sed -i "s/IVAS FORMAT/IVAS $in_format to $out_format/g" ${public_dir}/index.html # do separately here to avoid overwrite complaints by mv - mv -f ci/complexity_measurements/style.css ${public_dir}/ - - ls $public_dir .complexity-template: extends: -- GitLab From 1eb1372cd3722c288a16f510ce041ee983499632 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Apr 2025 12:37:00 +0200 Subject: [PATCH 18/18] revert jbm be test back to BASOP version --- tests/test_be_for_jbm_neutral_dly_profile.py | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/test_be_for_jbm_neutral_dly_profile.py b/tests/test_be_for_jbm_neutral_dly_profile.py index ec67ab22a3..53c585498c 100644 --- a/tests/test_be_for_jbm_neutral_dly_profile.py +++ b/tests/test_be_for_jbm_neutral_dly_profile.py @@ -18,7 +18,7 @@ DTX_OFF = "DTX_OFF" # testcases where DTX is supported TESTCASES_WITH_DTX = [ # stereo - ["stereo", 32000, "EXT"], + ["stereo", 32000, "STEREO"], ["stereo", 48000, "MONO"], ["stereo", 16400, "5_1"], ["stereo", 256000, "7_1_4"], @@ -40,8 +40,9 @@ TESTCASES_WITH_DTX = [ ["MASA1TC", 128000, "EXT"], # SBA ["HOA3", 64000, "BINAURAL"], - ["HOA2", 80000, "EXT"], - ["FOA", 13200, "stereo"], + ["HOA2", 80000, "HOA2"], + # NOTE: commented because still some bug in BASOP float reference + # ["FOA", 13200, "stereo"], ] # testcases with no DTX support @@ -53,27 +54,30 @@ TESTCASES_NO_DTX = [ # McMasa ["MC_5_1", 16400, "BINAURAL_ROOM_IR"], ["MC_7_1_4", 80000, "mono"], - ["MC_5_1_2", 24400, "EXT"], + ["MC_5_1_2", 24400, "5_1_2"], # paramMC ["MC_5_1_2", 48000, "BINAURAL"], - ["MC_7_1", 80000, "EXT"], + ["MC_7_1", 80000, "7_1"], ["MC_7_1_4", 128000, "FOA"], # paramUpmix ["MC_7_1_4", 160000, "stereo"], # discrete MC ["MC_5_1_2", 512000, "BINAURAL_ROOM_REVERB"], - ["MC_7_1", 128000, "EXT"], + ["MC_7_1", 128000, "7_1"], ["MC_7_1_4", 256000, "5_1"], # OMASA ["OMASA_ISM1", 512000, "BINAURAL"], ["OMASA_ISM2", 24400, "MONO"], ["OMASA_ISM3", 80000, "7_1_4"], ["OMASA_ISM4", 64000, "HOA3"], - ["OMASA_ISM2", 32000, "EXT"], + # NOTE: commented because EXT unsupported currently + # ["OMASA_ISM2", 32000, "EXT"], # OSBA ["OSBA_ISM2_HOA2", 64000, "BINAURAL_ROOM_IR"], - ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB"], - ["OSBA_ISM3_HOA3", 128000, "EXT"], + # NOTE: commented because still some bug in BASOP float reference + # ["OSBA_ISM4_FOA", 512000, "BINAURAL_ROOM_REVERB"], + # NOTE: commented because EXT unsupported currently + # ["OSBA_ISM3_HOA3", 128000, "EXT"], ["OSBA_ISM2_HOA3", 96000, "5_1"], ["OSBA_ISM1_HOA2", 32000, "mono"], ] @@ -181,6 +185,9 @@ def test_be_for_jbm_neutral_dly_profile_no_dtx( ) +@pytest.mark.skip( + reason="non-BE bug for DTX cases not yet fixed in BASOP ivas-float-update" +) @pytest.mark.parametrize("in_format,bitrate,out_format", TESTCASES_WITH_DTX) def test_be_for_jbm_neutral_dly_profile_with_dtx( in_format, -- GitLab