From 5f371a59593c7a3587123142de05f0defaaf6850 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 10 Oct 2023 16:42:15 +0200 Subject: [PATCH 1/2] revision of API public constants and ER constants --- apps/renderer.c | 4 ++-- lib_com/common_api_types.h | 15 ++++++--------- lib_com/ivas_cnst.h | 18 ------------------ lib_dec/lib_dec.c | 2 +- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_reflections.c | 2 ++ lib_rend/ivas_shoebox.c | 13 +++++++++++++ lib_rend/ivas_stat_rend.h | 2 +- lib_rend/lib_rend.c | 8 ++++---- lib_rend/lib_rend.h | 11 ++++++----- lib_util/render_config_reader.c | 7 ++++++- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 2c7d7c2401..31a84a9f63 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3750,7 +3750,7 @@ static ivas_error parseLfePanMtxFile( /* set default panning matrix to all zeros any subsequent issue in file reading will gracefully exit the function */ - for ( lfe_in = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) + for ( lfe_in = 0; lfe_in < RENDERER_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) { for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) { @@ -3758,7 +3758,7 @@ static ivas_error parseLfePanMtxFile( } } - for ( lfe_in = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) + for ( lfe_in = 0; lfe_in < RENDERER_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) { ch_out = 0; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 7e56c3ca32..82000e31a1 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -46,19 +46,16 @@ #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_MAX_NUM_OBJECTS 4 -#define IVAS_MAX_INPUT_CHANNELS 16 -#define IVAS_MAX_OUTPUT_CHANNELS 16 -#define IVAS_CLDFB_NO_COL_MAX 16 -#define IVAS_CLDFB_NO_CHANNELS_MAX 60 -#define IVAS_MAX_INPUT_LFE_CHANNELS 4 +#define IVAS_MAX_NUM_OBJECTS 4 +#define IVAS_MAX_INPUT_CHANNELS 16 +#define IVAS_MAX_OUTPUT_CHANNELS 16 +#define IVAS_CLDFB_NO_COL_MAX 16 +#define IVAS_CLDFB_NO_CHANNELS_MAX 60 #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 - -#define IVAS_ROOM_ABS_COEFF 6 +#define IVAS_ROOM_ABS_COEFF 6 /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index e7f3bcaa2f..1b597dbb46 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1841,29 +1841,11 @@ typedef enum * Early Reflection constants *----------------------------------------------------------------------------------*/ -#define ER_ABS_COEFF 6 -#define ER_MAX_SOURCES 25 -#define ER_REF_ORDER 1 -#define ER_NUM_REF 6 - -#define ER_AIR_COEFF (0.00137f) -#define ER_SOUND_SPEED (343.0f) -#define ER_MIN_WALL_DIST (0.1f) -#define ER_EUCLIDEAN_SCALE (1.29246971E-26f) - -#define ER_DEFAULT_ROOM_L (3.0f) -#define ER_DEFAULT_ROOM_W (4.0f) -#define ER_DEFAULT_ROOM_H (5.0f) #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_MIN_ROOM_DIMENSION (1.0f) -#define ER_MAX_ROOM_DIMENSION (999.0f) -#define ER_MIN_ABS_COEFF (0.0f) -#define ER_MAX_ABS_COEFF (1.0f) - /*----------------------------------------------------------------------------------* * Stereo downmix EVS constants diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 87757c3e00..886c7433b8 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2032,7 +2032,7 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); + mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } mvr2r( renderConfig.roomAcoustics.pFc_input, hRenderConfig->roomAcoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 0563921c6b..69dcbd858c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -992,7 +992,7 @@ static ivas_error ivas_shoebox_config_init_params( hShoeboxConfig->room_W = 0.0f; hShoeboxConfig->room_H = 0.0f; - for ( i = 0; i < ER_ABS_COEFF; i++ ) + for ( i = 0; i < IVAS_ROOM_ABS_COEFF; i++ ) { hShoeboxConfig->abs_coeff[i] = 0.0f; } diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index 7d5982b7d4..47143e20c3 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -51,6 +51,8 @@ * Local constants/tabels *-----------------------------------------------------------------------------------------*/ +#define ER_NUM_REF 6 + static uint16_t LC_mixing_5_1[5] = { 0, 1, 2, 0, 1 }; static uint16_t LC_mixing_7_1[7] = { 0, 1, 2, 3, 4, 3, 4 }; diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index 7c0f3c67d5..12368f5fde 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -39,6 +39,19 @@ #include "prot.h" #include "wmc_auto.h" + +/*------------------------------------------------------------------------- + * Local constants + *------------------------------------------------------------------------*/ + +#define ER_MAX_SOURCES 25 +#define ER_REF_ORDER 1 +#define ER_AIR_COEFF ( 0.00137f ) +#define ER_SOUND_SPEED ( 343.0f ) +#define ER_MIN_WALL_DIST ( 0.1f ) +#define ER_EUCLIDEAN_SCALE ( 1.29246971E-26f ) + + /*-----------------------------------------------------------------------------------------* * Function ivas_shoebox_config_init * diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index b585d3f6ba..3224bc0bf0 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -807,7 +807,7 @@ typedef struct float room_L; float room_W; float room_H; - float abs_coeff[ER_ABS_COEFF]; + float abs_coeff[IVAS_ROOM_ABS_COEFF]; float list_orig[3]; } shoebox_config_t; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 96e5750993..67600172e0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2333,7 +2333,7 @@ static lfe_routing defaultLfeRouting( /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */ - for ( i = 0; i < IVAS_MAX_INPUT_LFE_CHANNELS; ++i ) + for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; ++i ) { set_zero( routing.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); } @@ -4431,7 +4431,7 @@ ivas_error IVAS_REND_SetInputLfeMtx( pInputMc = (input_mc *) pInputBase; /* copy LFE panning matrix */ - for ( i = 0; i < IVAS_MAX_INPUT_LFE_CHANNELS; i++ ) + for ( i = 0; i < RENDERER_MAX_INPUT_LFE_CHANNELS; i++ ) { mvr2r( ( *lfePanMtx )[i], pInputMc->lfeRouting.lfePanMtx[i], IVAS_MAX_OUTPUT_CHANNELS ); } @@ -5070,7 +5070,7 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->roomAcoustics.dimensions = renderConfig.roomAcoustics.dimensions; hRenderConfig->roomAcoustics.ListenerOrigin = renderConfig.roomAcoustics.ListenerOrigin; - mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, ER_ABS_COEFF ); + mvr2r( renderConfig.roomAcoustics.AbsCoeff, hRenderConfig->roomAcoustics.AbsCoeff, IVAS_ROOM_ABS_COEFF ); } #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -8824,7 +8824,7 @@ static ivas_error getSamplesInternal( convertBitsBufferToInternalBitsBuff( *hBits, &bits ); if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 06d94c6cae..24eda6e464 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -40,10 +40,11 @@ * Renderer constants *---------------------------------------------------------------------*/ -#define RENDERER_MAX_ISM_INPUTS 4 -#define RENDERER_MAX_MC_INPUTS 1 -#define RENDERER_MAX_SBA_INPUTS 1 -#define RENDERER_MAX_MASA_INPUTS 1 +#define RENDERER_MAX_ISM_INPUTS 4 +#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 #ifdef SPLIT_REND_WITH_HEAD_ROT #define RENDERER_MAX_BIN_INPUTS 1 #endif @@ -66,7 +67,7 @@ * Renderer structures *---------------------------------------------------------------------*/ -typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +typedef float IVAS_REND_LfePanMtx[RENDERER_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; typedef struct { diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 29027ae99b..a1d778980d 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -64,6 +64,11 @@ #define INPUTPREDELAY_MIN ( 0.0f ) #define INPUTPREDELAY_MAX ( 1.0e+2f ) +#define ER_MIN_ROOM_DIMENSION ( 1.0f ) +#define ER_MAX_ROOM_DIMENSION ( 999.0f ) +#define ER_MIN_ABS_COEFF ( 0.0f ) +#define ER_MAX_ABS_COEFF ( 1.0f ) + /*------------------------------------------------------------------------------------------* * Local Type definitions *------------------------------------------------------------------------------------------*/ @@ -1229,7 +1234,7 @@ ivas_error RenderConfigReader_checkValues( } /* Abs Coeff */ - for ( wall_idx = 0; wall_idx < ER_ABS_COEFF; wall_idx++ ) + for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ ) { if ( pRoom_acoustics->AbsCoeff[wall_idx] < ER_MIN_ABS_COEFF ) { -- GitLab From ad1378f7b17d835deee51fa444d3238c7db0f251 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 10 Oct 2023 19:59:32 +0200 Subject: [PATCH 2/2] 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 ec3b6c720a..c9577a56b6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8823,7 +8823,7 @@ static ivas_error getSamplesInternal( convertBitsBufferToInternalBitsBuff( *hBits, &bits ); if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } -- GitLab