From 68dca016d8f97519585cc0e3dbc913fe71917ec2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 30 Aug 2023 17:10:51 +0200 Subject: [PATCH 1/3] address issue 743: RENDER_CONFIG_HANDLE defined twice --- apps/decoder.c | 5 ++-- apps/renderer.c | 4 +-- lib_com/common_api_types.h | 2 +- lib_dec/lib_dec.c | 46 ++++++++++++++++----------------- lib_rend/ivas_prot_rend.h | 4 +-- lib_rend/ivas_reverb.c | 20 +++++++------- lib_rend/ivas_reverb_utils.c | 2 +- lib_rend/ivas_stat_rend.h | 31 ++-------------------- lib_rend/lib_rend.c | 46 ++++++++++++++++----------------- lib_util/render_config_reader.c | 4 +-- 10 files changed, 69 insertions(+), 95 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index a63d8e9f4b..f35e47cd55 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -721,7 +721,7 @@ int main( if ( arg.outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -734,7 +734,7 @@ int main( fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId ); goto cleanup; } - renderConfig.room_acoustics.override = true; + renderConfig.roomAcoustics.override = true; } if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) @@ -743,6 +743,7 @@ int main( goto cleanup; } } + /*------------------------------------------------------------------------------------------* * Load custom loudspeaker layout data *------------------------------------------------------------------------------------------*/ diff --git a/apps/renderer.c b/apps/renderer.c index 858a9d4150..d8ff246191 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1078,7 +1078,7 @@ int main( if ( args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { @@ -1091,7 +1091,7 @@ int main( fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId ); exit( -1 ); } - renderConfig.room_acoustics.override = 1; + renderConfig.roomAcoustics.override = 1; } if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 9360ffb757..7564ca0992 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -280,7 +280,7 @@ typedef struct _IVAS_RENDER_CONFIG #ifdef DEBUGGING IVAS_RENDER_TYPE_OVERRIDE renderer_type_override; #endif - IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics; + IVAS_ROOM_ACOUSTICS_CONFIG_DATA roomAcoustics; #ifdef SPLIT_REND_WITH_HEAD_ROT IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; #endif diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b0d224b9c4..98edc57bc3 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2056,14 +2056,14 @@ static ivas_error copyRendererConfigStruct( RENDER_CONFIG_HANDLE hRCin, IVAS_REN break; } #endif - hRCout->room_acoustics.override = hRCin->roomAcoustics.override; - hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; - hRCout->room_acoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; - hRCout->room_acoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; - - mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; + hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; + hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; + hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; + + mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); #ifdef SPLIT_REND_WITH_HEAD_ROT hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; @@ -2075,8 +2075,8 @@ static ivas_error copyRendererConfigStruct( RENDER_CONFIG_HANDLE hRCin, IVAS_REN hRCout->split_rend_config.poseCorrectionMode = IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB; hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; #endif - hRCout->room_acoustics.use_er = hRCin->roomAcoustics.use_er; - hRCout->room_acoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; + hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; + hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; return IVAS_ERR_OK; } @@ -2200,25 +2200,25 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; } #endif - hRenderConfig->roomAcoustics.override = renderConfig.room_acoustics.override; - hRenderConfig->roomAcoustics.nBands = renderConfig.room_acoustics.nBands; - hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.room_acoustics.acousticPreDelay; - hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.room_acoustics.inputPreDelay; + hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; + hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; + hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; + hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; hRenderConfig->roomAcoustics.use_er = 0; - if ( renderConfig.room_acoustics.use_er == 1 ) + if ( renderConfig.roomAcoustics.use_er == 1 ) { - hRenderConfig->roomAcoustics.use_er = renderConfig.room_acoustics.use_er; - hRenderConfig->roomAcoustics.lowComplexity = renderConfig.room_acoustics.lowComplexity; - hRenderConfig->roomAcoustics.dimensions = renderConfig.room_acoustics.dimensions; - hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.room_acoustics.ListenerOrigin; + hRenderConfig->roomAcoustics.use_er = renderConfig.roomAcoustics.use_er; + hRenderConfig->roomAcoustics.lowComplexity = renderConfig.roomAcoustics.lowComplexity; + hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; + hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.room_acoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); + mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); } - mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.roomAcoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 578bac9dee..e4451a2918 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -892,7 +892,7 @@ ivas_error ivas_binaural_reverb_open( REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ const int16_t numBins, /* i : number of CLDFB bins */ const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ - ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ const int32_t sampling_rate, /* i : sampling rate */ const RENDERER_TYPE renderer_type, /* i : renderer type */ @@ -1076,7 +1076,7 @@ void ivas_reverb_calc_color_levels( ); void ivas_reverb_prepare_cldfb_params( - ivas_roomAcoustics_t *pInput_params, + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index ee00cb30c8..d19012ecba 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -948,7 +948,7 @@ static void set_reverb_acoustic_data( ivas_reverb_params_t *pParams, const AUDIO_CONFIG input_audio_config, const HRTFS_HANDLE hHrtf, - ivas_roomAcoustics_t *pRoomAcoustics, + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics, const int16_t subframe_len, const int16_t nr_fc_input, const int16_t nr_fc_fft_filter ) @@ -1783,15 +1783,15 @@ void ivas_binaural_reverb_processSubframe( *------------------------------------------------------------------------*/ ivas_error ivas_binaural_reverb_open( - REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ - const int16_t numBins, /* i : number of CLDFB bins */ - const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ - ivas_roomAcoustics_t *roomAcoustics, /* i/o: room acoustics parameters */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const int32_t sampling_rate, /* i : sampling rate */ - const RENDERER_TYPE renderer_type, /* i : renderer type */ - const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ - const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ + REVERB_STRUCT_HANDLE *hReverbPr, /* i/o: binaural reverb handle */ + const int16_t numBins, /* i : number of CLDFB bins */ + const int16_t numCldfbSlotsPerFrame, /* i : number of CLDFB slots per frame */ + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *roomAcoustics, /* i/o: room acoustics parameters */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const int32_t sampling_rate, /* i : sampling rate */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const HRTFS_FASTCONV_HANDLE hHrtfFastConv, /* i : FastConv HRTF handle */ + const HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i : Parametric binauralizer HRTF handle */ ) { int16_t bin, chIdx, k, len; diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 58613f4257..6af660af05 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -77,7 +77,7 @@ static void ivas_reverb_get_fastconv_hrtf_set_energies( const HRTFS_FASTCONV_HAN *-----------------------------------------------------------------------------------------*/ void ivas_reverb_prepare_cldfb_params( - ivas_roomAcoustics_t *pInput_params, + IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pInput_params, const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const AUDIO_CONFIG input_audio_config, const int16_t use_brir, diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 18dba0c798..c9a3ef494e 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -724,35 +724,8 @@ typedef struct ivas_combined_orientation_struct * Reverberator structure *----------------------------------------------------------------------------------*/ -typedef struct ivas_roomAcoustics_t -{ - int16_t override; - int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ - float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ - float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ - float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ - float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */ - float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ - int16_t use_er; /* ER activation flag */ - int32_t lowComplexity; /* Low complexity ER flag */ - IVAS_VECTOR3 dimensions; /* Room dimensions [m] */ - float AbsCoeff[ER_ABS_COEFF]; /* Absorption coeffs */ - IVAS_VECTOR3 ListenerOrigin; /* Listener origin */ - -} ivas_roomAcoustics_t; - -typedef struct ivas_render_config_t -{ -#ifdef DEBUGGING - ivas_renderTypeOverride renderer_type_override; -#endif - ivas_roomAcoustics_t roomAcoustics; - float directivity[MAX_NUM_OBJECTS * 3]; -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; -#endif - -} RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; +typedef struct _IVAS_RENDER_CONFIG RENDER_CONFIG_DATA; +typedef struct _IVAS_RENDER_CONFIG *RENDER_CONFIG_HANDLE; typedef struct ivas_rev_delay_line_t { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 96f2d4952a..1dd0fcdd91 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5075,15 +5075,15 @@ int16_t IVAS_REND_GetRenderConfig( break; } #endif - hRCout->room_acoustics.override = hRCin->roomAcoustics.override; - hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; - hRCout->room_acoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; - hRCout->room_acoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; + hRCout->roomAcoustics.override = hRCin->roomAcoustics.override; + hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands; + hRCout->roomAcoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; + hRCout->roomAcoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; mvr2r( hRCin->directivity, hRCout->directivity, 3 * MAX_NUM_OBJECTS ); - mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); + mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); #ifdef SPLIT_REND_WITH_HEAD_ROT hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k; @@ -5098,8 +5098,8 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection; #endif - hRCout->room_acoustics.use_er = hRCin->roomAcoustics.use_er; - hRCout->room_acoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; + hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; + hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; return IVAS_ERR_OK; } @@ -5138,24 +5138,24 @@ int16_t IVAS_REND_FeedRenderConfig( } #endif - hRenderConfig->roomAcoustics.override = renderConfig.room_acoustics.override; - hRenderConfig->roomAcoustics.nBands = renderConfig.room_acoustics.nBands; - hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.room_acoustics.acousticPreDelay; - hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.room_acoustics.inputPreDelay; - mvr2r( renderConfig.room_acoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); - mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); + hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; + hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands; + hRenderConfig->roomAcoustics.acousticPreDelay = renderConfig.roomAcoustics.acousticPreDelay; + hRenderConfig->roomAcoustics.inputPreDelay = renderConfig.roomAcoustics.inputPreDelay; + mvr2r( renderConfig.roomAcoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); + mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); hRenderConfig->roomAcoustics.use_er = 0; - if ( renderConfig.room_acoustics.use_er == 1 ) + if ( renderConfig.roomAcoustics.use_er == 1 ) { - hRenderConfig->roomAcoustics.use_er = renderConfig.room_acoustics.use_er; - hRenderConfig->roomAcoustics.lowComplexity = renderConfig.room_acoustics.lowComplexity; - hRenderConfig->roomAcoustics.dimensions = renderConfig.room_acoustics.dimensions; - hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.room_acoustics.ListenerOrigin; + hRenderConfig->roomAcoustics.use_er = renderConfig.roomAcoustics.use_er; + hRenderConfig->roomAcoustics.lowComplexity = renderConfig.roomAcoustics.lowComplexity; + hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; + hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.room_acoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); + mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -9432,7 +9432,7 @@ ivas_error IVAS_REND_GetSamples( &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, td_input, diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index bdbfe3ec2b..1ebb62fd9c 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1120,7 +1120,7 @@ ivas_error RenderConfigReader_checkValues( { int16_t band_idx, tab_value_err_count; IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoom_acoustics; - pRoom_acoustics = &hRenderConfig->room_acoustics; + pRoom_acoustics = &hRenderConfig->roomAcoustics; tab_value_err_count = 0; int16_t wall_idx; @@ -2279,7 +2279,7 @@ ivas_error RenderConfigReader_read( /* Acoustic pre-delay */ else if ( strcmp( item, "ACOUSTICPREDELAY" ) == 0 ) { - if ( !sscanf( pValue, "%f", &hRenderConfig->room_acoustics.acousticPreDelay ) ) + if ( !sscanf( pValue, "%f", &hRenderConfig->roomAcoustics.acousticPreDelay ) ) { errorHandler( item, ERROR_VALUE_INVALID ); } -- GitLab From bc67fa5b22912233d4183f9861d8f4de811bb479 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 30 Aug 2023 18:06:54 +0200 Subject: [PATCH 2/3] harmonize ivas_renderTypeOverride and IVAS_RENDER_TYPE_OVERRIDE --- lib_com/ivas_cnst.h | 9 --------- lib_dec/ivas_output_config.c | 10 +++++----- lib_dec/lib_dec.c | 14 +++++++------- lib_rend/ivas_render_config.c | 2 +- lib_rend/lib_rend.c | 16 ++++------------ 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 29473c091c..024e404df2 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -121,15 +121,6 @@ typedef enum RENDERER_OSBA_LS } RENDERER_TYPE; -#ifdef DEBUGGING -typedef enum -{ - RENDER_TYPE_OVERRIDE_NONE, - RENDER_TYPE_OVERRIDE_CREND, - RENDER_TYPE_OVERRIDE_FASTCONV -} ivas_renderTypeOverride; -#endif - #if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT typedef enum { diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 10491211c0..9738e5b962 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -130,7 +130,7 @@ void ivas_renderer_select( { *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; #ifdef DEBUGGING - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } @@ -242,11 +242,11 @@ void ivas_renderer_select( } #if 0 // def DEBUGGING /*temp disabling this as paramMC crashes with CREND*/ - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) + if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) { *renderer_type = RENDERER_BINAURAL_MIXER_CONV; } - else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { *renderer_type = RENDERER_BINAURAL_FASTCONV; } @@ -273,11 +273,11 @@ void ivas_renderer_select( *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } #ifdef DEBUGGING - if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND ) + if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) { *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM; } - else if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_FASTCONV ) + else if ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 98edc57bc3..66eb4088bd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2045,10 +2045,10 @@ static ivas_error copyRendererConfigStruct( RENDER_CONFIG_HANDLE hRCin, IVAS_REN #ifdef DEBUGGING switch ( hRCin->renderer_type_override ) { - case RENDER_TYPE_OVERRIDE_CREND: + case IVAS_RENDER_TYPE_OVERRIDE_CREND: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; break; - case RENDER_TYPE_OVERRIDE_FASTCONV: + case IVAS_RENDER_TYPE_OVERRIDE_FASTCONV: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; break; default: @@ -2109,10 +2109,10 @@ ivas_error IVAS_DEC_GetRenderConfig( #ifdef DEBUGGING switch ( hRCin->renderer_type_override ) { - case RENDER_TYPE_OVERRIDE_CREND: + case IVAS_RENDER_TYPE_OVERRIDE_CREND: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; break; - case RENDER_TYPE_OVERRIDE_FASTCONV: + case IVAS_RENDER_TYPE_OVERRIDE_FASTCONV: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; break; default: @@ -2190,14 +2190,14 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig = hIvasDec->st_ivas->hRenderConfig; #ifdef DEBUGGING - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_FASTCONV; + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; } if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; + hRenderConfig->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; } #endif hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; diff --git a/lib_rend/ivas_render_config.c b/lib_rend/ivas_render_config.c index 5f12c75214..49312336a1 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -110,7 +110,7 @@ ivas_error ivas_render_config_init_from_rom( return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } #ifdef DEBUGGING - ( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; + ( *hRenderConfig )->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; #endif ( *hRenderConfig )->roomAcoustics.override = FALSE; ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1dd0fcdd91..14c750615e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -5064,10 +5064,10 @@ int16_t IVAS_REND_GetRenderConfig( #ifdef DEBUGGING switch ( hRCin->renderer_type_override ) { - case RENDER_TYPE_OVERRIDE_CREND: + case IVAS_RENDER_TYPE_OVERRIDE_CREND: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_CREND; break; - case RENDER_TYPE_OVERRIDE_FASTCONV: + case IVAS_RENDER_TYPE_OVERRIDE_FASTCONV: hRCout->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_FASTCONV; break; default: @@ -5127,15 +5127,7 @@ int16_t IVAS_REND_FeedRenderConfig( } hRenderConfig = hIvasRend->hRendererConfig; #ifdef DEBUGGING - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE; - if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) - { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_FASTCONV; - } - if ( renderConfig.renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) - { - hRenderConfig->renderer_type_override = RENDER_TYPE_OVERRIDE_CREND; - } + hRenderConfig->renderer_type_override = renderConfig.renderer_type_override; #endif hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override; @@ -9432,7 +9424,7 @@ ivas_error IVAS_REND_GetSamples( &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, td_input, -- GitLab From 549e89a70850e45086378d8410533ef5f9f90c45 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 31 Aug 2023 12:47:28 +0200 Subject: [PATCH 3/3] clang-format --- lib_dec/lib_dec.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 4e0cdeea06..b087108f1b 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -76,7 +76,7 @@ struct IVAS_DEC int16_t bitstreamformat; /* Bitstream format flag (G.192/MIME/VOIP_G192_RTP/VOIP_RTPDUMP) */ bool Opt_VOIP; /* flag indicating VOIP mode with JBM */ - int16_t tsm_scale; /* scale for TSM operation */ + int16_t tsm_scale; /* scale for TSM operation */ int16_t tsm_max_scaling; float *apaExecBuffer; /* Buffer for APA scaling */ PCMDSP_APA_HANDLE hTimeScaler; @@ -368,7 +368,7 @@ 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 */ - const int16_t tsmEnabled, /* i : enable TSM */ + const int16_t tsmEnabled, /* i : enable TSM */ const int16_t enable5ms, const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ @@ -521,7 +521,7 @@ ivas_error IVAS_DEC_Get5msFlag( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_EnableVoIP( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */ ) @@ -580,14 +580,14 @@ ivas_error IVAS_DEC_EnableVoIP( } /* initialize JBM */ - if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) - { - return error; - } - if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) - { - return IVAS_ERR_FAILED_ALLOC; - } + if ( ( error = JB4_Create( &hIvasDec->hVoIP->hJBM ) != IVAS_ERR_OK ) != IVAS_ERR_OK ) + { + return error; + } + if ( JB4_Init( hIvasDec->hVoIP->hJBM, jbmSafetyMargin ) != 0 ) + { + return IVAS_ERR_FAILED_ALLOC; + } return error; } @@ -912,7 +912,7 @@ ivas_error IVAS_DEC_GetSamples( pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) #else - pcmBuf + nSamplesRendered * nOutChannels + pcmBuf + nSamplesRendered * nOutChannels #endif ) ) != IVAS_ERR_OK ) @@ -1537,7 +1537,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedHeadTrackData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ const int16_t subframe_idx /*subframe index*/ @@ -1645,7 +1645,7 @@ ivas_error IVAS_DEC_FeedRefVectorData( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_FeedExternalOrientationData( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : external orientation data */ int8_t enableHeadRotation, /* i : flag to enable head rotation for this frame */ int8_t enableExternalOrientation, /* i : flag to enable external orientation for this frame */ @@ -2457,8 +2457,8 @@ ivas_error IVAS_DEC_Flush( *nSamplesFlushed = min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext ); - nSamplesToRender = (uint16_t) *nSamplesFlushed; - /* render IVAS frames */ + nSamplesToRender = (uint16_t) *nSamplesFlushed; + /* render IVAS frames */ if ( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, #if defined SPLIT_REND_WITH_HEAD_ROT pcmType, @@ -3374,7 +3374,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } - } + } else { if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) @@ -3392,7 +3392,7 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); } /* realloc apa_exe_buffer */ - } + } hIvasDec->nTransportChannelsOld = nTransportChannels; -- GitLab