From 4c2b7cc4c0cfab39f768875c2dbd7d3fc4611fde Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 17:45:44 +0200 Subject: [PATCH 01/26] resolve renderer application dependency on internal library --- Workspace_msvc/lib_debug.vcxproj | 4 +- Workspace_msvc/lib_rend.vcxproj | 7 ++ apps/decoder.c | 17 +--- apps/renderer.c | 153 +++++++++++----------------- lib_com/common_api_types.h | 13 ++- lib_com/ivas_cnst.h | 13 --- lib_com/stat_com.h | 2 +- lib_dec/ivas_binRenderer_internal.c | 19 ---- lib_rend/ivas_prot_rend.h | 1 - lib_rend/lib_rend.c | 143 +++++++++++++++++++++++++- lib_rend/lib_rend.h | 56 +++++++++- 11 files changed, 282 insertions(+), 146 deletions(-) diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 7a2fcecef1..1faca1b17c 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -73,7 +73,7 @@ Disabled - ..\lib_util;..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) false @@ -124,7 +124,7 @@ AnySuitable false false - ..\lib_util;..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 3e5f8bee13..82ec9de5ee 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -254,9 +254,16 @@ + + + + + + + diff --git a/apps/decoder.c b/apps/decoder.c index 74aa3d7376..1549ad7472 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -30,11 +30,9 @@ *******************************************************************************************************/ -#include #include #include #include -#include "options.h" #include "lib_dec.h" #include "cmdl_tools.h" #include "audio_file_writer.h" @@ -72,20 +70,15 @@ static #endif int32_t frame = 0; /* Counter of frames */ -#define MIN_NUM_BITS_ACTIVE_FRAME 56 -#define NUM_BITS_SID_IVAS_5K2 104 -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define NUM_FRAMES_PER_SEC 50 -#define MAX_FRAME_SIZE ( 48000 / NUM_FRAMES_PER_SEC ) -#else -#define MAX_FRAME_SIZE ( 48000 / 50 ) -#endif +#define MIN_NUM_BITS_ACTIVE_FRAME 56 +#define NUM_BITS_SID_IVAS_5K2 104 #define MAX_NUM_OUTPUT_CHANNELS 16 -#define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE ) +#define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ) #ifdef SPLIT_REND_WITH_HEAD_ROT #define MAX_SPLIT_REND_BITRATE ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/ -#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) #endif + #define IVAS_PUBLIC_ORIENT_TRK_NONE ( 0 ) #define IVAS_PUBLIC_ORIENT_TRK_REF ( 1 ) #define IVAS_PUBLIC_ORIENT_TRK_AVG ( 2 ) diff --git a/apps/renderer.c b/apps/renderer.c index 17c84d9b81..17410ab62d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -52,8 +52,10 @@ #include "ls_custom_file_reader.h" #include "masa_file_reader.h" #include "masa_file_writer.h" -#include "prot.h" #include "render_config_reader.h" +#ifdef DEBUGGING +#include "debug.h" +#endif #include "wmc_auto.h" @@ -66,9 +68,12 @@ #define RENDERER_MAX_METADATA_LINE_LENGTH 1024 #ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) #endif +#define IVAS_MAX16B_FLT 32767.0f +#define IVAS_MIN16B_FLT ( -32768.0f ) + #if !defined( DEBUGGING ) && !defined( WMOPS ) static #endif @@ -80,6 +85,11 @@ static #define SEP_FOLDER '/' #endif +#ifndef _WIN32 +#define max( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) +#define min( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) +#endif + /*------------------------------------------------------------------------------------------* * Local structures @@ -412,7 +422,7 @@ static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSa #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t cldfb_in, - HANDLE_CLDFB_FILTER_BANK *cldfbAna + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna #endif ); @@ -420,7 +430,7 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamp #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t cldfb_in, - HANDLE_CLDFB_FILTER_BANK *cldfbSyn + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn #endif ); @@ -629,61 +639,6 @@ static float dBToLin( } #ifdef SPLIT_REND_WITH_HEAD_ROT -static int16_t rend_openCldfb( - HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], - HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS], - const int16_t num_in_chs, - const int16_t num_out_chs, - const int32_t output_Fs ) -{ - int16_t n; - - for ( n = 0; n < num_in_chs; n++ ) - { - if ( openCldfb( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) - { - return -1; - } - } - for ( ; n < MAX_INPUT_CHANNELS; n++ ) - { - cldfbAna[n] = NULL; - } - - for ( n = 0; n < num_out_chs; n++ ) - { - if ( openCldfb( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) - { - return -1; - } - } - for ( ; n < MAX_INPUT_CHANNELS; n++ ) - { - cldfbSyn[n] = NULL; - } - return 0; -} - -static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS] ) -{ - int16_t n; - for ( n = 0; n < MAX_INPUT_CHANNELS; n++ ) - { - if ( cldfbAna[n] != NULL ) - { - deleteCldfb( &( cldfbAna[n] ) ); - cldfbAna[n] = NULL; - } - - if ( cldfbSyn[n] != NULL ) - { - deleteCldfb( &( cldfbSyn[n] ) ); - cldfbSyn[n] = NULL; - } - } - return; -} - static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) { int16_t cldfb_in; @@ -744,8 +699,8 @@ int main( RotFileReader *externalOrientationFileReader = NULL; RotFileReader *referenceRotReader = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT - HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS]; - HANDLE_CLDFB_FILTER_BANK cldfbSyn[MAX_INPUT_CHANNELS]; + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS]; + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS]; int16_t cldfb_in, CLDFBframeSize_smpls; SplitRendBFIFileReader *splitRendBFIReader = NULL; #endif @@ -1077,7 +1032,7 @@ int main( if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - renderConfig.room_acoustics.override = TRUE; + renderConfig.room_acoustics.override = 1; } if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK ) @@ -1322,7 +1277,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in ) { - rend_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ); + IVAS_REND_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ); } if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) @@ -1919,7 +1874,7 @@ int main( #ifdef FIX_488_SYNC_DELAY if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); + fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / IVAS_NUM_FRAMES_PER_SEC / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); } #endif @@ -1961,7 +1916,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( cldfb_in ) { - rend_closeCldfb( cldfbAna, cldfbSyn ); + IVAS_REND_closeCldfb( cldfbAna, cldfbSyn ); } if ( hSplitRendFileReadWrite != NULL ) @@ -3349,12 +3304,20 @@ static ivas_error parseCustomLayoutFile( } pLsSetupCustom->num_spk = hLsCustomData.num_spk; - mvr2r( hLsCustomData.azimuth, pLsSetupCustom->azimuth, hLsCustomData.num_spk ); - mvr2r( hLsCustomData.elevation, pLsSetupCustom->elevation, hLsCustomData.num_spk ); + + for ( int16_t i = 0; i < hLsCustomData.num_spk; i++ ) + { + pLsSetupCustom->azimuth[i] = hLsCustomData.azimuth[i]; + pLsSetupCustom->elevation[i] = hLsCustomData.elevation[i]; + } /* Loudspeaker LFE */ pLsSetupCustom->num_lfe = hLsCustomData.num_lfe; - mvs2s( hLsCustomData.lfe_idx, pLsSetupCustom->lfe_idx, hLsCustomData.num_lfe ); + + for ( int16_t i = 0; i < hLsCustomData.num_lfe; i++ ) + { + pLsSetupCustom->lfe_idx[i] = hLsCustomData.lfe_idx[i]; + } CustomLsReader_close( &hLsCustomReader ); @@ -3561,7 +3524,7 @@ static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS_REND_LfePanMtx *lfePanMtx ) { - int16_t lfe_in, ch_out; + int16_t i, lfe_in, ch_out; const char *tok; char line[200]; /* > (10 chars * IVAS_MAX_OUTPUT_CHANNELS) i.e. "-999, " */ FILE *mtxFile; @@ -3582,7 +3545,10 @@ static ivas_error parseLfePanMtxFile( any subsequent issue in file reading will gracefully exit the function */ for ( lfe_in = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) { - set_zero( ( *lfePanMtx )[lfe_in], IVAS_MAX_OUTPUT_CHANNELS ); + for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ ) + { + ( *lfePanMtx )[lfe_in][i] = 0.0f; + } } for ( lfe_in = 0; lfe_in < IVAS_MAX_INPUT_LFE_CHANNELS; lfe_in++ ) @@ -3641,7 +3607,7 @@ static void convertInputBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t cldfb_in, - HANDLE_CLDFB_FILTER_BANK *cldfbAna + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna #endif ) { @@ -3652,11 +3618,11 @@ static void convertInputBuffer( if ( cldfb_in ) { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; - float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; numFloatPcmSamples = numFloatSamplesPerChannel >> 1; - numCldfbBands = numFloatPcmSamples / CLDFB_NO_COL_MAX; + numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Analysis*/ - assert( numIntSamplesPerChannel <= MAX_OUTPUT_CHANNELS * L_FRAME48k ); + assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE ); for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) { for ( chnl = 0; chnl < numChannels; ++chnl ) @@ -3675,13 +3641,12 @@ static void convertInputBuffer( } for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) + for ( slotIdx = 0; slotIdx < IVAS_CLDFB_NO_COL_MAX; slotIdx++ ) { - cldfbAnalysis_ts( &fIn[chnl][numCldfbBands * slotIdx], - &floatBuffer[( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], - &floatBuffer[numCldfbBands + ( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], - numCldfbBands, - cldfbAna[chnl] ); + IVAS_REND_cldfbAnalysis_ts_wrapper( &fIn[chnl][numCldfbBands * slotIdx], + &floatBuffer[( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], + &floatBuffer[numCldfbBands + ( chnl * numFloatSamplesPerChannel ) + ( 2 * slotIdx * numCldfbBands )], + numCldfbBands, cldfbAna[chnl] ); } } } @@ -3726,7 +3691,7 @@ static void convertOutputBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT , const int16_t cldfb_in, - HANDLE_CLDFB_FILTER_BANK *cldfbSyn + IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn #endif ) { @@ -3739,15 +3704,15 @@ static void convertOutputBuffer( if ( cldfb_in ) { int16_t slotIdx, numCldfbBands, numPcmSamples, b; - float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE]; + float re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; + float im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX]; numPcmSamples = numSamplesPerChannel >> 1; - numCldfbBands = numPcmSamples / CLDFB_NO_COL_MAX; + numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX; /* CLDFB Synthesis*/ for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) + for ( slotIdx = 0; slotIdx < IVAS_CLDFB_NO_COL_MAX; slotIdx++ ) { for ( b = 0; b < numCldfbBands; b++ ) { @@ -3760,16 +3725,16 @@ static void convertOutputBuffer( /* Implement CLDFB synthesis */ for ( chnl = 0; chnl < numChannels; ++chnl ) { - float *RealBuffer[CLDFB_NO_COL_MAX]; - float *ImagBuffer[CLDFB_NO_COL_MAX]; + float *RealBuffer[IVAS_CLDFB_NO_COL_MAX]; + float *ImagBuffer[IVAS_CLDFB_NO_COL_MAX]; - for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) + for ( slotIdx = 0; slotIdx < IVAS_CLDFB_NO_COL_MAX; slotIdx++ ) { RealBuffer[slotIdx] = re[chnl][slotIdx]; ImagBuffer[slotIdx] = im[chnl][slotIdx]; } - cldfbSynthesis( RealBuffer, ImagBuffer, &( fIn[chnl][0] ), numCldfbBands * CLDFB_NO_COL_MAX, cldfbSyn[chnl] ); + IVAS_REND_cldfbSynthesis_wrapper( RealBuffer, ImagBuffer, &( fIn[chnl][0] ), numCldfbBands * IVAS_CLDFB_NO_COL_MAX, cldfbSyn[chnl] ); } for ( smpl = 0; smpl < numPcmSamples; ++smpl ) { @@ -3789,13 +3754,13 @@ static void convertOutputBuffer( { temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; temp = (float) floor( temp + 0.5f ); - if ( temp > MAX16B_FLT ) + if ( temp > IVAS_MAX16B_FLT ) { - temp = MAX16B_FLT; + temp = IVAS_MAX16B_FLT; } - else if ( temp < MIN16B_FLT ) + else if ( temp < IVAS_MIN16B_FLT ) { - temp = MIN16B_FLT; + temp = IVAS_MIN16B_FLT; } intBuffer[i] = (int16_t) temp; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 59f6387935..123b271193 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -44,13 +44,19 @@ * 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 / 50 ) #define IVAS_MAX_NUM_OBJECTS 4 +#define IVAS_MAX_INPUT_CHANNELS 16 #define IVAS_MAX_OUTPUT_CHANNELS 16 -#define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 ) +#define IVAS_CLDFB_NO_COL_MAX 16 +#define IVAS_CLDFB_NO_CHANNELS_MAX 60 #define IVAS_MAX_INPUT_LFE_CHANNELS 4 -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 +#define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 +#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // ToDo: should it be harmonized with IVAS_MAX_PARAM_SPATIAL_SUBFRAMES? /*----------------------------------------------------------------------------------* @@ -147,6 +153,9 @@ typedef struct ivas_hrtfs_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 cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; + + #if defined( DEBUGGING ) || defined( SPLIT_REND_WITH_HEAD_ROT ) // TODO needs refactoring to a separate enum for split rendering typedef enum { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 4cd06c6ed4..84f143eb72 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1811,19 +1811,6 @@ typedef enum #define QUANT_STRAT_0 0 #define QUANT_STRAT_2 2 -#ifdef SPLIT_REND_WITH_HEAD_ROT -/*----------------------------------------------------------------------------------* - * Split rendering bitrate constants - *----------------------------------------------------------------------------------*/ - -#define SPLIT_REND_256k 256000 -#define SPLIT_REND_320k 320000 -#define SPLIT_REND_384k 384000 -#define SPLIT_REND_512k 512000 -#define SPLIT_REND_768k 768000 -#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k -#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ ( 1 ) -#endif /*----------------------------------------------------------------------------------* * Limiter constants diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 79976efa88..7216980840 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -573,7 +573,7 @@ typedef struct } FrameSizeParams; -typedef struct +typedef struct cldfb_filter_bank_struct { int16_t no_channels; int16_t no_col; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 808e124713..ed03dbb2e1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1483,25 +1483,6 @@ static void ivas_binRenderer_convModuleClose( return; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -/*------------------------------------------------------------------------- - * ivas_rend_openCldfbRend() - * - * Close CLDFB based fastconv binaural renderer memories - *------------------------------------------------------------------------*/ -void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ) -{ - if ( pCldfbRend->hCldfbRend->hInputSetup != NULL ) - { - free( pCldfbRend->hCldfbRend->hInputSetup ); - pCldfbRend->hCldfbRend->hInputSetup = NULL; - } - ivas_binRenderer_close( &pCldfbRend->hCldfbRend ); - - ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv ); - return; -} -#endif /*------------------------------------------------------------------------- * ivas_binRenderer_close() diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7b345e6910..310d72d71d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -906,7 +906,6 @@ IVAS_QUATERNION ivas_split_rend_get_sf_rot_data( const IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME], int16_t subframe_idx ); -void ivas_rend_closeCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend ); int32_t ivas_get_lcld_bitrate( const int32_t SplitRendBitRate, const IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); int32_t ivas_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out ); int32_t ivas_get_lc3plus_bitrate( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6dd53bdd02..7b658761d0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2914,6 +2914,30 @@ static void clearInputSplitRend( return; } + + +/*------------------------------------------------------------------------- + * ivas_rend_openCldfbRend() + * + * Close CLDFB based fastconv binaural renderer memories + *------------------------------------------------------------------------*/ + +static void ivas_rend_closeCldfbRend( + CLDFB_REND_WRAPPER *pCldfbRend ) +{ + if ( pCldfbRend->hCldfbRend->hInputSetup != NULL ) + { + free( pCldfbRend->hCldfbRend->hInputSetup ); + pCldfbRend->hCldfbRend->hInputSetup = NULL; + } + + ivas_binRenderer_close( &pCldfbRend->hCldfbRend ); + + ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv ); + + return; +} + #endif /* SPLIT_REND_WITH_HEAD_ROT */ static void clearInputSba( @@ -8531,7 +8555,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, @@ -8623,6 +8647,123 @@ void IVAS_REND_Close( return; } + +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*-------------------------------------------------------------------* + * IVAS_REND_openCldfb() + * + * + *-------------------------------------------------------------------*/ + +int16_t IVAS_REND_openCldfb( + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS], + const int16_t num_in_chs, + const int16_t num_out_chs, + const int32_t output_Fs ) +{ + int16_t n; + + for ( n = 0; n < num_in_chs; n++ ) + { + if ( openCldfb( &( cldfbAna[n] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) + { + return -1; + } + } + for ( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) + { + cldfbAna[n] = NULL; + } + + for ( n = 0; n < num_out_chs; n++ ) + { + if ( openCldfb( &( cldfbSyn[n] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) != IVAS_ERR_OK ) + { + return -1; + } + } + for ( ; n < IVAS_MAX_INPUT_CHANNELS; n++ ) + { + cldfbSyn[n] = NULL; + } + + return 0; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_closeCldfb() + * + * + *-------------------------------------------------------------------*/ + +void IVAS_REND_closeCldfb( + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS] ) +{ + int16_t n; + + for ( n = 0; n < IVAS_MAX_INPUT_CHANNELS; n++ ) + { + if ( cldfbAna[n] != NULL ) + { + deleteCldfb( &( cldfbAna[n] ) ); + cldfbAna[n] = NULL; + } + + if ( cldfbSyn[n] != NULL ) + { + deleteCldfb( &( cldfbSyn[n] ) ); + cldfbSyn[n] = NULL; + } + } + + return; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_cldfbSynthesis_wrapper() + * + * + *-------------------------------------------------------------------*/ + +void IVAS_REND_cldfbAnalysis_ts_wrapper( + const float *timeIn, /* i : time buffer */ + float realBuffer[IVAS_CLDFB_NO_CHANNELS_MAX], /* o : real value buffer */ + float imagBuffer[IVAS_CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer */ + const int16_t samplesToProcess, /* i : samples to process */ + IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb /* i : filterbank state */ +) +{ + cldfbAnalysis_ts( timeIn, realBuffer, imagBuffer, samplesToProcess, h_cldfb ); + + return; +} + + +/*-------------------------------------------------------------------* + * IVAS_REND_cldfbSynthesis_wrapper() + * + * + *-------------------------------------------------------------------*/ + +void IVAS_REND_cldfbSynthesis_wrapper( + float **realBuffer, /* i : real values */ + float **imagBuffer, /* i : imag values */ + float *timeOut, /* o : output time domain samples */ + const int16_t samplesToProcess, /* i : number of processed samples */ + IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb /* i : filter bank state */ +) +{ + cldfbSynthesis( realBuffer, imagBuffer, timeOut, samplesToProcess, h_cldfb ); + + return; +} +#endif + + #ifdef DEBUGGING /*-------------------------------------------------------------------* * IVAS_REND_GetNoCLipping() diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index c86b8bcbf2..0db8ddea59 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -36,6 +36,9 @@ #include "common_api_types.h" #include +/*---------------------------------------------------------------------* + * Renderer constants + *---------------------------------------------------------------------*/ #define RENDERER_MAX_ISM_INPUTS 4 #define RENDERER_MAX_MC_INPUTS 1 @@ -45,6 +48,23 @@ #define RENDERER_MAX_BIN_INPUTS 1 #endif +#ifdef SPLIT_REND_WITH_HEAD_ROT +/*----------------------------------------------------------------------------------* + * Split rendering bitrate constants + *----------------------------------------------------------------------------------*/ + +#define SPLIT_REND_256k 256000 +#define SPLIT_REND_320k 320000 +#define SPLIT_REND_384k 384000 +#define SPLIT_REND_512k 512000 +#define SPLIT_REND_768k 768000 +#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k +#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 +#endif + +/*---------------------------------------------------------------------* + * Renderer structures + *---------------------------------------------------------------------*/ typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; @@ -153,7 +173,7 @@ typedef uint16_t IVAS_REND_InputId; /* clang-format off */ /*----------------------------------------------------------------------------------* - * Function prototypes + * Renderer function prototypes *----------------------------------------------------------------------------------*/ /* Functions to be called before rendering */ @@ -376,6 +396,40 @@ void IVAS_REND_Close( IVAS_REND_HANDLE* phIvasRend /* i/o: Pointer to renderer handle */ ); + +#ifdef SPLIT_REND_WITH_HEAD_ROT +/* Split binaural rendering functions */ + +int16_t IVAS_REND_openCldfb( + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS], + const int16_t num_in_chs, + const int16_t num_out_chs, + const int32_t output_Fs +); + +void IVAS_REND_closeCldfb( + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS], + IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS] +); + +void IVAS_REND_cldfbAnalysis_ts_wrapper( + const float *timeIn, /* i : time buffer */ + float realBuffer[IVAS_CLDFB_NO_CHANNELS_MAX], /* o : real value buffer */ + float imagBuffer[IVAS_CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer */ + const int16_t samplesToProcess, /* i : samples to process */ + IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb /* i : filterbank state */ +); + +void IVAS_REND_cldfbSynthesis_wrapper( + float **realBuffer, /* i : real values */ + float **imagBuffer, /* i : imag values */ + float *timeOut, /* o : output time domain samples */ + const int16_t samplesToProcess, /* i : number of processed samples */ + IVAS_CLDFB_FILTER_BANK_HANDLE h_cldfb /* i : filter bank state */ +); +#endif + #ifdef DEBUGGING int32_t IVAS_REND_GetNoCLipping( IVAS_REND_CONST_HANDLE hIvasRend /* i : Renderer handle */ -- GitLab From 55d37f954a6f6fb16061daa63aba3c01e293a549 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 1 Aug 2023 19:08:11 +0200 Subject: [PATCH 02/26] Framework improvements --- apps/decoder.c | 114 ++++++------ lib_com/ivas_cov_smooth.c | 27 ++- lib_com/ivas_fb_mixer.c | 4 +- lib_com/ivas_prot.h | 3 +- lib_com/ivas_rom_com.c | 255 +++++++++++++++----------- lib_com/ivas_rom_com.h | 12 +- lib_com/lsf_tools.c | 2 +- lib_com/prot.h | 6 +- lib_com/stat_com.h | 4 +- lib_dec/FEC_clas_estim.c | 2 +- lib_dec/ivas_ism_dec.c | 8 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_mc_paramupmix_dec.c | 10 +- lib_dec/ivas_qmetadata_dec.c | 2 +- lib_dec/ivas_range_uni_dec.c | 10 +- lib_dec/ivas_sba_rendering_internal.c | 1 + lib_dec/ivas_sns_dec.c | 19 +- lib_dec/lib_dec.c | 50 ++--- lib_dec/lib_dec.h | 2 +- lib_enc/ivas_ism_metadata_enc.c | 4 +- lib_enc/ivas_masa_enc.c | 3 +- lib_enc/ivas_mc_paramupmix_enc.c | 8 +- lib_enc/lib_enc.c | 10 +- lib_enc/pre_proc.c | 2 +- lib_enc/set_impulse.c | 8 +- lib_rend/ivas_crend.c | 2 +- lib_rend/ivas_prot_rend.h | 4 + lib_util/hrtf_file_reader.c | 45 ----- 28 files changed, 332 insertions(+), 287 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 74aa3d7376..62b66a6111 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -103,7 +103,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; - IVAS_DEC_AUDIO_CONFIG outputFormat; + IVAS_DEC_AUDIO_CONFIG outputConfig; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; @@ -119,12 +119,10 @@ typedef struct char *jbmTraceFilename; #endif char *jbmOffsetFilename; - char *FEPatterFileName; + char *FEPatternFileName; float FER; bool hrtfReaderEnabled; char *hrtfFileName; - bool hrtfCRendReaderEnabled; - char *hrtfCRendFileName; IVAS_DEC_INPUT_FORMAT inputFormat; bool customLsOutputEnabled; char *customLsSetupFilename; @@ -281,7 +279,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); @@ -303,9 +301,9 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -327,7 +325,7 @@ int main( if ( arg.enableReferenceRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -354,7 +352,7 @@ int main( if ( arg.enableReferenceVectorTracking ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -407,9 +405,9 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM #endif ) { @@ -427,13 +425,15 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ + #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { arg.enableHeadRotation = true; } #endif - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) + + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -538,9 +538,9 @@ int main( * Open Error pattern file for simulation *-----------------------------------------------------------------*/ - if ( arg.FEPatterFileName != NULL ) + if ( arg.FEPatternFileName != NULL ) { - if ( ( FEC_pattern = fopen( arg.FEPatterFileName, "rb" ) ) == NULL ) + if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL ) { fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" ); usage_dec(); @@ -556,11 +556,11 @@ int main( * Print information about FEC *-----------------------------------------------------------------*/ - if ( !arg.voipMode && ( arg.FEPatterFileName != NULL || arg.FER > 0 ) ) + if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) ) { - if ( arg.FEPatterFileName != NULL ) + if ( arg.FEPatternFileName != NULL ) { - fprintf( stdout, "FEC: %s\n", arg.FEPatterFileName ); + fprintf( stdout, "FEC: %s\n", arg.FEPatternFileName ); } else { @@ -581,9 +581,9 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && + arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && + arg.outputConfig != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); @@ -653,28 +653,41 @@ int main( goto cleanup; } - IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL; - IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); + if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName ); + fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfFileName ); goto cleanup; } + IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL; - IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ); + if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName ); + fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); } + IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; - IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ); + if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfCRendFileName ); + fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); } } @@ -903,7 +916,7 @@ static bool parseCmdlIVAS_dec( #endif #endif arg->output_Fs = 48000; - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputConfig = IVAS_DEC_OUTPUT_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; @@ -926,14 +939,11 @@ static bool parseCmdlIVAS_dec( arg->jbmOffsetFilename = NULL; arg->FER = 0.f; - arg->FEPatterFileName = NULL; + arg->FEPatternFileName = NULL; arg->hrtfReaderEnabled = false; arg->hrtfFileName = NULL; - arg->hrtfCRendReaderEnabled = false; - arg->hrtfCRendFileName = NULL; - arg->customLsOutputEnabled = false; arg->customLsSetupFilename = NULL; @@ -1057,7 +1067,7 @@ static bool parseCmdlIVAS_dec( ftmp = 0.0f; if ( sscanf( argv[i + 1], "%f", &ftmp ) != 1 ) { - arg->FEPatterFileName = argv[i + 1]; + arg->FEPatternFileName = argv[i + 1]; } else { @@ -1344,14 +1354,14 @@ static bool parseCmdlIVAS_dec( if ( i < argc - 3 ) { - arg->outputFormat = cmdline2config( argv[i] ); - if ( arg->outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) + arg->outputConfig = cmdline2config( argv[i] ); + if ( arg->outputConfig == IVAS_DEC_OUTPUT_LS_CUSTOM ) { arg->customLsOutputEnabled = true; arg->customLsSetupFilename = argv[i]; } i++; - if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != IVAS_DEC_OUTPUT_STEREO ) ) + if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_DEC_OUTPUT_STEREO ) ) { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); @@ -1360,11 +1370,11 @@ static bool parseCmdlIVAS_dec( } else { - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputConfig = IVAS_DEC_OUTPUT_MONO; arg->decMode = IVAS_DEC_MODE_EVS; if ( ( arg->Opt_non_diegetic_pan ) ) { - arg->outputFormat = IVAS_DEC_OUTPUT_STEREO; + arg->outputConfig = IVAS_DEC_OUTPUT_STEREO; } } @@ -1562,8 +1572,8 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || - ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || + ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { pFullDelayNumSamples[0] = 0; } @@ -1590,7 +1600,7 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1605,7 +1615,7 @@ static ivas_error initOnFirstGoodFrame( } else { - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1673,7 +1683,7 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, pBsFormat ) ) != IVAS_ERR_OK ) { @@ -2036,7 +2046,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) @@ -2047,7 +2057,7 @@ static ivas_error decodeG192( } else { - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputConfig == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) @@ -2076,7 +2086,7 @@ static ivas_error decodeG192( } /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -2176,7 +2186,7 @@ static ivas_error decodeG192( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -2651,7 +2661,7 @@ static ivas_error decodeVoIP( } /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { int16_t i; @@ -3082,7 +3092,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -3261,7 +3271,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -3338,7 +3348,7 @@ static ivas_error decodeVariableSpeed( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_EXT ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 7211274eea..dc17fae8f2 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -40,7 +40,12 @@ #include "wmc_auto.h" #include "prot.h" +/*-----------------------------------------------------------------------------------------* + * Local constants + *-----------------------------------------------------------------------------------------*/ + #define BAND_SMOOTH_REST_START_IDX ( 2 ) + #ifndef CODE_CLEAN_UP_DIRAC /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() @@ -147,24 +152,36 @@ static void ivas_set_up_cov_smoothing( * To calculate the update factor *-----------------------------------------------------------------------------------------*/ -static float ivas_calculate_update_factor( float *p_bin_to_band, int16_t active_bins ) +static float ivas_calculate_update_factor( + float *p_bin_to_band, + int16_t active_bins ) { float update_factor_temp = 0.0f; int16_t k; + for ( k = 0; k < active_bins; k++ ) { update_factor_temp += p_bin_to_band[k]; } + return update_factor_temp; } + /*-----------------------------------------------------------------------------------------* * Function ivas_calculate_smoothning_factor() * * To calculate the Smoothning factor *-----------------------------------------------------------------------------------------*/ -static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float update_factor, const int16_t min_pool_size, const float max_update_rate, const COV_SMOOTHING_TYPE smooth_mode, const int32_t ivas_total_brate, int16_t j ) +static void ivas_calculate_smoothning_factor( + float *Smoothing_factor, + float update_factor, + const int16_t min_pool_size, + const float max_update_rate, + const COV_SMOOTHING_TYPE smooth_mode, + const int32_t ivas_total_brate, + int16_t j ) { float smooth_fact; *Smoothing_factor = update_factor / min_pool_size; @@ -180,12 +197,16 @@ static void ivas_calculate_smoothning_factor( float *Smoothing_factor, float upd } *Smoothing_factor *= ( j + 1 ) * smooth_fact; } + if ( *Smoothing_factor > max_update_rate ) { *Smoothing_factor = max_update_rate; } + + return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_set_up_cov_smoothing() * @@ -223,6 +244,8 @@ static void ivas_set_up_cov_smoothing( } hCovState->prior_bank_idx = -1; + + return; } #endif diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index a94a92c548..8bd14bdc42 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -603,8 +603,8 @@ static void ivas_fb_mixer_cross_fading( if ( hFbMixer->first_frame[ch] == 0 ) { - fade_start_offset = (int16_t) hFbMixer->cross_fade_start_offset; - fade_end_offset = (int16_t) hFbMixer->cross_fade_end_offset; + fade_start_offset = hFbMixer->cross_fade_start_offset; + fade_end_offset = hFbMixer->cross_fade_end_offset; for ( k = 0; k < fade_start_offset; k++ ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f841cbb1b6..0436aa5caa 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2604,7 +2604,7 @@ void sns_avq_dec( void sns_avq_dec_stereo( int16_t *indexl, /* i : Quantization indices (left channel) */ int16_t *indexr, /* i : Quantization indices (right channe) */ - const int16_t L_frame, + const int16_t L_frame, /* i : frame length */ float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ); @@ -3469,6 +3469,7 @@ void ivas_sba_getTCs( const int16_t input_frame /* i : frame length */ ); +/*! r: SBA DirAC stereo flag */ int16_t ivas_sba_remapTCs( float sba_data[][L_FRAME48k], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 5677a3cc9b..d0077a4956 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -5597,11 +5597,17 @@ const int16_t ivas_num_active_bands[FB - WB + 1] = IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12 }; +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + const int16_t ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 }; + const int16_t ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; /* pre-rounded codebook vectors for singed Q4.12 represantation */ -const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { +const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = +{ -1.8305664f, -2.0878906f, -0.9638672f, 2.8059082f, 2.668213f, 1.1638184f, 1.390625f, 1.217041f, 1.3850098f, 0.44555664f, -0.47045898f, -0.5307617f, -0.810791f, -1.1647949f, -1.4560547f, -1.7612305f, -2.5979004f, -3.3308105f, -1.8554688f, -0.3605957f, 1.6828613f, 2.5871582f, 0.98168945f, 0.22436523f, -0.13110352f, 0.16699219f, 1.5004883f, 0.3293457f, 0.33569336f, 1.1591797f, 0.1796875f, -0.8718262f, 1.982666f, 2.2011719f, 1.1525879f, 0.8093262f, 0.86499023f, 1.1618652f, 1.2888184f, 1.3618164f, 1.0827637f, 0.83251953f, 0.12011719f, -0.7182617f, -2.1948242f, -3.0500488f, -3.3571777f, -3.53833f, @@ -5731,7 +5737,9 @@ const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { 1.7553711f, 2.8996582f, 1.9260254f, 0.40551758f, -0.0234375f, 0.44506836f, 0.31152344f, 0.1809082f, -0.47607422f, -0.4807129f, -1.204834f, -1.3293457f, -1.2412109f, -1.0134277f, -0.89501953f, -1.2602539f, 0.2253418f, 2.2539062f, 2.265625f, 0.57128906f, -0.7661133f, -0.6245117f, 0.21313477f, 1.2248535f, 0.8737793f, -0.12524414f, -0.9609375f, -2.416504f, -1.1223145f, -0.70532227f, -0.31469727f, -0.592041f, }; -const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = +{ -1.1569824f, -0.4765625f, 0.008056641f, 0.47802734f, 0.38330078f, -0.075683594f, -0.3737793f, -0.29516602f, -0.1352539f, 0.012939453f, 0.22241211f, 0.375f, 0.31689453f, 0.20874023f, 0.2541504f, 0.25439453f, -0.40600586f, -0.22070312f, -0.04272461f, 0.15893555f, -0.25195312f, -0.6623535f, -0.27172852f, 0.28735352f, 0.35742188f, 0.20166016f, 0.052246094f, -0.3647461f, -0.4506836f, 0.1862793f, 0.66796875f, 0.7585449f, 0.02734375f, -0.2097168f, -0.39819336f, -0.54296875f, -0.46850586f, -0.25146484f, -0.26953125f, -0.07495117f, 0.375f, 0.9343262f, 0.91625977f, 0.4267578f, 0.026123047f, -0.15576172f, -0.11425781f, -0.22021484f, @@ -5797,7 +5805,9 @@ const float ivas_sns_cdbk_tcx20_stage2[ 64 * 16 ] = { 0.3227539f, -1.0678711f, -1.1435547f, 0.068603516f, 0.7546387f, 0.38745117f, 0.09008789f, -0.0007324219f, -0.12792969f, 0.076416016f, 0.24853516f, 0.28735352f, 0.076660156f, -0.041748047f, -0.01977539f, 0.08911133f, 0.6101074f, -0.22070312f, -0.5324707f, -0.119384766f, 0.10473633f, 0.16333008f, -0.15112305f, -0.34472656f, -0.39746094f, -0.43652344f, -0.23876953f, 0.0017089844f, 0.056152344f, 0.22973633f, 0.50024414f, 0.7751465f, }; -const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = +{ -0.12109375f, -0.32348633f, -0.25976562f, 0.21435547f, 0.4814453f, 0.14819336f, -0.22363281f, -0.31030273f, -0.13256836f, 0.10107422f, 0.33276367f, 0.32495117f, 0.16577148f, -0.079833984f, -0.16210938f, -0.15527344f, 0.088378906f, -0.0146484375f, -0.13378906f, -0.29003906f, 0.873291f, -0.3125f, -0.19384766f, 0.19311523f, -0.09863281f, 0.052734375f, -0.13110352f, -0.021972656f, -0.07861328f, -0.01977539f, -0.07373047f, 0.1616211f, -0.115722656f, 0.28100586f, 0.2697754f, -0.10522461f, -0.107910156f, -0.2866211f, -0.36694336f, -0.33862305f, -0.15844727f, 0.01928711f, 0.17382812f, 0.21118164f, 0.2697754f, 0.17260742f, 0.07299805f, 0.009033203f, @@ -5831,7 +5841,9 @@ const float ivas_sns_cdbk_tcx20_stage3[ 32 * 16 ] = { 0.17895508f, -0.31396484f, -0.033203125f, -0.02734375f, -0.0637207f, -0.11791992f, -0.03466797f, 0.0061035156f, 0.07324219f, 0.072753906f, 0.14916992f, 0.13671875f, 0.12524414f, 0.017333984f, -0.08178711f, -0.08618164f, 0.13330078f, -0.15893555f, -0.22045898f, -0.032226562f, -0.07739258f, -0.25463867f, -0.32299805f, -0.2614746f, 0.039794922f, 0.18554688f, 0.1262207f, -0.04321289f, -0.010498047f, 0.13330078f, 0.31860352f, 0.44506836f, }; -const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = +{ -0.0056152344f, -0.03955078f, 0.071777344f, 0.26879883f, 0.44140625f, -0.08203125f, -0.20092773f, -0.009277344f, 0.05810547f, -0.06347656f, -0.07910156f, -0.05126953f, -0.07006836f, -0.068847656f, -0.07885742f, -0.09082031f, -0.011962891f, -0.060302734f, 0.011962891f, 0.049804688f, -0.044677734f, 0.037841797f, 0.099121094f, 0.06274414f, 0.022216797f, -0.09057617f, 0.00390625f, 0.38452148f, 0.1027832f, -0.5292969f, -0.3269043f, 0.28881836f, -0.3557129f, 0.3815918f, 0.10839844f, 0.08203125f, 0.03149414f, -0.0024414062f, -0.0036621094f, -0.02758789f, -0.03125f, -0.096191406f, -0.09326172f, -0.103515625f, -0.07006836f, 0.008056641f, 0.06616211f, 0.10644531f, @@ -5869,9 +5881,11 @@ const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = { const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; + const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; -const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { +const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = +{ 1.0144043f, 1.1826172f, 0.3269043f, -0.6411133f, -1.2163086f, -1.1411133f, -1.1525879f, -0.8898926f, -0.19604492f, 0.7402344f, 1.1782227f, 1.0830078f, 0.78222656f, 0.26953125f, -0.33203125f, -1.0080566f, -0.38916016f, -0.31347656f, -1.1826172f, -2.036621f, -2.086914f, -1.8569336f, -1.637207f, -1.3156738f, -0.4182129f, 0.50634766f, 1.2770996f, 1.3771973f, 1.8566895f, 2.3503418f, 2.3015137f, 1.5678711f, 0.43652344f, 1.8859863f, 2.8059082f, 2.2385254f, 1.5480957f, 0.14331055f, 0.07299805f, -1.1218262f, -1.1103516f, -0.7336426f, -0.4194336f, -0.89624023f, -1.0429688f, -0.79785156f, -1.204834f, -1.8046875f, @@ -6001,7 +6015,9 @@ const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { 3.256836f, 3.5593262f, 2.2746582f, 1.1318359f, 0.3149414f, -0.02368164f, 0.27172852f, -0.19335938f, -0.48779297f, -0.9663086f, -0.9187012f, -1.0222168f, -1.512207f, -1.6816406f, -1.8964844f, -2.1069336f, -0.057617188f, -0.45092773f, -0.9638672f, -0.72143555f, 0.20703125f, 1.4692383f, 1.921875f, 1.6833496f, 1.3933105f, 0.6699219f, 0.17333984f, -0.43798828f, -0.9772949f, -1.1477051f, -1.3552246f, -1.4057617f, }; -const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { + +const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = +{ 0.30615234f, 0.48828125f, -0.02709961f, -0.47680664f, -0.5300293f, -0.25463867f, -0.13305664f, -0.14941406f, -0.14819336f, 0.08666992f, 0.28833008f, 0.27514648f, 0.099365234f, -0.017578125f, 0.033203125f, 0.15893555f, 0.40942383f, -0.044189453f, -0.088378906f, 0.38720703f, 0.5151367f, 0.42236328f, 0.34960938f, 0.2680664f, 0.037597656f, -0.19970703f, -0.31054688f, -0.32617188f, -0.38452148f, -0.38085938f, -0.38598633f, -0.2692871f, -0.16040039f, -0.37548828f, -0.41479492f, -0.1237793f, 0.25708008f, 0.29589844f, 0.045410156f, -0.04345703f, -0.11450195f, -0.2019043f, 0.032470703f, 0.5847168f, 1.074707f, 0.3178711f, -0.43847656f, -0.73535156f, @@ -6035,7 +6051,9 @@ const float ivas_sns_cdbk_tcx10_stage2[ 32 * 16 ] = { -0.78149414f, 0.05517578f, 0.09863281f, -0.35083008f, -0.29174805f, 0.1352539f, 0.10620117f, -0.3515625f, -0.27514648f, 0.15917969f, 0.34326172f, 0.2626953f, 0.39916992f, 0.42089844f, 0.20947266f, -0.1394043f, -0.20361328f, -0.21557617f, -0.16308594f, -0.041748047f, -0.111083984f, -0.057617188f, 0.0390625f, 0.013183594f, 0.17358398f, 0.74902344f, 0.9448242f, 0.4477539f, -0.09423828f, -0.32739258f, -0.50634766f, -0.6467285f, }; -const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = { + +const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = +{ 0.15209961f, -0.12768555f, 0.09375f, -0.083496094f, -0.25390625f, 0.12524414f, 0.2993164f, -0.09863281f, -0.34814453f, -0.2434082f, -0.11254883f, -0.060058594f, 0.032470703f, 0.15527344f, 0.23413086f, 0.2355957f, -0.16235352f, -0.111083984f, -0.3173828f, -0.25634766f, 0.13842773f, 0.29858398f, 0.10498047f, 0.11743164f, 0.26611328f, 0.05444336f, -0.1459961f, -0.19238281f, 0.041748047f, 0.2097168f, 0.07421875f, -0.12011719f, -0.05078125f, 0.14770508f, -0.1003418f, -0.32104492f, -0.17504883f, -0.18652344f, -0.27148438f, -0.07788086f, 0.0036621094f, -0.04296875f, 0.10131836f, 0.34985352f, 0.3083496f, 0.10107422f, 0.0769043f, 0.13696289f, @@ -6053,7 +6071,8 @@ const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; const int16_t ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; -const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = +{ -0.11376953f, -0.06591797f, 0.041992188f, 0.044677734f, 0.17871094f, -0.02758789f, -0.32592773f, -0.21069336f, -0.049072266f, 0.0126953125f, 0.012939453f, 0.015136719f, 0.08203125f, 0.12670898f, 0.12695312f, 0.15112305f, -0.017089844f, 0.09326172f, 0.2355957f, 0.2241211f, 0.107421875f, 0.05029297f, 0.039794922f, -0.0073242188f, -0.048339844f, -0.0871582f, -0.08520508f, -0.12060547f, -0.111572266f, -0.10620117f, -0.08911133f, -0.078125f, -0.26635742f, 0.27368164f, 0.4543457f, 0.1821289f, 0.6513672f, 0.18066406f, 0.14575195f, -0.008056641f, 0.2631836f, -0.045898438f, -0.52001953f, -0.1628418f, 0.038330078f, -0.31811523f, -0.4321289f, -0.43603516f, @@ -6088,7 +6107,8 @@ const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { -0.19580078f, -0.14624023f, -0.11303711f, -0.055908203f, -0.052001953f, -0.009033203f, 0.022949219f, -0.0068359375f, -0.032470703f, 0.0017089844f, 0.045410156f, 0.025146484f, 0.039794922f, 0.07543945f, 0.1574707f, 0.24267578f, }; -const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = +{ -0.013916016f, 0.0007324219f, 0.017089844f, 0.005859375f, 0.056152344f, -0.08178711f, -0.2927246f, 0.00390625f, 0.140625f, 0.03881836f, 0.010498047f, 0.038330078f, 0.042236328f, 0.020751953f, 0.005859375f, 0.0075683594f, -0.07104492f, -0.10253906f, 0.038085938f, 0.091552734f, 0.118896484f, 0.13476562f, 0.05078125f, -0.111328125f, -0.13842773f, -0.20727539f, -0.25732422f, -0.15063477f, 0.032470703f, 0.08129883f, 0.17578125f, 0.31469727f, 0.0715332f, 0.029052734f, 0.01953125f, 0.008056641f, 0.0234375f, 0.020751953f, 0.032226562f, 0.021972656f, 0.03466797f, 0.017822266f, -0.037841797f, -0.14038086f, -0.21679688f, -0.11035156f, 0.057617188f, 0.16845703f, @@ -6125,7 +6145,8 @@ const float ivas_sns_cdbks_side_tcx20_stage2[ 32 * 16 ] = { const float *const ivas_sns_cdbks_side_tcx20[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx20_stage1, ivas_sns_cdbks_side_tcx20_stage2 }; -const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { +const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = +{ -0.23950195f, -0.203125f, -0.17822266f, -0.1315918f, -0.123291016f, -0.095947266f, -0.106933594f, -0.16552734f, -0.14941406f, -0.075683594f, 0.026367188f, 0.1015625f, 0.17041016f, 0.2770996f, 0.37890625f, 0.5148926f, 0.12890625f, 0.20825195f, 0.22924805f, 0.2998047f, 0.24267578f, 0.14477539f, 0.07861328f, 0.024658203f, -0.076171875f, -0.18432617f, -0.26660156f, -0.33251953f, -0.2758789f, -0.13964844f, -0.030517578f, -0.05126953f, -0.14160156f, -0.13305664f, -0.111816406f, -0.037353516f, -0.038085938f, 0.051513672f, 0.07348633f, 0.0073242188f, 0.044921875f, -0.0234375f, -0.123291016f, -0.01171875f, 0.28100586f, 0.24194336f, 0.0703125f, -0.1496582f, @@ -6158,9 +6179,11 @@ const float ivas_sns_cdbks_side_tcx10_stage1[ 32 * 16 ] = { 0.06982422f, 0.072265625f, 0.18261719f, 0.025390625f, -0.2475586f, -0.2861328f, -0.111572266f, -0.037109375f, 0.0036621094f, 0.031982422f, 0.043945312f, 0.057373047f, 0.078125f, 0.072021484f, 0.028564453f, 0.016357422f, 0.07836914f, 0.13549805f, 0.1743164f, 0.15478516f, 0.12573242f, -0.009521484f, -0.1508789f, -0.1965332f, -0.19604492f, -0.103027344f, -0.045898438f, -0.026123047f, 0.020263672f, 0.023925781f, 0.013183594f, 0.0014648438f, 0.25341797f, 0.22558594f, 0.2241211f, 0.17114258f, 0.18164062f, 0.16894531f, 0.16503906f, 0.20239258f, 0.17041016f, 0.025878906f, -0.16625977f, -0.24121094f, -0.31982422f, -0.4008789f, -0.38256836f, -0.27783203f, -}; +} +; -const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { +const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = +{ -0.13989258f, -0.024658203f, 0.12670898f, 0.027832031f, 0.06689453f, 0.12817383f, 0.07495117f, -0.01977539f, -0.05834961f, -0.07543945f, -0.06542969f, -0.0546875f, -0.04345703f, -0.0063476562f, 0.034179688f, 0.029541016f, -0.06713867f, -0.11450195f, -0.09790039f, -0.091308594f, -0.12182617f, -0.010009766f, 0.10986328f, 0.115478516f, 0.060058594f, 0.038085938f, 0.020507812f, 0.017333984f, 0.024169922f, 0.028320312f, 0.038330078f, 0.05053711f, 0.05517578f, 0.030517578f, 0.0390625f, 0.05810547f, 0.021484375f, 0.032470703f, 0.040039062f, -0.0087890625f, -0.055908203f, -0.023925781f, 0.037109375f, 0.06347656f, 0.02709961f, -0.07373047f, -0.1274414f, -0.115234375f, @@ -6173,7 +6196,8 @@ const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = { const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; -const int16_t sns_1st_cdbk[2][2][8 * 32] = { +const int16_t sns_1st_cdbk[2][2][8 * 32] = +{ { /* split 1 */ { /* TCX 20 */ -10900, -11064, -10637, -10471, -9051, -6381, -4688, -2438, @@ -6315,7 +6339,9 @@ const int16_t sns_1st_cdbk[2][2][8 * 32] = { } } }; -const int16_t sns_1st_means_16k[2][16] = { + +const int16_t sns_1st_means_16k[2][16] = +{ { /* TCX 20 */ 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281, }, @@ -6323,7 +6349,9 @@ const int16_t sns_1st_means_16k[2][16] = { 12018, 15915, 11089, 6015, 847, -705, -539, -1548, -893, -2163, -1806, -4189, -7017, -8670, -8874, -9480, } }; -const int16_t sns_1st_means_25k6[2][16] = { + +const int16_t sns_1st_means_25k6[2][16] = +{ { /* TCX 20 */ 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749, }, @@ -6331,7 +6359,9 @@ const int16_t sns_1st_means_25k6[2][16] = { 15560, 19489, 14623, 5595, 2084, 1699, 775, -1312, -2195, -6101, -9078, -9465, -7825, -6603, -7281, -9960, } }; -const int16_t sns_1st_means_32k[2][16] = { + +const int16_t sns_1st_means_32k[2][16] = +{ { /* TCX 20 */ 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930, }, @@ -6340,100 +6370,105 @@ const int16_t sns_1st_means_32k[2][16] = { } }; -ACPL_QUANT_TABLE alpha_quant_table[] = -{ - { /* Alfa Fine */ - 33, /* nquant */ - 16, /* offset */ - { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, - -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, - +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, - +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */ - }, /* End Alfa Fine */ - { /* Alfa Coarse */ - 17, /* nquant */ - 8, /* offset */ - { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, - +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */ - } /* End Alfa Coarse */ -}; - -ACPL_QUANT_TABLE beta_quant_table[2][9] = -{ - { - { /* Beta Fine #1 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */ - }, /* End Beta Fine #1 */ - { /* Beta Fine #2 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */ - }, /* End Beta Fine #2 */ - { /* Beta Fine #3 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */ - }, /* End Beta Fine #3 */ - { /* Beta Fine #4 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */ - }, /* End Beta Fine #4 */ - { /* Beta Fine #5 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */ - }, /* End Beta Fine #5 */ - { /* Beta Fine #6 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */ - }, /* End Beta Fine #6 */ - { /* Beta Fine #7 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */ - }, /* End Beta Fine #7 */ - { /* Beta Fine #8 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */ - }, /* End Beta Fine #8 */ - { /* Beta Fine #9 */ - 9, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */ - } /* End Beta Fine #9 */ - }, - { - { /* Beta Coarse #1 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */ - }, /* End Beta Coarse #1 */ - { /* Beta Coarse #2 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */ - }, /* End Beta Coarse #2 */ - { /* Beta Coarse #3 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */ - }, /* End Beta Coarse #3 */ - { /* Beta Coarse #4 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */ - }, /* End Beta Coarse #4 */ - { /* Beta Coarse #5 */ - 5, /* nquant */ - 0, /* offset */ - { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */ - } /* End Beta Coarse #5 */ - } + +/*------------------------------------------------------------------------------------------* + * MC ParamUpMix tables + *------------------------------------------------------------------------------------------*/ + +const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[] = +{ + { /* Alfa Fine */ + 33, /* nquant */ + 16, /* offset */ + { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, + -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, + +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, + +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */ + }, + { /* Alfa Coarse */ + 17, /* nquant */ + 8, /* offset */ + { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, + +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */ + } +}; + +const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9] = +{ + { + { /* Beta Fine #1 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */ + }, + { /* Beta Fine #2 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */ + }, + { /* Beta Fine #3 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */ + }, + { /* Beta Fine #4 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */ + }, + { /* Beta Fine #5 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */ + }, + { /* Beta Fine #6 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */ + }, + { /* Beta Fine #7 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */ + }, + { /* Beta Fine #8 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */ + }, + { /* Beta Fine #9 */ + 9, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */ + } + }, + { + { /* Beta Coarse #1 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */ + }, + { /* Beta Coarse #2 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */ + }, + { /* Beta Coarse #3 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */ + }, + { /* Beta Coarse #4 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */ + }, + { /* Beta Coarse #5 */ + 5, /* nquant */ + 0, /* offset */ + { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */ + } + } }; /* clang-format on */ diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 8dc958e06c..c45a3d2c58 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -418,6 +418,7 @@ extern const int16_t ivas_num_active_bands[FB - WB + 1]; /*------------------------------------------------------------------------------------------* * SNS MSVQ codebooks and means *------------------------------------------------------------------------------------------*/ + extern const int16_t ivas_sns_cdbks_tcx20_levels[]; extern const int16_t ivas_sns_cdbks_tcx20_bits[]; @@ -435,13 +436,18 @@ extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; extern const float *const ivas_sns_cdbks_side_tcx20[]; extern const float *const ivas_sns_cdbks_side_tcx10[]; -extern ACPL_QUANT_TABLE alpha_quant_table[]; -extern ACPL_QUANT_TABLE beta_quant_table[2][9]; - /* means and codebooks for the split VQ in the 2-stage SNS VQ */ extern const int16_t sns_1st_cdbk[2][2][8 * 32]; extern const int16_t sns_1st_means_16k[2][16]; extern const int16_t sns_1st_means_25k6[2][16]; extern const int16_t sns_1st_means_32k[2][16]; + +/*------------------------------------------------------------------------------------------* + * SNS MSVQ codebooks and means + *------------------------------------------------------------------------------------------*/ + +extern const ACPL_QUANT_TABLE ivas_param_upmx_alpha_quant_table[]; +extern const ACPL_QUANT_TABLE ivas_param_upmx_beta_quant_table[2][9]; + /* IVAS_ROM_COM_H */ #endif diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index 42688ee145..4f4f6319dc 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -2448,7 +2448,7 @@ void dctT2_N_apply_matrix( const float *input, /* i : input in fdcng or DCT(fdcng) domain */ float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - int16_t fdcngvq_dim, /* i : fdcng domain length */ + const int16_t fdcngvq_dim, /* i : fdcng domain length */ const float *matrix, /* i : IDCT matrix */ const int16_t matrix_row_dim, /* i : */ const DCTTYPE dcttype /* i : matrix operation type */ diff --git a/lib_com/prot.h b/lib_com/prot.h index bf9446939d..2459ba90af 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3984,7 +3984,7 @@ void set_impulse( float exc[], /* o : adaptive codebook excitation */ float y1[], /* o : filtered adaptive codebook excitation */ int16_t *imp_shape, /* o : adaptive codebook index */ - int16_t *imp_pos, /* o : position of the glotal impulse center index */ + int16_t *imp_pos, /* o : position of the glottal impulse center index */ float *gain_trans /* o : transition gain */ ); @@ -4943,7 +4943,7 @@ void FEC_encode( int16_t FEC_pos_dec( Decoder_State *st, /* i/o: decoder state structure */ - int16_t *last_pulse_pos, /* o : Last glotal pulse position in the lost ACB */ + int16_t *last_pulse_pos, /* o : Last glottal pulse position in the lost ACB */ float *enr_q, /* o : Decoded energy */ const int16_t nBits_es_Pred /* i : number of bits for Es_pred Q */ ); @@ -8149,7 +8149,7 @@ void dctT2_N_apply_matrix( const float *input, /* i : input in fdcng or DCT(fdcng) domain */ float *output, /* o : output in DCT(fdcng) or fdcng ordomain */ const int16_t dct_dim, /* i : dct processing dim possibly truncated */ - int16_t fdcngvq_dim, /* i : fdcng domain length */ + const int16_t fdcngvq_dim, /* i : fdcng domain length */ const float *matrix, /* i : IDCT matrix */ const int16_t matrix_row_dim, /* i : */ const DCTTYPE dcttype /* i : matrix operation type */ diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 79976efa88..b36e31253f 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -461,7 +461,7 @@ typedef int16_t ( *TDecodeValue )( struct Decoder_State *st, int16_t index, int1 */ typedef float ( *TLinearPredictionFilter )( const int16_t order, const float parCoeff[], float *state, float x ); -/** Structure that defines mapping between a parameter and a bistream. */ +/** Structure that defines mapping between a parameter and a bitstream. */ typedef struct ParamBitMap { /** Number of bits in a bitstream required for the parameter. @@ -516,7 +516,7 @@ typedef struct ParamBitMap struct ParamsBitMap const *pSubParamBitMap; } ParamBitMap; -/** Structure that defines mapping between parameters and a bistream. */ +/** Structure that defines mapping between parameters and a bitstream. */ typedef struct ParamsBitMap { /** Number of parameters in params. */ diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index 4acd3dab9c..8d54129a7c 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -735,7 +735,7 @@ static void FEC_classificationMusic( int16_t FEC_pos_dec( Decoder_State *st, /* i/o: decoder state structure */ - int16_t *last_pulse_pos, /* o : last glotal pulse position in the lost ACB */ + int16_t *last_pulse_pos, /* o : last glottal pulse position in the lost ACB */ float *enr_q, /* o : decoded energy */ const int16_t nBits_es_Pred /* i : number of bits for Es_pred Q */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 63464def7f..94f22d0fd6 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -41,12 +41,12 @@ #include "wmc_auto.h" /*-------------------------------------------------------------------------* - * ivas_ism_bitrate_switching() + * ivas_ism_bitrate_switching_dec() * * *-------------------------------------------------------------------------*/ -static ivas_error ivas_ism_bitrate_switching( +static ivas_error ivas_ism_bitrate_switching_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode, /* i : last ISM mode */ @@ -418,7 +418,7 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } @@ -441,7 +441,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_bitrate_switching_dec( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f5ed58974f..a3699bdad6 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -622,7 +622,7 @@ ivas_error ivas_ism_metadata_dec_create( /*------------------------------------------------------------------------- * decode_angle_indices() * - * Decoding of an angle + * Decoding of a position/orientation angle *-------------------------------------------------------------------------*/ static void decode_angle_indices( diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 9ae580ae3a..2f8e02aa27 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -1018,10 +1018,10 @@ static void huffman_decode( switch ( parType ) { case ALPHA: - nquant = alpha_quant_table[quant_type].nquant; + nquant = ivas_param_upmx_alpha_quant_table[quant_type].nquant; break; case BETA: - nquant = beta_quant_table[quant_type][0].nquant; + nquant = ivas_param_upmx_beta_quant_table[quant_type][0].nquant; break; default: assert( 0 ); @@ -1104,7 +1104,7 @@ static void dequant_alpha( float *v ) { int16_t iv; - ACPL_QUANT_TABLE *quant_table = &alpha_quant_table[quant_type]; + const ACPL_QUANT_TABLE *quant_table = &ivas_param_upmx_alpha_quant_table[quant_type]; for ( iv = 0; iv < ivStart; iv++ ) { @@ -1129,7 +1129,7 @@ static void dequant_beta( float *beta ) { int16_t iv; - ACPL_QUANT_TABLE *quant_table; + const ACPL_QUANT_TABLE *quant_table; for ( iv = 0; iv < ivStart; iv++ ) { @@ -1138,7 +1138,7 @@ static void dequant_beta( for ( iv = ivStart; iv < nv; iv++ ) { - quant_table = &beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]]; + quant_table = &ivas_param_upmx_beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]]; beta[iv] = quant_table->data[bq[iv]]; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index af7795f617..5998f769f1 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -3728,7 +3728,7 @@ static int16_t decode_fixed_rate_composed_index_coherence( /*-------------------------------------------------------------------* * read_coherence_data_hr_512() * - * + * Read coherence data at HR *-------------------------------------------------------------------*/ /*! r: number of bits read */ diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index db0fbddeab..6fbbaa5636 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -138,7 +138,7 @@ uint16_t rc_uni_dec_read_symbol_fastS( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -248,7 +248,7 @@ uint16_t rc_uni_dec_read_bit( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -303,7 +303,7 @@ uint16_t rc_uni_dec_read_bit_prob_fast( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -376,7 +376,7 @@ uint16_t rc_uni_dec_read_bits( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; @@ -482,7 +482,7 @@ static int16_t rc_uni_dec_read( { rc_st_dec->bit_error_detected = 1; - /* for valid bistreams, always low < range, therefore setting low = range */ + /* for valid bitstreams, always low < range, therefore setting low = range */ /* will always reach the bitstream error condition branch on the next call */ rc_st_dec->rc_range = 0xFFFFFFFF; rc_st_dec->rc_low = rc_st_dec->rc_range; diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 643c7b5a6c..978d3152e2 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -219,6 +219,7 @@ void ivas_mc2sba( * Get TCs from Ambisonics signal in ACN *-------------------------------------------------------------------*/ +/*! r: SBA DirAC stereo flag */ int16_t ivas_sba_remapTCs( float sba_data[][L_FRAME48k], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ diff --git a/lib_dec/ivas_sns_dec.c b/lib_dec/ivas_sns_dec.c index adcfe88186..dec6d85252 100644 --- a/lib_dec/ivas_sns_dec.c +++ b/lib_dec/ivas_sns_dec.c @@ -182,11 +182,11 @@ void sns_avq_dec( *-------------------------------------------------------------------*/ void sns_avq_dec_stereo( - int16_t *indexl, /* i : Quantization indices (left channel) */ - int16_t *indexr, /* i : Quantization indices (right channe) */ - const int16_t L_frame, - float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ - float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ + int16_t *indexl, /* i : Quantization indices (left channel) */ + int16_t *indexr, /* i : Quantization indices (right channe) */ + const int16_t L_frame, /* i : frame length */ + float *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ + float *SNS_Qr /* o : Quantized SNS vectors (right channe) */ ) { int16_t i, stereo_mode; @@ -232,6 +232,13 @@ void sns_avq_dec_stereo( return; } + +/*------------------------------------------------------------------- + * dequantize_sns() + * + * Dequantize SNS + *-------------------------------------------------------------------*/ + void dequantize_sns( int16_t indices[CPE_CHANNELS][NPRM_LPC_NEW], float snsQ_out[CPE_CHANNELS][NB_DIV][M], @@ -293,4 +300,6 @@ void dequantize_sns( } } } + + return; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 686a4b6da7..b351338244 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -289,82 +289,82 @@ void IVAS_DEC_Close( /*---------------------------------------------------------------------* - * mapOutputFormat() + * mapOutputConfig() * * *---------------------------------------------------------------------*/ -static AUDIO_CONFIG mapOutputFormat( - const IVAS_DEC_AUDIO_CONFIG outputFormat ) +static AUDIO_CONFIG mapOutputConfig( + const IVAS_DEC_AUDIO_CONFIG outputConfig_api ) { AUDIO_CONFIG output_config; - if ( outputFormat == IVAS_DEC_OUTPUT_EXT ) /* external renderer */ + if ( outputConfig_api == IVAS_DEC_OUTPUT_EXT ) /* external renderer */ { output_config = AUDIO_CONFIG_EXTERNAL; } - else if ( outputFormat == IVAS_DEC_OUTPUT_MONO ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_MONO ) { output_config = AUDIO_CONFIG_MONO; } - else if ( outputFormat == IVAS_DEC_OUTPUT_STEREO ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_STEREO ) { output_config = AUDIO_CONFIG_STEREO; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1 ) { output_config = AUDIO_CONFIG_5_1; } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_7_1 ) { output_config = AUDIO_CONFIG_7_1; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_2 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1_2 ) { output_config = AUDIO_CONFIG_5_1_2; } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_4 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_5_1_4 ) { output_config = AUDIO_CONFIG_5_1_4; } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1_4 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_7_1_4 ) { output_config = AUDIO_CONFIG_7_1_4; } - else if ( outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_LS_CUSTOM ) { output_config = AUDIO_CONFIG_LS_CUSTOM; } - else if ( outputFormat == IVAS_DEC_OUTPUT_FOA ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_FOA ) { output_config = AUDIO_CONFIG_FOA; } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA2 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_HOA2 ) { output_config = AUDIO_CONFIG_HOA2; } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA3 ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_HOA3 ) { output_config = AUDIO_CONFIG_HOA3; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL ) { output_config = AUDIO_CONFIG_BINAURAL; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR ) { output_config = AUDIO_CONFIG_BINAURAL_ROOM_IR; } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { output_config = AUDIO_CONFIG_BINAURAL_ROOM_REVERB; } #ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + else if ( outputConfig_api == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) { output_config = AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } @@ -419,7 +419,7 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const IVAS_DEC_AUDIO_CONFIG outputConfig, /* i : output configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -446,8 +446,8 @@ ivas_error IVAS_DEC_Configure( return IVAS_ERR_WRONG_PARAMS; } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputFormat == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || - ( outputFormat == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputConfig == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || + ( outputConfig == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) { return IVAS_ERR_WRONG_MODE; } @@ -456,7 +456,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig = st_ivas->hDecoderConfig; - hDecoderConfig->output_config = mapOutputFormat( outputFormat ); + hDecoderConfig->output_config = mapOutputConfig( outputConfig ); if ( hDecoderConfig->output_config == AUDIO_CONFIG_INVALID ) { return IVAS_ERR_WRONG_PARAMS; @@ -470,7 +470,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = 1; } - if ( outputFormat != IVAS_DEC_OUTPUT_EXT && outputFormat != IVAS_DEC_OUTPUT_LS_CUSTOM ) + if ( outputConfig != IVAS_DEC_OUTPUT_EXT && outputConfig != IVAS_DEC_OUTPUT_LS_CUSTOM ) { hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 9edc1a130c..78343f090a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -144,7 +144,7 @@ ivas_error IVAS_DEC_Open( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const IVAS_DEC_AUDIO_CONFIG outputConfig, /* i : output configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index ed43af153d..7cccef4592 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -502,7 +502,7 @@ ivas_error ivas_ism_metadata_enc( /* But send the flag with 1 bit */ push_next_indice( hBstr, hParamIsm->flag_noisy_speech, 1 ); - /* Loop over multiwave to write the object indices into bistream */ + /* Loop over multiwave to write the object indices into bitstream */ for ( ch = 0; ch < MAX_PARAM_ISM_WAVE; ch++ ) { for ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) @@ -514,7 +514,7 @@ ivas_error ivas_ism_metadata_enc( } } - /* Loop over bands to write the power ratio's indices into bistream */ + /* Loop over bands to write the power ratio's indices into bitstream */ for ( nbands = 0; nbands < hParamIsm->nbands; nbands++ ) { for ( nblocks = 0; nblocks < hParamIsm->nblocks[nbands]; nblocks++ ) diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index ec8c22bcd9..76e366188e 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -1943,11 +1943,12 @@ static void copy_masa_metadata( * Compare the similarity of MASA metadata in two sub-frames *-------------------------------------------------------------------*/ +/* r: similarity decision */ static uint8_t are_masa_subframes_similar( const MASA_METADATA_HANDLE frame1, /* i : MASA metadata frame 1 */ const uint8_t sf1_idx, /* i : index of the subframe of frame1 to inspect */ const MASA_METADATA_HANDLE frame2, /* i : MASA metadata frame 2 */ - const uint8_t sf2_idx /* o : index of the subframe of frame2 to inspect */ + const uint8_t sf2_idx /* i : index of the subframe of frame2 to inspect */ ) { uint8_t num_dir; diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 5c50c3d6bd..d8d75dbfe1 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -546,8 +546,8 @@ static void quantize_alpha( int16_t nq; const float *data; - nq = alpha_quant_table[quant_type].nquant; - data = alpha_quant_table[quant_type].data; + nq = ivas_param_upmx_alpha_quant_table[quant_type].nquant; + data = ivas_param_upmx_alpha_quant_table[quant_type].data; quantize_pars( nv, alpha, nq, data, aq, adeq ); @@ -567,7 +567,7 @@ static void quantize_beta( float *bdeq ) { int16_t iv, iq, iq0, iq1; - ACPL_QUANT_TABLE *tables = beta_quant_table[quant_type]; + const ACPL_QUANT_TABLE *tables = ivas_param_upmx_beta_quant_table[quant_type]; ACPL_QUANT_TABLE quant_table; for ( iv = 0; iv < nv; iv++ ) @@ -602,7 +602,7 @@ static void quantize_beta( } } - *pnq = beta_quant_table[quant_type][0].nquant; + *pnq = ivas_param_upmx_beta_quant_table[quant_type][0].nquant; return; } diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 5e051e41b7..9e2412c87d 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -76,7 +76,7 @@ static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const IVAS_ENC_HANDLE hIvasEnc ); +static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi ); static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); @@ -757,7 +757,7 @@ static ivas_error configureEncoder( } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc->extMetadataApi ) ) != IVAS_ERR_OK ) { return error; } @@ -1737,7 +1737,7 @@ static ivas_error setBitrate( if ( hEncoderConfig->ivas_format == ISM_FORMAT ) { - if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc ) ) != IVAS_ERR_OK ) + if ( ( error = sanitizeBitrateISM( hEncoderConfig, hIvasEnc->extMetadataApi ) ) != IVAS_ERR_OK ) { return error; } @@ -1978,7 +1978,7 @@ static ivas_error sanitizeBandwidth( static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, - const IVAS_ENC_HANDLE hIvasEnc ) + const bool extMetadataApi ) { if ( hEncoderConfig->ivas_total_brate > IVAS_128k && hEncoderConfig->nchan_inp == 1 ) { @@ -2010,7 +2010,7 @@ static ivas_error sanitizeBitrateISM( return IVAS_ERROR( IVAS_ERR_INVALID_BITRATE, "Too low bitrate for 4 ISM specified in IVAS: %d", hEncoderConfig->ivas_total_brate ); } - if ( hIvasEnc->extMetadataApi ) + if ( extMetadataApi ) { hEncoderConfig->ism_extended_metadata_flag = ( hEncoderConfig->ivas_total_brate >= ISM_EXTENDED_METADATA_BRATE ); } diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 4a11f1b61f..c035ef5ac4 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -381,7 +381,7 @@ void pre_proc( } else if ( st->rf_mode && st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40 ) { - /* the RF config is for (n- fec_offset)th frame that will be packed along with the n-th frame bistream */ + /* the RF config is for (n- fec_offset)th frame that will be packed along with the n-th frame bitstream */ st->rf_mode = 1; st->codec_mode = MODE2; diff --git a/lib_enc/set_impulse.c b/lib_enc/set_impulse.c index 4cafeea9e8..2c8a7fdd08 100644 --- a/lib_enc/set_impulse.c +++ b/lib_enc/set_impulse.c @@ -61,10 +61,10 @@ static void convolve_tc2( const float g[], const float h[], float y[], const int /*---------------------------------------------------------------------------------------* * Function set_impulse() for TC * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * Builds glottal codebook contribution based on glotal impulses positions finding. * + * Builds glottal codebook contribution based on glottal impulses positions finding. * * * - * Returns a position of the glotal impulse center and * - * a number of the glotal impulse shape. * + * Returns a position of the glottal impulse center and * + * a number of the glottal impulse shape. * * * * |----| |----| xn * * imp_pos-> || | imp_shape-> | g1 | | * @@ -89,7 +89,7 @@ void set_impulse( float exc[], /* o : adaptive codebook excitation */ float y1[], /* o : filtered adaptive codebook excitation */ int16_t *imp_shape, /* o : adaptive codebook index */ - int16_t *imp_pos, /* o : position of the glotal impulse center index */ + int16_t *imp_pos, /* o : position of the glottal impulse center index */ float *gain_trans /* o : transition gain */ ) { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e333043560..6449e90299 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -53,7 +53,7 @@ * Initialize hHrtf handle *------------------------------------------------------------------------*/ -static ivas_error ivas_hrtf_init( +ivas_error ivas_hrtf_init( HRTFS_DATA *hHrtf /* i/o: HRTF handle */ ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 7b345e6910..08b22ea94b 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -843,6 +843,10 @@ void ivas_rend_closeCrend( #endif ); +ivas_error ivas_hrtf_init( + HRTFS_DATA *hHrtf /* i/o: HRTF handle */ +); + ivas_error ivas_rend_initCrendWrapper( CREND_WRAPPER_HANDLE *pCrend #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index df2c5c66f3..0793f91f8c 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -678,51 +678,6 @@ ivas_error dealloc_HRTF_binary( } -/*------------------------------------------------------------------------- - * ivas_hrtf_init() - * - * Initialize hHRTF handle - *------------------------------------------------------------------------*/ - -static ivas_error ivas_hrtf_init( - HRTFS_DATA *hHRTF /* i/o: HRTF handle */ -) -{ - int16_t i, j; - - if ( hHRTF == NULL ) - { - return IVAS_ERR_WRONG_PARAMS; - } - - hHRTF->latency_s = 0; - hHRTF->max_num_ir = 0; - hHRTF->max_num_iterations = 0; - hHRTF->index_frequency_max_diffuse = 0; - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - hHRTF->inv_diffuse_weight[i] = 0; - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHRTF->num_iterations[i][j] = 0; - hHRTF->pIndex_frequency_max[i][j] = NULL; - hHRTF->pOut_to_bin_re[i][j] = NULL; - hHRTF->pOut_to_bin_im[i][j] = NULL; - } - } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) - { - hHRTF->num_iterations_diffuse[j] = 0; - hHRTF->pIndex_frequency_max_diffuse[j] = NULL; - hHRTF->pOut_to_bin_diffuse_re[j] = NULL; - hHRTF->pOut_to_bin_diffuse_im[j] = NULL; - } - - return IVAS_ERR_OK; -} - - /*---------------------------------------------------------------------* * create_HRTF_from_rawdata() * -- GitLab From 338e972f17f7662bcc5cf72bc99e80a3709df6ed Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 2 Aug 2023 09:10:07 +0200 Subject: [PATCH 03/26] revision of includes in applications files --- Workspace_msvc/renderer.vcxproj | 4 ++-- apps/decoder.c | 22 ++++++++++------------ apps/encoder.c | 7 +++---- apps/renderer.c | 17 ++++++++--------- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index eee6eed340..b119e778db 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -86,7 +86,7 @@ Disabled - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) EnableFastChecks @@ -180,7 +180,7 @@ Neither false false - ..\lib_com;..\lib_dec;..\lib_enc;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) + ..\lib_com;..\lib_debug;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) true diff --git a/apps/decoder.c b/apps/decoder.c index bf991780d9..fd38c5bed7 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -30,33 +30,31 @@ *******************************************************************************************************/ +#include "lib_dec.h" #include -#include #include -#include "lib_dec.h" #include "cmdl_tools.h" #include "audio_file_writer.h" #include "bitstream_reader.h" -#include "masa_file_writer.h" +#include "evs_rtp_payload.h" #include "ism_file_writer.h" -#include "ls_custom_file_reader.h" +#include "jbm_file_writer.h" #include "hrtf_file_reader.h" +#include "ls_custom_file_reader.h" +#include "masa_file_writer.h" +#include "render_config_reader.h" #include "rotation_file_reader.h" -#include "vector3_pair_file_reader.h" -#include "jbm_file_writer.h" -#include "evs_rtp_payload.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "split_render_file_read_write.h" +#endif #ifdef VARIABLE_SPEED_DECODING #include "tsm_scale_file_reader.h" #endif +#include "vector3_pair_file_reader.h" #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" -#include "render_config_reader.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#include "split_render_file_read_write.h" -#endif -#include "hrtf_file_reader.h" #define WMC_TOOL_SKIP diff --git a/apps/encoder.c b/apps/encoder.c index 672b3f55ed..c2574c9537 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -30,21 +30,20 @@ *******************************************************************************************************/ -#include -#include -#include #include "lib_enc.h" +#include #include "cmdl_tools.h" #include "audio_file_reader.h" #include "bitstream_writer.h" +#include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" -#include "ism_file_reader.h" #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" + #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* diff --git a/apps/renderer.c b/apps/renderer.c index 17410ab62d..9aac5cc9ec 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -31,34 +31,33 @@ *******************************************************************************************************/ #include "lib_rend.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#include "split_render_file_read_write.h" -#include "split_rend_bfi_file_reader.h" -#endif #include -#include #include -#include -#include #include #include "audio_file_reader.h" #include "audio_file_writer.h" #include "cmdl_tools.h" #include "cmdln_parser.h" -#include "rotation_file_reader.h" -#include "vector3_pair_file_reader.h" #include "hrtf_file_reader.h" #include "ism_file_reader.h" #include "ls_custom_file_reader.h" #include "masa_file_reader.h" #include "masa_file_writer.h" #include "render_config_reader.h" +#include "rotation_file_reader.h" +#ifdef SPLIT_REND_WITH_HEAD_ROT +#include "split_render_file_read_write.h" +#include "split_rend_bfi_file_reader.h" +#endif +#include "vector3_pair_file_reader.h" #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" +#define WMC_TOOL_SKIP + /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ -- GitLab From d0ea56d3a350515c95d6f8ee4cd4f06804e676aa Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 2 Aug 2023 09:23:06 +0200 Subject: [PATCH 04/26] add exit codes --- apps/decoder.c | 63 ++++++++++++++----------- apps/renderer.c | 5 ++ lib_util/split_render_file_read_write.c | 5 ++ 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 8b30b25f2d..cb46245718 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "options.h" #include "lib_dec.h" #include "cmdl_tools.h" @@ -1608,13 +1607,19 @@ static ivas_error initOnFirstGoodFrame( { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; - IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); - error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ); - if ( error != IVAS_ERR_OK ) + + if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); + return error; + } + + if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); - exit( -1 ); + return error; } + *ppAfWriter = NULL; } else @@ -1623,13 +1628,17 @@ static ivas_error initOnFirstGoodFrame( { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; - IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ); - assert( arg.outputMdFilename != NULL ); - error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ); - if ( error != IVAS_ERR_OK ) + + if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); + return error; + } + + if ( ( error = split_rend_writer_open( hSplitRendFileReadWrite, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Could not open split rend metadata file %s\n", arg.outputWavFilename ); - exit( -1 ); + return error; } } #endif @@ -1756,30 +1765,30 @@ static ivas_error initOnFirstGoodFrame( if ( numInitialBadFrames > 0 ) { #endif - /* Duplicate good first frame metadata to fill the beginning of stream. */ - MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; + /* Duplicate good first frame metadata to fill the beginning of stream. */ + MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL; #ifdef FIX_470_MASA_JBM_EXT - if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta ) ) != IVAS_ERR_OK ) #endif - { - fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); - return error; - } - - for ( int16_t j = 0; j < numInitialBadFrames; ++j ) - { - if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); return error; } - } + + for ( int16_t j = 0; j < numInitialBadFrames; ++j ) + { + if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) ); + return error; + } + } #ifdef MASA_AND_OBJECTS - } + } #endif - } + } } return IVAS_ERR_OK; @@ -2235,7 +2244,7 @@ static ivas_error decodeG192( for ( i = 0; i < numObj; i++ ) { fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } + } fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } #endif @@ -3434,7 +3443,7 @@ static ivas_error decodeVariableSpeed( for ( i = 0; i < numObj; i++ ) { fprintf( stdout, "\nOutput ISM metadata file: %s", IsmFileWriter_getFilePath( ismWriters[i] ) ); - } + } fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } #endif diff --git a/apps/renderer.c b/apps/renderer.c index 17c84d9b81..a6cf81b63a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3653,8 +3653,10 @@ static void convertInputBuffer( { int16_t slotIdx, numCldfbBands, numFloatPcmSamples; float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; + numFloatPcmSamples = numFloatSamplesPerChannel >> 1; numCldfbBands = numFloatPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Analysis*/ assert( numIntSamplesPerChannel <= MAX_OUTPUT_CHANNELS * L_FRAME48k ); for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl ) @@ -3673,6 +3675,7 @@ static void convertInputBuffer( ++i; } } + for ( chnl = 0; chnl < numChannels; ++chnl ) { for ( slotIdx = 0; slotIdx < CLDFB_NO_COL_MAX; slotIdx++ ) @@ -3742,8 +3745,10 @@ static void convertOutputBuffer( float fIn[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float im[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + numPcmSamples = numSamplesPerChannel >> 1; numCldfbBands = numPcmSamples / CLDFB_NO_COL_MAX; + /* CLDFB Synthesis*/ for ( chnl = 0; chnl < numChannels; ++chnl ) { diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index b596a5781c..c993f51349 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -110,6 +110,11 @@ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite size_t header_len, h; char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "MAIN_SPLITH"; + if ( filename == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + hSplitRendFileReadWrite = (SplitFileReadWrite *) malloc( sizeof( SplitFileReadWrite ) ); hSplitRendFileReadWrite->file = fopen( filename, "wb" ); if ( hSplitRendFileReadWrite->file == NULL ) -- GitLab From c919c0379db9c0c772b8806e96d2c7d285956271 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 2 Aug 2023 10:02:13 +0200 Subject: [PATCH 05/26] revision of includes in util files --- lib_util/g192.h | 1 - lib_util/masa_file_writer.h | 4 +--- lib_util/rotation_file_reader.h | 2 -- lib_util/split_rend_bfi_file_reader.h | 10 ++++------ lib_util/split_render_file_read_write.h | 16 +++++++--------- lib_util/tsm_scale_file_reader.h | 13 +++++-------- lib_util/vector3_pair_file_reader.h | 2 -- 7 files changed, 17 insertions(+), 31 deletions(-) diff --git a/lib_util/g192.h b/lib_util/g192.h index 2dfd34b9e5..9e5e56d223 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -38,7 +38,6 @@ #define G192_H G192_H #include "common_api_types.h" -#include /*-----------------------------------------------------------------------* diff --git a/lib_util/masa_file_writer.h b/lib_util/masa_file_writer.h index 62aa8c6b48..6b1bcbb9fb 100644 --- a/lib_util/masa_file_writer.h +++ b/lib_util/masa_file_writer.h @@ -33,10 +33,8 @@ #ifndef IVAS_MASA_FILE_WRITER_H #define IVAS_MASA_FILE_WRITER_H -#include -#include "options.h" -#include #include "common_api_types.h" +#include struct MasaFileWriter; diff --git a/lib_util/rotation_file_reader.h b/lib_util/rotation_file_reader.h index d597c67a7f..1ae772fceb 100644 --- a/lib_util/rotation_file_reader.h +++ b/lib_util/rotation_file_reader.h @@ -36,8 +36,6 @@ #include "common_api_types.h" -#define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 - typedef struct RotFileReader RotFileReader; /*-----------------------------------------------------------------------* diff --git a/lib_util/split_rend_bfi_file_reader.h b/lib_util/split_rend_bfi_file_reader.h index 3541883513..fc0a530ddc 100644 --- a/lib_util/split_rend_bfi_file_reader.h +++ b/lib_util/split_rend_bfi_file_reader.h @@ -33,17 +33,15 @@ #ifndef IVAS_SR_BFI_FILE_READER_H #define IVAS_SR_BFI_FILE_READER_H -#include "options.h" - #ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" -#include "ivas_error.h" + typedef struct SplitRendBFIFileReader SplitRendBFIFileReader; ivas_error SplitRendBFIFileReader_open( - char *trajFilePath, /* i : head rotation trajectory file name */ - SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */ + char *trajFilePath, /* i : head rotation trajectory file name */ + SplitRendBFIFileReader **SplitRendBFIReader /* o : SplitRendBFIFileReader handle */ ); ivas_error SplitRendBFIFileReading( @@ -55,7 +53,7 @@ void SplitRendBFIFileReader_close( ); const char *SplitRendBFIFileReader_getFilePath( - SplitRendBFIFileReader *SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */ + SplitRendBFIFileReader *SplitRendBFIReader /* i/o: SplitRendBFIFileReader handle */ ); diff --git a/lib_util/split_render_file_read_write.h b/lib_util/split_render_file_read_write.h index 19b4b7cf27..29ca49aad7 100644 --- a/lib_util/split_render_file_read_write.h +++ b/lib_util/split_render_file_read_write.h @@ -33,29 +33,27 @@ #ifndef SPLIT_RENDER_FILE_READ_WRITE_H #define SPLIT_RENDER_FILE_READ_WRITE_H -#include "options.h" - #ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" -#include "ivas_error.h" + typedef struct SplitFileReadWrite SplitFileReadWrite; -/* Allocates and initializes a a split renderer reader instance */ +/* Allocates and initializes a a split renderer reader instance */ ivas_error split_rend_reader_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename ); -/* Allocates and initializes a a split renderer writer instance */ +/* Allocates and initializes a a split renderer writer instance */ ivas_error split_rend_writer_open( SplitFileReadWrite **hhSplitRendFileReadWrite, char *filename, int16_t delayNumSamples, int32_t delayTimeScale ); -/* Closes the split renderer reader/writer and deallocates memory */ +/* Closes the split renderer reader/writer and deallocates memory */ ivas_error split_rend_reader_writer_close( SplitFileReadWrite **hhSplitRendFileReadWrite ); -/*write split rend coded bitstream to file*/ +/*write split rend coded bitstream to file */ ivas_error split_rend_write_bitstream_to_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, @@ -64,7 +62,7 @@ ivas_error split_rend_write_bitstream_to_file( IVAS_SPLIT_REND_CODEC codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection ); -/*read split rend coded bits from file*/ +/* read split rend coded bits from file */ ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, @@ -73,7 +71,7 @@ ivas_error split_rend_read_bits_from_file( IVAS_SPLIT_REND_CODEC *codec, IVAS_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection ); -/*read split pre rend delay*/ +/* read split pre rend delay */ ivas_error split_rend_read_pre_rend_delay_ns( SplitFileReadWrite *hSplitRendFileReadWrite, uint32_t *delay_ns ); diff --git a/lib_util/tsm_scale_file_reader.h b/lib_util/tsm_scale_file_reader.h index 7a795a25cb..55ee20f8cf 100644 --- a/lib_util/tsm_scale_file_reader.h +++ b/lib_util/tsm_scale_file_reader.h @@ -33,9 +33,7 @@ #ifndef IVAS_TSM_SCALE_FILE_READER_H #define IVAS_TSM_SCALE_FILE_READER_H -#include #include "common_api_types.h" -#include "ivas_error.h" /* clang-format off */ @@ -44,24 +42,23 @@ typedef struct TsmScaleFileReader TsmScaleFileReader; /*! r: TsmScaleFileReader handle */ TsmScaleFileReader *TsmScaleFileReader_open( - const char *filePath /* i : path to TSM scale file */ + const char *filePath /* i : path to TSM scale file */ ); ivas_error TsmScaleFileReader_readScale( - TsmScaleFileReader* self, /* i/o: TsmScaleFileReader handle */ - int16_t *scale /* o : next scale */ + TsmScaleFileReader* self, /* i/o: TsmScaleFileReader handle */ + int16_t *scale /* o : next scale */ ); void TsmScaleFileReader_close( - TsmScaleFileReader **selfPtr /* i/o: pointer to TsmScaleFileReader handle */ + TsmScaleFileReader **selfPtr /* i/o: pointer to TsmScaleFileReader handle */ ); /*! r: path to the currently opened file or NULL if `self` is NULL */ const char *TsmScaleFileReader_getFilePath( - TsmScaleFileReader* self /* i/o: TsmScaleFileReader handle */ + TsmScaleFileReader* self /* i/o: TsmScaleFileReader handle */ ); - /* clang-format on */ #endif /* IVAS_TSM_SCALE_FILE_READER_H */ diff --git a/lib_util/vector3_pair_file_reader.h b/lib_util/vector3_pair_file_reader.h index 4ab687848c..e469193922 100644 --- a/lib_util/vector3_pair_file_reader.h +++ b/lib_util/vector3_pair_file_reader.h @@ -34,8 +34,6 @@ #define IVAS_V3PAIR_FILE_READER_H #include "common_api_types.h" -#include "ivas_error.h" -#include "options.h" /* only included to get access to the feature-defines */ typedef struct Vector3PairFileReader Vector3PairFileReader; -- GitLab From 7c672fe0c3e7c09904044edf1f547ae507e889a1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 3 Aug 2023 15:16:49 +0200 Subject: [PATCH 06/26] add malloc() return errors --- lib_dec/ivas_init_dec.c | 4 ++-- lib_rend/ivas_dirac_ana.c | 15 ++++++++++++--- lib_rend/ivas_limiter.c | 21 ++++++++++++++------- lib_rend/ivas_prot_rend.h | 5 +++-- lib_rend/lib_rend.c | 12 ++++++------ 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 73c66b5379..ab845217b6 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1865,9 +1865,9 @@ ivas_error ivas_init_decoder( * Allocate and initialize limiter struct *-----------------------------------------------------------------*/ - if ( ( st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs ) ) == NULL ) + if ( ( error = ivas_limiter_open( &st_ivas->hLimiter, hDecoderConfig->nchan_out, output_Fs ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + return error; } /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index 6d2b8861bb..dc41207be4 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -109,11 +109,17 @@ ivas_error ivas_dirac_ana_open( /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { - hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ); + if ( ( hDirAC->direction_vector_m[i] = (float **) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } for ( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ ) { - hDirAC->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hDirAC->direction_vector_m[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hDirAC->direction_vector_m[i][j], MASA_FREQUENCY_BANDS ); } } @@ -122,7 +128,10 @@ ivas_error ivas_dirac_ana_open( { for ( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ ) { - hDirAC->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ); + if ( ( hDirAC->buffer_intensity_real[i][j] = (float *) malloc( MASA_FREQUENCY_BANDS * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); + } set_zero( hDirAC->buffer_intensity_real[i][j], MASA_FREQUENCY_BANDS ); } } diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 106c433034..0953e8a825 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -101,9 +101,10 @@ static int16_t detect_strong_saturations( *-------------------------------------------------------------------*/ /*! r : limiter struct handle */ -IVAS_LIMITER_HANDLE ivas_limiter_open( - const int16_t max_num_channels, /* i : maximum number of I/O channels to be processed */ - const int32_t sampling_rate /* i : sampling rate for processing */ +ivas_error ivas_limiter_open( + IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ + const int16_t max_num_channels, /* i : maximum number of I/O channels to be processed */ + const int32_t sampling_rate /* i : sampling rate for processing */ ) { int16_t i; @@ -111,17 +112,21 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( if ( max_num_channels <= 0 || sampling_rate <= 0 ) { - return NULL; + return ( IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Wrong parameters for Limiter\n" ) ); } if ( ( hLimiter = malloc( sizeof( IVAS_LIMITER ) ) ) == NULL ) { - return NULL; + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Limiter handle\n" ) ); } hLimiter->max_num_channels = max_num_channels; hLimiter->num_channels = max_num_channels; - hLimiter->channel_ptrs = malloc( max_num_channels * sizeof( float * ) ); + + if ( ( hLimiter->channel_ptrs = malloc( max_num_channels * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Limiter handle\n" ) ); + } hLimiter->sampling_rate = sampling_rate; hLimiter->gain = 1.f; hLimiter->release_heuristic = 0.f; @@ -136,7 +141,9 @@ IVAS_LIMITER_HANDLE ivas_limiter_open( hLimiter->channel_ptrs[i] = NULL; } - return hLimiter; + *hLimiter_out = hLimiter; + + return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 16f9891915..da67c51932 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -80,8 +80,9 @@ void ivas_output_init( * Limiter prototypes *----------------------------------------------------------------------------------*/ -/*! r: limiter struct handle */ -IVAS_LIMITER_HANDLE ivas_limiter_open( + +ivas_error ivas_limiter_open( + IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */ const int16_t num_channels, /* i : number of I/O channels */ const int32_t sampling_rate /* i : sampling rate for processing */ ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e30368606a..d8b9657ad2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -790,10 +790,10 @@ static ivas_error initLimiter( const int16_t numChannels, const int32_t sampleRate ) { + ivas_error error; + /* If re-initializing with unchanged values, return early */ - if ( *phLimiter != NULL && - ( *phLimiter )->num_channels == numChannels && - ( *phLimiter )->sampling_rate == sampleRate ) + if ( *phLimiter != NULL && ( *phLimiter )->num_channels == numChannels && ( *phLimiter )->sampling_rate == sampleRate ) { return IVAS_ERR_OK; } @@ -804,9 +804,9 @@ static ivas_error initLimiter( ivas_limiter_close( phLimiter ); } - if ( ( *phLimiter = ivas_limiter_open( numChannels, sampleRate ) ) == NULL ) + if ( ( error = ivas_limiter_open( phLimiter, numChannels, sampleRate ) ) != IVAS_ERR_OK ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); + return error; } return IVAS_ERR_OK; @@ -8654,7 +8654,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 21503dbcd19c2ec43a9c061765b65287cb2f2228 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 4 Aug 2023 12:00:12 +0200 Subject: [PATCH 07/26] AUDIO_CONFIG with IVAS_REND_AudioConfig and with IVAS_DEC_AUDIO_CONFIG --- apps/decoder.c | 99 ++-- apps/renderer.c | 164 +++--- lib_com/common_api_types.h | 35 ++ lib_com/ivas_cnst.h | 32 +- lib_dec/ivas_binRenderer_internal.c | 4 +- lib_dec/lib_dec.c | 203 +------- lib_dec/lib_dec.h | 37 +- lib_rend/ivas_crend.c | 90 ++-- lib_rend/ivas_mcmasa_ana.c | 10 +- lib_rend/ivas_objectRenderer.c | 10 +- lib_rend/ivas_prot_rend.h | 30 +- lib_rend/lib_rend.c | 766 +++++++++++++++------------- lib_rend/lib_rend.h | 58 +-- 13 files changed, 664 insertions(+), 874 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ea8a58f8db..3e93e2f9d9 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -103,7 +103,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; - IVAS_DEC_AUDIO_CONFIG outputFormat; + IVAS_AUDIO_CONFIG outputFormat; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; @@ -281,7 +281,7 @@ int main( if ( arg.hrtfReaderEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { arg.hrtfReaderEnabled = false; fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" ); @@ -303,9 +303,9 @@ int main( if ( arg.enableHeadRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -327,7 +327,7 @@ int main( if ( arg.enableReferenceRotation ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference rotation file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -354,7 +354,7 @@ int main( if ( arg.enableReferenceVectorTracking ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { fprintf( stderr, "\nError: Reference vector trajectory file cannot be used in this output configuration.\n\n" ); goto cleanup; @@ -407,9 +407,9 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM + && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -427,8 +427,9 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ + #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { arg.enableHeadRotation = true; } @@ -581,9 +582,9 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED && - arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputFormat != AUDIO_CONFIG_BINAURAL && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputFormat != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && + arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && + arg.outputFormat != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" ); exit( -1 ); @@ -796,10 +797,10 @@ cleanup: * Translate command-line argument to output configuration *---------------------------------------------------------------------*/ -static IVAS_DEC_AUDIO_CONFIG cmdline2config( +static IVAS_AUDIO_CONFIG cmdline2config( char *argv ) { - IVAS_DEC_AUDIO_CONFIG output_config; + IVAS_AUDIO_CONFIG output_config; char argv_to_upper[FILENAME_MAX]; @@ -809,73 +810,73 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */ { - output_config = IVAS_DEC_OUTPUT_EXT; + output_config = AUDIO_CONFIG_EXTERNAL; } else if ( strcmp( argv_to_upper, "MONO" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_MONO; + output_config = AUDIO_CONFIG_MONO; } else if ( strcmp( argv_to_upper, "STEREO" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_STEREO; + output_config = AUDIO_CONFIG_STEREO; } else if ( strcmp( argv_to_upper, "5_1" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_5_1; + output_config = AUDIO_CONFIG_5_1; } else if ( strcmp( argv_to_upper, "7_1" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_7_1; + output_config = AUDIO_CONFIG_7_1; } else if ( strcmp( argv_to_upper, "5_1_2" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_5_1_2; + output_config = AUDIO_CONFIG_5_1_2; } else if ( strcmp( argv_to_upper, "5_1_4" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_5_1_4; + output_config = AUDIO_CONFIG_5_1_4; } else if ( strcmp( argv_to_upper, "7_1_4" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_7_1_4; + output_config = AUDIO_CONFIG_7_1_4; } else if ( strcmp( argv_to_upper, "FOA" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_FOA; + output_config = AUDIO_CONFIG_FOA; } else if ( strcmp( argv_to_upper, "HOA2" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_HOA2; + output_config = AUDIO_CONFIG_HOA2; } else if ( strcmp( argv_to_upper, "HOA3" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_HOA3; + output_config = AUDIO_CONFIG_HOA3; } else if ( strcmp( argv_to_upper, "BINAURAL" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_BINAURAL; + output_config = AUDIO_CONFIG_BINAURAL; } #ifdef SPLIT_REND_WITH_HEAD_ROT else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_CODED" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED; + output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } else if ( strcmp( argv_to_upper, "BINAURAL_SPLIT_PCM" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM; + output_config = AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } #endif else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_IR" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR; + output_config = AUDIO_CONFIG_BINAURAL_ROOM_IR; } else if ( strcmp( argv_to_upper, "BINAURAL_ROOM_REVERB" ) == 0 ) { - output_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB; + output_config = AUDIO_CONFIG_BINAURAL_ROOM_REVERB; } else { - output_config = IVAS_DEC_OUTPUT_LS_CUSTOM; + output_config = AUDIO_CONFIG_LS_CUSTOM; } return output_config; @@ -905,7 +906,7 @@ static bool parseCmdlIVAS_dec( #endif #endif arg->output_Fs = 48000; - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputFormat = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; @@ -1349,13 +1350,13 @@ static bool parseCmdlIVAS_dec( if ( i < argc - 3 ) { arg->outputFormat = cmdline2config( argv[i] ); - if ( arg->outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) + if ( arg->outputFormat == AUDIO_CONFIG_LS_CUSTOM ) { arg->customLsOutputEnabled = true; arg->customLsSetupFilename = argv[i]; } i++; - if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != IVAS_DEC_OUTPUT_STEREO ) ) + if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputFormat != AUDIO_CONFIG_STEREO ) ) { fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" ); usage_dec(); @@ -1364,11 +1365,11 @@ static bool parseCmdlIVAS_dec( } else { - arg->outputFormat = IVAS_DEC_OUTPUT_MONO; + arg->outputFormat = AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_EVS; if ( ( arg->Opt_non_diegetic_pan ) ) { - arg->outputFormat = IVAS_DEC_OUTPUT_STEREO; + arg->outputFormat = AUDIO_CONFIG_STEREO; } } @@ -1566,8 +1567,8 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || - ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || + ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { pFullDelayNumSamples[0] = 0; } @@ -1594,7 +1595,7 @@ static ivas_error initOnFirstGoodFrame( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) + if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1609,7 +1610,7 @@ static ivas_error initOnFirstGoodFrame( } else { - if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) + if ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t delayNumSamples_temp[3]; int32_t delayTimeScale_temp; @@ -1677,7 +1678,7 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, pBsFormat ) ) != IVAS_ERR_OK ) { @@ -2056,7 +2057,7 @@ static ivas_error decodeG192( if ( decodedGoodFrame ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) @@ -2067,7 +2068,7 @@ static ivas_error decodeG192( } else { - if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) ) + if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written, splitRendBits.codec, splitRendBits.pose_correction ) != IVAS_ERR_OK ) @@ -2096,7 +2097,7 @@ static ivas_error decodeG192( } /* Write MASA/ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) @@ -2205,7 +2206,7 @@ static ivas_error decodeG192( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { @@ -2690,7 +2691,7 @@ static ivas_error decodeVoIP( } /* Write ISM metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { int16_t i; @@ -3130,7 +3131,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) @@ -3318,7 +3319,7 @@ static ivas_error decodeVariableSpeed( } /* Write ISm metadata to external file(s) */ - if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( decodedGoodFrame && arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { #ifdef MASA_AND_OBJECTS if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM ) @@ -3404,7 +3405,7 @@ static ivas_error decodeVariableSpeed( } /* Print output metadata file name(s) */ - if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) + if ( arg.outputFormat == AUDIO_CONFIG_EXTERNAL ) { if ( bsFormat == IVAS_DEC_BS_OBJ ) { diff --git a/apps/renderer.c b/apps/renderer.c index 817b423383..ace8f4eb6d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -106,7 +106,7 @@ typedef struct } LfeRoutingConfig; typedef struct { - IVAS_REND_AudioConfig audioConfig; + IVAS_AUDIO_CONFIG audioConfig; int32_t inputChannelIndex; float gain_dB; } RendererInput; @@ -136,7 +136,7 @@ typedef struct typedef struct { - IVAS_REND_AudioConfig audioConfig; + IVAS_AUDIO_CONFIG audioConfig; IVAS_CUSTOM_LS_DATA outSetupCustom; } OutputConfig; @@ -365,7 +365,7 @@ static const CmdLnParser_Option cliOptions[] = { static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_Option ); -static IVAS_REND_AudioConfig ambisonicsOrderToEnum( const int16_t order ); +static IVAS_AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order ); static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs ); @@ -406,7 +406,7 @@ static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS static void printSupportedAudioConfigs( void ); -static IVAS_REND_AudioConfig parseAudioConfig( const char *configString ); +static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString ); static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -607,7 +607,7 @@ static void setupWithSingleFormatInput( else if ( args.inConfig.numBinBuses != 0 ) { *hhSplitRendFileReadWrite = NULL; - if ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( args.inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { ivas_error error; error = split_rend_reader_open( hhSplitRendFileReadWrite, args.inMetadataFilePaths[0] ); @@ -684,7 +684,7 @@ static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNEL return; } -static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) +static int16_t get_cldfb_in_flag( IVAS_AUDIO_CONFIG audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) { int16_t cldfb_in; cldfb_in = 0; @@ -693,7 +693,7 @@ static int16_t get_cldfb_in_flag( IVAS_REND_AudioConfig audioConfig, IVAS_RENDER #ifdef DEBUGGING cldfb_in = 1; #endif - if ( audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + if ( audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { cldfb_in = 1; } @@ -707,7 +707,7 @@ static int16_t is_split_post_rend_mode( CmdlnArgs *args ) int16_t flag; flag = 0; if ( ( args->inConfig.numBinBuses > 0 ) && - ( ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( args->inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) + ( ( args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( args->inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) ) { flag = 1; } @@ -719,8 +719,8 @@ static int16_t is_split_pre_rend_mode( CmdlnArgs *args ) { int16_t flag; flag = 0; - if ( ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( args->outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( ( args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( args->outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { flag = 1; } @@ -810,14 +810,14 @@ int main( CmdlnArgs args = parseCmdlnArgs( argc, argv ); - if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_MONO ) || - ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == IVAS_REND_AUDIO_CONFIG_OBJECT && args.inConfig.numAudioObjects == 1 ) ) ) + if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == AUDIO_CONFIG_MONO ) || + ( args.inConfig.numAudioObjects > 0 && args.inConfig.audioObjects[0].audioConfig == AUDIO_CONFIG_OBA && args.inConfig.numAudioObjects == 1 ) ) ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires mono or ISM1 input\n" ); exit( -1 ); } - if ( args.nonDiegeticPan && args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_STEREO ) + if ( args.nonDiegeticPan && args.outConfig.audioConfig != AUDIO_CONFIG_STEREO ) { fprintf( stderr, "\ninvalid configuration - non-diegetic panning requires stereo output\n" ); exit( -1 ); @@ -916,7 +916,7 @@ int main( } /* Check that there is allowed configuration for MASA format output */ - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 ) { if ( args.inConfig.numMasaBuses == 0 ) { @@ -935,7 +935,7 @@ int main( #ifdef SPLIT_REND_WITH_HEAD_ROT /*if split renderer is running in post renderer mode*/ - if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) + if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) { error = split_rend_reader_open( &hSplitRendFileReadWrite, args.inputFilePath ); if ( error != IVAS_ERR_OK ) @@ -1045,13 +1045,13 @@ int main( /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) ) + if ( ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) ) { fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split pre-rendering mode is enabled. Exiting. \n" ); exit( -1 ); } #else - if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + if ( ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { fprintf( stderr, "\nExternal Renderer Config is only supported for binaural output configurations. Exiting. \n" ); exit( -1 ); @@ -1075,7 +1075,7 @@ int main( exit( -1 ); } - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { renderConfig.room_acoustics.override = TRUE; } @@ -1104,7 +1104,7 @@ int main( } /* Set up output custom layout configuration */ - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( hIvasRend, args.outConfig.outSetupCustom ) ) != IVAS_ERR_OK ) { @@ -1113,7 +1113,7 @@ int main( } /* Set up MASA writer for MASA output */ - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 ) { MasaFileWriter_open( args.outputFilePath, true, &masaWriter ); /* No delay for audio in renderer, so calling metadata writer in delayCompensated mode, i.e., no delay applied to meta */ if ( masaWriter == NULL ) @@ -1158,7 +1158,7 @@ int main( exit( -1 ); } - if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( args.inConfig.multiChannelBuses[i].audioConfig == AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK ) { @@ -1225,7 +1225,7 @@ int main( for ( i = 0; i < args.inConfig.numAudioObjects; ++i ) { - if ( ( error = IVAS_REND_AddInput( hIvasRend, IVAS_REND_AUDIO_CONFIG_OBJECT, &ismIds[i] ) ) != IVAS_ERR_OK ) + if ( ( error = IVAS_REND_AddInput( hIvasRend, AUDIO_CONFIG_OBA, &ismIds[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); exit( -1 ); @@ -1238,7 +1238,7 @@ int main( } /* With MASA output, all objects are handled at once, so add only one input having all objects in it */ - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 ) { break; } @@ -1325,7 +1325,7 @@ int main( rend_openCldfb( cldfbAna, cldfbSyn, totalNumInChannels, numOutChannels, args.sampleRate ); } - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp ); @@ -1338,7 +1338,7 @@ int main( } else { - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { IVAS_REND_GetDelay( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ); error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp ); @@ -1624,7 +1624,7 @@ int main( for ( i = 0; i < args.inConfig.numAudioObjects; ++i ) { - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 ) { if ( i == 0 ) { @@ -1816,7 +1816,7 @@ int main( /* Write MASA metadata for MASA outputs */ - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == AUDIO_CONFIG_MASA2 ) { IVAS_REND_AudioConfigType inputType1; IVAS_REND_AudioConfigType inputType2; @@ -1917,7 +1917,7 @@ int main( #endif #ifdef FIX_488_SYNC_DELAY - if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); } @@ -2002,20 +2002,20 @@ int main( * Local functions *------------------------------------------------------------------------------------------*/ -static IVAS_REND_AudioConfig ambisonicsOrderToEnum( +static IVAS_AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order ) { switch ( order ) { case 1: - return IVAS_REND_AUDIO_CONFIG_FOA; + return AUDIO_CONFIG_FOA; case 2: - return IVAS_REND_AUDIO_CONFIG_HOA2; + return AUDIO_CONFIG_HOA2; case 3: - return IVAS_REND_AUDIO_CONFIG_HOA3; + return AUDIO_CONFIG_HOA3; } - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; + return AUDIO_CONFIG_INVALID; } static const CmdLnParser_Option *findOptionById( @@ -2060,47 +2060,47 @@ static bool parseInConfig( return true; } - /* Check for single-format inputs. The given string should map to a member of IVAS_REND_AudioConfig enum. */ - IVAS_REND_AudioConfig audioConfig = parseAudioConfig( inFormatStr ); + /* Check for single-format inputs. The given string should map to a member of IVAS_AUDIO_CONFIG enum. */ + IVAS_AUDIO_CONFIG audioConfig = parseAudioConfig( inFormatStr ); switch ( audioConfig ) { - case IVAS_REND_AUDIO_CONFIG_MONO: - case IVAS_REND_AUDIO_CONFIG_STEREO: - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: inConfig->numMultiChannelBuses = 1; inConfig->multiChannelBuses[0].audioConfig = audioConfig; inConfig->multiChannelBuses[0].inputChannelIndex = 0; inConfig->multiChannelBuses[0].gain_dB = 0.0f; break; - case IVAS_REND_AUDIO_CONFIG_FOA: - case IVAS_REND_AUDIO_CONFIG_HOA2: - case IVAS_REND_AUDIO_CONFIG_HOA3: + case AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA3: inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = 0; inConfig->ambisonicsBuses[0].gain_dB = 0.0f; break; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: inConfig->numBinBuses = 1; inConfig->binBuses[0].audioConfig = audioConfig; inConfig->binBuses[0].inputChannelIndex = 0; inConfig->binBuses[0].gain_dB = 0.0f; break; #endif - case IVAS_REND_AUDIO_CONFIG_MASA1: - case IVAS_REND_AUDIO_CONFIG_MASA2: + case AUDIO_CONFIG_MASA1: + case AUDIO_CONFIG_MASA2: inConfig->numMasaBuses = 1; inConfig->masaBuses[0].audioConfig = audioConfig; inConfig->masaBuses[0].inputChannelIndex = 0; inConfig->masaBuses[0].gain_dB = 0.0f; break; - case IVAS_REND_AUDIO_CONFIG_OBJECT: + case AUDIO_CONFIG_OBA: /* If input format is objects, parse the characters after "ISM" to get number of objects */ { char *ptr = NULL; @@ -2124,8 +2124,8 @@ static bool parseInConfig( } } break; - case IVAS_REND_AUDIO_CONFIG_UNKNOWN: - /* This case will be reached if parsing string to IVAS_REND_AudioConfig enum fails. + case AUDIO_CONFIG_INVALID: + /* This case will be reached if parsing string to IVAS_AUDIO_CONFIG enum fails. * Try to use the given string as a path to a custom loudspeaker layout file. */ { ivas_error error = parseCustomLayoutFile( inFormatStr, &inConfig->inSetupCustom ); @@ -2143,14 +2143,14 @@ static bool parseInConfig( return false; } inConfig->numMultiChannelBuses = 1; - inConfig->multiChannelBuses[0].audioConfig = IVAS_REND_AUDIO_CONFIG_LS_CUSTOM; + inConfig->multiChannelBuses[0].audioConfig = AUDIO_CONFIG_LS_CUSTOM; inConfig->multiChannelBuses[0].inputChannelIndex = 0; inConfig->multiChannelBuses[0].gain_dB = 0.0f; } break; default: { - /* Default case covers formats that are defined in the IVAS_REND_AudioConfig enum, + /* Default case covers formats that are defined in the IVAS_AUDIO_CONFIG enum, * but cannot be used at input, e.g. BINAURAL */ const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_listFormats ); fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match ); @@ -2170,9 +2170,9 @@ static bool parseOutConfig( outConfig->audioConfig = parseAudioConfig( outputFormatStr ); /* If the string provided is not recognized as a valid output config, * it's expected to be a path to a custom loudspeaker layout description file. */ - if ( outConfig->audioConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( outConfig->audioConfig == AUDIO_CONFIG_INVALID ) { - outConfig->audioConfig = IVAS_REND_AUDIO_CONFIG_LS_CUSTOM; + outConfig->audioConfig = AUDIO_CONFIG_LS_CUSTOM; if ( ( error = parseCustomLayoutFile( outputFormatStr, &outConfig->outSetupCustom ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error while parsing output format option\n" ); @@ -2249,7 +2249,7 @@ static bool parseOrientationTracking( return true; } -static IVAS_REND_AudioConfig parseAudioConfig( +static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString ) { #ifndef SPLIT_REND_WITH_HEAD_ROT @@ -2266,43 +2266,43 @@ static IVAS_REND_AudioConfig parseAudioConfig( if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_MONO; + return AUDIO_CONFIG_MONO; } if ( ( strcmp( charBuf, "STEREO" ) == 0 ) || ( strcmp( charBuf, "CICP2" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_STEREO; + return AUDIO_CONFIG_STEREO; } if ( ( strcmp( charBuf, "FOA" ) == 0 ) || ( strcmp( charBuf, "SBA1" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_FOA; + return AUDIO_CONFIG_FOA; } if ( ( strcmp( charBuf, "HOA2" ) == 0 ) || ( strcmp( charBuf, "SBA2" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_HOA2; + return AUDIO_CONFIG_HOA2; } if ( ( strcmp( charBuf, "HOA3" ) == 0 ) || ( strcmp( charBuf, "SBA3" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_HOA3; + return AUDIO_CONFIG_HOA3; } if ( ( strcmp( charBuf, "5_1" ) == 0 ) || ( strcmp( charBuf, "CICP6" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_5_1; + return AUDIO_CONFIG_5_1; } if ( ( strcmp( charBuf, "7_1" ) == 0 ) || ( strcmp( charBuf, "CICP12" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_7_1; + return AUDIO_CONFIG_7_1; } if ( ( strcmp( charBuf, "5_1_2" ) == 0 ) || ( strcmp( charBuf, "CICP14" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_5_1_2; + return AUDIO_CONFIG_5_1_2; } if ( ( strcmp( charBuf, "5_1_4" ) == 0 ) || ( strcmp( charBuf, "CICP16" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_5_1_4; + return AUDIO_CONFIG_5_1_4; } if ( ( strcmp( charBuf, "7_1_4" ) == 0 ) || ( strcmp( charBuf, "CICP19" ) == 0 ) ) { - return IVAS_REND_AUDIO_CONFIG_7_1_4; + return AUDIO_CONFIG_7_1_4; } if ( strncmp( charBuf, "ISM", 3 ) == 0 ) { @@ -2314,7 +2314,7 @@ static IVAS_REND_AudioConfig parseAudioConfig( case '2': case '3': case '4': - return IVAS_REND_AUDIO_CONFIG_OBJECT; + return AUDIO_CONFIG_OBA; } } if ( strncmp( charBuf, "MASA", 4 ) == 0 ) @@ -2324,36 +2324,36 @@ static IVAS_REND_AudioConfig parseAudioConfig( case '1': fprintf( stderr, "1TC MASA support is not functional and is pending on DirAC renderer refactoring.\n" ); exit( EXIT_FAILURE ); - /*return IVAS_REND_AUDIO_CONFIG_MASA1;*/ // ToDo: temporarily disabled to avoid compilation warnings + /*return AUDIO_CONFIG_MASA1;*/ // ToDo: temporarily disabled to avoid compilation warnings case '2': - return IVAS_REND_AUDIO_CONFIG_MASA2; + return AUDIO_CONFIG_MASA2; default: - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; + return AUDIO_CONFIG_INVALID; } } if ( strcmp( charBuf, "BINAURAL" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL; + return AUDIO_CONFIG_BINAURAL; } #ifdef SPLIT_REND_WITH_HEAD_ROT if ( strcmp( charBuf, "BINAURAL_SPLIT_PCM" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; + return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; } if ( strcmp( charBuf, "BINAURAL_SPLIT_CODED" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; + return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } #endif if ( strcmp( charBuf, "BINAURAL_ROOM_IR" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR; + return AUDIO_CONFIG_BINAURAL_ROOM_IR; } if ( strcmp( charBuf, "BINAURAL_ROOM_REVERB" ) == 0 ) { - return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB; + return AUDIO_CONFIG_BINAURAL_ROOM_REVERB; } - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; + return AUDIO_CONFIG_INVALID; } static bool parseLfePositionConfig( @@ -2441,7 +2441,7 @@ static bool checkRequiredArgs( fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort ); missingRequiredArg = true; } - if ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( args.outConfig.audioConfig == AUDIO_CONFIG_INVALID ) { tmpOption = findOptionById( CmdLnOptionId_outputFormat ); fprintf( stderr, "Missing required argument: %s (%s)\n", tmpOption->match, tmpOption->matchShort ); @@ -2472,7 +2472,7 @@ static CmdlnArgs defaultArgs( args.inConfig.numMultiChannelBuses = 0; args.inConfig.numMasaBuses = 0; - args.outConfig.audioConfig = IVAS_REND_AUDIO_CONFIG_UNKNOWN; + args.outConfig.audioConfig = AUDIO_CONFIG_INVALID; args.outConfig.outSetupCustom.num_spk = 0; args.outConfig.outSetupCustom.num_lfe = 0; @@ -3231,9 +3231,9 @@ static void parseMc( --inConfig->multiChannelBuses[idx].inputChannelIndex; /* Convert from 1-indexing */ readNextMetadataChunk( line, "\n" ); - IVAS_REND_AudioConfig cfg = parseAudioConfig( line ); + IVAS_AUDIO_CONFIG cfg = parseAudioConfig( line ); /* Try to use the given string as a path to a custom loudspeaker layout file. */ - if ( cfg == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( cfg == AUDIO_CONFIG_INVALID ) { ivas_error error = parseCustomLayoutFile( line, &inConfig->inSetupCustom ); @@ -3243,7 +3243,7 @@ static void parseMc( exit( -1 ); } inConfig->numMultiChannelBuses = 1; - inConfig->multiChannelBuses[idx].audioConfig = IVAS_REND_AUDIO_CONFIG_LS_CUSTOM; + inConfig->multiChannelBuses[idx].audioConfig = AUDIO_CONFIG_LS_CUSTOM; inConfig->multiChannelBuses[idx].inputChannelIndex = 0; inConfig->multiChannelBuses[idx].gain_dB = 0.0f; } diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 79bda1eaa6..1d722a0615 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -53,6 +53,41 @@ #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 +/*----------------------------------------------------------------------------------* + * Common API enum for output audio configurations + *----------------------------------------------------------------------------------*/ + +typedef enum _IVAS_AUDIO_CONFIG +{ + AUDIO_CONFIG_INVALID, + AUDIO_CONFIG_MONO, /* mono output */ + AUDIO_CONFIG_STEREO, /* stereo output */ + AUDIO_CONFIG_5_1, /* 5.1 speakers layout CICP6 */ + AUDIO_CONFIG_7_1, /* 7.1 speakers layout CICP12 */ + AUDIO_CONFIG_5_1_2, /* 5.1+2 speakers layout CICP14 */ + AUDIO_CONFIG_5_1_4, /* 5.1+4 speakers layout CICP16 */ + AUDIO_CONFIG_7_1_4, /* 7.1+4 speakers layout CICP19 */ + AUDIO_CONFIG_LS_CUSTOM, /* custom loudspeaker layout */ + AUDIO_CONFIG_FOA, /* ambisonics, order 1 */ + AUDIO_CONFIG_HOA2, /* ambisonics, order 2 */ + AUDIO_CONFIG_HOA3, /* ambisonics, order 3 */ + AUDIO_CONFIG_OBA, /* object based audio */ + AUDIO_CONFIG_BINAURAL, /* binaural with HRIR */ + AUDIO_CONFIG_BINAURAL_SPLIT_CODED, /* split binaural with CLDFB coded output */ + AUDIO_CONFIG_BINAURAL_SPLIT_PCM, /* split binaural with PCM coded output */ + AUDIO_CONFIG_BINAURAL_ROOM_IR, /* binaural with BRIR */ + AUDIO_CONFIG_BINAURAL_ROOM_REVERB, /* binaural with HRIR + reverb */ + AUDIO_CONFIG_ISM1, /* ISM1 */ + AUDIO_CONFIG_ISM2, /* ISM2 */ + AUDIO_CONFIG_ISM3, /* ISM3 */ + AUDIO_CONFIG_ISM4, /* ISM4 */ + AUDIO_CONFIG_MASA1, /* MASA1 */ + AUDIO_CONFIG_MASA2, /* MASA2 */ + AUDIO_CONFIG_EXTERNAL /* external renderer */ + +} IVAS_AUDIO_CONFIG; + + /*----------------------------------------------------------------------------------* * Common API structures *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 6d89e222ec..23c78ba0fd 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -90,37 +90,7 @@ typedef enum * IVAS output audio configurations *----------------------------------------------------------------------------------*/ -typedef enum -{ - AUDIO_CONFIG_INVALID, - AUDIO_CONFIG_MONO, /* mono output */ - AUDIO_CONFIG_STEREO, /* stereo output */ - AUDIO_CONFIG_5_1, /* 5.1 speakers layout CICP6 */ - AUDIO_CONFIG_7_1, /* 7.1 speakers layout CICP12 */ - AUDIO_CONFIG_5_1_2, /* 5.1+2 speakers layout CICP14 */ - AUDIO_CONFIG_5_1_4, /* 5.1+4 speakers layout CICP16 */ - AUDIO_CONFIG_7_1_4, /* 7.1+4 speakers layout CICP19 */ - AUDIO_CONFIG_LS_CUSTOM, /* custom loudspeaker layout */ - AUDIO_CONFIG_FOA, /* ambisonics, order 1 */ - AUDIO_CONFIG_HOA2, /* ambisonics, order 2 */ - AUDIO_CONFIG_HOA3, /* ambisonics, order 3 */ - AUDIO_CONFIG_OBA, /* object based audio */ - AUDIO_CONFIG_BINAURAL, /* binaural with HRIR */ -#ifdef SPLIT_REND_WITH_HEAD_ROT - AUDIO_CONFIG_BINAURAL_SPLIT_CODED, /* split binaural with CLDFB coded output */ - AUDIO_CONFIG_BINAURAL_SPLIT_PCM, /* split binaural with PCM coded output */ -#endif - AUDIO_CONFIG_BINAURAL_ROOM_IR, /* binaural with BRIR */ - AUDIO_CONFIG_BINAURAL_ROOM_REVERB, /* binaural with HRIR + reverb */ - AUDIO_CONFIG_ISM1, /* ISM1 */ - AUDIO_CONFIG_ISM2, /* ISM2 */ - AUDIO_CONFIG_ISM3, /* ISM3 */ - AUDIO_CONFIG_ISM4, /* ISM4 */ - AUDIO_CONFIG_MASA1, /* MASA1 */ // TODO: seems not to be used - AUDIO_CONFIG_MASA2, /* MASA2 */ // TODO: seems not to be used - AUDIO_CONFIG_EXTERNAL /* external renderer */ - -} AUDIO_CONFIG; +typedef enum _IVAS_AUDIO_CONFIG AUDIO_CONFIG; /* defined in common_api_types.h */ typedef enum { diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 0e95aa2af4..0ef74f10a4 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1040,8 +1040,8 @@ static void ivas_binaural_obtain_DMX( ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG inConfig, + const IVAS_AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index ee50dea27e..f6dcee8c1f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -293,185 +293,6 @@ void IVAS_DEC_Close( return; } -#ifdef SPLIT_REND_WITH_HEAD_ROT -/*---------------------------------------------------------------------* - * mapAudioConfig2DecAudioConfig() - * - * - *---------------------------------------------------------------------*/ - -static IVAS_DEC_AUDIO_CONFIG mapAudioConfig2DecAudioConfig( - const AUDIO_CONFIG audio_config ) -{ - IVAS_DEC_AUDIO_CONFIG dec_audio_config; - - if ( audio_config == AUDIO_CONFIG_EXTERNAL ) /* external renderer */ - { - dec_audio_config = IVAS_DEC_OUTPUT_EXT; - } - else if ( audio_config == AUDIO_CONFIG_MONO ) - { - dec_audio_config = IVAS_DEC_OUTPUT_MONO; - } - else if ( audio_config == AUDIO_CONFIG_STEREO ) - { - dec_audio_config = IVAS_DEC_OUTPUT_STEREO; - } - else if ( audio_config == AUDIO_CONFIG_5_1 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_5_1; - } - else if ( audio_config == AUDIO_CONFIG_7_1 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_7_1; - } - else if ( audio_config == AUDIO_CONFIG_5_1_2 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_5_1_2; - } - else if ( audio_config == AUDIO_CONFIG_5_1_4 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_5_1_4; - } - else if ( audio_config == AUDIO_CONFIG_7_1_4 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_7_1_4; - } - else if ( audio_config == AUDIO_CONFIG_LS_CUSTOM ) - { - dec_audio_config = IVAS_DEC_OUTPUT_LS_CUSTOM; - } - else if ( audio_config == AUDIO_CONFIG_FOA ) - { - dec_audio_config = IVAS_DEC_OUTPUT_FOA; - } - else if ( audio_config == AUDIO_CONFIG_HOA2 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_HOA2; - } - else if ( audio_config == AUDIO_CONFIG_HOA3 ) - { - dec_audio_config = IVAS_DEC_OUTPUT_HOA3; - } - else if ( audio_config == AUDIO_CONFIG_BINAURAL ) - { - dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL; - } - else if ( audio_config == AUDIO_CONFIG_BINAURAL_ROOM_IR ) - { - dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR; - } - else if ( audio_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - dec_audio_config = IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB; - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( audio_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) - { - dec_audio_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED; - } - else if ( audio_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - dec_audio_config = IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM; - } -#endif - else - { - dec_audio_config = IVAS_DEC_OUTPUT_UNKNOWN; - } - - return dec_audio_config; -} -#endif - -/*---------------------------------------------------------------------* - * mapOutputFormat() - * - * - *---------------------------------------------------------------------*/ - -static AUDIO_CONFIG mapOutputFormat( - const IVAS_DEC_AUDIO_CONFIG outputFormat ) -{ - AUDIO_CONFIG output_config; - - if ( outputFormat == IVAS_DEC_OUTPUT_EXT ) /* external renderer */ - { - output_config = AUDIO_CONFIG_EXTERNAL; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_MONO ) - { - output_config = AUDIO_CONFIG_MONO; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_STEREO ) - { - output_config = AUDIO_CONFIG_STEREO; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1 ) - { - output_config = AUDIO_CONFIG_5_1; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1 ) - { - output_config = AUDIO_CONFIG_7_1; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_2 ) - { - output_config = AUDIO_CONFIG_5_1_2; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_5_1_4 ) - { - output_config = AUDIO_CONFIG_5_1_4; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_7_1_4 ) - { - output_config = AUDIO_CONFIG_7_1_4; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_LS_CUSTOM ) - { - output_config = AUDIO_CONFIG_LS_CUSTOM; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_FOA ) - { - output_config = AUDIO_CONFIG_FOA; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA2 ) - { - output_config = AUDIO_CONFIG_HOA2; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_HOA3 ) - { - output_config = AUDIO_CONFIG_HOA3; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL ) - { - output_config = AUDIO_CONFIG_BINAURAL; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR ) - { - output_config = AUDIO_CONFIG_BINAURAL_ROOM_IR; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) - { - output_config = AUDIO_CONFIG_BINAURAL_ROOM_REVERB; - } -#ifdef SPLIT_REND_WITH_HEAD_ROT - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) - { - output_config = AUDIO_CONFIG_BINAURAL_SPLIT_CODED; - } - else if ( outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) - { - output_config = AUDIO_CONFIG_BINAURAL_SPLIT_PCM; - } -#endif - else - { - output_config = AUDIO_CONFIG_INVALID; - } - - return output_config; -} /*---------------------------------------------------------------------* @@ -519,7 +340,7 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const AUDIO_CONFIG outputFormat, /* i : output format */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -546,8 +367,8 @@ ivas_error IVAS_DEC_Configure( return IVAS_ERR_WRONG_PARAMS; } - if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputFormat == IVAS_DEC_OUTPUT_MONO && Opt_non_diegetic_pan == 0 ) || - ( outputFormat == IVAS_DEC_OUTPUT_STEREO && Opt_non_diegetic_pan == 1 ) ) ) + if ( hIvasDec->mode == IVAS_DEC_MODE_EVS && !( ( outputFormat == AUDIO_CONFIG_MONO && Opt_non_diegetic_pan == 0 ) || + ( outputFormat == AUDIO_CONFIG_STEREO && Opt_non_diegetic_pan == 1 ) ) ) { return IVAS_ERR_WRONG_MODE; } @@ -556,7 +377,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig = st_ivas->hDecoderConfig; - hDecoderConfig->output_config = mapOutputFormat( outputFormat ); + hDecoderConfig->output_config = outputFormat; if ( hDecoderConfig->output_config == AUDIO_CONFIG_INVALID ) { return IVAS_ERR_WRONG_PARAMS; @@ -570,7 +391,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->nchan_out = 1; } - if ( outputFormat != IVAS_DEC_OUTPUT_EXT && outputFormat != IVAS_DEC_OUTPUT_LS_CUSTOM ) + if ( outputFormat != AUDIO_CONFIG_EXTERNAL && outputFormat != AUDIO_CONFIG_LS_CUSTOM ) { hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); } @@ -3374,11 +3195,11 @@ ivas_error IVAS_DEC_VoIP_reconfigure( * *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetCldfbSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - float *out_real, /* o: buffer for decoded PCM real output in CLDFB domain */ - float *out_imag, /* o: buffer for decoded PCM imag output in CLDFB domain */ - IVAS_DEC_AUDIO_CONFIG *audio_config, - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */ + float *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */ + IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */ + int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ ) { Decoder_Struct *st_ivas; @@ -3396,7 +3217,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( num_samples = 0; if ( st_ivas->splitBinRend.hCldfbDataOut != NULL ) { - *audio_config = mapAudioConfig2DecAudioConfig( st_ivas->splitBinRend.hCldfbDataOut->config ); + *audio_config = st_ivas->splitBinRend.hCldfbDataOut->config; if ( st_ivas->splitBinRend.hCldfbDataOut->config != AUDIO_CONFIG_INVALID ) { num_chs = audioCfg2channels( st_ivas->splitBinRend.hCldfbDataOut->config ); @@ -3418,7 +3239,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( } else { - *audio_config = IVAS_DEC_OUTPUT_UNKNOWN; + *audio_config = AUDIO_CONFIG_INVALID; } *nOutSamples = num_samples; return error; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index ba6432bd30..d850977449 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -40,31 +40,6 @@ * Decoder enums *---------------------------------------------------------------------*/ -/* output formats generated by the decoder */ -typedef enum _IVAS_DEC_OUTPUT_CONFIG -{ - IVAS_DEC_OUTPUT_MONO = 0x0001, - IVAS_DEC_OUTPUT_STEREO, - IVAS_DEC_OUTPUT_5_1, - IVAS_DEC_OUTPUT_7_1, - IVAS_DEC_OUTPUT_5_1_2, - IVAS_DEC_OUTPUT_5_1_4, - IVAS_DEC_OUTPUT_7_1_4, - IVAS_DEC_OUTPUT_LS_CUSTOM, - IVAS_DEC_OUTPUT_FOA, - IVAS_DEC_OUTPUT_HOA2, - IVAS_DEC_OUTPUT_HOA3, - IVAS_DEC_OUTPUT_BINAURAL, -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED, - IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM, -#endif - IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR, - IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB, - IVAS_DEC_OUTPUT_EXT, - IVAS_DEC_OUTPUT_UNKNOWN = 0xffff -} IVAS_DEC_AUDIO_CONFIG; - /* mode the decoder is operating in */ typedef enum _IVAS_DEC_MODE { @@ -147,7 +122,7 @@ ivas_error IVAS_DEC_Open( ivas_error IVAS_DEC_Configure( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const IVAS_AUDIO_CONFIG outputFormat, /* i : audio configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -188,11 +163,11 @@ ivas_error IVAS_DEC_GetSamples( #ifdef SPLIT_REND_WITH_HEAD_ROT /*! r: decoder error code */ ivas_error IVAS_DEC_GetCldfbSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - float *out_real, /* o: buffer for decoded PCM real output in CLDFB domain */ - float *out_imag, /* o: buffer for decoded PCM imag output in CLDFB domain */ - IVAS_DEC_AUDIO_CONFIG *audio_config, - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */ + float *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */ + IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */ + int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ ); #endif diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index e333043560..c54e4d9b4c 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -165,8 +165,8 @@ static ivas_error ivas_rend_initCrend( IVAS_REND_AudioConfigType inConfigType; HRTFS_HANDLE hHrtf; ivas_error error; - IVAS_REND_AudioConfig inConfig; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG inConfig; + IVAS_AUDIO_CONFIG outConfig; inConfig = getRendAudioConfigFromIvasAudioConfig( inIvasConfig ); outConfig = getRendAudioConfigFromIvasAudioConfig( outIvasConfig ); @@ -180,9 +180,9 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } - if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + if ( outConfig != AUDIO_CONFIG_BINAURAL && outConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB #ifdef SPLIT_REND_WITH_HEAD_ROT - && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM + && outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -218,7 +218,7 @@ static ivas_error ivas_rend_initCrend( if ( output_Fs == 48000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_48kHz; @@ -233,7 +233,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j]; @@ -251,7 +251,7 @@ static ivas_error ivas_rend_initCrend( } else if ( output_Fs == 32000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_32kHz; @@ -266,7 +266,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j]; @@ -284,7 +284,7 @@ static ivas_error ivas_rend_initCrend( } else if ( output_Fs == 16000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_16kHz; @@ -299,7 +299,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j]; @@ -322,23 +322,23 @@ static ivas_error ivas_rend_initCrend( for ( i = 0; i < hHrtf->max_num_ir; i++ ) { - if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 ) + if ( inConfig == AUDIO_CONFIG_5_1 ) { tmp = channelIndex_CICP6[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) + else if ( inConfig == AUDIO_CONFIG_7_1 ) { tmp = channelIndex_CICP12[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 ) + else if ( inConfig == AUDIO_CONFIG_5_1_2 ) { tmp = channelIndex_CICP14[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) + else if ( inConfig == AUDIO_CONFIG_5_1_4 ) { tmp = channelIndex_CICP16[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_7_1_4 ) + else if ( inConfig == AUDIO_CONFIG_7_1_4 ) { tmp = channelIndex_CICP19[i]; } @@ -349,7 +349,7 @@ static ivas_error ivas_rend_initCrend( if ( output_Fs == 48000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[tmp]; } @@ -360,7 +360,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j]; @@ -378,7 +378,7 @@ static ivas_error ivas_rend_initCrend( } else if ( output_Fs == 32000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[tmp]; } @@ -389,7 +389,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j]; @@ -407,7 +407,7 @@ static ivas_error ivas_rend_initCrend( } else if ( output_Fs == 16000 ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[tmp]; } @@ -418,7 +418,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j]; @@ -442,7 +442,7 @@ static ivas_error ivas_rend_initCrend( } else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { - if ( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 ) + if ( inConfig == AUDIO_CONFIG_HOA3 ) { if ( output_Fs == 48000 ) { @@ -529,7 +529,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_HOA2 ) + else if ( inConfig == AUDIO_CONFIG_HOA2 ) { if ( output_Fs == 48000 ) { @@ -616,7 +616,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_FOA ) + else if ( inConfig == AUDIO_CONFIG_FOA ) { if ( output_Fs == 48000 ) { @@ -720,7 +720,7 @@ static ivas_error ivas_rend_initCrend( hHrtf->max_num_ir -= 1; /* subtract LFE */ hHrtf->gain_lfe = GAIN_LFE; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->latency_s = hSetOfHRTF->hHRTF_brir_combined->latency_s; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_brir_combined->max_num_iterations; @@ -735,7 +735,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max_diffuse[j]; @@ -753,23 +753,23 @@ static ivas_error ivas_rend_initCrend( for ( i = 0; i < hHrtf->max_num_ir; i++ ) { - if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 ) + if ( inConfig == AUDIO_CONFIG_5_1 ) { tmp = channelIndex_CICP6[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) + else if ( inConfig == AUDIO_CONFIG_7_1 ) { tmp = channelIndex_CICP12[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 ) + else if ( inConfig == AUDIO_CONFIG_5_1_2 ) { tmp = channelIndex_CICP14[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) + else if ( inConfig == AUDIO_CONFIG_5_1_4 ) { tmp = channelIndex_CICP16[i]; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_7_1_4 ) + else if ( inConfig == AUDIO_CONFIG_7_1_4 ) { tmp = channelIndex_CICP19[i]; } @@ -778,7 +778,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); } - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight[tmp]; } @@ -789,7 +789,7 @@ static ivas_error ivas_rend_initCrend( for ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max[tmp][j]; @@ -808,7 +808,7 @@ static ivas_error ivas_rend_initCrend( } else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { - if ( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 ) + if ( inConfig == AUDIO_CONFIG_HOA3 ) { hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa3->max_num_iterations; @@ -834,7 +834,7 @@ static ivas_error ivas_rend_initCrend( hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_im[j]; } } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_HOA2 ) + else if ( inConfig == AUDIO_CONFIG_HOA2 ) { hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa2->max_num_iterations; @@ -860,7 +860,7 @@ static ivas_error ivas_rend_initCrend( hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_im[j]; } } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_FOA ) + else if ( inConfig == AUDIO_CONFIG_FOA ) { hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_foa->latency_s; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_foa->max_num_iterations; @@ -982,8 +982,8 @@ ivas_error ivas_rend_initCrendWrapper( ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG inConfig, + const IVAS_AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { @@ -1270,8 +1270,8 @@ void ivas_rend_closeCrend( static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, - IVAS_REND_AudioConfig inConfig, - IVAS_REND_AudioConfig outConfig, + IVAS_AUDIO_CONFIG inConfig, + IVAS_AUDIO_CONFIG outConfig, float *pcm_in[], float *pcm_out[], const int32_t output_Fs, @@ -1315,7 +1315,7 @@ static ivas_error ivas_rend_crendConvolver( lfe_idx_in = -1; if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { lfe_idx_in = LFE_CHANNEL; } @@ -1464,8 +1464,8 @@ ivas_error ivas_rend_crendProcess( AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; - IVAS_REND_AudioConfig inRendConfig; - IVAS_REND_AudioConfig outRendConfig; + IVAS_AUDIO_CONFIG inRendConfig; + IVAS_AUDIO_CONFIG outRendConfig; CREND_HANDLE hCrend; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1603,8 +1603,8 @@ ivas_error ivas_rend_crendProcessSubframe( AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; - IVAS_REND_AudioConfig inRendConfig; - IVAS_REND_AudioConfig outRendConfig; + IVAS_AUDIO_CONFIG inRendConfig; + IVAS_AUDIO_CONFIG outRendConfig; int8_t combinedOrientationEnabled; combinedOrientationEnabled = 0; diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index b90b02ed14..b15e7ee495 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -84,7 +84,7 @@ static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_REND_AudioConfig inConfig, /* i : Input config */ + const IVAS_AUDIO_CONFIG inConfig, /* i : Input config */ int32_t input_Fs /* i : Sampling frequency */ ) { @@ -106,7 +106,7 @@ ivas_error ivas_mcmasa_ana_open( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for McMasa\n" ) ); } - if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 ) + if ( inConfig == AUDIO_CONFIG_5_1 ) { nchan_inp = 6; mvr2r( ls_azimuth_CICP6, ls_azimuth, nchan_inp - 1 ); @@ -114,7 +114,7 @@ ivas_error ivas_mcmasa_ana_open( hMcMasa->numHorizontalChannels = 5; hMcMasa->isHorizontalSetup = 1; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) + else if ( inConfig == AUDIO_CONFIG_7_1 ) { nchan_inp = 8; mvr2r( ls_azimuth_CICP12, ls_azimuth, nchan_inp - 1 ); @@ -122,7 +122,7 @@ ivas_error ivas_mcmasa_ana_open( hMcMasa->numHorizontalChannels = 7; hMcMasa->isHorizontalSetup = 1; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 ) + else if ( inConfig == AUDIO_CONFIG_5_1_2 ) { nchan_inp = 8; mvr2r( ls_azimuth_CICP14, ls_azimuth, nchan_inp - 1 ); @@ -130,7 +130,7 @@ ivas_error ivas_mcmasa_ana_open( hMcMasa->numHorizontalChannels = 5; hMcMasa->isHorizontalSetup = 0; } - else if ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) + else if ( inConfig == AUDIO_CONFIG_5_1_4 ) { nchan_inp = 10; mvr2r( ls_azimuth_CICP16, ls_azimuth, nchan_inp - 1 ); diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 3aa9e6d80b..4e2f4a6e44 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -633,7 +633,7 @@ void TDREND_Update_listener_orientation( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, - IVAS_REND_AudioConfig inConfig, + IVAS_AUDIO_CONFIG inConfig, RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) @@ -645,7 +645,7 @@ ivas_error ivas_td_binaural_open_ext( ivas_error error; float *directivity = NULL; - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_transport ) ) != IVAS_ERR_OK ) { @@ -665,7 +665,7 @@ ivas_error ivas_td_binaural_open_ext( hTransSetup.ls_elevation = NULL; #endif #ifdef TD_TDREND_FIX_NULLPTR_ACCESS - if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) { hTransSetup.ls_azimuth = customLsInput->ls_azimuth; hTransSetup.ls_elevation = customLsInput->ls_elevation; @@ -694,7 +694,7 @@ ivas_error ivas_td_binaural_open_ext( ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ + const IVAS_AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ @@ -739,7 +739,7 @@ ivas_error ivas_td_binaural_renderer_ext( { ivas_format = MC_FORMAT; transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 50b363f192..cf60ea0774 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -47,19 +47,21 @@ *----------------------------------------------------------------------------------*/ IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_REND_AudioConfig config + const IVAS_AUDIO_CONFIG config ); ivas_error getAudioConfigNumChannels( - const IVAS_REND_AudioConfig config, + const IVAS_AUDIO_CONFIG config, int16_t *numChannels ); AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig rendConfig ); + const IVAS_AUDIO_CONFIG rendConfig +); -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ); +IVAS_AUDIO_CONFIG getRendAudioConfigFromIvasAudioConfig( + const AUDIO_CONFIG config +); /*----------------------------------------------------------------------------------* @@ -577,9 +579,9 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ + const IVAS_AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ - const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ + const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ #ifdef FIX_488_SYNC_DELAY @@ -603,7 +605,7 @@ ivas_error ivas_td_binaural_open_unwrap( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t output_Fs @@ -857,8 +859,8 @@ ivas_error ivas_rend_initCrendWrapper( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG inConfig, + const IVAS_AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); @@ -874,13 +876,13 @@ void ivas_rend_CldfbMultiBinRendProcess( ivas_error ivas_rend_openCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const int32_t output_Fs ); ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG inConfig, + const IVAS_AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); @@ -1593,7 +1595,7 @@ void ivas_SplitRenderer_PostRenderer( ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_REND_AudioConfig inConfig, /* i : Input config */ + const IVAS_AUDIO_CONFIG inConfig, /* i : Input config */ int32_t input_Fs /* i : Sampling frequency */ ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8a023a1087..f7ffa55132 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -86,7 +86,7 @@ typedef float rotation_matrix[3][3]; typedef struct { EFAP_HANDLE hEfap; - IVAS_REND_AudioConfig speakerConfig; + IVAS_AUDIO_CONFIG speakerConfig; const LSSETUP_CUSTOM_STRUCT *pCustomLsSetup; /* Pointer to main custom LS struct from renderer handle - doesn't need freeing */ } EFAP_WRAPPER; @@ -100,7 +100,7 @@ typedef struct typedef struct { const int32_t *pOutSampleRate; - const IVAS_REND_AudioConfig *pOutConfig; + const IVAS_AUDIO_CONFIG *pOutConfig; const LSSETUP_CUSTOM_STRUCT *pCustomLsOut; const EFAP_WRAPPER *pEfapOutWrapper; const IVAS_REND_HeadRotData *pHeadRotData; @@ -121,7 +121,7 @@ typedef struct /* Common base for input structs */ typedef struct { - IVAS_REND_AudioConfig inConfig; + IVAS_AUDIO_CONFIG inConfig; IVAS_REND_InputId id; IVAS_REND_AudioBuffer inputBuffer; float gain; /* Linear, not in dB */ @@ -252,8 +252,8 @@ struct IVAS_REND #endif /* TODO @Philips - inputConfig should not be stored here, but read from e.g. input_mc->input_base.inConfig, please remove this */ - IVAS_REND_AudioConfig inputConfig; - IVAS_REND_AudioConfig outputConfig; + IVAS_AUDIO_CONFIG inputConfig; + IVAS_AUDIO_CONFIG outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -541,49 +541,49 @@ static int32_t limitRendererOutput( *-------------------------------------------------------------------*/ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig rendConfig ) + IVAS_AUDIO_CONFIG rendConfig ) { switch ( rendConfig ) { - case IVAS_REND_AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_MONO: return AUDIO_CONFIG_MONO; - case IVAS_REND_AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_STEREO: return AUDIO_CONFIG_STEREO; - case IVAS_REND_AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1: return AUDIO_CONFIG_5_1; - case IVAS_REND_AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_7_1: return AUDIO_CONFIG_7_1; - case IVAS_REND_AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_2: return AUDIO_CONFIG_5_1_2; - case IVAS_REND_AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_5_1_4: return AUDIO_CONFIG_5_1_4; - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_7_1_4: return AUDIO_CONFIG_7_1_4; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: return AUDIO_CONFIG_LS_CUSTOM; - case IVAS_REND_AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_FOA: return AUDIO_CONFIG_FOA; - case IVAS_REND_AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA2: return AUDIO_CONFIG_HOA2; - case IVAS_REND_AUDIO_CONFIG_HOA3: + case AUDIO_CONFIG_HOA3: return AUDIO_CONFIG_HOA3; - case IVAS_REND_AUDIO_CONFIG_OBJECT: + case AUDIO_CONFIG_OBA: return AUDIO_CONFIG_OBA; - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: return AUDIO_CONFIG_BINAURAL; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: return AUDIO_CONFIG_BINAURAL_ROOM_IR; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: return AUDIO_CONFIG_BINAURAL_ROOM_REVERB; - case IVAS_REND_AUDIO_CONFIG_MASA1: + case AUDIO_CONFIG_MASA1: return AUDIO_CONFIG_MASA1; - case IVAS_REND_AUDIO_CONFIG_MASA2: + case AUDIO_CONFIG_MASA2: return AUDIO_CONFIG_MASA2; default: break; @@ -598,47 +598,47 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( * *-------------------------------------------------------------------*/ -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ) +IVAS_AUDIO_CONFIG getRendAudioConfigFromIvasAudioConfig( + const AUDIO_CONFIG config ) { switch ( config ) { case AUDIO_CONFIG_MONO: - return IVAS_REND_AUDIO_CONFIG_MONO; + return AUDIO_CONFIG_MONO; case AUDIO_CONFIG_STEREO: - return IVAS_REND_AUDIO_CONFIG_STEREO; + return AUDIO_CONFIG_STEREO; case AUDIO_CONFIG_BINAURAL: - return IVAS_REND_AUDIO_CONFIG_BINAURAL; + return AUDIO_CONFIG_BINAURAL; #ifdef SPLIT_REND_WITH_HEAD_ROT case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; + return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; + return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif case AUDIO_CONFIG_BINAURAL_ROOM_IR: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR; + return AUDIO_CONFIG_BINAURAL_ROOM_IR; case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - return IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB; + return AUDIO_CONFIG_BINAURAL_ROOM_REVERB; case AUDIO_CONFIG_5_1: - return IVAS_REND_AUDIO_CONFIG_5_1; + return AUDIO_CONFIG_5_1; case AUDIO_CONFIG_7_1: - return IVAS_REND_AUDIO_CONFIG_7_1; + return AUDIO_CONFIG_7_1; case AUDIO_CONFIG_5_1_2: - return IVAS_REND_AUDIO_CONFIG_5_1_2; + return AUDIO_CONFIG_5_1_2; case AUDIO_CONFIG_5_1_4: - return IVAS_REND_AUDIO_CONFIG_5_1_4; + return AUDIO_CONFIG_5_1_4; case AUDIO_CONFIG_7_1_4: - return IVAS_REND_AUDIO_CONFIG_7_1_4; + return AUDIO_CONFIG_7_1_4; case AUDIO_CONFIG_FOA: - return IVAS_REND_AUDIO_CONFIG_FOA; + return AUDIO_CONFIG_FOA; case AUDIO_CONFIG_HOA2: - return IVAS_REND_AUDIO_CONFIG_HOA2; + return AUDIO_CONFIG_HOA2; case AUDIO_CONFIG_HOA3: - return IVAS_REND_AUDIO_CONFIG_HOA3; + return AUDIO_CONFIG_HOA3; default: break; } - return IVAS_REND_AUDIO_CONFIG_UNKNOWN; + return AUDIO_CONFIG_INVALID; } /*-------------------------------------------------------------------* @@ -648,28 +648,28 @@ IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( *-------------------------------------------------------------------*/ static ivas_error validateOutputAudioConfig( - IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_MONO: - case IVAS_REND_AUDIO_CONFIG_STEREO: - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1_4: - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: - case IVAS_REND_AUDIO_CONFIG_FOA: - case IVAS_REND_AUDIO_CONFIG_HOA2: - case IVAS_REND_AUDIO_CONFIG_HOA3: - case IVAS_REND_AUDIO_CONFIG_BINAURAL: -#ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: -#endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA3: + case AUDIO_CONFIG_BINAURAL: +#ifdef SPLIT_REND_WITH_HEAD_ROT + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: +#endif + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: return IVAS_ERR_OK; default: break; @@ -686,10 +686,46 @@ static ivas_error validateOutputAudioConfig( *-------------------------------------------------------------------*/ IVAS_REND_AudioConfigType getAudioConfigType( - IVAS_REND_AudioConfig config ) + const IVAS_AUDIO_CONFIG config ) { - /* By definition, config type is the second byte (from LSB) of IVAS_REND_AudioConfig enum. */ - return ( config & 0xFF00 ) >> 8; + IVAS_REND_AudioConfigType type; + + type = IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN; + + switch ( config ) + { + case AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_LS_CUSTOM: + type = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED; + break; + case AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA3: + type = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS; + break; + case AUDIO_CONFIG_OBA: + type = IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED; + break; + case AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + type = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL; + break; + case AUDIO_CONFIG_MASA1: + case AUDIO_CONFIG_MASA2: + type = IVAS_REND_AUDIO_CONFIG_TYPE_MASA; + break; + } + + return type; } @@ -701,7 +737,7 @@ IVAS_REND_AudioConfigType getAudioConfigType( static ivas_error validateOutputSampleRate( const int32_t sampleRate, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { @@ -730,47 +766,47 @@ static ivas_error validateOutputSampleRate( *-------------------------------------------------------------------*/ ivas_error getAudioConfigNumChannels( - const IVAS_REND_AudioConfig config, + const IVAS_AUDIO_CONFIG config, int16_t *numChannels ) { switch ( config ) { - case IVAS_REND_AUDIO_CONFIG_MONO: - case IVAS_REND_AUDIO_CONFIG_OBJECT: - case IVAS_REND_AUDIO_CONFIG_MASA1: + case AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_OBA: + case AUDIO_CONFIG_MASA1: *numChannels = 1; break; - case IVAS_REND_AUDIO_CONFIG_STEREO: - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - case IVAS_REND_AUDIO_CONFIG_MASA2: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_MASA2: *numChannels = 2; break; - case IVAS_REND_AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_FOA: *numChannels = 4; break; - case IVAS_REND_AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1: *numChannels = 6; break; - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: *numChannels = 8; break; - case IVAS_REND_AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA2: *numChannels = 9; break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_5_1_4: *numChannels = 10; break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_7_1_4: *numChannels = 12; break; - case IVAS_REND_AUDIO_CONFIG_HOA3: + case AUDIO_CONFIG_HOA3: *numChannels = 16; break; default: @@ -832,30 +868,30 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( } static ivas_error getSpeakerAzimuths( - IVAS_REND_AudioConfig config, + IVAS_AUDIO_CONFIG config, const float **azimuths ) { switch ( config ) { - case IVAS_REND_AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_MONO: *azimuths = ls_azimuth_CICP1; break; - case IVAS_REND_AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_STEREO: *azimuths = ls_azimuth_CICP2; break; - case IVAS_REND_AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1: *azimuths = ls_azimuth_CICP6; break; - case IVAS_REND_AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_7_1: *azimuths = ls_azimuth_CICP12; break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_2: *azimuths = ls_azimuth_CICP14; break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_5_1_4: *azimuths = ls_azimuth_CICP16; break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_7_1_4: *azimuths = ls_azimuth_CICP19; break; default: @@ -866,30 +902,30 @@ static ivas_error getSpeakerAzimuths( } static ivas_error getSpeakerElevations( - IVAS_REND_AudioConfig config, + IVAS_AUDIO_CONFIG config, const float **elevations ) { switch ( config ) { - case IVAS_REND_AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_MONO: *elevations = ls_elevation_CICP1; break; - case IVAS_REND_AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_STEREO: *elevations = ls_elevation_CICP2; break; - case IVAS_REND_AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1: *elevations = ls_elevation_CICP6; break; - case IVAS_REND_AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_7_1: *elevations = ls_elevation_CICP12; break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_2: *elevations = ls_elevation_CICP14; break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_5_1_4: *elevations = ls_elevation_CICP16; break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_7_1_4: *elevations = ls_elevation_CICP19; break; default: @@ -900,18 +936,18 @@ static ivas_error getSpeakerElevations( } static ivas_error getAmbisonicsOrder( - IVAS_REND_AudioConfig config, + IVAS_AUDIO_CONFIG config, int16_t *order ) { switch ( config ) { - case IVAS_REND_AUDIO_CONFIG_FOA: + case AUDIO_CONFIG_FOA: *order = 1; break; - case IVAS_REND_AUDIO_CONFIG_HOA2: + case AUDIO_CONFIG_HOA2: *order = 2; break; - case IVAS_REND_AUDIO_CONFIG_HOA3: + case AUDIO_CONFIG_HOA3: *order = 3; break; default: @@ -926,13 +962,13 @@ static int16_t getNumLfeChannels( { switch ( inputMc->base.inConfig ) { - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: return 1; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: return inputMc->customLsInput.num_lfe; default: break; @@ -942,28 +978,28 @@ static int16_t getNumLfeChannels( } static ivas_error getNumNonLfeChannelsInSpeakerLayout( - IVAS_REND_AudioConfig config, + IVAS_AUDIO_CONFIG config, int16_t *numNonLfeChannels ) { switch ( config ) { - case IVAS_REND_AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_MONO: *numNonLfeChannels = 1; break; - case IVAS_REND_AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_STEREO: *numNonLfeChannels = 2; break; - case IVAS_REND_AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1: *numNonLfeChannels = 5; break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_7_1: *numNonLfeChannels = 7; break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_5_1_4: *numNonLfeChannels = 9; break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_7_1_4: *numNonLfeChannels = 11; break; default: @@ -974,7 +1010,7 @@ static ivas_error getNumNonLfeChannelsInSpeakerLayout( } static ivas_error getMcConfigValues( - IVAS_REND_AudioConfig inConfig, + IVAS_AUDIO_CONFIG inConfig, LSSETUP_CUSTOM_STRUCT inCustomLs, const float **azimuth, const float **elevation, @@ -987,7 +1023,7 @@ static ivas_error getMcConfigValues( *is_planar = 1; switch ( inConfig ) { - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: *azimuth = (const float *) &inCustomLs.ls_azimuth; *elevation = (const float *) &inCustomLs.ls_elevation; if ( inCustomLs.num_lfe > 0 ) @@ -1003,20 +1039,20 @@ static ivas_error getMcConfigValues( } } break; - case IVAS_REND_AUDIO_CONFIG_MONO: - case IVAS_REND_AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_STEREO: getSpeakerAzimuths( inConfig, azimuth ); getSpeakerElevations( inConfig, elevation ); break; - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: getSpeakerAzimuths( inConfig, azimuth ); getSpeakerElevations( inConfig, elevation ); *lfe_idx = LFE_CHANNEL; - *is_planar = ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ? 1 : 0; + *is_planar = ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) ? 1 : 0; break; default: assert( !"Invalid speaker config" ); @@ -1028,7 +1064,7 @@ static ivas_error getMcConfigValues( static ivas_error initEfap( EFAP_WRAPPER *pEfapWrapper, - IVAS_REND_AudioConfig outConfig, + IVAS_AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) { ivas_error error; @@ -1036,9 +1072,9 @@ static ivas_error initEfap( const float *elevations; int16_t numNonLfeChannels; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - pEfapWrapper->speakerConfig = IVAS_REND_AUDIO_CONFIG_7_1_4; + pEfapWrapper->speakerConfig = AUDIO_CONFIG_7_1_4; } else { @@ -1059,7 +1095,7 @@ static ivas_error initEfap( return IVAS_ERR_OK; } - if ( outConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( outConfig == AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = efap_init_data( &pEfapWrapper->hEfap, pCustomLsOut->ls_azimuth, pCustomLsOut->ls_elevation, pCustomLsOut->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { @@ -1109,7 +1145,7 @@ static ivas_error getEfapGains( efap_determine_gains( efapWrapper.hEfap, tmpPanGains, azi, ele, EFAP_MODE_EFAP ); /* Now copy to buffer that includes LFE channels */ - if ( efapWrapper.speakerConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( efapWrapper.speakerConfig == AUDIO_CONFIG_LS_CUSTOM ) { numChannels = efapWrapper.pCustomLsSetup->num_spk + efapWrapper.pCustomLsSetup->num_lfe; readPtr = tmpPanGains; @@ -1238,7 +1274,7 @@ static void initRotGains( static void initRendInputBase( input_base *inputBase, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, const rendering_context rendCtx, float *dataBuf, @@ -1332,11 +1368,11 @@ static CREND_WRAPPER defaultCrendWrapper( } static bool isIoConfigPairSupported( - IVAS_REND_AudioConfig inConfig, - IVAS_REND_AudioConfig outConfig ) + IVAS_AUDIO_CONFIG inConfig, + IVAS_AUDIO_CONFIG outConfig ) { /* Rendering mono or stereo to binaural is not supported */ - if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) && + if ( ( inConfig == AUDIO_CONFIG_MONO || inConfig == AUDIO_CONFIG_STEREO ) && getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { return false; @@ -1375,13 +1411,13 @@ static ivas_error initIsmMasaRendering( static ivas_error setRendInputActiveIsm( void *input, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG outConfig; input_ism *inputIsm; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; @@ -1419,9 +1455,9 @@ static ivas_error setRendInputActiveIsm( error = IVAS_ERR_OK; #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == AUDIO_CONFIG_BINAURAL || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) #else - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) #endif { #ifndef SPLIT_REND_WITH_HEAD_ROT @@ -1437,7 +1473,7 @@ static ivas_error setRendInputActiveIsm( } #endif } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + else if ( outConfig == AUDIO_CONFIG_MASA1 || outConfig == AUDIO_CONFIG_MASA2 ) { if ( ( error = initIsmMasaRendering( inputIsm, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { @@ -1451,7 +1487,7 @@ static ivas_error setRendInputActiveIsm( { return error; } - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { @@ -1463,7 +1499,7 @@ static ivas_error setRendInputActiveIsm( { return error; } - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) @@ -1471,7 +1507,7 @@ static ivas_error setRendInputActiveIsm( return error; } } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + else if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, *rendCtx.pOutSampleRate @@ -1502,7 +1538,7 @@ static void clearInputIsm( rendCtx = inputIsm->base.ctx; freeInputBaseBufferData( &inputIsm->base.inputBuffer.data ); - initRendInputBase( &inputIsm->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + initRendInputBase( &inputIsm->base, AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -1595,7 +1631,7 @@ static ivas_error initMcPanGainsWithIdentMatrix( static ivas_error initMcPanGainsWithConversionMapping( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { AUDIO_CONFIG ivasConfigIn, ivasConfigOut; int16_t i; @@ -1629,7 +1665,7 @@ static ivas_error initMcPanGainsWithConversionMapping( static ivas_error initMcPanGainsWithEfap( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { int16_t i; int16_t numNonLfeInChannels; @@ -1637,7 +1673,7 @@ static ivas_error initMcPanGainsWithEfap( const float *spkAzi, *spkEle; ivas_error error; - if ( inputMc->base.inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inputMc->base.inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) { @@ -1681,7 +1717,7 @@ static ivas_error initMcPanGainsWithEfap( } } - if ( outConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) + if ( outConfig != AUDIO_CONFIG_LS_CUSTOM && inLfeChIdx >= 0 ) { inputMc->panGains[inLfeChIdx][LFE_CHANNEL] = 1; } @@ -1708,7 +1744,7 @@ static ivas_error getRendInputNumChannels( pInputBase = (const input_base *) rendInput; - if ( pInputBase->inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( pInputBase->inConfig == AUDIO_CONFIG_LS_CUSTOM ) { pInputMc = (const input_mc *) rendInput; *numInChannels = pInputMc->customLsInput.num_spk + pInputMc->customLsInput.num_lfe; @@ -1739,7 +1775,7 @@ static ivas_error initMcPanGainsWithMonoOut( return error; } - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_LS_CUSTOM ) { for ( i = 0; i < numInChannels; ++i ) { @@ -1748,7 +1784,7 @@ static ivas_error initMcPanGainsWithMonoOut( inputMc->panGains[i][0] = 1.f; } } - else if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) + else if ( inputMc->base.inConfig == AUDIO_CONFIG_STEREO ) { /* Special case for STEREO to MONO: Passive downmix (L+R)/2 */ inputMc->panGains[0][0] = 0.5; @@ -1759,7 +1795,7 @@ static ivas_error initMcPanGainsWithMonoOut( /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == AUDIO_CONFIG_5_1_4 ) { skipSideSpeakers = true; } @@ -1789,7 +1825,7 @@ static ivas_error initMcPanGainsWithStereoLookup( /* Special case - MONO input. * Use gains for center CICP speaker and return early. */ - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_MONO ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_MONO ) { inputMc->panGains[0][0] = ls_conversion_cicpX_stereo[2][0]; inputMc->panGains[0][1] = ls_conversion_cicpX_stereo[2][1]; @@ -1799,7 +1835,7 @@ static ivas_error initMcPanGainsWithStereoLookup( /* ls_conversion_cicpX_stereo contains gains for side speakers. * These should be skipped with 5.1+X inputs. */ skipSideSpeakers = false; - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_5_1_4 ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_5_1_2 || inputMc->base.inConfig == AUDIO_CONFIG_5_1_4 ) { skipSideSpeakers = true; } @@ -1827,15 +1863,15 @@ static ivas_error initMcPanGainsWithStereoLookup( /* Returns 1 (true) if configs A and B are equal, otherwise returns 0 (false). * If both configs are custom LS layouts, layout details are compared to determine equality. */ static bool configsAreEqual( - const IVAS_REND_AudioConfig configA, + const IVAS_AUDIO_CONFIG configA, const LSSETUP_CUSTOM_STRUCT customLsA, - const IVAS_REND_AudioConfig configB, + const IVAS_AUDIO_CONFIG configB, const LSSETUP_CUSTOM_STRUCT customLsB ) { int16_t i; /* Both input and output are custom LS - compare structs */ - if ( configA == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && configB == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( configA == AUDIO_CONFIG_LS_CUSTOM && configB == AUDIO_CONFIG_LS_CUSTOM ) { if ( customLsA.num_spk != customLsB.num_spk ) { @@ -1878,7 +1914,7 @@ static bool configsAreEqual( static ivas_error updateLfePanGainsForMcOut( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { int16_t i, numLfeIn, numOutChannels; ivas_error error; @@ -1892,7 +1928,7 @@ static ivas_error updateLfePanGainsForMcOut( numLfeIn = getNumLfeChannels( inputMc ); - if ( outConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( outConfig == AUDIO_CONFIG_LS_CUSTOM ) { numOutChannels = inputMc->base.ctx.pCustomLsOut->num_spk + inputMc->base.ctx.pCustomLsOut->num_lfe; } @@ -1927,7 +1963,7 @@ static ivas_error updateLfePanGainsForMcOut( static ivas_error updateLfePanGainsForAmbiOut( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { int16_t i; int16_t numLfeIn, outAmbiOrder; @@ -1967,7 +2003,7 @@ static ivas_error updateLfePanGainsForAmbiOut( static ivas_error updateMcPanGainsForMcOut( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; @@ -1987,11 +2023,11 @@ static ivas_error updateMcPanGainsForMcOut( { error = initMcPanGainsWithIdentMatrix( inputMc ); } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM || - inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_MONO || - inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + else if ( outConfig == AUDIO_CONFIG_LS_CUSTOM || + inputMc->base.inConfig == AUDIO_CONFIG_MONO || + inputMc->base.inConfig == AUDIO_CONFIG_LS_CUSTOM ) { - if ( ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) + if ( ( inputMc->base.inConfig == AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) ) { inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f; inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0]; @@ -2002,11 +2038,11 @@ static ivas_error updateMcPanGainsForMcOut( error = initMcPanGainsWithEfap( inputMc, outConfig ); } } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_MONO ) + else if ( outConfig == AUDIO_CONFIG_MONO ) { error = initMcPanGainsWithMonoOut( inputMc ); } - else if ( outConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) + else if ( outConfig == AUDIO_CONFIG_STEREO ) { error = initMcPanGainsWithStereoLookup( inputMc ); } @@ -2029,7 +2065,7 @@ static ivas_error updateMcPanGainsForMcOut( static ivas_error updateMcPanGainsForAmbiOut( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { int16_t ch_in, ch_out, lfeIdx; int16_t numNonLfeInChannels, outAmbiOrder; @@ -2041,7 +2077,7 @@ static ivas_error updateMcPanGainsForAmbiOut( return error; } - if ( inputMc->base.inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inputMc->base.inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getNumNonLfeChannelsInSpeakerLayout( inputMc->base.inConfig, &numNonLfeInChannels ) ) != IVAS_ERR_OK ) { @@ -2099,7 +2135,7 @@ static ivas_error updateMcPanGainsForAmbiOut( static ivas_error updateMcPanGains( input_mc *inputMc, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { int16_t i; ivas_error error; @@ -2119,16 +2155,16 @@ static ivas_error updateMcPanGains( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: #endif break; /* Do nothing */ - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: /* Prepare rendering to intermediate format */ - error = updateMcPanGainsForMcOut( inputMc, IVAS_REND_AUDIO_CONFIG_7_1_4 ); + error = updateMcPanGainsForMcOut( inputMc, AUDIO_CONFIG_7_1_4 ); break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -2146,7 +2182,7 @@ static ivas_error updateMcPanGains( } /* Copy LFE routing to pan gains array */ - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_LS_CUSTOM ) { for ( i = 0; i < inputMc->customLsInput.num_lfe; ++i ) { @@ -2165,8 +2201,8 @@ static ivas_error updateMcPanGains( static ivas_error initMcBinauralRendering( input_mc *inputMc, - const IVAS_REND_AudioConfig inConfig, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG inConfig, + const IVAS_AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; @@ -2217,16 +2253,16 @@ static ivas_error initMcBinauralRendering( // initTDRend = false; //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG // if ( ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && - // ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + // ( outConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( outConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) //#else // if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) //#endif // { - // if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + // if ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) // { // initTDRend = true; // } - // else if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) && + // else if ( ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) && // ( inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) // { // initTDRend = true; @@ -2242,7 +2278,7 @@ static ivas_error initMcBinauralRendering( } #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { /* Open TD renderer wrappers */ for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -2262,7 +2298,7 @@ static ivas_error initMcBinauralRendering( } #endif - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -2272,11 +2308,11 @@ static ivas_error initMcBinauralRendering( } { - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, NULL, outSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , - ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 + ( ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 #endif ) ) != IVAS_ERR_OK ) { @@ -2285,7 +2321,7 @@ static ivas_error initMcBinauralRendering( } /* Initialise the EFAP handle for rotation on input layout */ - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) { if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) { @@ -2310,7 +2346,7 @@ static ivas_error initMcBinauralRendering( static ivas_error initMcMasaRendering( input_mc *inputMc, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, int32_t inSampleRate ) { ivas_error error; @@ -2341,9 +2377,9 @@ static ivas_error initMcMasaRendering( } static lfe_routing defaultLfeRouting( - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const LSSETUP_CUSTOM_STRUCT customLsIn, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT customLsOut ) { int16_t i; @@ -2361,14 +2397,14 @@ static lfe_routing defaultLfeRouting( switch ( inConfig ) { - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_7_1_4: routing.numLfeChannels = 1; break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: routing.numLfeChannels = customLsIn.num_lfe; break; default: @@ -2377,14 +2413,14 @@ static lfe_routing defaultLfeRouting( switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_7_1_4: routing.lfePanMtx[0][LFE_CHANNEL] = 1.0f; break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: for ( i = 0; i < routing.numLfeChannels && i < customLsOut.num_lfe; ++i ) { routing.lfePanMtx[i][customLsOut.lfe_idx[i]] = 1.0f; @@ -2400,7 +2436,7 @@ static lfe_routing defaultLfeRouting( static ivas_error setRendInputActiveMc( void *input, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { @@ -2409,7 +2445,7 @@ static ivas_error setRendInputActiveMc( #endif ivas_error error; rendering_context rendCtx; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG outConfig; input_mc *inputMc; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; @@ -2464,7 +2500,7 @@ static ivas_error setRendInputActiveMc( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL || outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) @@ -2473,7 +2509,7 @@ static ivas_error setRendInputActiveMc( } } - if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( outConfig == AUDIO_CONFIG_MASA1 || outConfig == AUDIO_CONFIG_MASA2 ) { if ( ( error = initMcMasaRendering( inputMc, inConfig, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { @@ -2503,7 +2539,7 @@ static void clearInputMc( freeMcLfeDelayBuffer( &inputMc->lfeDelayBuffer ); #endif freeInputBaseBufferData( &inputMc->bufferData ); - initRendInputBase( &inputMc->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + initRendInputBase( &inputMc->base, AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -2545,7 +2581,7 @@ static void clearInputMc( static ivas_error initSbaPanGainsForMcOut( input_sba *inputSba, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) { int16_t ambiOrderIn; @@ -2567,20 +2603,20 @@ static ivas_error initSbaPanGainsForMcOut( switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_MONO: + case AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); break; - case IVAS_REND_AUDIO_CONFIG_STEREO: - case IVAS_REND_AUDIO_CONFIG_5_1: - case IVAS_REND_AUDIO_CONFIG_7_1: - case IVAS_REND_AUDIO_CONFIG_5_1_2: - case IVAS_REND_AUDIO_CONFIG_5_1_4: - case IVAS_REND_AUDIO_CONFIG_7_1_4: + case AUDIO_CONFIG_STEREO: + case AUDIO_CONFIG_5_1: + case AUDIO_CONFIG_7_1: + case AUDIO_CONFIG_5_1_2: + case AUDIO_CONFIG_5_1_4: + case AUDIO_CONFIG_7_1_4: ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); break; default: @@ -2615,7 +2651,7 @@ static ivas_error initSbaPanGainsForMcOut( static ivas_error initSbaPanGainsForSbaOut( input_sba *inputSba, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; error = IVAS_ERR_OK; @@ -2635,7 +2671,7 @@ static ivas_error initSbaPanGainsForSbaOut( static ivas_error updateSplitPostRendPanGains( input_split_post_rend *inputSplitPostRend, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; @@ -2663,11 +2699,11 @@ updateSplitPostRendPanGains( static ivas_error updateSbaPanGains( input_sba *inputSba, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; - IVAS_REND_AudioConfig inConfig; + IVAS_AUDIO_CONFIG inConfig; rendering_context rendCtx; /* Reset to all zeros - some functions below only write non-zero elements. */ @@ -2688,13 +2724,13 @@ static ivas_error updateSbaPanGains( switch ( outConfig ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: { if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { - assert( inConfig == IVAS_REND_AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); + assert( inConfig == AUDIO_CONFIG_HOA3 && ( *rendCtx.pOutSampleRate == 48000 ) && "split binaural fast conv mode is currently supported with HOA3 input and 48k sampling rate only" ); error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ); @@ -2718,7 +2754,7 @@ static ivas_error updateSbaPanGains( break; } #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { @@ -2746,9 +2782,9 @@ static ivas_error updateSbaPanGains( ); } break; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_REND_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + if ( ( error = initSbaPanGainsForMcOut( inputSba, AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) { return error; } @@ -2787,13 +2823,13 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error setRendInputActiveSplitPostRend( void *input, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG outConfig; input_split_post_rend *inputSplitPostRend; inputSplitPostRend = (input_split_post_rend *) input; @@ -2838,13 +2874,13 @@ static ivas_error initSbaMasaRendering( static ivas_error setRendInputActiveSba( void *input, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG outConfig; input_sba *inputSba; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; @@ -2885,7 +2921,7 @@ static ivas_error setRendInputActiveSba( initRotGains( inputSba->rot_gains_prev ); #endif /* SPLIT_REND_WITH_HEAD_ROT */ - if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( outConfig == AUDIO_CONFIG_MASA1 || outConfig == AUDIO_CONFIG_MASA2 ) { if ( ( error = initSbaMasaRendering( inputSba, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { @@ -2910,7 +2946,7 @@ static void clearInputSplitRend( rendCtx = inputSplitRend->base.ctx; freeInputBaseBufferData( &inputSplitRend->bufferData ); - initRendInputBase( &inputSplitRend->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + initRendInputBase( &inputSplitRend->base, AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); if ( inputSplitRend->splitPostRendWrapper.hBinHrSplitPostRend != NULL ) { @@ -2937,7 +2973,7 @@ static void clearInputSba( rendCtx = inputSba->base.ctx; freeInputBaseBufferData( &inputSba->bufferData ); - initRendInputBase( &inputSba->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + initRendInputBase( &inputSba->base, AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ @@ -2958,7 +2994,7 @@ static void clearInputSba( static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; int16_t numCldfbAnalyses; @@ -3041,7 +3077,7 @@ static ivas_error initMasaDummyDecForMcOut( static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; int16_t numCldfbAnalyses; @@ -3111,7 +3147,7 @@ static ivas_error initMasaDummyDecForSbaOut( static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; @@ -3186,7 +3222,7 @@ static ivas_error initMasaDummyDecForBinauralOut( static ivas_error updateMasaDummyDec( input_masa *inputMasa, - const IVAS_REND_AudioConfig outConfig ) + const IVAS_AUDIO_CONFIG outConfig ) { ivas_error error; @@ -3211,7 +3247,7 @@ static ivas_error updateMasaDummyDec( static DecoderDummy *initDecoderDummy( const int32_t sampleRate, const int16_t numTransChannels, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const uint8_t enableRenderConfig #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -3244,8 +3280,8 @@ static DecoderDummy *initDecoderDummy( ivas_init_split_rend_handles( &decDummy->splitBinRend.splitrend ); decDummy->splitBinRend.splitrend = *pSplitRendWrapper; #ifdef FIX_658_SPLIT_REND_MASA - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || - outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || + outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) #else if ( decDummy->splitBinRend.splitrend.multiBinPoseData.num_poses > 1 ) #endif @@ -3347,13 +3383,13 @@ static DecoderDummy *initDecoderDummy( static ivas_error setRendInputActiveMasa( void *input, - const IVAS_REND_AudioConfig inConfig, + const IVAS_AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */ { ivas_error error; rendering_context rendCtx; - IVAS_REND_AudioConfig outConfig; + IVAS_AUDIO_CONFIG outConfig; input_masa *inputMasa; int16_t numInChannels; @@ -3381,7 +3417,7 @@ static ivas_error setRendInputActiveMasa( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inputMasa->metadataHasBeenFed = false; - if ( ( error = masaPrerendOpen( &inputMasa->hMasaPrerend, inputMasa->base.inConfig == IVAS_REND_AUDIO_CONFIG_MASA1 ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = masaPrerendOpen( &inputMasa->hMasaPrerend, inputMasa->base.inConfig == AUDIO_CONFIG_MASA1 ? 1 : 2, *( inputMasa->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) { return error; } @@ -3513,7 +3549,7 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); masaPrerendClose( &inputMasa->hMasaPrerend ); - initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx, + initRendInputBase( &inputMasa->base, AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); freeDecoderDummy( &inputMasa->decDummy ); @@ -3521,12 +3557,12 @@ static void clearInputMasa( } #ifdef SPLIT_REND_WITH_HEAD_ROT -static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_REND_AudioConfig outConfig, const int16_t cldfb_in ) +static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_AUDIO_CONFIG outConfig, const int16_t cldfb_in ) { ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; - if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { if ( pSplit_rend_config->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) @@ -3542,7 +3578,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN pSplit_rend_config, outputSampleRate, cldfb_in, - outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); + outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); if ( error != IVAS_ERR_OK ) { return error; @@ -3577,7 +3613,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const int16_t nonDiegeticPan, const float nonDiegeticPanGain ) { @@ -3665,7 +3701,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsIsm[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + initRendInputBase( &hIvasRend->inputsIsm[i].base, AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; @@ -3685,7 +3721,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMc[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + initRendInputBase( &hIvasRend->inputsMc[i].base, AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsMc[i].efapInWrapper.hEfap = NULL; hIvasRend->inputsMc[i].crendWrapper = NULL; @@ -3709,7 +3745,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + initRendInputBase( &hIvasRend->inputsSba[i].base, AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsSba[i].crendWrapper = NULL; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -3722,7 +3758,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i ) { - initRendInputBase( &hIvasRend->inputsMasa[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ), + initRendInputBase( &hIvasRend->inputsMasa[i].base, AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsMasa[i].decDummy = NULL; hIvasRend->inputsMasa[i].metadataHasBeenFed = false; @@ -3733,7 +3769,7 @@ ivas_error IVAS_REND_Open( for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) { initRendInputBase( &hIvasRend->inputsSplitPost[i].base, - IVAS_REND_AUDIO_CONFIG_UNKNOWN, + AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); @@ -3819,7 +3855,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( hIvasRend->outputConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( hIvasRend->outputConfig != AUDIO_CONFIG_LS_CUSTOM ) { /* Specifying details of custom speaker layout only makes sense if output config is set to custom speaker layout */ return IVAS_ERR_INVALID_OUTPUT_FORMAT; @@ -3855,7 +3891,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { inputMc = &hIvasRend->inputsMc[i]; - if ( inputMc->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( inputMc->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Input inactive, skip. */ continue; @@ -3874,7 +3910,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( { inputSba = &hIvasRend->inputsSba[i]; - if ( inputSba->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( inputSba->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Input inactive, skip. */ continue; @@ -3904,7 +3940,7 @@ ivas_error IVAS_REND_NumOutChannels( /* Handle special cases where additional info is needed from the renderer, otherwise use getAudioConfigNumChannels() */ switch ( hIvasRend->outputConfig ) { - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: + case AUDIO_CONFIG_LS_CUSTOM: *numOutChannels = hIvasRend->customLsOut.num_spk + hIvasRend->customLsOut.num_lfe; break; default: @@ -3919,7 +3955,7 @@ ivas_error IVAS_REND_NumOutChannels( } static IVAS_REND_InputId makeInputId( - IVAS_REND_AudioConfig config, + IVAS_AUDIO_CONFIG config, const int32_t inputIndex ) { /* Put config type in second byte (from LSB), put index + 1 in first byte @@ -3990,7 +4026,7 @@ static ivas_error getInputById( } /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pInputBase->id != inputId || pInputBase->inConfig == AUDIO_CONFIG_INVALID ) { return IVAS_ERR_INVALID_INPUT_ID; } @@ -4064,7 +4100,7 @@ static ivas_error getConstInputById( } /* Ensure input ID matches and that input is active */ - if ( pInputBase->id != inputId || pInputBase->inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pInputBase->id != inputId || pInputBase->inConfig == AUDIO_CONFIG_INVALID ) { return IVAS_ERR_INVALID_INPUT_ID; } @@ -4100,7 +4136,7 @@ static ivas_error findFreeInputSlot( { pInputBase = (const input_base *) pByte; - if ( pInputBase->inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pInputBase->inConfig == AUDIO_CONFIG_INVALID ) { *inputIndex = i; canAddInput = true; @@ -4137,16 +4173,16 @@ static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_Aud *-------------------------------------------------------------------*/ ivas_error IVAS_REND_AddInput( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_AudioConfig inConfig, /* i : audio config for a new input */ - IVAS_REND_InputId *inputId /* o : ID of the new input */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ ) { ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; int32_t inputStructSize; - ivas_error ( *activateInput )( void *, IVAS_REND_AudioConfig, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); + ivas_error ( *activateInput )( void *, IVAS_AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); int32_t inputIndex; /* Validate function arguments */ @@ -4168,7 +4204,7 @@ ivas_error IVAS_REND_AddInput( #ifdef FIX_658_SPLIT_REND_MASA ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, ( cldfb_in == 0 ), - hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); + hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); #endif if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, @@ -4270,7 +4306,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( return error; } - if ( inputMc->base.inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inputMc->base.inConfig != AUDIO_CONFIG_LS_CUSTOM ) { /* Specifying details of custom speaker layout only makes sense if input config is set to custom speaker layout */ return IVAS_ERR_INVALID_INPUT_FORMAT; @@ -4291,7 +4327,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) @@ -4544,7 +4580,7 @@ ivas_error IVAS_REND_GetNumAllObjects( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) + if ( hIvasRend->outputConfig == AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == AUDIO_CONFIG_MASA2 ) { *numChannels = (int16_t) hIvasRend->inputsIsm[0].total_num_objects; } @@ -4585,7 +4621,7 @@ ivas_error IVAS_REND_GetDelay( /* Compute the maximum delay across all inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) { - if ( hIvasRend->inputsIsm[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( hIvasRend->inputsIsm[i].base.inConfig != AUDIO_CONFIG_INVALID ) { latency_ns = max( ( hIvasRend->inputsIsm[i].crendWrapper != NULL ) ? hIvasRend->inputsIsm[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsIsm[i].tdRendWrapper.binaural_latency_ns ); @@ -4595,7 +4631,7 @@ ivas_error IVAS_REND_GetDelay( for ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) { - if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( hIvasRend->inputsMc[i].base.inConfig != AUDIO_CONFIG_INVALID ) { latency_ns = max( ( hIvasRend->inputsMc[i].crendWrapper != NULL ) ? hIvasRend->inputsMc[i].crendWrapper->binaural_latency_ns : 0, hIvasRend->inputsMc[i].tdRendWrapper.binaural_latency_ns ); @@ -4605,7 +4641,7 @@ ivas_error IVAS_REND_GetDelay( for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { - if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( hIvasRend->inputsSba[i].base.inConfig != AUDIO_CONFIG_INVALID ) { #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL ) @@ -4637,7 +4673,7 @@ ivas_error IVAS_REND_GetDelay( #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; i++ ) { - if ( hIvasRend->inputsSplitPost[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( hIvasRend->inputsSplitPost[i].base.inConfig != AUDIO_CONFIG_INVALID ) { latency_ns = 0; if ( hIvasRend->inputsSplitPost[i].splitPostRendWrapper.hLc3plusDec != NULL ) @@ -4657,7 +4693,7 @@ ivas_error IVAS_REND_GetDelay( for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { - if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( hIvasRend->inputsMasa[i].base.inConfig != AUDIO_CONFIG_INVALID ) { latency_ns = (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); max_latency_ns = max( max_latency_ns, latency_ns ); @@ -4732,7 +4768,7 @@ ivas_error IVAS_REND_FeedInputAudio( { return error; } - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == IVAS_REND_AUDIO_CONFIG_OBJECT ) + if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_MASA1 || hIvasRend->outputConfig == AUDIO_CONFIG_MASA2 ) && inputBase->inConfig == AUDIO_CONFIG_OBA ) { numInputChannels = (int16_t) hIvasRend->inputsIsm[0].total_num_objects; } @@ -4783,7 +4819,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( return error; } - if ( inputBase->inConfig != IVAS_REND_AUDIO_CONFIG_OBJECT ) + if ( inputBase->inConfig != AUDIO_CONFIG_OBA ) { /* Object metadata should only be fed for object inputs */ return IVAS_ERR_METADATA_NOT_EXPECTED; @@ -4871,8 +4907,8 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ) { ivas_error error; @@ -5018,7 +5054,7 @@ int16_t IVAS_REND_FeedRenderConfig( hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; - if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -5033,7 +5069,7 @@ int16_t IVAS_REND_FeedRenderConfig( /* TODO : Do not hard code TDin to 1 here*/ ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, 1, - hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); + hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ); if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, @@ -5085,8 +5121,8 @@ ivas_error IVAS_REND_SetHeadRotation( if ( headRot == NULL ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { hIvasRend->headRotData.headRotEnabled = 1; for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; ++i ) @@ -5114,10 +5150,10 @@ ivas_error IVAS_REND_SetHeadRotation( if ( headRot[i].w == -3.0f ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || - ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->inputsSplitPost[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || + ( hIvasRend->inputsSplitPost[0].base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( hIvasRend->inputsSplitPost[0].base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { Euler2Quat( deg2rad( headRot[i].x ), deg2rad( headRot[i].y ), deg2rad( headRot[i].z ), &rotQuat ); } @@ -5460,7 +5496,7 @@ static void renderBufferChannel( static ivas_error rotateFrameMc( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + IVAS_AUDIO_CONFIG inConfig, /* i : Input Audio config */ LSSETUP_CUSTOM_STRUCT inCustomLs, /* i : Input Custom LS setup */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ @@ -5486,7 +5522,7 @@ static ivas_error rotateFrameMc( push_wmops( "rotateFrameMc" ); - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getAudioConfigNumChannels( inConfig, &nchan ) ) != IVAS_ERR_OK ) { @@ -5597,7 +5633,7 @@ static ivas_error rotateFrameMc( static ivas_error rotateFrameSba( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_REND_AudioConfig inConfig, /* i : Input Audio config */ + IVAS_AUDIO_CONFIG inConfig, /* i : Input Audio config */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ @@ -5867,7 +5903,7 @@ static ivas_error renderIsmToBinauralRoom( /* intermediate rendering to 7_1_4 */ tmpMcBuffer = ismInput->base.inputBuffer; - if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -5949,7 +5985,7 @@ static ivas_error renderIsmToMc( push_wmops( "renderIsmToMc" ); /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ - if ( *ismInput->base.ctx.pOutConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) + if ( *ismInput->base.ctx.pOutConfig == AUDIO_CONFIG_STEREO ) { if ( ismInput->nonDiegeticPan ) { @@ -6004,7 +6040,7 @@ static ivas_error renderIsmToMc( static ivas_error renderIsmToSba( const input_ism *ismInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { int16_t ambiOrderOut; @@ -6230,7 +6266,7 @@ static ivas_error renderIsmToMasa( static ivas_error renderInputIsm( input_ism *ismInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -6259,19 +6295,19 @@ static ivas_error renderInputIsm( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: error = renderIsmToBinaural( ismInput, outAudio ); break; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: error = renderIsmToBinauralRoom( ismInput, outAudio ); break; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderIsmToSplitBinaural( ismInput, outAudio ); break; #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderIsmToBinauralReverb( ismInput, outAudio ); break; default: @@ -6303,7 +6339,7 @@ static ivas_error renderActiveInputsIsm( for ( i = 0, pCurrentInput = hIvasRend->inputsIsm; i < RENDERER_MAX_ISM_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pCurrentInput->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -6322,7 +6358,7 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, #ifdef SPLIT_REND_WITH_HEAD_ROT - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, #endif IVAS_REND_AudioBuffer outAudio ) { @@ -6352,7 +6388,7 @@ static ivas_error renderLfeToBinaural( gain = GAIN_LFE; - if ( mcInput->base.inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + if ( mcInput->base.inConfig != AUDIO_CONFIG_LS_CUSTOM ) { lfe_idx = LFE_CHANNEL; } @@ -6449,11 +6485,11 @@ static ivas_error renderLfeToBinaural( static ivas_error renderMcToBinaural( input_mc *mcInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - IVAS_REND_AudioConfig inConfig; + IVAS_AUDIO_CONFIG inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; @@ -6485,9 +6521,9 @@ static ivas_error renderMcToBinaural( } } - if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled + if ( ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled - && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) + && ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); @@ -6565,11 +6601,11 @@ static ivas_error renderMcToBinaural( static ivas_error renderMcToBinauralRoom( input_mc *mcInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - IVAS_REND_AudioConfig inConfig; + IVAS_AUDIO_CONFIG inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; @@ -6601,7 +6637,7 @@ static ivas_error renderMcToBinauralRoom( } } - if ( ( mcInput->hReverb != NULL && outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && ( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled && ( inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) ) ) ) + if ( ( mcInput->hReverb != NULL && outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && ( ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled && ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); @@ -6676,7 +6712,7 @@ static ivas_error renderMcToBinauralRoom( static ivas_error renderMcCustomLsToBinauralRoom( input_mc *mcInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i; @@ -6737,7 +6773,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* intermediate conversion to 7_1_4 */ tmpMcBuffer = mcInput->base.inputBuffer; - if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -6849,7 +6885,7 @@ static ivas_error renderMcToMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderMcToSplitBinaural( input_mc *mcInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i, j, sf, pos_idx; @@ -6860,7 +6896,7 @@ static ivas_error renderMcToSplitBinaural( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; float tmpSplitBinauralBuffer[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; - IVAS_REND_AudioConfig inConfig; + IVAS_AUDIO_CONFIG inConfig; IVAS_REND_AudioBuffer tmpRotBuffer; COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; @@ -6898,7 +6934,7 @@ static ivas_error renderMcToSplitBinaural( /* temporary buffer for rotation in source format for CREND */ tmpRotBuffer = mcInput->base.inputBuffer; - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inConfig != IVAS_REND_AUDIO_CONFIG_5_1 && inConfig != IVAS_REND_AUDIO_CONFIG_7_1 ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM && inConfig != AUDIO_CONFIG_5_1 && inConfig != AUDIO_CONFIG_7_1 ) { tmpRotBuffer.data = malloc( tmpRotBuffer.config.numSamplesPerChannel * tmpRotBuffer.config.numChannels * sizeof( float ) ); } @@ -6920,7 +6956,7 @@ static ivas_error renderMcToSplitBinaural( QuatToRotMat( combinedOrientationDataLocal.Quaternions[i], combinedOrientationDataLocal.Rmat[i] ); } - if ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM || inConfig == IVAS_REND_AUDIO_CONFIG_5_1 || inConfig == IVAS_REND_AUDIO_CONFIG_7_1 ) + if ( inConfig == AUDIO_CONFIG_LS_CUSTOM || inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) { /* tdrend processing overview: * 1. copy from inputBuffer to tmpRendBuffer @@ -7015,7 +7051,7 @@ static ivas_error renderMcToSplitBinaural( } } - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM && inConfig != IVAS_REND_AUDIO_CONFIG_5_1 && inConfig != IVAS_REND_AUDIO_CONFIG_7_1 ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM && inConfig != AUDIO_CONFIG_5_1 && inConfig != AUDIO_CONFIG_7_1 ) { /* free temporary buffer for rotation in source format for CREND */ free( tmpRotBuffer.data ); @@ -7036,7 +7072,7 @@ static ivas_error renderMcToSplitBinaural( static ivas_error renderInputMc( input_mc *mcInput, - IVAS_REND_AudioConfig outConfig, + IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -7070,12 +7106,12 @@ static ivas_error renderInputMc( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: error = renderMcToBinaural( mcInput, outConfig, outAudio ); break; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - if ( mcInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + if ( mcInput->base.inConfig == AUDIO_CONFIG_LS_CUSTOM ) { error = renderMcCustomLsToBinauralRoom( mcInput, outConfig, outAudio ); } @@ -7085,8 +7121,8 @@ static ivas_error renderInputMc( } break; #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderMcToSplitBinaural( mcInput, outConfig, outAudio ); break; #endif @@ -7114,7 +7150,7 @@ static ivas_error renderActiveInputsMc( for ( i = 0, pCurrentInput = hIvasRend->inputsMc; i < RENDERER_MAX_MC_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pCurrentInput->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -7297,7 +7333,7 @@ static ivas_error renderSplitBinauralWithPostRot( hSplitBin->multiBinPoseData.poseCorrectionMode = bits.pose_correction; /* decode audio */ - if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + if ( splitBinInput->base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) { @@ -7361,7 +7397,7 @@ static ivas_error renderSplitBinauralWithPostRot( } else { - if ( splitBinInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + if ( splitBinInput->base.inConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { int16_t ch_idx; for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) @@ -7386,7 +7422,7 @@ static ivas_error renderSplitBinauralWithPostRot( static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, float out[][L_FRAME48k] ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7512,7 +7548,7 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7552,7 +7588,7 @@ static ivas_error renderSbaToSplitBinaural( static ivas_error renderSbaToBinaural( input_sba *sbaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7653,7 +7689,7 @@ static ivas_error renderSbaToBinaural( static ivas_error renderSbaToBinauralRoom( input_sba *sbaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i; @@ -7716,7 +7752,7 @@ static ivas_error renderSbaToBinauralRoom( /* intermediate rendering to 7_1_4 */ tmpMcBuffer = sbaInput->base.inputBuffer; - if ( ( error = getAudioConfigNumChannels( IVAS_REND_AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( AUDIO_CONFIG_7_1_4, &tmp ) ) != IVAS_ERR_OK ) { return error; } @@ -7761,7 +7797,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderInputSplitBin( input_split_post_rend *splitBinInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio, IVAS_REND_BitstreamBuffer *hBits, const int16_t SplitRendBFI ) @@ -7785,7 +7821,7 @@ static ivas_error renderInputSplitBin( inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: error = renderSplitBinauralWithPostRot( splitBinInput, outAudio, hBits, SplitRendBFI ); @@ -7817,7 +7853,7 @@ static ivas_error renderSbaToMasa( static ivas_error renderInputSba( input_sba *sbaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -7829,7 +7865,7 @@ static ivas_error renderInputSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && - ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif @@ -7857,8 +7893,8 @@ static ivas_error renderInputSba( switch ( outConfig ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: error = renderSbaToSplitBinaural( sbaInput, #ifdef SPLIT_REND_WITH_HEAD_ROT outConfig, @@ -7866,11 +7902,11 @@ static ivas_error renderInputSba( outAudio ); break; #endif - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: error = renderSbaToBinaural( sbaInput, outConfig, outAudio ); break; - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + case AUDIO_CONFIG_BINAURAL_ROOM_IR: + case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: error = renderSbaToBinauralRoom( sbaInput, outConfig, outAudio ); break; default: @@ -7899,7 +7935,7 @@ static ivas_error renderActiveInputsSplitBin( for ( i = 0, pCurrentInput = hIvasRend->inputsSplitPost; i < RENDERER_MAX_BIN_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pCurrentInput->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -7926,7 +7962,7 @@ static ivas_error renderActiveInputsSba( for ( i = 0, pCurrentInput = hIvasRend->inputsSba; i < RENDERER_MAX_SBA_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pCurrentInput->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -8184,7 +8220,7 @@ static void renderMasaToMasa( static ivas_error renderInputMasa( input_masa *masaInput, - const IVAS_REND_AudioConfig outConfig, + const IVAS_AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { IVAS_REND_AudioBuffer inAudio; @@ -8197,7 +8233,7 @@ static ivas_error renderInputMasa( inAudio = masaInput->base.inputBuffer; #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) && - ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif @@ -8224,7 +8260,7 @@ static ivas_error renderInputMasa( case IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL: switch ( outConfig ) { - case IVAS_REND_AUDIO_CONFIG_BINAURAL: + case AUDIO_CONFIG_BINAURAL: renderMasaToBinaural( masaInput, outAudio #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -8234,16 +8270,16 @@ static ivas_error renderInputMasa( break; /* ToDo */ //#ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG - // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR: - // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: + // case AUDIO_CONFIG_BINAURAL_ROOM_IR: + // case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: //#else // case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM: //#endif // renderMasaToBinauralRoom( masaInput, outConfig, outAudio ); // break; #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM: + case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: + case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: /* TODO: implement */ renderMasaToBinaural( masaInput, outAudio #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -8278,7 +8314,7 @@ static ivas_error renderActiveInputsMasa( for ( i = 0, pCurrentInput = hIvasRend->inputsMasa; i < RENDERER_MAX_MASA_INPUTS; ++i, ++pCurrentInput ) { - if ( pCurrentInput->base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) + if ( pCurrentInput->base.inConfig == AUDIO_CONFIG_INVALID ) { /* Skip inactive inputs */ continue; @@ -8418,7 +8454,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( /* Merge metadata */ ivas_prerend_merge_masa_metadata( *hMasaExtOutMeta, *hMasaExtOutMeta, inputType1, *inEne1, inMeta2, inputType2, *inEne2 ); - ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_MASA1 ? 0u : 1u; + ( *hMasaExtOutMeta )->descriptiveMeta.numberOfChannels = hIvasRend->outputConfig == AUDIO_CONFIG_MASA1 ? 0u : 1u; return IVAS_ERR_OK; @@ -8541,21 +8577,21 @@ ivas_error IVAS_REND_GetSamples( for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { - numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ? 0 : 1; + numMasaInputs += hIvasRend->inputsMasa[i].base.inConfig == AUDIO_CONFIG_INVALID ? 0 : 1; } for ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) { - numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ? 0 : 1; + numOtherInputs += hIvasRend->inputsMc[i].base.inConfig == AUDIO_CONFIG_INVALID ? 0 : 1; } for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) { - numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ? 0 : 1; + numOtherInputs += hIvasRend->inputsSba[i].base.inConfig == AUDIO_CONFIG_INVALID ? 0 : 1; } /* For ISM, we check only first as all ISMs are handled together via OMASA when merging to MASA. */ - numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ? 0 : 1; + numOtherInputs += hIvasRend->inputsIsm[0].base.inConfig == AUDIO_CONFIG_INVALID ? 0 : 1; if ( numMasaInputs == 0 || numOtherInputs == 0 ) { @@ -8580,14 +8616,14 @@ ivas_error IVAS_REND_GetSamples( #ifdef SPLIT_REND_WITH_HEAD_ROT outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ - if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || - ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { int16_t num_poses_orig; num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses; outAudio = hIvasRend->splitRendEncBuffer; if ( ( outAudioOrig.config.is_cldfb == 0 ) && - ( hIvasRend->inputsMasa[0].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) + ( hIvasRend->inputsMasa[0].base.inConfig == AUDIO_CONFIG_INVALID ) ) { outAudio.config.is_cldfb = 0; outAudio.config.numSamplesPerChannel >>= 1; @@ -8643,7 +8679,7 @@ ivas_error IVAS_REND_GetSamples( #endif /* SPLIT_REND_WITH_HEAD_ROT */ #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { ivas_split_rend_bits_t bits; int16_t td_input; @@ -8671,18 +8707,18 @@ 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, - ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); + ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ); if ( error != IVAS_ERR_OK ) { return error; } convertInternalBitsBuffToBitsBuffer( hBits, bits ); outAudio = outAudioOrig; - if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + if ( hIvasRend->outputConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { accumulate2dArrayToBuffer( tmpBinaural, &outAudio ); } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index c86b8bcbf2..e18b7ec39f 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -98,56 +98,6 @@ typedef enum IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN, } IVAS_REND_AudioConfigType; -/* TODO(sgi): Harmonize with AUDIO_CONFIG */ -/* - Note: numerical values carry specific information here. - - MSB LSB - -------------------------------------------------------------------------------- - ... unused (assumed all 0) ... | config type (1 byte) | config variant (1 byte) | - -------------------------------------------------------------------------------- - - Where "config type" is the general type from the following list: - - unknown - - channel-based - - ambisonics - - object-based - - binaural - - MASA - - Config variants are concrete configs of each type. - */ -typedef enum -{ - IVAS_REND_AUDIO_CONFIG_MONO = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 0, - IVAS_REND_AUDIO_CONFIG_STEREO = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 1, - IVAS_REND_AUDIO_CONFIG_5_1 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 2, - IVAS_REND_AUDIO_CONFIG_7_1 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 3, - IVAS_REND_AUDIO_CONFIG_5_1_2 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 4, - IVAS_REND_AUDIO_CONFIG_5_1_4 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 5, - IVAS_REND_AUDIO_CONFIG_7_1_4 = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 6, - IVAS_REND_AUDIO_CONFIG_LS_CUSTOM = IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED << 8 | 255, - - IVAS_REND_AUDIO_CONFIG_FOA = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 0, - IVAS_REND_AUDIO_CONFIG_HOA2 = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 1, - IVAS_REND_AUDIO_CONFIG_HOA3 = IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS << 8 | 2, - - IVAS_REND_AUDIO_CONFIG_OBJECT = IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED << 8 | 0, - - IVAS_REND_AUDIO_CONFIG_BINAURAL = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 0, - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, - IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 2, -#ifdef SPLIT_REND_WITH_HEAD_ROT - IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 3, - IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 4, -#endif - - IVAS_REND_AUDIO_CONFIG_MASA1 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 0, - IVAS_REND_AUDIO_CONFIG_MASA2 = IVAS_REND_AUDIO_CONFIG_TYPE_MASA << 8 | 1, - - IVAS_REND_AUDIO_CONFIG_UNKNOWN = IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN << 8 | 0, -} IVAS_REND_AudioConfig; - typedef uint16_t IVAS_REND_InputId; @@ -161,7 +111,7 @@ typedef uint16_t IVAS_REND_InputId; ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ - const IVAS_REND_AudioConfig outConfig, /* i : output audio config */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ const float nonDiegeticPanGain /* i : non-diegetic panning gain */ ); @@ -182,7 +132,7 @@ ivas_error IVAS_REND_NumOutChannels( ivas_error IVAS_REND_AddInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_AudioConfig inConfig, /* i : audio config for a new input */ + const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ IVAS_REND_InputId *inputId /* o : ID of the new input */ ); @@ -258,7 +208,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_AudioConfig outAudioConfig /* i : output audioConfig */ + const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ); int16_t IVAS_REND_GetRenderConfig( @@ -366,7 +316,7 @@ ivas_error IVAS_REND_GetSamples( IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ + IVAS_REND_BitstreamBuffer *hBits /*i/o: buffer for input/output bitstream. Needed in split rendering mode*/ #endif ); -- GitLab From d89cabdb67b8ae85941cd514d1a50a0cfeeed5f1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 4 Aug 2023 13:17:59 +0200 Subject: [PATCH 08/26] more harmonization of AUDIO_CONFIG with IVAS_REND_AudioConfig and with IVAS_DEC_AUDIO_CONFIG --- apps/decoder.c | 6 +- apps/renderer.c | 24 +- lib_com/common_api_types.h | 2 +- lib_com/ivas_cnst.h | 23 +- lib_dec/ivas_binRenderer_internal.c | 11 +- lib_dec/lib_dec.c | 10 +- lib_dec/lib_dec.h | 4 +- lib_rend/ivas_crend.c | 78 ++---- lib_rend/ivas_mcmasa_ana.c | 6 +- lib_rend/ivas_objectRenderer.c | 8 +- lib_rend/ivas_prot_rend.h | 28 +- lib_rend/lib_rend.c | 394 +++++++++------------------- lib_rend/lib_rend.h | 6 +- 13 files changed, 204 insertions(+), 396 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 3e93e2f9d9..5b2ae9a1de 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -103,7 +103,7 @@ typedef struct char *outputWavFilename; IVAS_DEC_MODE decMode; int32_t output_Fs; - IVAS_AUDIO_CONFIG outputFormat; + AUDIO_CONFIG outputFormat; bool quietModeEnabled; bool delayCompensationEnabled; bool voipMode; @@ -797,10 +797,10 @@ cleanup: * Translate command-line argument to output configuration *---------------------------------------------------------------------*/ -static IVAS_AUDIO_CONFIG cmdline2config( +static AUDIO_CONFIG cmdline2config( char *argv ) { - IVAS_AUDIO_CONFIG output_config; + AUDIO_CONFIG output_config; char argv_to_upper[FILENAME_MAX]; diff --git a/apps/renderer.c b/apps/renderer.c index ace8f4eb6d..02b78532dd 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -106,7 +106,7 @@ typedef struct } LfeRoutingConfig; typedef struct { - IVAS_AUDIO_CONFIG audioConfig; + AUDIO_CONFIG audioConfig; int32_t inputChannelIndex; float gain_dB; } RendererInput; @@ -136,7 +136,7 @@ typedef struct typedef struct { - IVAS_AUDIO_CONFIG audioConfig; + AUDIO_CONFIG audioConfig; IVAS_CUSTOM_LS_DATA outSetupCustom; } OutputConfig; @@ -365,7 +365,7 @@ static const CmdLnParser_Option cliOptions[] = { static const int32_t numCliOptions = sizeof( cliOptions ) / sizeof( CmdLnParser_Option ); -static IVAS_AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order ); +static AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order ); static void parseSceneDescriptionFile( char *path, char *audioFilePath, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs ); @@ -406,7 +406,7 @@ static ivas_error parseLfePanMtxFile( const char *lfeRoutingMatrixFilePath, IVAS static void printSupportedAudioConfigs( void ); -static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString ); +static AUDIO_CONFIG parseAudioConfig( const char *configString ); static void convertInputBuffer( const int16_t *intBuffer, const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, float *floatBuffer #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -684,7 +684,7 @@ static void rend_closeCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNEL return; } -static int16_t get_cldfb_in_flag( IVAS_AUDIO_CONFIG audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) +static int16_t get_cldfb_in_flag( AUDIO_CONFIG audioConfig, IVAS_RENDER_CONFIG_DATA *renderConfig ) { int16_t cldfb_in; cldfb_in = 0; @@ -2002,7 +2002,7 @@ int main( * Local functions *------------------------------------------------------------------------------------------*/ -static IVAS_AUDIO_CONFIG ambisonicsOrderToEnum( +static AUDIO_CONFIG ambisonicsOrderToEnum( const int16_t order ) { switch ( order ) @@ -2060,8 +2060,8 @@ static bool parseInConfig( return true; } - /* Check for single-format inputs. The given string should map to a member of IVAS_AUDIO_CONFIG enum. */ - IVAS_AUDIO_CONFIG audioConfig = parseAudioConfig( inFormatStr ); + /* Check for single-format inputs. The given string should map to a member of AUDIO_CONFIG enum. */ + AUDIO_CONFIG audioConfig = parseAudioConfig( inFormatStr ); switch ( audioConfig ) { case AUDIO_CONFIG_MONO: @@ -2125,7 +2125,7 @@ static bool parseInConfig( } break; case AUDIO_CONFIG_INVALID: - /* This case will be reached if parsing string to IVAS_AUDIO_CONFIG enum fails. + /* This case will be reached if parsing string to AUDIO_CONFIG enum fails. * Try to use the given string as a path to a custom loudspeaker layout file. */ { ivas_error error = parseCustomLayoutFile( inFormatStr, &inConfig->inSetupCustom ); @@ -2150,7 +2150,7 @@ static bool parseInConfig( break; default: { - /* Default case covers formats that are defined in the IVAS_AUDIO_CONFIG enum, + /* Default case covers formats that are defined in the AUDIO_CONFIG enum, * but cannot be used at input, e.g. BINAURAL */ const CmdLnParser_Option *listOption = findOptionById( CmdLnOptionId_listFormats ); fprintf( stderr, "Unsupported input format: %s. To list valid formats, use option --%s.\n", inFormatStr, listOption->match ); @@ -2249,7 +2249,7 @@ static bool parseOrientationTracking( return true; } -static IVAS_AUDIO_CONFIG parseAudioConfig( +static AUDIO_CONFIG parseAudioConfig( const char *configString ) { #ifndef SPLIT_REND_WITH_HEAD_ROT @@ -3231,7 +3231,7 @@ static void parseMc( --inConfig->multiChannelBuses[idx].inputChannelIndex; /* Convert from 1-indexing */ readNextMetadataChunk( line, "\n" ); - IVAS_AUDIO_CONFIG cfg = parseAudioConfig( line ); + AUDIO_CONFIG cfg = parseAudioConfig( line ); /* Try to use the given string as a path to a custom loudspeaker layout file. */ if ( cfg == AUDIO_CONFIG_INVALID ) { diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 1d722a0615..8a51721b97 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -85,7 +85,7 @@ typedef enum _IVAS_AUDIO_CONFIG AUDIO_CONFIG_MASA2, /* MASA2 */ AUDIO_CONFIG_EXTERNAL /* external renderer */ -} IVAS_AUDIO_CONFIG; +} AUDIO_CONFIG; /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 23c78ba0fd..48011e132c 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -86,19 +86,6 @@ typedef enum #endif -/*----------------------------------------------------------------------------------* - * IVAS output audio configurations - *----------------------------------------------------------------------------------*/ - -typedef enum _IVAS_AUDIO_CONFIG AUDIO_CONFIG; /* defined in common_api_types.h */ - -typedef enum -{ - RENDER_TYPE_OVERRIDE_NONE, - RENDER_TYPE_OVERRIDE_CREND, - RENDER_TYPE_OVERRIDE_FASTCONV -} ivas_renderTypeOverride; - /*----------------------------------------------------------------------------------* * IVAS rendering configurations *----------------------------------------------------------------------------------*/ @@ -135,6 +122,16 @@ typedef enum } RENDERER_TYPE; +#ifdef DEBUGGING +typedef enum +{ + RENDER_TYPE_OVERRIDE_NONE, + RENDER_TYPE_OVERRIDE_CREND, + RENDER_TYPE_OVERRIDE_FASTCONV + +} ivas_renderTypeOverride; +#endif + /*----------------------------------------------------------------------------------* * IVAS general constants *----------------------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 0ef74f10a4..dd571e83d6 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1040,15 +1040,14 @@ static void ivas_binaural_obtain_DMX( ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, - const IVAS_AUDIO_CONFIG inConfig, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { BINAURAL_RENDERER_HANDLE hBinRenderer; int16_t convBand; ivas_error error; - AUDIO_CONFIG in_config, out_config; error = IVAS_ERR_OK; @@ -1073,8 +1072,6 @@ ivas_error ivas_rend_openCldfbRend( convBand = hBinRenderer->max_band; hBinRenderer->timeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; /* Corresponds to 5 msec sound to motion latency */ - in_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); - out_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); if ( convBand > BINAURAL_CONVBANDS ) { @@ -1087,7 +1084,7 @@ ivas_error ivas_rend_openCldfbRend( hBinRenderer->hInputSetup->is_loudspeaker_setup = 0; getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ); - if ( ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG hBinRenderer->numPoses = pMultiBinPoseData->num_poses + 1; @@ -1108,7 +1105,7 @@ ivas_error ivas_rend_openCldfbRend( /* Allocate memories and buffers needed for convolutional module */ - if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, in_config, + if ( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f6dcee8c1f..fa5cabf5e8 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3195,11 +3195,11 @@ ivas_error IVAS_DEC_VoIP_reconfigure( * *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_GetCldfbSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */ - float *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */ - IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */ - int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */ + float *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */ + AUDIO_CONFIG *audio_config, /* o : audio configuration */ + int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ ) { Decoder_Struct *st_ivas; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index d850977449..ad93e19846 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -122,7 +122,7 @@ ivas_error IVAS_DEC_Open( 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 outputFormat, /* i : audio configuration */ + const AUDIO_CONFIG outputFormat, /* i : audio configuration */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -166,7 +166,7 @@ ivas_error IVAS_DEC_GetCldfbSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ float *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */ float *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */ - IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */ + AUDIO_CONFIG *audio_config, /* o : audio configuration */ int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ ); #endif diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index c54e4d9b4c..e21ef9bf52 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -155,8 +155,8 @@ static ivas_error ivas_hrtf_close( static ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, - const AUDIO_CONFIG inIvasConfig, - const AUDIO_CONFIG outIvasConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, HRTFS_CREND_HANDLE hSetOfHRTF, const int32_t output_Fs ) { @@ -165,11 +165,6 @@ static ivas_error ivas_rend_initCrend( IVAS_REND_AudioConfigType inConfigType; HRTFS_HANDLE hHrtf; ivas_error error; - IVAS_AUDIO_CONFIG inConfig; - IVAS_AUDIO_CONFIG outConfig; - - inConfig = getRendAudioConfigFromIvasAudioConfig( inIvasConfig ); - outConfig = getRendAudioConfigFromIvasAudioConfig( outIvasConfig ); inConfigType = getAudioConfigType( inConfig ); hHrtf = pCrend->hHrtfCrend; @@ -197,7 +192,6 @@ static ivas_error ivas_rend_initCrend( } } - if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { return error; @@ -982,20 +976,15 @@ ivas_error ivas_rend_initCrendWrapper( ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, - const IVAS_AUDIO_CONFIG inConfig, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ) { ivas_error error; error = IVAS_ERR_OK; - error = ivas_rend_openCrend( pCrend, - getIvasAudioConfigFromRendAudioConfig( inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL /*hRendCfg*/, - NULL, - output_Fs + error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT , pMultiBinPoseData->num_poses @@ -1270,8 +1259,8 @@ void ivas_rend_closeCrend( static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, - IVAS_AUDIO_CONFIG inConfig, - IVAS_AUDIO_CONFIG outConfig, + AUDIO_CONFIG inConfig, + AUDIO_CONFIG outConfig, float *pcm_in[], float *pcm_out[], const int32_t output_Fs, @@ -1461,11 +1450,8 @@ ivas_error ivas_rend_crendProcess( int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; float *p_pcm_tmp[BINAURAL_CHANNELS]; - AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; - IVAS_AUDIO_CONFIG inRendConfig; - IVAS_AUDIO_CONFIG outRendConfig; CREND_HANDLE hCrend; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1491,14 +1477,9 @@ ivas_error ivas_rend_crendProcess( push_wmops( "ivas_rend_crendProcess" ); - inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); - outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); - - in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); - - inConfigType = getAudioConfigType( inRendConfig ); + inConfigType = getAudioConfigType( inConfig ); - if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } @@ -1521,7 +1502,7 @@ ivas_error ivas_rend_crendProcess( MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL SBA SPAR -> BINAURAL or BINAURAL_ROOM */ - if ( in_config == AUDIO_CONFIG_FOA || in_config == AUDIO_CONFIG_HOA2 || in_config == AUDIO_CONFIG_HOA3 ) + if ( inConfig == AUDIO_CONFIG_FOA || inConfig == AUDIO_CONFIG_HOA2 || inConfig == AUDIO_CONFIG_HOA3 ) { rotateFrame_shd( hCombinedOrientationData, output, subframe_len, *hIntSetup, subframe_idx ); } @@ -1532,9 +1513,9 @@ ivas_error ivas_rend_crendProcess( } } - if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) + if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED || inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, p_pcm_tmp, output_Fs, subframe_idx + if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, p_pcm_tmp, output_Fs, subframe_idx #ifdef SPLIT_REND_WITH_HEAD_ROT , pos_idx @@ -1547,9 +1528,9 @@ ivas_error ivas_rend_crendProcess( if ( hCrend->hReverb != NULL ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, inConfig, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, inConfig, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1600,11 +1581,8 @@ ivas_error ivas_rend_crendProcessSubframe( float *tc_local[MAX_TRANSPORT_CHANNELS]; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; float *p_pcm_tmp[BINAURAL_CHANNELS]; - AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; - IVAS_AUDIO_CONFIG inRendConfig; - IVAS_AUDIO_CONFIG outRendConfig; int8_t combinedOrientationEnabled; combinedOrientationEnabled = 0; @@ -1622,18 +1600,14 @@ ivas_error ivas_rend_crendProcessSubframe( push_wmops( "ivas_rend_crendProcessSubframe" ); - inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); - outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); - - in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); - inConfigType = getAudioConfigType( inRendConfig ); + inConfigType = getAudioConfigType( inConfig ); - if ( ( error = getAudioConfigNumChannels( outRendConfig, &nchan_out ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = getAudioConfigNumChannels( inRendConfig, &nchan_in ) ) != IVAS_ERR_OK ) + if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { return error; } @@ -1673,27 +1647,23 @@ ivas_error ivas_rend_crendProcessSubframe( MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL SBA SPAR -> BINAURAL or BINAURAL_ROOM */ - if ( in_config == AUDIO_CONFIG_FOA || in_config == AUDIO_CONFIG_HOA2 || in_config == AUDIO_CONFIG_HOA3 ) + if ( inConfig == AUDIO_CONFIG_FOA || inConfig == AUDIO_CONFIG_HOA2 || inConfig == AUDIO_CONFIG_HOA3 ) { - rotateFrame_shd( - hCombinedOrientationData, - tc_local, subframe_len, *hIntSetup, 0 ); + rotateFrame_shd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, 0 ); } /* Rotation in SD for MC -> BINAURAL_ROOM */ else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { - rotateFrame_sd( - hCombinedOrientationData, - tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 ); + rotateFrame_sd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 ); } } if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, tc_local, p_pcm_tmp, output_Fs, 0, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local, p_pcm_tmp, output_Fs, 0, 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, tc_local, p_pcm_tmp, output_Fs, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local, p_pcm_tmp, output_Fs, 0 ) ) != IVAS_ERR_OK ) #endif { @@ -1702,7 +1672,7 @@ ivas_error ivas_rend_crendProcessSubframe( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pCrend->hCrend[0]->hReverb != NULL ) { - if ( ( error = ivas_reverb_process( pCrend->hCrend[0]->hReverb, in_config, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( pCrend->hCrend[0]->hReverb, inConfig, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -1710,7 +1680,7 @@ ivas_error ivas_rend_crendProcessSubframe( #else if ( pCrend->hCrend->hReverb != NULL ) { - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, inConfig, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index b15e7ee495..43a91b3489 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -83,9 +83,9 @@ static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, *--------------------------------------------------------------------------*/ ivas_error ivas_mcmasa_ana_open( - MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_AUDIO_CONFIG inConfig, /* i : Input config */ - int32_t input_Fs /* i : Sampling frequency */ + MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ + const AUDIO_CONFIG inConfig, /* i : Input config */ + int32_t input_Fs /* i : Sampling frequency */ ) { int16_t i, j; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 4e2f4a6e44..a6cd72f582 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -633,7 +633,7 @@ void TDREND_Update_listener_orientation( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, - IVAS_AUDIO_CONFIG inConfig, + AUDIO_CONFIG inConfig, RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) @@ -657,7 +657,7 @@ ivas_error ivas_td_binaural_open_ext( nchan_transport = customLsInput->num_spk; } - transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + transport_config = inConfig; ivas_format = ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? MC_FORMAT : ISM_FORMAT; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -694,7 +694,7 @@ ivas_error ivas_td_binaural_open_ext( ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_AUDIO_CONFIG inConfig, /* i : Input audio configuration */ + const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ @@ -738,7 +738,7 @@ ivas_error ivas_td_binaural_renderer_ext( if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; - transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); + transport_config = inConfig; if ( inConfig != AUDIO_CONFIG_LS_CUSTOM ) { if ( ( error = getAudioConfigNumChannels( inConfig, &num_src ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index cf60ea0774..b24978484c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -47,22 +47,14 @@ *----------------------------------------------------------------------------------*/ IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_AUDIO_CONFIG config + const AUDIO_CONFIG config ); ivas_error getAudioConfigNumChannels( - const IVAS_AUDIO_CONFIG config, + const AUDIO_CONFIG config, int16_t *numChannels ); -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - const IVAS_AUDIO_CONFIG rendConfig -); - -IVAS_AUDIO_CONFIG getRendAudioConfigFromIvasAudioConfig( - const AUDIO_CONFIG config -); - /*----------------------------------------------------------------------------------* * output setup prototypes @@ -579,7 +571,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const IVAS_AUDIO_CONFIG inConfig, /* i : Input audio configuration */ + const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ @@ -605,7 +597,7 @@ ivas_error ivas_td_binaural_open_unwrap( ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, RENDER_CONFIG_DATA *hRendCfg, /* i : Renderer configuration */ LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t output_Fs @@ -859,8 +851,8 @@ ivas_error ivas_rend_initCrendWrapper( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_error ivas_rend_openMultiBinCrend( CREND_WRAPPER_HANDLE *pCrend, - const IVAS_AUDIO_CONFIG inConfig, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); @@ -876,13 +868,13 @@ void ivas_rend_CldfbMultiBinRendProcess( ivas_error ivas_rend_openCldfb( HANDLE_CLDFB_FILTER_BANK cldfbAna[MAX_INPUT_CHANNELS], - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const int32_t output_Fs ); ivas_error ivas_rend_openCldfbRend( CLDFB_REND_WRAPPER *pCldfbRend, - const IVAS_AUDIO_CONFIG inConfig, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int32_t output_Fs ); @@ -1595,7 +1587,7 @@ void ivas_SplitRenderer_PostRenderer( ivas_error ivas_mcmasa_ana_open( MCMASA_ANA_HANDLE *hMcMasaPtr, /* i/o: McMASA data handle pointer */ - const IVAS_AUDIO_CONFIG inConfig, /* i : Input config */ + const AUDIO_CONFIG inConfig, /* i : Input config */ int32_t input_Fs /* i : Sampling frequency */ ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f7ffa55132..a102e5f51b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -86,7 +86,7 @@ typedef float rotation_matrix[3][3]; typedef struct { EFAP_HANDLE hEfap; - IVAS_AUDIO_CONFIG speakerConfig; + AUDIO_CONFIG speakerConfig; const LSSETUP_CUSTOM_STRUCT *pCustomLsSetup; /* Pointer to main custom LS struct from renderer handle - doesn't need freeing */ } EFAP_WRAPPER; @@ -100,7 +100,7 @@ typedef struct typedef struct { const int32_t *pOutSampleRate; - const IVAS_AUDIO_CONFIG *pOutConfig; + const AUDIO_CONFIG *pOutConfig; const LSSETUP_CUSTOM_STRUCT *pCustomLsOut; const EFAP_WRAPPER *pEfapOutWrapper; const IVAS_REND_HeadRotData *pHeadRotData; @@ -121,7 +121,7 @@ typedef struct /* Common base for input structs */ typedef struct { - IVAS_AUDIO_CONFIG inConfig; + AUDIO_CONFIG inConfig; IVAS_REND_InputId id; IVAS_REND_AudioBuffer inputBuffer; float gain; /* Linear, not in dB */ @@ -252,8 +252,8 @@ struct IVAS_REND #endif /* TODO @Philips - inputConfig should not be stored here, but read from e.g. input_mc->input_base.inConfig, please remove this */ - IVAS_AUDIO_CONFIG inputConfig; - IVAS_AUDIO_CONFIG outputConfig; + AUDIO_CONFIG inputConfig; + AUDIO_CONFIG outputConfig; EFAP_WRAPPER efapOutWrapper; IVAS_LSSETUP_CUSTOM_STRUCT customLsOut; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -534,113 +534,6 @@ static int32_t limitRendererOutput( } -/*-------------------------------------------------------------------* - * getIvasAudioConfigFromRendAudioConfig() - * - * - *-------------------------------------------------------------------*/ - -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_AUDIO_CONFIG rendConfig ) -{ - switch ( rendConfig ) - { - case AUDIO_CONFIG_MONO: - return AUDIO_CONFIG_MONO; - case AUDIO_CONFIG_STEREO: - return AUDIO_CONFIG_STEREO; - case AUDIO_CONFIG_5_1: - return AUDIO_CONFIG_5_1; - case AUDIO_CONFIG_7_1: - return AUDIO_CONFIG_7_1; - case AUDIO_CONFIG_5_1_2: - return AUDIO_CONFIG_5_1_2; - case AUDIO_CONFIG_5_1_4: - return AUDIO_CONFIG_5_1_4; - case AUDIO_CONFIG_7_1_4: - return AUDIO_CONFIG_7_1_4; - case AUDIO_CONFIG_LS_CUSTOM: - return AUDIO_CONFIG_LS_CUSTOM; - case AUDIO_CONFIG_FOA: - return AUDIO_CONFIG_FOA; - case AUDIO_CONFIG_HOA2: - return AUDIO_CONFIG_HOA2; - case AUDIO_CONFIG_HOA3: - return AUDIO_CONFIG_HOA3; - case AUDIO_CONFIG_OBA: - return AUDIO_CONFIG_OBA; - case AUDIO_CONFIG_BINAURAL: - return AUDIO_CONFIG_BINAURAL; -#ifdef SPLIT_REND_WITH_HEAD_ROT - case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; - case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: - return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; -#endif - case AUDIO_CONFIG_BINAURAL_ROOM_IR: - return AUDIO_CONFIG_BINAURAL_ROOM_IR; - case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - return AUDIO_CONFIG_BINAURAL_ROOM_REVERB; - case AUDIO_CONFIG_MASA1: - return AUDIO_CONFIG_MASA1; - case AUDIO_CONFIG_MASA2: - return AUDIO_CONFIG_MASA2; - default: - break; - } - - return AUDIO_CONFIG_INVALID; -} - -/*-------------------------------------------------------------------* - * getRendAudioConfigFromIvasAudioConfig() - * - * - *-------------------------------------------------------------------*/ - -IVAS_AUDIO_CONFIG getRendAudioConfigFromIvasAudioConfig( - const AUDIO_CONFIG config ) -{ - switch ( config ) - { - case AUDIO_CONFIG_MONO: - return AUDIO_CONFIG_MONO; - case AUDIO_CONFIG_STEREO: - return AUDIO_CONFIG_STEREO; - case AUDIO_CONFIG_BINAURAL: - return AUDIO_CONFIG_BINAURAL; -#ifdef SPLIT_REND_WITH_HEAD_ROT - case AUDIO_CONFIG_BINAURAL_SPLIT_CODED: - return AUDIO_CONFIG_BINAURAL_SPLIT_CODED; - case AUDIO_CONFIG_BINAURAL_SPLIT_PCM: - return AUDIO_CONFIG_BINAURAL_SPLIT_PCM; -#endif - case AUDIO_CONFIG_BINAURAL_ROOM_IR: - return AUDIO_CONFIG_BINAURAL_ROOM_IR; - case AUDIO_CONFIG_BINAURAL_ROOM_REVERB: - return AUDIO_CONFIG_BINAURAL_ROOM_REVERB; - case AUDIO_CONFIG_5_1: - return AUDIO_CONFIG_5_1; - case AUDIO_CONFIG_7_1: - return AUDIO_CONFIG_7_1; - case AUDIO_CONFIG_5_1_2: - return AUDIO_CONFIG_5_1_2; - case AUDIO_CONFIG_5_1_4: - return AUDIO_CONFIG_5_1_4; - case AUDIO_CONFIG_7_1_4: - return AUDIO_CONFIG_7_1_4; - case AUDIO_CONFIG_FOA: - return AUDIO_CONFIG_FOA; - case AUDIO_CONFIG_HOA2: - return AUDIO_CONFIG_HOA2; - case AUDIO_CONFIG_HOA3: - return AUDIO_CONFIG_HOA3; - default: - break; - } - return AUDIO_CONFIG_INVALID; -} - /*-------------------------------------------------------------------* * validateOutputAudioConfig() * @@ -648,7 +541,7 @@ IVAS_AUDIO_CONFIG getRendAudioConfigFromIvasAudioConfig( *-------------------------------------------------------------------*/ static ivas_error validateOutputAudioConfig( - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { switch ( outConfig ) { @@ -686,12 +579,10 @@ static ivas_error validateOutputAudioConfig( *-------------------------------------------------------------------*/ IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_AUDIO_CONFIG config ) + const AUDIO_CONFIG config ) { IVAS_REND_AudioConfigType type; - type = IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN; - switch ( config ) { case AUDIO_CONFIG_MONO: @@ -723,6 +614,9 @@ IVAS_REND_AudioConfigType getAudioConfigType( case AUDIO_CONFIG_MASA2: type = IVAS_REND_AUDIO_CONFIG_TYPE_MASA; break; + default: + type = IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN; + break; } return type; @@ -737,7 +631,7 @@ IVAS_REND_AudioConfigType getAudioConfigType( static ivas_error validateOutputSampleRate( const int32_t sampleRate, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { if ( getAudioConfigType( outConfig ) != IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) { @@ -766,7 +660,7 @@ static ivas_error validateOutputSampleRate( *-------------------------------------------------------------------*/ ivas_error getAudioConfigNumChannels( - const IVAS_AUDIO_CONFIG config, + const AUDIO_CONFIG config, int16_t *numChannels ) { switch ( config ) @@ -868,7 +762,7 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( } static ivas_error getSpeakerAzimuths( - IVAS_AUDIO_CONFIG config, + AUDIO_CONFIG config, const float **azimuths ) { switch ( config ) @@ -902,7 +796,7 @@ static ivas_error getSpeakerAzimuths( } static ivas_error getSpeakerElevations( - IVAS_AUDIO_CONFIG config, + AUDIO_CONFIG config, const float **elevations ) { switch ( config ) @@ -936,7 +830,7 @@ static ivas_error getSpeakerElevations( } static ivas_error getAmbisonicsOrder( - IVAS_AUDIO_CONFIG config, + AUDIO_CONFIG config, int16_t *order ) { switch ( config ) @@ -978,7 +872,7 @@ static int16_t getNumLfeChannels( } static ivas_error getNumNonLfeChannelsInSpeakerLayout( - IVAS_AUDIO_CONFIG config, + AUDIO_CONFIG config, int16_t *numNonLfeChannels ) { switch ( config ) @@ -1010,7 +904,7 @@ static ivas_error getNumNonLfeChannelsInSpeakerLayout( } static ivas_error getMcConfigValues( - IVAS_AUDIO_CONFIG inConfig, + AUDIO_CONFIG inConfig, LSSETUP_CUSTOM_STRUCT inCustomLs, const float **azimuth, const float **elevation, @@ -1064,7 +958,7 @@ static ivas_error getMcConfigValues( static ivas_error initEfap( EFAP_WRAPPER *pEfapWrapper, - IVAS_AUDIO_CONFIG outConfig, + AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *pCustomLsOut ) { ivas_error error; @@ -1274,7 +1168,7 @@ static void initRotGains( static void initRendInputBase( input_base *inputBase, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, const rendering_context rendCtx, float *dataBuf, @@ -1368,8 +1262,8 @@ static CREND_WRAPPER defaultCrendWrapper( } static bool isIoConfigPairSupported( - IVAS_AUDIO_CONFIG inConfig, - IVAS_AUDIO_CONFIG outConfig ) + AUDIO_CONFIG inConfig, + AUDIO_CONFIG outConfig ) { /* Rendering mono or stereo to binaural is not supported */ if ( ( inConfig == AUDIO_CONFIG_MONO || inConfig == AUDIO_CONFIG_STEREO ) && @@ -1411,13 +1305,13 @@ static ivas_error initIsmMasaRendering( static ivas_error setRendInputActiveIsm( void *input, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_AUDIO_CONFIG outConfig; + AUDIO_CONFIG outConfig; input_ism *inputIsm; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t i; @@ -1461,7 +1355,7 @@ static ivas_error setRendInputActiveIsm( #endif { #ifndef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; @@ -1489,7 +1383,7 @@ static ivas_error setRendInputActiveIsm( } if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -1502,15 +1396,14 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) { return error; } } else if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_IR ) { - if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, - NULL, *rendCtx.pOutSampleRate + if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses @@ -1631,13 +1524,13 @@ static ivas_error initMcPanGainsWithIdentMatrix( static ivas_error initMcPanGainsWithConversionMapping( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { AUDIO_CONFIG ivasConfigIn, ivasConfigOut; int16_t i; - ivasConfigIn = getIvasAudioConfigFromRendAudioConfig( inputMc->base.inConfig ); - ivasConfigOut = getIvasAudioConfigFromRendAudioConfig( outConfig ); + ivasConfigIn = inputMc->base.inConfig; + ivasConfigOut = outConfig; /* Find conversion mapping for current I/O config pair. * Stay with default panning matrix if conversion_matrix is NULL */ @@ -1665,7 +1558,7 @@ static ivas_error initMcPanGainsWithConversionMapping( static ivas_error initMcPanGainsWithEfap( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { int16_t i; int16_t numNonLfeInChannels; @@ -1863,9 +1756,9 @@ static ivas_error initMcPanGainsWithStereoLookup( /* Returns 1 (true) if configs A and B are equal, otherwise returns 0 (false). * If both configs are custom LS layouts, layout details are compared to determine equality. */ static bool configsAreEqual( - const IVAS_AUDIO_CONFIG configA, + const AUDIO_CONFIG configA, const LSSETUP_CUSTOM_STRUCT customLsA, - const IVAS_AUDIO_CONFIG configB, + const AUDIO_CONFIG configB, const LSSETUP_CUSTOM_STRUCT customLsB ) { int16_t i; @@ -1914,7 +1807,7 @@ static bool configsAreEqual( static ivas_error updateLfePanGainsForMcOut( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { int16_t i, numLfeIn, numOutChannels; ivas_error error; @@ -1963,7 +1856,7 @@ static ivas_error updateLfePanGainsForMcOut( static ivas_error updateLfePanGainsForAmbiOut( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { int16_t i; int16_t numLfeIn, outAmbiOrder; @@ -2003,7 +1896,7 @@ static ivas_error updateLfePanGainsForAmbiOut( static ivas_error updateMcPanGainsForMcOut( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; @@ -2065,7 +1958,7 @@ static ivas_error updateMcPanGainsForMcOut( static ivas_error updateMcPanGainsForAmbiOut( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { int16_t ch_in, ch_out, lfeIdx; int16_t numNonLfeInChannels, outAmbiOrder; @@ -2135,7 +2028,7 @@ static ivas_error updateMcPanGainsForAmbiOut( static ivas_error updateMcPanGains( input_mc *inputMc, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { int16_t i; ivas_error error; @@ -2201,8 +2094,8 @@ static ivas_error updateMcPanGains( static ivas_error initMcBinauralRendering( input_mc *inputMc, - const IVAS_AUDIO_CONFIG inConfig, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; @@ -2300,7 +2193,7 @@ static ivas_error initMcBinauralRendering( #endif if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -2308,8 +2201,7 @@ static ivas_error initMcBinauralRendering( } { - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, - NULL, outSampleRate + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , ( ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 @@ -2346,7 +2238,7 @@ static ivas_error initMcBinauralRendering( static ivas_error initMcMasaRendering( input_mc *inputMc, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, int32_t inSampleRate ) { ivas_error error; @@ -2377,9 +2269,9 @@ static ivas_error initMcMasaRendering( } static lfe_routing defaultLfeRouting( - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const LSSETUP_CUSTOM_STRUCT customLsIn, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT customLsOut ) { int16_t i; @@ -2436,7 +2328,7 @@ static lfe_routing defaultLfeRouting( static ivas_error setRendInputActiveMc( void *input, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { @@ -2445,7 +2337,7 @@ static ivas_error setRendInputActiveMc( #endif ivas_error error; rendering_context rendCtx; - IVAS_AUDIO_CONFIG outConfig; + AUDIO_CONFIG outConfig; input_mc *inputMc; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; @@ -2581,7 +2473,7 @@ static void clearInputMc( static ivas_error initSbaPanGainsForMcOut( input_sba *inputSba, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const LSSETUP_CUSTOM_STRUCT *outSetupCustom ) { int16_t ambiOrderIn; @@ -2606,7 +2498,7 @@ static ivas_error initSbaPanGainsForMcOut( case AUDIO_CONFIG_MONO: hOutSetup.ls_azimuth = ls_azimuth_CICP1; hOutSetup.ls_elevation = ls_elevation_CICP1; - ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); + ivas_output_init( &hOutSetup, outConfig ); break; case AUDIO_CONFIG_STEREO: case AUDIO_CONFIG_5_1: @@ -2614,7 +2506,7 @@ static ivas_error initSbaPanGainsForMcOut( case AUDIO_CONFIG_5_1_2: case AUDIO_CONFIG_5_1_4: case AUDIO_CONFIG_7_1_4: - ivas_output_init( &hOutSetup, getIvasAudioConfigFromRendAudioConfig( outConfig ) ); + ivas_output_init( &hOutSetup, outConfig ); break; case AUDIO_CONFIG_LS_CUSTOM: ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); @@ -2651,7 +2543,7 @@ static ivas_error initSbaPanGainsForMcOut( static ivas_error initSbaPanGainsForSbaOut( input_sba *inputSba, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; error = IVAS_ERR_OK; @@ -2671,7 +2563,7 @@ static ivas_error initSbaPanGainsForSbaOut( static ivas_error updateSplitPostRendPanGains( input_split_post_rend *inputSplitPostRend, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; @@ -2699,11 +2591,11 @@ updateSplitPostRendPanGains( static ivas_error updateSbaPanGains( input_sba *inputSba, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; - IVAS_AUDIO_CONFIG inConfig; + AUDIO_CONFIG inConfig; rendering_context rendCtx; /* Reset to all zeros - some functions below only write non-zero elements. */ @@ -2758,9 +2650,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hRendCfg->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { - error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, - &rendCtx.pSplitRendWrapper->multiBinPoseData, - *rendCtx.pOutSampleRate ); + error = ivas_rend_openCldfbRend( &inputSba->cldfbRendWrapper, inConfig, outConfig, &rendCtx.pSplitRendWrapper->multiBinPoseData, *rendCtx.pOutSampleRate ); if ( error != IVAS_ERR_OK ) { return error; @@ -2769,12 +2659,7 @@ static ivas_error updateSbaPanGains( else #endif { - error = ivas_rend_openCrend( &inputSba->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - hRendCfg, - NULL, - *rendCtx.pOutSampleRate + error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses @@ -2789,12 +2674,7 @@ static ivas_error updateSbaPanGains( return error; } - error = ivas_rend_openCrend( &inputSba->crendWrapper, - AUDIO_CONFIG_7_1_4, - getIvasAudioConfigFromRendAudioConfig( outConfig ), - hRendCfg, - NULL, - *rendCtx.pOutSampleRate + error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses @@ -2823,13 +2703,13 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error setRendInputActiveSplitPostRend( void *input, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_AUDIO_CONFIG outConfig; + AUDIO_CONFIG outConfig; input_split_post_rend *inputSplitPostRend; inputSplitPostRend = (input_split_post_rend *) input; @@ -2874,13 +2754,13 @@ static ivas_error initSbaMasaRendering( static ivas_error setRendInputActiveSba( void *input, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) { ivas_error error; rendering_context rendCtx; - IVAS_AUDIO_CONFIG outConfig; + AUDIO_CONFIG outConfig; input_sba *inputSba; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx; @@ -2994,29 +2874,27 @@ static void clearInputSba( static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; int16_t numCldfbAnalyses; int16_t numCldfbSyntheses; int16_t i; - AUDIO_CONFIG output_config; DecoderDummy *decDummy; decDummy = inputMasa->decDummy; - output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); - decDummy->hDecoderConfig->output_config = output_config; + decDummy->hDecoderConfig->output_config = outConfig; decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ - ivas_output_init( &( decDummy->hOutSetup ), output_config ); - ivas_output_init( &( decDummy->hIntSetup ), output_config ); + ivas_output_init( &( decDummy->hOutSetup ), outConfig ); + ivas_output_init( &( decDummy->hIntSetup ), outConfig ); decDummy->renderer_type = RENDERER_DIRAC; - if ( output_config == AUDIO_CONFIG_STEREO ) + if ( outConfig == AUDIO_CONFIG_STEREO ) { decDummy->renderer_type = RENDERER_STEREO_PARAMETRIC; } @@ -3077,27 +2955,25 @@ static ivas_error initMasaDummyDecForMcOut( static ivas_error initMasaDummyDecForSbaOut( input_masa *inputMasa, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; int16_t numCldfbAnalyses; int16_t numCldfbSyntheses; int16_t i; - AUDIO_CONFIG output_config; DecoderDummy *decDummy; decDummy = inputMasa->decDummy; - output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); - decDummy->hDecoderConfig->output_config = output_config; + decDummy->hDecoderConfig->output_config = outConfig; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ decDummy->sba_analysis_order = 1; - ivas_output_init( &( decDummy->hOutSetup ), output_config ); - ivas_output_init( &( decDummy->hIntSetup ), output_config ); + ivas_output_init( &( decDummy->hOutSetup ), outConfig ); + ivas_output_init( &( decDummy->hIntSetup ), outConfig ); decDummy->renderer_type = RENDERER_DIRAC; decDummy->ivas_format = MASA_FORMAT; decDummy->transport_config = AUDIO_CONFIG_INVALID; @@ -3147,30 +3023,23 @@ static ivas_error initMasaDummyDecForSbaOut( static ivas_error initMasaDummyDecForBinauralOut( input_masa *inputMasa, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; - int16_t i; - AUDIO_CONFIG output_config; DecoderDummy *decDummy; decDummy = inputMasa->decDummy; - - output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); - decDummy->hDecoderConfig->output_config = output_config; - - output_config = decDummy->hDecoderConfig->output_config; - + decDummy->hDecoderConfig->output_config = outConfig; decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ - ivas_output_init( &( decDummy->hOutSetup ), output_config ); - if ( output_config == AUDIO_CONFIG_BINAURAL + ivas_output_init( &( decDummy->hOutSetup ), outConfig ); + if ( outConfig == AUDIO_CONFIG_BINAURAL #ifdef SPLIT_REND_WITH_HEAD_ROT - || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM + || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == AUDIO_CONFIG_BINAURAL_SPLIT_PCM #endif ) { @@ -3222,7 +3091,7 @@ static ivas_error initMasaDummyDecForBinauralOut( static ivas_error updateMasaDummyDec( input_masa *inputMasa, - const IVAS_AUDIO_CONFIG outConfig ) + const AUDIO_CONFIG outConfig ) { ivas_error error; @@ -3247,7 +3116,7 @@ static ivas_error updateMasaDummyDec( static DecoderDummy *initDecoderDummy( const int32_t sampleRate, const int16_t numTransChannels, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const uint8_t enableRenderConfig #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -3314,7 +3183,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData = NULL; decDummy->hDirAC = NULL; decDummy->hTcBuffer = NULL; - decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); + decDummy->hDecoderConfig->output_config = outConfig; decDummy->nchan_transport = numTransChannels; if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) @@ -3383,13 +3252,13 @@ static DecoderDummy *initDecoderDummy( static ivas_error setRendInputActiveMasa( void *input, - const IVAS_AUDIO_CONFIG inConfig, + const AUDIO_CONFIG inConfig, const IVAS_REND_InputId id, RENDER_CONFIG_DATA *hRendCfg ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */ { ivas_error error; rendering_context rendCtx; - IVAS_AUDIO_CONFIG outConfig; + AUDIO_CONFIG outConfig; input_masa *inputMasa; int16_t numInChannels; @@ -3557,7 +3426,7 @@ static void clearInputMasa( } #ifdef SPLIT_REND_WITH_HEAD_ROT -static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_AUDIO_CONFIG outConfig, const int16_t cldfb_in ) +static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, const IVAS_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, const int16_t cldfb_in ) { ivas_error error; IVAS_REND_AudioBufferConfig bufConfig; @@ -3613,7 +3482,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const int16_t nonDiegeticPan, const float nonDiegeticPanGain ) { @@ -3955,7 +3824,7 @@ ivas_error IVAS_REND_NumOutChannels( } static IVAS_REND_InputId makeInputId( - IVAS_AUDIO_CONFIG config, + AUDIO_CONFIG config, const int32_t inputIndex ) { /* Put config type in second byte (from LSB), put index + 1 in first byte @@ -4173,16 +4042,16 @@ static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_Aud *-------------------------------------------------------------------*/ ivas_error IVAS_REND_AddInput( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ - IVAS_REND_InputId *inputId /* o : ID of the new input */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + IVAS_REND_InputId *inputId /* o : ID of the new input */ ) { ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; int32_t inputStructSize; - ivas_error ( *activateInput )( void *, IVAS_AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); + ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * ); int32_t inputIndex; /* Validate function arguments */ @@ -4907,8 +4776,8 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ) { ivas_error error; @@ -5496,7 +5365,7 @@ static void renderBufferChannel( static ivas_error rotateFrameMc( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_AUDIO_CONFIG inConfig, /* i : Input Audio config */ + AUDIO_CONFIG inConfig, /* i : Input Audio config */ LSSETUP_CUSTOM_STRUCT inCustomLs, /* i : Input Custom LS setup */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ @@ -5633,7 +5502,7 @@ static ivas_error rotateFrameMc( static ivas_error rotateFrameSba( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - IVAS_AUDIO_CONFIG inConfig, /* i : Input Audio config */ + AUDIO_CONFIG inConfig, /* i : Input Audio config */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ @@ -6040,7 +5909,7 @@ static ivas_error renderIsmToMc( static ivas_error renderIsmToSba( const input_ism *ismInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { int16_t ambiOrderOut; @@ -6266,7 +6135,7 @@ static ivas_error renderIsmToMasa( static ivas_error renderInputIsm( input_ism *ismInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, const IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -6358,7 +6227,7 @@ static ivas_error renderActiveInputsIsm( static ivas_error renderLfeToBinaural( const input_mc *mcInput, #ifdef SPLIT_REND_WITH_HEAD_ROT - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, #endif IVAS_REND_AudioBuffer outAudio ) { @@ -6485,11 +6354,11 @@ static ivas_error renderLfeToBinaural( static ivas_error renderMcToBinaural( input_mc *mcInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - IVAS_AUDIO_CONFIG inConfig; + AUDIO_CONFIG inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; @@ -6569,8 +6438,7 @@ static ivas_error renderMcToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -6601,11 +6469,11 @@ static ivas_error renderMcToBinaural( static ivas_error renderMcToBinauralRoom( input_mc *mcInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; - IVAS_AUDIO_CONFIG inConfig; + AUDIO_CONFIG inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; @@ -6682,8 +6550,7 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -6712,7 +6579,7 @@ static ivas_error renderMcToBinauralRoom( static ivas_error renderMcCustomLsToBinauralRoom( input_mc *mcInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i; @@ -6790,7 +6657,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , @@ -6885,7 +6752,7 @@ static ivas_error renderMcToMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderMcToSplitBinaural( input_mc *mcInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i, j, sf, pos_idx; @@ -6896,7 +6763,7 @@ static ivas_error renderMcToSplitBinaural( float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; float tmpSplitBinauralBuffer[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k]; - IVAS_AUDIO_CONFIG inConfig; + AUDIO_CONFIG inConfig; IVAS_REND_AudioBuffer tmpRotBuffer; COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; @@ -7024,16 +6891,7 @@ static ivas_error renderMcToSplitBinaural( copyBufferTo2dArray( tmpRotBuffer, tmpRendBuffer ); /* call CREND (rotation already performed) */ - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, - getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), - getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, - NULL, - NULL, - NULL, - p_tmpRendBuffer, - *mcInput->base.ctx.pOutSampleRate, - pos_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -7072,7 +6930,7 @@ static ivas_error renderMcToSplitBinaural( static ivas_error renderInputMc( input_mc *mcInput, - IVAS_AUDIO_CONFIG outConfig, + AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -7422,7 +7280,7 @@ static ivas_error renderSplitBinauralWithPostRot( static ivas_error renderSbaToMultiBinaural( input_sba *sbaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, float out[][L_FRAME48k] ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7431,11 +7289,10 @@ static ivas_error renderSbaToMultiBinaural( int16_t sf, i, j, pos_idx; COMBINED_ORIENTATION_DATA combinedOrientationDataLocal; COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal; - - ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData; + for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; @@ -7496,11 +7353,7 @@ static ivas_error renderSbaToMultiBinaural( assert( sbaInput->crendWrapper->hCrend[0]->hReverb == NULL ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, - *sbaInput->base.ctx.pOutSampleRate, - pos_idx ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, pos_idx ) ) != IVAS_ERR_OK ) { return error; } @@ -7524,10 +7377,11 @@ static ivas_error renderSbaToMultiBinaural( return IVAS_ERR_OK; } -static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, - float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t low_res_pre_rend_rot ) +static ivas_error renderSbaToMultiBinauralCldfb( + input_sba *sbaInput, + float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t low_res_pre_rend_rot ) { float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -7548,7 +7402,7 @@ static ivas_error renderSbaToMultiBinauralCldfb( input_sba *sbaInput, static ivas_error renderSbaToSplitBinaural( input_sba *sbaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7588,7 +7442,7 @@ static ivas_error renderSbaToSplitBinaural( static ivas_error renderSbaToBinaural( input_sba *sbaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; @@ -7668,8 +7522,7 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -7689,7 +7542,7 @@ static ivas_error renderSbaToBinaural( static ivas_error renderSbaToBinauralRoom( input_sba *sbaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { int16_t i; @@ -7770,8 +7623,7 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT , 0 @@ -7797,7 +7649,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderInputSplitBin( input_split_post_rend *splitBinInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio, IVAS_REND_BitstreamBuffer *hBits, const int16_t SplitRendBFI ) @@ -7853,7 +7705,7 @@ static ivas_error renderSbaToMasa( static ivas_error renderInputSba( input_sba *sbaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -8220,7 +8072,7 @@ static void renderMasaToMasa( static ivas_error renderInputMasa( input_masa *masaInput, - const IVAS_AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { IVAS_REND_AudioBuffer inAudio; @@ -8707,7 +8559,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_rend/lib_rend.h b/lib_rend/lib_rend.h index e18b7ec39f..8300893aed 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -111,7 +111,7 @@ typedef uint16_t IVAS_REND_InputId; ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ const int32_t outputSampleRate, /* i : output sampling rate */ - const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const AUDIO_CONFIG outConfig, /* i : output audio config */ const int16_t nonDiegeticPan, /* i : non-diegetic object flag */ const float nonDiegeticPanGain /* i : non-diegetic panning gain */ ); @@ -132,7 +132,7 @@ ivas_error IVAS_REND_NumOutChannels( ivas_error IVAS_REND_AddInput( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_AUDIO_CONFIG inConfig, /* i : audio config for a new input */ + const AUDIO_CONFIG inConfig, /* i : audio config for a new input */ IVAS_REND_InputId *inputId /* o : ID of the new input */ ); @@ -208,7 +208,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ + const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ); int16_t IVAS_REND_GetRenderConfig( -- GitLab From 6d4be00615b424fc75a4f3bf06d38566ef14b63b Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 4 Aug 2023 13:21:07 +0200 Subject: [PATCH 09/26] addition of "goto cleanup;" --- apps/decoder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 5f1844ae12..af4a13baa1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -675,6 +675,7 @@ int main( if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfFileName ); + goto cleanup; } IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL; @@ -687,6 +688,7 @@ int main( if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfFileName ); + goto cleanup; } } -- GitLab From 37be0604388c84d4c9d7e757dffd2c6ba6224bc5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 8 Aug 2023 10:08:09 +0200 Subject: [PATCH 10/26] define local functions as "static" + correct comments --- lib_dec/lib_dec.c | 49 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index cc675bfc5b..6715d6fa4b 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -97,7 +97,7 @@ struct IVAS_DEC /*---------------------------------------------------------------------* - * Local functions + * Local function declarations *---------------------------------------------------------------------*/ static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); @@ -107,14 +107,8 @@ static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, c static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); 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 ); -static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); -static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); 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, uint8_t *nOutChannels, uint16_t *nSamplesRendered, int16_t *data ); -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, int16_t *pcmBuf ); -static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); + /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -180,6 +174,7 @@ ivas_error IVAS_DEC_Open( /* initialize Decoder Config. handle */ init_decoder_config( hIvasDec->st_ivas->hDecoderConfig ); + /* initialize pointers to handles to NULL */ ivas_initialize_handles_dec( st_ivas ); @@ -872,7 +867,7 @@ ivas_error IVAS_DEC_GetSamples( /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * - * Main function to decode to PCM data of the transport channels + * *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_Setup( @@ -940,7 +935,7 @@ static ivas_error IVAS_DEC_Setup( * Main function to decode to PCM data of the transport channels *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_GetTcSamples( +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 */ @@ -992,7 +987,7 @@ ivas_error IVAS_DEC_GetTcSamples( * Main function to decode to PCM data of the transport channels *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_RendererFeedTcSamples( +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 */ @@ -1024,10 +1019,10 @@ ivas_error IVAS_DEC_RendererFeedTcSamples( /*---------------------------------------------------------------------* * IVAS_DEC_GetRenderedSamples( ) * - * Main function to decode to PCM data of the transport channels + * Main function to render the transport channels to PCM output datat *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_GetRenderedSamples( +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 */ @@ -1057,7 +1052,14 @@ ivas_error IVAS_DEC_GetRenderedSamples( return error; } -ivas_error IVAS_DEC_GetBufferedNumberOfSamples( + +/*---------------------------------------------------------------------* + * 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 */ ) @@ -1279,6 +1281,7 @@ ivas_error IVAS_DEC_GetMasaMetadata( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedHeadTrackData( ) * @@ -1341,6 +1344,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefRotData( ) * @@ -1369,6 +1373,7 @@ ivas_error IVAS_DEC_FeedRefRotData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedRefVectorData( ) * @@ -1379,8 +1384,8 @@ ivas_error IVAS_DEC_FeedRefRotData( ivas_error IVAS_DEC_FeedRefVectorData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const IVAS_VECTOR3 listenerPos, /* i : Listener position */ - const IVAS_VECTOR3 refPos /* i : Reference position */ + const IVAS_VECTOR3 listenerPos, /* i : Listener position */ + const IVAS_VECTOR3 refPos /* i : Reference position */ ) { ivas_orient_trk_state_t *pOtr; @@ -1391,9 +1396,11 @@ ivas_error IVAS_DEC_FeedRefVectorData( } pOtr = hIvasDec->st_ivas->hHeadTrackData->OrientationTracker; + return ivas_orient_trk_SetReferenceVector( pOtr, listenerPos, refPos ); } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedExternalOrientationData( ) * @@ -1438,6 +1445,7 @@ ivas_error IVAS_DEC_FeedExternalOrientationData( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_DEC_FeedCustomLsData( ) * @@ -3169,6 +3177,13 @@ ivas_error IVAS_DEC_GetSbaDebugParams( #endif /* DEBUGGING */ + +/*---------------------------------------------------------------------* + * input_format_API_to_internal() + * + * + *---------------------------------------------------------------------*/ + static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, @@ -3249,7 +3264,7 @@ static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( * *---------------------------------------------------------------------*/ -ivas_error IVAS_DEC_VoIP_reconfigure( +static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ) -- GitLab From e858538dccb0fd98b90d2bf0802cce732fc54d21 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 8 Aug 2023 10:45:57 +0200 Subject: [PATCH 11/26] clang-format --- lib_dec/lib_dec.c | 2 +- lib_rend/lib_rend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6715d6fa4b..be759fb589 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -867,7 +867,7 @@ ivas_error IVAS_DEC_GetSamples( /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * - * + * *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_Setup( diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 919ab12ef6..4495c379e7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8671,7 +8671,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 87582869c351f78faa1736f3a8d9242db363e84d Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 9 Aug 2023 18:22:12 +0200 Subject: [PATCH 12/26] 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 9adb2dab63..7f2ed3d34c 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8709,7 +8709,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 a51f6ec6ed5eb9533b717d0c8124feca342c6289 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 10 Aug 2023 21:02:31 +0200 Subject: [PATCH 13/26] correct variable name --- apps/decoder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 94c396e771..595ca6a714 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -142,6 +142,7 @@ typedef struct #endif #ifdef DEBUG_JBM_CMD_OPTION bool noBadFrameDelay; + uint16_t frontendFetchSizeMs; #endif #ifdef VARIABLE_SPEED_DECODING bool variableSpeedMode; @@ -149,11 +150,7 @@ typedef struct char *tsmScaleFileName; uint16_t tsmScale; #endif -#ifdef DEBUG_JBM_CMD_OPTION - uint16_t frontendFetchSizeMs; -#endif #endif - #ifdef CONTROL_METADATA_REVERB uint16_t acousticEnvironmentId; #ifdef CONTROL_METADATA_DIRECTIVITY @@ -169,6 +166,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, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, @@ -177,6 +175,7 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotF #endif IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); + static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING @@ -626,7 +625,7 @@ int main( #endif #ifdef CONTROL_METADATA_REVERB - if ( arg.outputFormat == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) + if ( arg.outputConfig == IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB ) { if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.room_acoustics ) ) == IVAS_ERR_OK ) { @@ -644,6 +643,7 @@ int main( renderConfig.room_acoustics.override = true; } #endif + if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); -- GitLab From 0d4d1ed93778e4b5ec7cf13cffc8879039bd9081 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 11 Aug 2023 16:23:09 +0200 Subject: [PATCH 14/26] formal improvements within EARLY_REFLECTIONS --- lib_com/common_api_types.h | 2 + lib_com/ivas_cnst.h | 1 + lib_rend/ivas_crend.c | 29 +++++---- lib_rend/ivas_prot_rend.h | 56 +++++++++-------- lib_rend/ivas_reflections.c | 116 ++++++++++++++++++------------------ lib_rend/ivas_rotation.c | 5 ++ lib_rend/ivas_shoebox.c | 60 +++++++++++++------ lib_rend/ivas_stat_rend.h | 2 + 8 files changed, 153 insertions(+), 118 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index dc93a0fe43..6f1958c923 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -222,6 +222,8 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG float pAcoustic_dsr[IVAS_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] */ + + /* early reflections */ #ifdef EARLY_REFLECTIONS int16_t use_er; /* ER activation flag */ int32_t lowComplexity; /* Low complexity ER flag */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 67f7a782ca..ab2c38715e 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1884,6 +1884,7 @@ typedef enum /*----------------------------------------------------------------------------------* * Early Reflection constants *----------------------------------------------------------------------------------*/ + #define ER_ABS_COEFF 6 #define ER_MAX_SOURCES 25 #define ER_REF_ORDER 1 diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 886a5caee8..5424d12b26 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -892,6 +892,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } + #ifdef EARLY_REFLECTIONS /*------------------------------------------------------------------------- * ivas_shoebox_data_init() @@ -922,6 +923,7 @@ static ivas_error ivas_shoebox_data_init( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_shoebox_output_init() * @@ -948,13 +950,14 @@ static ivas_error ivas_shoebox_output_init( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_shoebox_config_init() * * Initialize shoebox_config_t handle *------------------------------------------------------------------------*/ -static ivas_error ivas_shoebox_config_init( +static ivas_error ivas_shoebox_config_init_params( shoebox_config_t *hShoeboxConfig /* i/o: shoebox_config_t handle */ ) { @@ -981,6 +984,7 @@ static ivas_error ivas_shoebox_config_init( return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- * ivas_shoebox_obj_init() * @@ -1025,18 +1029,19 @@ static ivas_error ivas_shoebox_obj_init( hShoeboxObj->soundspeed = 0.0f; hShoeboxObj->air_coeff = 0.0f; - ivas_shoebox_config_init( &hShoeboxObj->cal ); + ivas_shoebox_config_init_params( &hShoeboxObj->cal ); return IVAS_ERR_OK; } + /*------------------------------------------------------------------------- - * ivas_er_init() + * ivas_er_init_handle() * * Initialize early reflections handle *------------------------------------------------------------------------*/ -static ivas_error ivas_er_init( +static ivas_error ivas_er_init_handle( er_struct_t *reflections /* i/o: early reflections handle */ ) { @@ -1081,6 +1086,7 @@ static ivas_error ivas_er_init( } #endif + /*------------------------------------------------------------------------- * ivas_rend_initCrendWrapper() * @@ -1331,7 +1337,7 @@ ivas_error ivas_rend_openCrend( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections" ); } - ivas_er_init( hCrend->reflections ); + ivas_er_init_handle( hCrend->reflections ); hCrend->reflections->use_er = hRendCfg->roomAcoustics.use_er; hCrend->reflections->lowComplexity = hRendCfg->roomAcoustics.lowComplexity; @@ -1340,10 +1346,10 @@ ivas_error ivas_rend_openCrend( hCrend->reflections->max_frame_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ); /* Init Shoebox */ - shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg ); + ivas_shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg ); /* Init and compute Reflections */ - if ( ( error = er_init( hCrend->reflections, inConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_init( hCrend->reflections, inConfig ) ) != IVAS_ERR_OK ) { return error; }; @@ -1367,6 +1373,7 @@ ivas_error ivas_rend_openCrend( ( *pCrend )->hCrend = hCrend; #endif } + return IVAS_ERR_OK; } @@ -1745,11 +1752,7 @@ ivas_error ivas_rend_crendProcess( { if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { - if ( ( error = er_process( hCrend->reflections, - subframe_len, - subframe_idx, - output, - inConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output, inConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -1920,7 +1923,7 @@ ivas_error ivas_rend_crendProcessSubframe( { if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 ) { - if ( ( error = er_process( hCrend->reflections, subframe_len, subframe_idx, output, inConfig ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output, inConfig ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index dbc491c8ab..dac316a8df 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1203,60 +1203,54 @@ void ivas_reverb_get_hrtf_set_properties( * Shoebox Prototypes *-----------------------------------------------------------------------------------*/ -void shoebox_config_init( +void ivas_shoebox_config_init( shoebox_config_t *cal, RENDER_CONFIG_HANDLE pConfig ); -void shoebox_get_config( - const shoebox_obj_t *obj, - shoebox_config_t *s -); - -void shoebox_init( +void ivas_shoebox_init( shoebox_obj_t *obj, shoebox_config_t *cal ); -void shoebox_set_scene ( +void ivas_shoebox_set_scene ( shoebox_obj_t *obj, shoebox_output_t *ER_PARAMS, const float list_pos[3], const float src_pos_data[], - uint16_t isCartesian, - uint16_t isRelative + const uint16_t isCartesian, + const uint16_t isRelative ); -#endif -#ifdef EARLY_REFLECTIONS + /*---------------------------------------------------------------------------------* - * Reflections compute and process Prototypes + * Early reflections prototypes *-----------------------------------------------------------------------------------*/ -ivas_error er_init( +ivas_error ivas_er_init( er_struct_t *reflections, - AUDIO_CONFIG inConfig + const AUDIO_CONFIG inConfig ); -ivas_error er_set_reflections_mode( +ivas_error ivas_er_set_reflections_mode( er_struct_t *reflections, - AUDIO_CONFIG mode + const AUDIO_CONFIG inConfig ); -ivas_error er_compute_reflections( +ivas_error ivas_er_compute_reflections( er_struct_t *reflections ); -ivas_error er_encoder_init( +ivas_error ivas_er_encoder_init( er_struct_t *reflections ); -ivas_error er_process( +ivas_error ivas_er_process( er_struct_t *reflections, - int16_t frame_size, - int16_t subframe_idx, + const int16_t frame_size, + const int16_t subframe_idx, float **io, - AUDIO_CONFIG inConfig + const AUDIO_CONFIG inConfig ); #endif @@ -1280,10 +1274,14 @@ void Euler2Quat( IVAS_QUATERNION *quat /* o : quaternion describing the rotation */ ); -float deg2rad( float degrees ); +float deg2rad( + float degrees +); #ifdef EARLY_REFLECTIONS -float rad2deg( float radians ); +float rad2deg( + float radians +); #endif void QuatToRotMat( @@ -1293,10 +1291,10 @@ void QuatToRotMat( #ifdef SPLIT_REND_WITH_HEAD_ROT void Quat2EulerDegree( - const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ - float *yaw, /* o : yaw */ - float *pitch, /* o : pitch */ - float *roll /* o : roll */ + const IVAS_QUATERNION quat, /* i : quaternion describing the rotation */ + float *yaw, /* o : yaw */ + float *pitch, /* o : pitch */ + float *roll /* o : roll */ ); #endif diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index d87f9d7ed9..6291676cdf 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -31,10 +31,8 @@ *******************************************************************************************************/ #include "options.h" - #ifdef EARLY_REFLECTIONS - -#include +#include #include #include "prot.h" #include "rom_dec.h" @@ -49,22 +47,31 @@ #include "debug.h" #endif -uint16_t LC_mixing_5_1[5] = { 0, 1, 2, 0, 1 }; -uint16_t LC_mixing_7_1[7] = { 0, 1, 2, 3, 4, 3, 4 }; -uint16_t LC_mixing_5_1_2[7] = { 0, 1, 2, 3, 4, 0, 1 }; -uint16_t LC_mixing_5_1_4[9] = { 0, 1, 2, 3, 4, 0, 1, 2, 3 }; -uint16_t LC_mixing_7_1_4[11] = { 0, 1, 2, 3, 4, 3, 4, 0, 1, 2, 3 }; /*-----------------------------------------------------------------------------------------* - * Function er_init + * Local constants/tabels + *-----------------------------------------------------------------------------------------*/ + +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 }; + +static uint16_t LC_mixing_5_1_2[7] = { 0, 1, 2, 3, 4, 0, 1 }; + +static uint16_t LC_mixing_5_1_4[9] = { 0, 1, 2, 3, 4, 0, 1, 2, 3 }; + +static uint16_t LC_mixing_7_1_4[11] = { 0, 1, 2, 3, 4, 3, 4, 0, 1, 2, 3 }; + + +/*-----------------------------------------------------------------------------------------* + * Function ivas_er_init() * * Initializes the reflections data structure according to the requested input config. *-----------------------------------------------------------------------------------------*/ - -ivas_error er_init( +ivas_error ivas_er_init( er_struct_t *reflections, - AUDIO_CONFIG mode ) + const AUDIO_CONFIG inConfig ) { ivas_error error; uint8_t i; @@ -86,22 +93,21 @@ ivas_error er_init( } /* Init Shoebox */ - shoebox_init( &reflections->shoebox_lib, &reflections->shoebox_lib.cal ); + ivas_shoebox_init( &reflections->shoebox_lib, &reflections->shoebox_lib.cal ); /* Set mode */ - if ( ( error = er_set_reflections_mode( reflections, mode ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_set_reflections_mode( reflections, inConfig ) ) != IVAS_ERR_OK ) { return error; } /* Compute the static reflections (first frame) */ - if ( ( error = er_compute_reflections( reflections ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_compute_reflections( reflections ) ) != IVAS_ERR_OK ) { return error; } - reflections->closest_ch_idx = (uint16_t *) malloc( reflections->n_total_reflections * sizeof( uint16_t ) ); - if ( !reflections->closest_ch_idx ) + if ( ( reflections->closest_ch_idx = (uint16_t *) malloc( reflections->n_total_reflections * sizeof( uint16_t ) ) ) == NULL ) { return IVAS_ERR_FAILED_ALLOC; } @@ -113,7 +119,7 @@ ivas_error er_init( } /* Initialize Encoder */ - if ( ( error = er_encoder_init( reflections ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_er_encoder_init( reflections ) ) != IVAS_ERR_OK ) { return error; } @@ -126,26 +132,26 @@ ivas_error er_init( /*-----------------------------------------------------------------------------------------* - Function er_set_reflections_mode + Function ivas_er_set_reflections_mode() Function sets the ER source positions based on the audio config *-----------------------------------------------------------------------------------------*/ -ivas_error er_set_reflections_mode( +ivas_error ivas_er_set_reflections_mode( er_struct_t *reflections, - AUDIO_CONFIG mode ) + const AUDIO_CONFIG inConfig ) { ivas_error error; uint16_t ch; error = IVAS_ERR_OK; - if ( reflections->mode == mode ) + if ( reflections->mode == inConfig ) { return error; } reflections->is_ready = 0; - reflections->mode = mode; + reflections->mode = inConfig; switch ( reflections->mode ) { @@ -242,12 +248,12 @@ ivas_error er_set_reflections_mode( /*-----------------------------------------------------------------------------------------* - Function er_encoder_init + Function ivas_er_encoder_init() Function that initializes the er encoder *-----------------------------------------------------------------------------------------*/ -ivas_error er_encoder_init( +ivas_error ivas_er_encoder_init( er_struct_t *reflections ) { ivas_error error = IVAS_ERR_OK; @@ -260,8 +266,7 @@ ivas_error er_encoder_init( if ( !reflections ) { - error = IVAS_ERR_FAILED_ALLOC; - return error; + return IVAS_ERR_FAILED_ALLOC; } if ( getAudioConfigType( reflections->mode ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) @@ -317,13 +322,13 @@ ivas_error er_encoder_init( /*-----------------------------------------------------------------------------------------* - Function er_compute_reflections + Function ivas_er_compute_reflections() Function computes reflections using the shoebox library and sets up the circular buffers structure for the early reflections process *-----------------------------------------------------------------------------------------*/ -ivas_error er_compute_reflections( +ivas_error ivas_er_compute_reflections( er_struct_t *reflections ) { ivas_error error = IVAS_ERR_OK; @@ -339,9 +344,9 @@ ivas_error er_compute_reflections( } /* Run shoebox with current reflection parameters */ - shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), - reflections->shoebox_lib.cal.list_orig, reflections->source_positions, - reflections->is_cartesian, reflections->is_relative ); + ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), + reflections->shoebox_lib.cal.list_orig, reflections->source_positions, + reflections->is_cartesian, reflections->is_relative ); /* Convert reflection times in seconds to samples and keep track of max */ circ_len = 0; @@ -349,9 +354,9 @@ ivas_error er_compute_reflections( { for ( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { - tmp = reflections->shoebox_data.times.data[j + ( i * (int) reflections->shoebox_data.n_ref )]; + tmp = reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )]; tmp = (float) round( tmp * reflections->output_Fs ); - reflections->shoebox_data.times.data[j + ( i * (int) reflections->shoebox_data.n_ref )] = tmp; + reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )] = tmp; circ_len = ( (uint16_t) tmp > circ_len ) ? (uint16_t) tmp : circ_len; } } @@ -376,27 +381,24 @@ ivas_error er_compute_reflections( /* circ buffers exist but size is different */ reflections->circ_len = circ_len; free( reflections->circ_buffers ); - reflections->circ_buffers = (float *) malloc( - reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ); - set_f( reflections->circ_buffers, 0.0f, - reflections->shoebox_data.n_sources * reflections->circ_len ); + if ( ( reflections->circ_buffers = (float *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); + } + set_f( reflections->circ_buffers, 0.0f, reflections->shoebox_data.n_sources * reflections->circ_len ); } } else { /* circ buffers do not exist */ reflections->circ_len = circ_len; - reflections->circ_buffers = (float *) malloc( - reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ); - set_f( reflections->circ_buffers, 0.0f, - reflections->shoebox_data.n_sources * reflections->circ_len ); + if ( ( reflections->circ_buffers = (float *) malloc( reflections->shoebox_data.n_sources * reflections->circ_len * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); + } + set_f( reflections->circ_buffers, 0.0f, reflections->shoebox_data.n_sources * reflections->circ_len ); } - /* Check that circ buffers were allocated */ - if ( !reflections->circ_buffers ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections buffers" ); - } /* Initialize circular buffer insertion point */ reflections->circ_insert = reflections->circ_len - (uint16_t) reflections->max_frame_size; @@ -413,20 +415,21 @@ ivas_error er_compute_reflections( return error; } + /*-----------------------------------------------------------------------------------------* -Function er_process +Function ivas_er_process() Takes a buffer of N channels, returns a buffer of N*6 channels containing the early reflections (one per wall). The process is a delay line architecture *-----------------------------------------------------------------------------------------*/ -ivas_error er_process( +ivas_error ivas_er_process( er_struct_t *reflections, - int16_t subframe_size, - int16_t subframe_idx, + const int16_t subframe_size, + const int16_t subframe_idx, float **io, - AUDIO_CONFIG inConfig ) + const AUDIO_CONFIG inConfig ) { ivas_error error = IVAS_ERR_OK; uint16_t i, j, k, subframe_offset; @@ -448,8 +451,7 @@ ivas_error er_process( } /* Ensure all reflection memory is allocated */ - if ( !reflections->circ_buffers || - !reflections->is_ready ) + if ( !reflections->circ_buffers || !reflections->is_ready ) { return IVAS_ERR_INIT_ERROR; } @@ -522,10 +524,10 @@ ivas_error er_process( /* Determine start idx of reflection in circ buffer based on current insert idx and reflection delay */ - samp_idx = (int) reflections->circ_insert - ref_delay; + samp_idx = (int16_t) reflections->circ_insert - ref_delay; if ( samp_idx < 0 ) { - samp_idx = (int) reflections->circ_len + samp_idx; + samp_idx = (int16_t) reflections->circ_len + samp_idx; } /* Pull reflection from circ buffer and apply gain */ @@ -542,6 +544,4 @@ ivas_error er_process( return error; } - - #endif diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 324b88549a..b733339cc2 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -252,11 +252,13 @@ void Quat2EulerDegree( } #endif + /*------------------------------------------------------------------------- * deg2rad() * * Converts degrees to normalized radians *------------------------------------------------------------------------*/ + float deg2rad( float degrees ) { @@ -272,12 +274,14 @@ float deg2rad( return PI_OVER_180 * degrees; } + #ifdef EARLY_REFLECTIONS /*------------------------------------------------------------------------- * rad2deg() * * Converts normalized radians to degrees *------------------------------------------------------------------------*/ + float rad2deg( float radians ) { @@ -293,6 +297,7 @@ float rad2deg( } #endif + /*------------------------------------------------------------------------- * rotateAziEle() * diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index 90db7575fd..44c17c3e80 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -31,10 +31,8 @@ *******************************************************************************************************/ #include "options.h" - #ifdef EARLY_REFLECTIONS - -#include +#include #include #include "ivas_prot_rend.h" #include "ivas_stat_rend.h" @@ -43,18 +41,18 @@ #include "wmc_auto.h" /*-----------------------------------------------------------------------------------------* - * Function shoebox_config_init + * Function ivas_shoebox_config_init * * Function transfer the parameters from the reverb config handle to the shoebox * calibration data structure. *-----------------------------------------------------------------------------------------*/ -void shoebox_config_init( +void ivas_shoebox_config_init( shoebox_config_t *cal, RENDER_CONFIG_HANDLE hRenderConfig /* i : Renderer configuration handle */ ) { - int32_t wall_idx; + int16_t wall_idx; cal->room_L = hRenderConfig->roomAcoustics.dimensions.x; cal->room_W = hRenderConfig->roomAcoustics.dimensions.y; @@ -71,16 +69,19 @@ void shoebox_config_init( cal->list_orig[0] = hRenderConfig->roomAcoustics.ListenerOrigin.x; cal->list_orig[1] = hRenderConfig->roomAcoustics.ListenerOrigin.y; cal->list_orig[2] = hRenderConfig->roomAcoustics.ListenerOrigin.z; + + return; } + /*-----------------------------------------------------------------------------------------* - * Function shoebox_init + * Function ivas_shoebox_init() * * Function initializes the shoebox operating parameters by setting limits and defaults, * also contains the calibration structure. *-----------------------------------------------------------------------------------------*/ -void shoebox_init( +void ivas_shoebox_init( shoebox_obj_t *obj, shoebox_config_t *cal ) { @@ -116,10 +117,13 @@ void shoebox_init( obj->min_wall_dist = ER_MIN_WALL_DIST; obj->soundspeed = ER_SOUND_SPEED; obj->air_coeff = ER_AIR_COEFF; + + return; } + /*-----------------------------------------------------------------------------------------* - * Function shoebox_bound + * Function shoebox_bound() * * SHOEBOX_BOUND takes in CARTESIAN coordinates of either a receiver or * source and checks if it is within the virtual room boundaries established @@ -127,7 +131,6 @@ void shoebox_init( * coordinates are established to collapse the object position. *-----------------------------------------------------------------------------------------*/ - static void shoebox_bound( shoebox_obj_t *obj, float *out_pos ) @@ -136,6 +139,7 @@ static void shoebox_bound( int32_t i; out_tmp = ( obj->cal.room_L / 2.0f ) - obj->min_wall_dist; + if ( ( out_pos[0] > out_tmp ) || ( out_pos[0] < ( ( ( -obj->cal.room_L ) / 2.0f ) + obj->min_wall_dist ) ) ) { if ( out_pos[0] < 0.0f ) @@ -148,7 +152,9 @@ static void shoebox_bound( } out_pos[0] = out_tmp * ( (float) i ); } + out_tmp = ( obj->cal.room_W / 2.0f ) - obj->min_wall_dist; + if ( ( out_pos[1] > out_tmp ) || ( out_pos[1] < ( ( ( -obj->cal.room_W ) / 2.0f ) + obj->min_wall_dist ) ) ) { if ( out_pos[1] < 0.0f ) @@ -161,7 +167,9 @@ static void shoebox_bound( } out_pos[1] = out_tmp * ( (float) i ); } + out_tmp = ( obj->cal.room_H / 2.0f ) - obj->min_wall_dist; + if ( ( out_pos[2] > out_tmp ) || ( out_pos[2] < ( ( ( -obj->cal.room_H ) / 2.0f ) + obj->min_wall_dist ) ) ) { if ( out_pos[2] < 0.0f ) @@ -174,10 +182,13 @@ static void shoebox_bound( } out_pos[2] = out_tmp * ( (float) i ); } + + return; } + /*-----------------------------------------------------------------------------------------* - * Function shoebox_get_coord + * Function shoebox_get_coord() * * Transform relative spherical coordinate to 3D cartesian point *-----------------------------------------------------------------------------------------*/ @@ -228,10 +239,12 @@ static void shoebox_get_coord( tmp_data[2] = src_pos_data[k + 2] - ( obj->cal.room_H / 2.0f ); } } + for ( k = 0; k < tmp_size_idx_1; k++ ) { obj->src_pos[( coord + k ) - 1] = tmp_data[k]; } + /* CENTER TO LISTENER */ if ( ( out_tmp + 1.0f ) > ( ( out_tmp + 1.0f ) + 2.0f ) ) { @@ -241,19 +254,24 @@ static void shoebox_get_coord( { k = (int32_t) ( (float) ( out_tmp + 1.0f ) ); } + tmp_pos[0] = obj->src_pos[k - 1]; tmp_pos[1] = obj->src_pos[k]; tmp_pos[2] = obj->src_pos[k + 1]; + if ( isRelative != 0.0f ) { tmp_pos[0] += obj->list_pos[0]; tmp_pos[1] += obj->list_pos[1]; tmp_pos[2] += obj->list_pos[2]; } + + return; } + /*-----------------------------------------------------------------------------------------* - * Function shoebox_get_euclidian_distance_internal + * Function shoebox_get_euclidian_distance_internal() * * Get 3D source distance from receiver *-----------------------------------------------------------------------------------------*/ @@ -266,6 +284,7 @@ static float shoebox_get_euclidian_distance_internal( float absxk, out_tmp, t; absxk = fabsf( obj->list_pos[0] - tmp_pos[0] ); + if ( absxk > ER_EUCLIDEAN_SCALE ) { out_tmp = 1.0f; @@ -276,7 +295,9 @@ static float shoebox_get_euclidian_distance_internal( t = absxk / ER_EUCLIDEAN_SCALE; out_tmp = t * t; } + absxk = fabsf( obj->list_pos[1] - tmp_pos[1] ); + if ( absxk > *scale ) { t = *scale / absxk; @@ -288,7 +309,9 @@ static float shoebox_get_euclidian_distance_internal( t = absxk / *scale; out_tmp += t * t; } + absxk = fabsf( obj->list_pos[2] - tmp_pos[2] ); + if ( absxk > *scale ) { t = *scale / absxk; @@ -300,24 +323,24 @@ static float shoebox_get_euclidian_distance_internal( t = absxk / *scale; out_tmp += t * t; } + return out_tmp; } /*-----------------------------------------------------------------------------------------* - * Function shoebox_set_scene + * Function ivas_shoebox_set_scene() * * Initial scene setup returning computed reflection (arrival times, DOA and gain). *-----------------------------------------------------------------------------------------*/ - -void shoebox_set_scene( +void ivas_shoebox_set_scene( shoebox_obj_t *obj, shoebox_output_t *ER_PARAMS, const float list_pos[3], const float src_pos_data[], - uint16_t isCartesian, - uint16_t isRelative ) + const uint16_t isCartesian, + const uint16_t isRelative ) { float tmp_pos[3]; float out_tmp; @@ -379,7 +402,6 @@ void shoebox_set_scene( fcnOutput_data[n] = src_pos_data[k + n]; } - shoebox_get_coord( obj, fcnOutput_data, src_pos_data, tmp_pos, out_tmp, coord, loop_ub, k, isRelative ); shoebox_bound( obj, tmp_pos ); @@ -452,6 +474,8 @@ void shoebox_set_scene( ( ( 1.0f - obj->cal.abs_coeff[loop_ub] ) * ( out_tmp / path_dist ) ) - ( path_dist * obj->air_coeff ); } } + + return; } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index b6cdca9f16..5994137e9b 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1090,6 +1090,7 @@ typedef struct #endif + #ifdef EARLY_REFLECTIONS /*----------------------------------------------------------------------------------* * Reflections structure @@ -1118,6 +1119,7 @@ typedef struct er_struct_t uint16_t *closest_ch_idx; shoebox_output_t shoebox_data; shoebox_obj_t shoebox_lib; + } er_struct_t; #endif -- GitLab From eefa8f8408a04afb3a56ff0924e8aca520d38aa2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 11 Aug 2023 16:36:33 +0200 Subject: [PATCH 15/26] formatting --- lib_com/ivas_fb_mixer.c | 1 + lib_com/ivas_prot.h | 42 ++++++++++++++++++---------------- lib_com/ivas_spar_com.c | 9 +++----- lib_com/ivas_stat_com.h | 1 + lib_dec/ivas_spar_decoder.c | 1 + lib_dec/ivas_spar_md_dec.c | 3 +++ lib_enc/ivas_dirac_enc.c | 3 +-- lib_enc/ivas_enc_cov_handler.c | 6 ++--- lib_enc/ivas_spar_encoder.c | 7 ++---- lib_enc/ivas_spar_md_enc.c | 6 ++--- lib_enc/ivas_stat_enc.h | 1 + lib_rend/lib_rend.c | 2 +- 12 files changed, 42 insertions(+), 40 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 070a0ff5fa..9c0e132d1c 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -590,6 +590,7 @@ void ivas_fb_mixer_get_windowed_fr( * * FB Mixer cross fading *-----------------------------------------------------------------------------------------*/ + #ifndef FIX_SBA_VANISHING_RESIDUAL static #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f029892be9..1a5cb8341a 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -123,7 +123,8 @@ int16_t ivas_spar_get_activeW_flag( const int16_t nchan_inp, const int16_t nchan_transport, int16_t *res_ind, - const int16_t *dmx_order); + const int16_t *dmx_order +); #endif ivas_error ivas_sba_enc_reconfigure( @@ -4416,14 +4417,14 @@ ivas_error ivas_spar_md_enc_process( const int16_t dtx_vad, const int16_t nchan_inp, const int16_t sba_order, /* i : Ambisonic (SBA) order */ - float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ + float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i : prior mixer_matrix */ #ifdef FIX_SBA_VANISHING_RESIDUAL , - const int16_t dyn_active_w_flag /* i : flag to indicate dynamic active W*/ + const int16_t dyn_active_w_flag /* i : flag to indicate dynamic active W */ #endif #ifdef FIX_527_SBA_MONO_INPUT , - const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA*/ + const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ #endif ); @@ -4508,20 +4509,21 @@ int16_t ivas_get_spar_dec_md_num_subframes( const int32_t ivas_total_brate /* i : IVAS total bitrate */ #ifdef VLBR_20MS_MD , - const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ + const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ #endif ); #ifdef VLBR_20MS_MD ivas_error ivas_spar_md_dec_matrix_open( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels, /* i : number of internal channels */ - const int16_t num_md_sub_frames ); + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t num_md_sub_frames +); void ivas_spar_md_dec_matrix_close( - ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels ); /* i : number of internal channels */ - + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ +); #endif ivas_error ivas_spar_md_dec_open( @@ -4532,7 +4534,7 @@ ivas_error ivas_spar_md_dec_open( const int16_t sid_format /* i : SID format */ #ifdef VLBR_20MS_MD , - const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ + const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ #endif ); @@ -6102,14 +6104,14 @@ void ivas_fb_mixer_get_in_out_mapping( #ifdef FIX_SBA_VANISHING_RESIDUAL void ivas_fb_mixer_cross_fading( - IVAS_FB_MIXER_HANDLE hFbMixer, - float **ppOut_pcm, - float *pMdft_out_old, - float *pMdft_out_new, - const int16_t ch, - const int16_t frame_len, - const int16_t cf_offset - ); + IVAS_FB_MIXER_HANDLE hFbMixer, + float **ppOut_pcm, + float *pMdft_out_old, + float *pMdft_out_new, + const int16_t ch, + const int16_t frame_len, + const int16_t cf_offset +); #endif /*! r: number of spectral bands */ diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index fc4941fe59..f8c3bc0e7d 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -536,6 +536,7 @@ static void ivas_get_pred_coeffs( float num_f, den_f, passive_g; #ifdef FIX_SBA_VANISHING_RESIDUAL float activew_quad_thresh, g_th_sq; + if ( dyn_active_w_flag == 1 ) { activew_quad_thresh = 1.0f; @@ -549,7 +550,6 @@ static void ivas_get_pred_coeffs( float g_th_sq = IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH * IVAS_LIN_ACTIVEW_QUAD_ACTIVEW_THRESH; #endif - set_zero( dm_alpha, IVAS_MAX_NUM_BANDS ); for ( i = 1; i < in_chans; i++ ) @@ -625,7 +625,6 @@ static void ivas_get_pred_coeffs( } #endif - #ifdef FIX_SBA_VANISHING_RESIDUAL if ( passive_g < activew_quad_thresh ) #else @@ -1625,12 +1624,10 @@ void ivas_compute_spar_params( int16_t b, i, ndm; ivas_get_pred_coeffs( cov_real, pred_coeffs_re, dm_fv_re, num_ch, start_band, end_band, active_w, - active_w_vlbr, - dtx_vad, from_dirac + active_w_vlbr, dtx_vad, from_dirac #ifdef FIX_SBA_VANISHING_RESIDUAL , - dyn_active_w_flag, - hSparMd->res_ind + dyn_active_w_flag, hSparMd->res_ind #endif ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 975fb77a71..43e930d2c4 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -233,6 +233,7 @@ typedef struct ivas_spar_md_t int16_t res_ind; int16_t prior_dyn_active_w_flag; #endif + } ivas_spar_md_t; typedef struct ivas_spar_md_prev_t diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 3695bf7bd0..aa6757b2d0 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -181,6 +181,7 @@ ivas_error ivas_spar_dec_open( #ifdef FIX_SBA_VANISHING_RESIDUAL hSpar->AGC_flag = 0; #endif + /*-----------------------------------------------------------------* * Configuration - set SPAR high-level parameters *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index e280cf5858..63d23bc241 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1295,6 +1295,7 @@ static void ivas_get_spar_matrices( { num_bands = num_bands >> 1; } + #ifdef FIX_SBA_VANISHING_RESIDUAL active_w = ( dyn_active_w_flag == 1 ) || ( hMdDec->spar_md_cfg.active_w == 1 ); #else @@ -2750,12 +2751,14 @@ static void ivas_parse_parameter_bitstream_dtx( sid_bits_len = st0->next_bit_pos - sid_bits_len; zero_pad_bits = ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - sid_bits_len; assert( zero_pad_bits >= 0 ); + #ifdef FIX_SBA_VANISHING_RESIDUAL if ( num_dmx_per_band[0] == 2 ) { zero_pad_bits -= 1; } #endif + for ( j = 0; j < zero_pad_bits; j++ ) { get_next_indice( st0, 1 ); diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 9f4b3b7694..f9864ced72 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -303,8 +303,7 @@ void ivas_dirac_enc( ivas_dirac_param_est_enc( hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, ivas_format, hodirac_flag, hodirac_flag ? HOA2_CHANNELS : FOA_CHANNELS #ifdef FIX_527_SBA_MONO_INPUT , - &( hDirAC->mono_frame_count ), - &( hQMetaData->dirac_mono_flag ) + &( hDirAC->mono_frame_count ), &( hQMetaData->dirac_mono_flag ) #endif ); diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 5b9ab2801c..93e4858f29 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -154,6 +154,7 @@ void ivas_spar_covar_enc_close( * * *-----------------------------------------------------------------------------------------*/ + int16_t ivas_spar_get_activeW_flag( ivas_enc_cov_handler_state_t *hCovEnc, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], @@ -198,7 +199,6 @@ int16_t ivas_spar_get_activeW_flag( { hCovEnc->bb_var_lt[ch] = bb_var[ch]; } - // hCovEnc->prior_var_flag = 0; } else { @@ -261,6 +261,7 @@ int16_t ivas_spar_get_activeW_flag( } #endif + /*-----------------------------------------------------------------------------------------* * Function ivas_enc_cov_handler_process() * @@ -311,8 +312,7 @@ void ivas_enc_cov_handler_process( *res_ind = 0; if ( nchan_transport > 1 && nchan_transport <= ( FOA_CHANNELS - 1 ) ) { - *dyn_active_w_flag = ivas_spar_get_activeW_flag( hCovEnc, cov_real, cov_real, dtx_vad, num_ch, nchan_transport, res_ind, - remix_order ); + *dyn_active_w_flag = ivas_spar_get_activeW_flag( hCovEnc, cov_real, cov_real, dtx_vad, num_ch, nchan_transport, res_ind, remix_order ); } else { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 0e82d08566..4d94e20b58 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -448,9 +448,7 @@ static ivas_error ivas_spar_cov_md_process( ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det, hSpar->hMdEnc->HOA_md_ind #ifdef FIX_SBA_VANISHING_RESIDUAL , - &hSpar->hMdEnc->spar_md.res_ind, - remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], - dyn_active_w_flag, nchan_transport, 1 + &hSpar->hMdEnc->spar_md.res_ind, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], dyn_active_w_flag, nchan_transport, 1 #endif ); @@ -735,8 +733,7 @@ static ivas_error ivas_spar_enc_process( if ( ( error = ivas_spar_cov_md_process( hEncoderConfig, st_ivas->hSpar, st_ivas->hQMetaData, hMetaData, nchan_inp, sba_order, ppIn_FR_real, ppIn_FR_imag, transient_det, dtx_vad #ifdef FIX_SBA_VANISHING_RESIDUAL , - nchan_transport, - &dyn_active_w_flag + nchan_transport, &dyn_active_w_flag #endif ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 89ac1d6379..6d5f538269 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -701,9 +701,7 @@ ivas_error ivas_spar_md_enc_process( } ivas_compute_spar_params( cov_real, dm_fv_re, 0, hMdEnc->mixer_mat, 0, nB, dtx_vad, num_ch, - bands_bw, active_w, - active_w_vlbr, - &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 + bands_bw, active_w, active_w_vlbr, &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0 #ifdef FIX_SBA_VANISHING_RESIDUAL , dyn_active_w_flag @@ -2106,12 +2104,14 @@ static void ivas_write_parameter_bitstream_dtx( sid_bits_len = hMetaData->nb_bits_tot - sid_bits_len; zero_pad_bits = ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - sid_bits_len; assert( zero_pad_bits >= 0 ); + #ifdef FIX_SBA_VANISHING_RESIDUAL if ( num_dmx[0] == 2 ) { zero_pad_bits -= 1; } #endif + while ( zero_pad_bits > 0 ) { j = min( zero_pad_bits, 16 ); diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 138e09b5c4..27f77d310d 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -655,6 +655,7 @@ typedef struct ivas_enc_cov_handler_state_t float bb_var_lt[FOA_CHANNELS]; int16_t prior_var_flag; #endif + } ivas_enc_cov_handler_state_t; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0d0784d663..4399b413b4 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8633,7 +8633,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 a8112f43a086f7716cfad22622ae7846eb806ae6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 12 Aug 2023 00:44:43 +0200 Subject: [PATCH 16/26] formatting --- lib_com/ivas_prot.h | 4 ++-- lib_dec/ivas_dec.c | 24 ++++++++++++++++++------ lib_dec/ivas_init_dec.c | 5 ++++- lib_dec/ivas_mono_dmx_renderer.c | 1 + lib_dec/ivas_osba_dec.c | 15 +++++++++++---- lib_dec/ivas_sba_rendering_internal.c | 16 +++++++++------- lib_rend/lib_rend.c | 20 ++++++++++---------- 7 files changed, 55 insertions(+), 30 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 10d4c9e9dc..221909adae 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4133,7 +4133,7 @@ void ivas_spar_config( const int16_t sid_format /* i : IVAS format indicator from SID frame */ ); -void ivas_sba_upmixer_renderer( +ivas_error ivas_sba_upmixer_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float output[][L_FRAME48k], /* i/o: transport/output audio channels */ const int16_t output_frame /* i : output frame length */ @@ -5771,7 +5771,7 @@ ivas_error ivas_osba_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); -void ivas_osba_render( +ivas_error ivas_osba_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index bce8d4e3de..4450a019ee 100755 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -555,7 +555,10 @@ ivas_error ivas_dec( } else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) { - ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + { + return error; + } } } #ifdef MASA_AND_OBJECTS @@ -782,8 +785,8 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { #ifdef VLBR_20MS_MD - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, - st_ivas->last_active_ivas_total_brate ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + ivas_sba_mix_matrix_determiner( st_ivas->hSpar, &output[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #else ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); @@ -861,11 +864,17 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS ) { - ivas_osba_render( st_ivas, output, output_frame ); + if ( ( error = ivas_osba_render( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL && !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) { - ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { @@ -877,7 +886,10 @@ ivas_error ivas_dec( } } - ivas_sba_upmixer_renderer( st_ivas, &output[sba_ch_idx], output_frame ); + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output[sba_ch_idx], output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->ism_mode == ISM_MODE_NONE ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 70fa68a1dd..74bf2f246b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -445,7 +445,6 @@ ivas_error ivas_dec_setup( st_ivas->sba_order = 3; } - /* set Ambisonic (SBA) order used for analysis and coding */ st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); @@ -474,6 +473,7 @@ ivas_error ivas_dec_setup( st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; } #endif + if ( ivas_total_brate >= IVAS_256k ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; @@ -757,6 +757,7 @@ static ivas_error ivas_read_format( #ifdef SBA_AND_OBJECTS /* read Ambisonic (SBA) planar flag */ st_ivas->sba_planar = st_ivas->bit_stream[( *num_bits_read ) + 1]; + /* read Ambisonic (SBA) order */ st_ivas->sba_order = st_ivas->bit_stream[( *num_bits_read ) + 2 + SBA_PLANAR_BITS]; st_ivas->sba_order += 2 * st_ivas->bit_stream[( *num_bits_read ) + 1 + SBA_PLANAR_BITS]; @@ -2094,6 +2095,7 @@ ivas_error ivas_init_decoder( return error; } } + #ifdef SBA_AND_OBJECTS if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { @@ -2772,6 +2774,7 @@ void ivas_init_dec_get_num_cldfb_instances( { *numCldfbAnalyses = st_ivas->nchan_transport + 1; } + #ifdef SBA_AND_OBJECTS if ( ivas_format == SBA_ISM_FORMAT ) { diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c index 9937c9b855..2093aeeb4e 100755 --- a/lib_dec/ivas_mono_dmx_renderer.c +++ b/lib_dec/ivas_mono_dmx_renderer.c @@ -100,6 +100,7 @@ void ivas_mono_downmix_render_passive( numInputChannels = st_ivas->nchan_ism; } #endif + #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 09a6bd27c8..32e3ace827 100755 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -177,7 +177,10 @@ ivas_error ivas_osba_dirac_td_binaural( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { - ivas_sba_upmixer_renderer( st_ivas, &output[channel_offset], output_frame ); + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output[channel_offset], output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } } else { @@ -296,7 +299,7 @@ ivas_error ivas_osba_ism_metadata_dec( * Object + SBA rendering process. *-------------------------------------------------------------------------*/ -void ivas_osba_render( +ivas_error ivas_osba_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ @@ -305,6 +308,7 @@ void ivas_osba_render( float tmp_ism_out[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float *p_tmp_ism_out[MAX_OUTPUT_CHANNELS]; int16_t n, nchan_out, nchan_ism, sba_ch_idx; + ivas_error error; nchan_out = st_ivas->hDecoderConfig->nchan_out; nchan_ism = st_ivas->nchan_ism; @@ -340,7 +344,10 @@ void ivas_osba_render( } } - ivas_sba_upmixer_renderer( st_ivas, &output_f[sba_ch_idx], output_frame ); + if ( ( error = ivas_sba_upmixer_renderer( st_ivas, &output_f[sba_ch_idx], output_frame ) ) != IVAS_ERR_OK ) + { + return error; + } if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { @@ -351,6 +358,6 @@ void ivas_osba_render( } } - return; + return IVAS_ERR_OK; } #endif diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 290f6a76f9..2ecf122bcf 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -388,13 +388,14 @@ void ivas_ism2sba_sf( * SBA upmix & rendering *-------------------------------------------------------------------*/ -void ivas_sba_upmixer_renderer( +ivas_error ivas_sba_upmixer_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float output[][L_FRAME48k], /* i/o: transport/output audio channels */ const int16_t output_frame /* i : output frame length */ ) { int16_t nchan_internal; + ivas_error error; push_wmops( "ivas_sba_upmixer_renderer" ); @@ -416,6 +417,7 @@ void ivas_sba_upmixer_renderer( output_config = ( st_ivas->ivas_format == SBA_ISM_FORMAT ? st_ivas->hOutSetup.output_config : st_ivas->hDecoderConfig->output_config ); #endif + #ifdef SBA_AND_OBJECTS for ( ch = 0; ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; ch++ ) #else @@ -424,19 +426,19 @@ void ivas_sba_upmixer_renderer( { output_f[ch] = output[ch]; } + #ifdef SBA_AND_OBJECTS - ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, -#ifdef SBA_AND_OBJECTS - st_ivas->nchan_ism, -#endif - output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); + if ( ( error = ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->nchan_ism, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) + { + return error; + } #else ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); #endif } pop_wmops(); - return; + return IVAS_ERR_OK; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ce35a8ce21..462ed41baa 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1330,8 +1330,7 @@ static ivas_error setRendInputActiveIsm( { return error; } - initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, - inputIsm->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); inputIsm->currentPos = defaultObjectPosition(); inputIsm->previousPos = defaultObjectPosition(); @@ -1339,6 +1338,7 @@ static ivas_error setRendInputActiveIsm( inputIsm->hReverb = NULL; inputIsm->tdRendWrapper = defaultTdRendWrapper(); initRotMatrix( inputIsm->rot_mat_prev ); + #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputIsm->splitTdRendWrappers ) / sizeof( *inputIsm->splitTdRendWrappers ) ); ++i ) { @@ -1384,9 +1384,9 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_674_MISSING_TABLES_FOR_TDREND_REVERB - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, &inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, &inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1397,13 +1397,14 @@ static ivas_error setRendInputActiveIsm( { return error; } + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_674_MISSING_TABLES_FOR_TDREND_REVERB - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputIsm->hReverb ), outConfig, NULL, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -1424,7 +1425,6 @@ static ivas_error setRendInputActiveIsm( #endif /* SPLIT_REND_WITH_HEAD_ROT */ } - return IVAS_ERR_OK; } @@ -2202,9 +2202,9 @@ static ivas_error initMcBinauralRendering( if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { #ifdef FIX_674_MISSING_TABLES_FOR_TDREND_REVERB - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8669,7 +8669,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 600f64ad30c3f9a49c8b5bf937ca1d561a8be6cf Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 12 Aug 2023 14:27:58 +0200 Subject: [PATCH 17/26] math operations in ER: change double-precision to single-prcesion functions --- lib_rend/ivas_reflections.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index 7c88da9da3..42ff786157 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -275,9 +275,9 @@ ivas_error ivas_er_encoder_init( for ( i = 0; i < reflections->n_total_reflections; i++ ) { /* Compute cartesian points for reflection (from degrees) */ - p_x = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) cos( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); - p_y = ER_RADIUS * ( (float) cos( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * (float) sin( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); - p_z = ER_RADIUS * ( (float) sin( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); + p_x = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * cosf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); + p_y = ER_RADIUS * ( cosf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) * sinf( deg2rad( reflections->shoebox_data.az_angle.data[i] ) ) ); + p_z = ER_RADIUS * ( sinf( deg2rad( reflections->shoebox_data.el_angle.data[i] ) ) ); /* Calculate the euclidean distance to each point in the config ls setup */ for ( j = 0; j < reflections->nchan_out; j++ ) @@ -287,14 +287,14 @@ ivas_error ivas_er_encoder_init( { src_idx = ( j > LFE_CHANNEL ) ? j - 1 : j; - p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) cos( reflections->source_positions[src_idx * 3] ) ); - p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( (float) cos( reflections->source_positions[src_idx * 3 + 1] ) * (float) sin( reflections->source_positions[src_idx * 3] ) ); - p_z_src = reflections->source_positions[src_idx * 3 + 2] * (float) sin( reflections->source_positions[src_idx * 3 + 1] ); + p_x_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * cosf( reflections->source_positions[src_idx * 3] ) ); + p_y_src = reflections->source_positions[src_idx * 3 + 2] * ( cosf( reflections->source_positions[src_idx * 3 + 1] ) * sinf( reflections->source_positions[src_idx * 3] ) ); + p_z_src = reflections->source_positions[src_idx * 3 + 2] * sinf( reflections->source_positions[src_idx * 3 + 1] ); tmp = ( p_x_src - p_x ) * ( p_x_src - p_x ); tmp += ( p_y_src - p_y ) * ( p_y_src - p_y ); tmp += ( p_z_src - p_z ) * ( p_z_src - p_z ); - dist = (float) sqrt( tmp ); + dist = sqrtf( tmp ); /* Save index of closest channel */ if ( src_idx == 0 ) @@ -344,9 +344,8 @@ ivas_error ivas_er_compute_reflections( } /* Run shoebox with current reflection parameters */ - ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), - reflections->shoebox_lib.cal.list_orig, reflections->source_positions, - reflections->is_cartesian, reflections->is_relative ); + ivas_shoebox_set_scene( &( reflections->shoebox_lib ), &( reflections->shoebox_data ), reflections->shoebox_lib.cal.list_orig, + reflections->source_positions, reflections->is_cartesian, reflections->is_relative ); /* Convert reflection times in seconds to samples and keep track of max */ circ_len = 0; @@ -354,9 +353,9 @@ ivas_error ivas_er_compute_reflections( { for ( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { - tmp = reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )]; - tmp = (float) round( tmp * reflections->output_Fs ); - reflections->shoebox_data.times.data[j + ( i * (int16_t) reflections->shoebox_data.n_ref )] = tmp; + tmp = reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )]; + tmp = roundf( tmp * reflections->output_Fs ); + reflections->shoebox_data.times.data[j + ( i * reflections->shoebox_data.n_ref )] = tmp; circ_len = ( (uint16_t) tmp > circ_len ) ? (uint16_t) tmp : circ_len; } } -- GitLab From 5724d623fdbcd40680666006c1ae4b54f06e4189 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 12 Aug 2023 14:44:07 +0200 Subject: [PATCH 18/26] remove Unittest leftovers from MSVC project files --- Workspace_msvc/encoder.vcxproj | 78 --------- Workspace_msvc/lib_com.vcxproj | 53 ------ Workspace_msvc/lib_debug.vcxproj | 42 ----- Workspace_msvc/lib_dec.vcxproj | 61 ------- Workspace_msvc/lib_enc.vcxproj | 65 ------- Workspace_msvc/lib_rend.vcxproj | 61 ------- Workspace_msvc/lib_rend.vcxproj.filters | 215 ++++++++++++++++++++++++ Workspace_msvc/lib_util.vcxproj | 39 ----- Workspace_msvc/renderer.vcxproj | 71 -------- lib_rend/ivas_stat_rend.h | 12 +- 10 files changed, 221 insertions(+), 476 deletions(-) create mode 100644 Workspace_msvc/lib_rend.vcxproj.filters diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj index bcfe92a4db..9578e488dc 100644 --- a/Workspace_msvc/encoder.vcxproj +++ b/Workspace_msvc/encoder.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - encoder @@ -27,12 +23,6 @@ false MultiByte - - Application - v141 - false - MultiByte - Application v141 @@ -46,10 +36,6 @@ - - - - @@ -65,13 +51,6 @@ false IVAS_cod - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_cod - ..\ .\Release_$(ProjectName)\ @@ -126,63 +105,6 @@ - - - - - - - $(IntDir)$(ProjectName).tlb - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - false - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - - $(OutDir)$(TargetName).exe - true - - - false - true - $(IntDir)$(ProjectName).pdb - Console - - - false - - - MachineX86 - - - - - - diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 0769491d34..8a15590902 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - {39EC200D-7795-4FF8-B214-B24EDA5526AE} @@ -26,12 +22,6 @@ false MultiByte - - StaticLibrary - v141 - false - MultiByte - StaticLibrary v141 @@ -45,10 +35,6 @@ - - - - @@ -62,11 +48,6 @@ .\Debug_$(ProjectName)\ libivascom - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivascom - .\Release_$(ProjectName)\ .\Release_$(ProjectName)\ @@ -102,40 +83,6 @@ true - - - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj index 1faca1b17c..4f3b1aa297 100644 --- a/Workspace_msvc/lib_debug.vcxproj +++ b/Workspace_msvc/lib_debug.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - {54509728-928B-44D9-A118-A6F92F08B34F} @@ -25,11 +21,6 @@ v141 MultiByte - - StaticLibrary - v141 - MultiByte - StaticLibrary v141 @@ -42,9 +33,6 @@ - - - @@ -57,11 +45,6 @@ .\Debug_$(ProjectName)\ libivasdebug - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasdebug - .\Release_$(ProjectName)\ .\Release_$(ProjectName)\ @@ -90,31 +73,6 @@ $(OutDir)$(TargetName).lib - - - - - - - Disabled - ..\lib_util;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions) - false - - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj index ff41d4f9c4..5ed2cd88a9 100644 --- a/Workspace_msvc/lib_dec.vcxproj +++ b/Workspace_msvc/lib_dec.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - lib_dec @@ -26,12 +22,6 @@ false MultiByte - - StaticLibrary - v141 - false - MultiByte - StaticLibrary @@ -46,10 +36,6 @@ - - - - @@ -65,13 +51,6 @@ false libivasdec - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasdec - .\Release_$(ProjectName)\ .\Release_$(ProjectName)\ @@ -114,46 +93,6 @@ true - - - - - - - .\Debug\$(ProjectName).tlb - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - false - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj index c38a0e1e1a..4ff380f542 100644 --- a/Workspace_msvc/lib_enc.vcxproj +++ b/Workspace_msvc/lib_enc.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - lib_enc @@ -27,12 +23,6 @@ false MultiByte - - StaticLibrary - v141 - false - MultiByte - StaticLibrary v141 @@ -46,10 +36,6 @@ - - - - @@ -65,13 +51,6 @@ false libivasenc - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasenc - .\Release_$(ProjectName)\ .\Release_$(ProjectName)\ @@ -117,50 +96,6 @@ - - - - - - - $(IntDir)$(ProjectName).tlb - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - false - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - - - - - diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index e615fe990f..9cd48bcd8a 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - lib_rend @@ -26,12 +22,6 @@ false MultiByte - - StaticLibrary - v141 - false - MultiByte - StaticLibrary @@ -46,10 +36,6 @@ - - - - @@ -65,13 +51,6 @@ false libivasrend - - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - false - false - libivasrend - .\Release_$(ProjectName)\ .\Release_$(ProjectName)\ @@ -114,46 +93,6 @@ true - - - - - - - .\Debug\$(ProjectName).tlb - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - false - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - WS2_32.lib; %(AdditionalDependencies) - $(OutDir)$(TargetName).lib - true - - diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters new file mode 100644 index 0000000000..7bcbdd91e4 --- /dev/null +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -0,0 +1,215 @@ + + + + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + rend_c + + + + + + rend_c + + + rend_c + + + + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + rend_h + + + + + + + + + + + + + + {54449ece-ef29-44b5-9512-ed8f555851a8} + + + {672b0eb6-cce8-425c-8bf2-aba4b45639bb} + + + \ No newline at end of file diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index 4938d0b2ce..687e9795a0 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - {2FA8F384-0775-F3B7-F8C3-85209222FC70} @@ -25,11 +21,6 @@ v141 MultiByte - - StaticLibrary - v141 - MultiByte - StaticLibrary v141 @@ -42,9 +33,6 @@ - - - @@ -58,12 +46,6 @@ .\Debug_$(ProjectName)\ libivasutil - - true - .\Debug_$(ProjectName)\ - .\Debug_$(ProjectName)\ - libivasutil - false .\Release_$(ProjectName)\ @@ -90,27 +72,6 @@ $(OutDir)$(TargetName).lib - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions) - false - - - EnableFastChecks - MultiThreadedDebug - false - $(IntDir)$(ProjectName).pdb - Level4 - OldStyle - Default - %(DisableSpecificWarnings) - - - $(OutDir)$(TargetName).lib - - MaxSpeed diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj index b119e778db..56c9601e2f 100644 --- a/Workspace_msvc/renderer.vcxproj +++ b/Workspace_msvc/renderer.vcxproj @@ -9,10 +9,6 @@ Release Win32 - - Unittests - Win32 - renderer @@ -27,12 +23,6 @@ false MultiByte - - Application - v141 - false - MultiByte - Application v141 @@ -46,10 +36,6 @@ - - - - @@ -65,13 +51,6 @@ false IVAS_rend - - ..\ - .\Debug_$(ProjectName)\ - false - false - IVAS_rend - ..\ .\Release_$(ProjectName)\ @@ -118,56 +97,6 @@ MachineX86 - - - - - - - $(IntDir)$(ProjectName).tlb - - - - - Disabled - ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_util;..\lib_rend;..\lc3plus;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions) - - - EnableFastChecks - MultiThreadedDebug - false - - - - - $(IntDir)$(ProjectName).pdb - Level4 - true - OldStyle - Default - %(DisableSpecificWarnings) - - - _DEBUG;%(PreprocessorDefinitions) - 0x0c0c - - - - - $(OutDir)$(TargetName).exe - true - - - true - $(IntDir)$(ProjectName).pdb - Console - false - - - MachineX86 - - $(IntDir)$(ProjectName).tlb diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index adc1e525fd..72b6937032 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1037,8 +1037,7 @@ typedef struct ivas_reverb_state_t * Shoebox structure *----------------------------------------------------------------------------------*/ -/* This structure holds the original bitstream metadata */ - +/* Structure to hold the original bitstream metadata */ typedef struct { float room_L; @@ -1046,10 +1045,10 @@ typedef struct float room_H; float abs_coeff[ER_ABS_COEFF]; float list_orig[3]; -} shoebox_config_t; -/* This structure holds the corrected( bounded ) source and listener positions */ +} shoebox_config_t; +/* Structure to hold the corrected( bounded ) source and listener positions */ typedef struct { uint16_t isCartesian; @@ -1075,6 +1074,7 @@ typedef struct shoebox_data_t { float data[150]; int32_t size[1]; + } shoebox_data_t; @@ -1086,8 +1086,8 @@ typedef struct shoebox_data_t gains; shoebox_data_t az_angle; shoebox_data_t el_angle; -} shoebox_output_t; +} shoebox_output_t; #endif @@ -1096,7 +1096,7 @@ typedef struct * Reflections structure *----------------------------------------------------------------------------------*/ -/* This structure holds the original source positions */ +/* Structure to hold the original source positions */ typedef struct er_struct_t { AUDIO_CONFIG audio_config; -- GitLab From 83cb40dff14c059a6a9c243fbba9333d7af572f5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 12 Aug 2023 15:02:18 +0200 Subject: [PATCH 19/26] reintroduce MSVC filters for decoder project file --- Workspace_msvc/lib_dec.vcxproj.filters | 669 +++++++++++++------------ 1 file changed, 336 insertions(+), 333 deletions(-) diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters index 82f949db78..b916d743c9 100644 --- a/Workspace_msvc/lib_dec.vcxproj.filters +++ b/Workspace_msvc/lib_dec.vcxproj.filters @@ -1,576 +1,579 @@  + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + - dec_ivas_c + decoder_ivas_c + + + decoder_ivas_c - dec_ivas_c + decoder_ivas_c - dec_ivas_c + decoder_ivas_c - dec_ivas_c + decoder_ivas_c - dec_ivas_c + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c - dec_ivas_c + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c - dec_ivas_c + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c + + + decoder_ivas_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c - - - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_evs_c + decoder_evs_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c + + + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c + + + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c + decoder_all_c - dec_all_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_evs_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - dec_ivas_c - - - - dec_ivas_c + decoder_all_c - - dec_h - - - dec_h - - dec_h + decoder_h - dec_h + decoder_h + + + decoder_h + + + decoder_h - dec_h + decoder_h - dec_h - - - dec_h + decoder_h - dec_h + decoder_h - - dec_h + + decoder_h - dec_h + decoder_h + + + decoder_h - dec_h + decoder_h - dec_h + decoder_h + + + decoder_h - - - {9d223c16-7845-4b37-b6fe-30de409ab87b} + + {f63b6db2-97ec-4d8d-be9c-e798ac8bb645} - - {0df7c383-e6a6-4d1c-a261-eea34adef2fc} + + {0853864e-7de7-411d-975b-5045652f22c3} - - {71a041e7-3b8b-4642-ab14-2b6a79aeb0a8} + + {e29aae34-aeeb-45dd-a986-61b39890c5bb} - - {e4a97be1-bcf8-43d3-b941-594f39f2d41b} + + {c33b80b3-67ce-466b-91c0-4adfc9efcb5c} - + \ No newline at end of file -- GitLab From 93c1f7d5e7bb478bcc326c93c85315309c575492 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sat, 12 Aug 2023 15:11:39 +0200 Subject: [PATCH 20/26] clang-format --- lib_dec/ivas_sba_rendering_internal.c | 14 +++++++------- lib_rend/lib_rend.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 759c7290a6..722066a707 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -226,8 +226,8 @@ int16_t ivas_sba_remapTCs( #else float sba_data[][L_FRAME48k], /* i/o: SBA signals */ #endif - Decoder_Struct *st_ivas, /* i/o: decoder struct */ - const int16_t output_frame /* i : frame length */ + Decoder_Struct *st_ivas, /* i/o: decoder struct */ + const int16_t output_frame /* i : frame length */ ) { int16_t nchan_remapped; @@ -393,13 +393,13 @@ void ivas_ism2sba_sf( *-------------------------------------------------------------------*/ ivas_error ivas_sba_upmixer_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ #ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP float *output[], /* i/o: transport/output audio channels */ #else - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ #endif - const int16_t output_frame /* i : output frame length */ + const int16_t output_frame /* i : output frame length */ ) { int16_t nchan_internal; @@ -631,11 +631,11 @@ ivas_error ivas_sba_linear_renderer( *-------------------------------------------------------------------*/ void ivas_sba_mix_matrix_determiner( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ #ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP float *output[], /* i/o: transport/output audio channels */ #else - float output[][L_FRAME48k], /* i/o: transport/output audio channels */ + float output[][L_FRAME48k], /* i/o: transport/output audio channels */ #endif const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 20426af406..4f4c70db7d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8731,7 +8731,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 15620553748703eea8f1876bb777c32994f53f27 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 13 Aug 2023 18:38:50 +0200 Subject: [PATCH 21/26] formatting --- apps/renderer.c | 7 +--- lib_com/ivas_prot.h | 4 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_spar_md_dec.c | 66 +++++++++++++++++---------------- lib_dec/lib_dec.c | 2 +- lib_enc/ivas_spar_encoder.c | 19 ++-------- lib_rend/ivas_crend.c | 7 +--- lib_rend/lib_rend.c | 34 ++++++----------- 8 files changed, 57 insertions(+), 84 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 20d347ae30..cddaac77df 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -859,12 +859,7 @@ int main( if ( args.sceneDescriptionInput ) { /* With scene description input, inputFilePath is the path to the scene description file. Parse it. */ - parseSceneDescriptionFile( args.inputFilePath, - audioFilePath, - &args.inConfig, - positionProvider, - masaReaders, - lfeRoutingConfigs ); + parseSceneDescriptionFile( args.inputFilePath, audioFilePath, &args.inConfig, positionProvider, masaReaders, lfeRoutingConfigs ); } else { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f6a1fc22f9..c5bcda9c02 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1036,9 +1036,9 @@ ivas_error ivas_ism_metadata_dec( ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ int16_t *ism_extended_metadata_flag, /* i/o: Extended metadata active in renderer */ - int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ + int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ #ifdef SBA_AND_OBJECTS - , DEC_CORE_HANDLE st0 + , DEC_CORE_HANDLE st0 /* i : core-coder handle */ #endif ); diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index cd13c393d0..e21566dd24 100755 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -152,7 +152,7 @@ ivas_error ivas_ism_metadata_dec( int16_t *ism_extmeta_cnt /* i/o: Number of change frames observed */ #ifdef SBA_AND_OBJECTS , - DEC_CORE_HANDLE st0 + DEC_CORE_HANDLE st0 /* i : core-coder handle */ #endif ) { diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 531fb42e5e..80851af85b 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -91,9 +91,9 @@ static void ivas_spar_dec_parse_md_bs( ivas_spar_md_dec_state_t *hMdDec, Decoder * Allocate and initialize SPAR MD decoder matrices *------------------------------------------------------------------------*/ ivas_error ivas_spar_md_dec_matrix_open( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels, /* i : number of internal channels */ - const int16_t num_md_sub_frames /* i : number of MD subframes */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels, /* i : number of internal channels */ + const int16_t num_md_sub_frames /* i : number of MD subframes */ ) { int16_t i, j; @@ -260,7 +260,7 @@ ivas_error ivas_spar_md_dec_matrix_open( /*! r: number of MD subframes */ int16_t ivas_get_spar_dec_md_num_subframes( - const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int32_t ivas_last_active_brate /* i : IVAS last active bitrate */ ) @@ -298,7 +298,7 @@ ivas_error ivas_spar_md_dec_open( const int16_t num_channels, /* i : number of internal channels */ const int16_t sba_order, /* i : SBA order */ const int16_t sid_format, /* i : SID format */ - const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ + const int32_t last_active_ivas_total_brate /* i : IVAS last active bitrate */ ) { ivas_spar_md_dec_state_t *hMdDec; @@ -312,9 +312,7 @@ ivas_error ivas_spar_md_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD decoder" ); } - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate, - last_active_ivas_total_brate /* i : IVAS last active bitrate */ - ); + num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order, hDecoderConfig->ivas_total_brate, last_active_ivas_total_brate ); if ( ( error = ivas_spar_md_dec_matrix_open( hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK ) { @@ -336,6 +334,7 @@ ivas_error ivas_spar_md_dec_open( { hMdDec->table_idx = ivas_get_spar_table_idx( hDecoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); } + if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; @@ -353,8 +352,8 @@ ivas_error ivas_spar_md_dec_open( * Deallocate SPAR MD decoder matrices *------------------------------------------------------------------------*/ void ivas_spar_md_dec_matrix_close( - ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ - const int16_t num_channels /* i : number of internal channels */ + ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */ + const int16_t num_channels /* i : number of internal channels */ ) { int16_t i, j; @@ -821,12 +820,7 @@ void ivas_spar_md_dec_process( } } - ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, - num_md_chs, - active_w_vlbr, - dyn_active_w_flag - - ); + ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB, num_md_chs, active_w_vlbr, dyn_active_w_flag ); #ifdef DEBUG_SPAR_DIRAC_WRITE_OUT_PRED_PARS { @@ -843,6 +837,7 @@ void ivas_spar_md_dec_process( { nB = nB << 1; } + for ( b = nB; b < num_bands_out; b++ ) { hMdDec->valid_bands[b] = 1; @@ -854,14 +849,17 @@ void ivas_spar_md_dec_process( return; } + + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_chk_zero_coefs() * * Check for zeroed SPAR coefficients *-----------------------------------------------------------------------------------------*/ + int16_t ivas_spar_chk_zero_coefs( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ ) { int16_t j, k, b, i_ts; @@ -911,6 +909,7 @@ int16_t ivas_spar_chk_zero_coefs( return mono; } + /*-----------------------------------------------------------------------------------------* * Function ivas_spar_smooth_md_dtx() * @@ -1162,9 +1161,10 @@ static void ivas_get_spar_matrices( { num_bands = num_bands >> 1; } - active_w = ( dyn_active_w_flag == 1 ) || ( hMdDec->spar_md_cfg.active_w == 1 ); + active_w = ( dyn_active_w_flag == 1 ) || ( hMdDec->spar_md_cfg.active_w == 1 ); active_w_dm_fac = ( dtx_vad == 0 ) ? IVAS_ACTIVEW_DM_F_SCALE_DTX : ( ( active_w_vlbr ) ? IVAS_ACTIVEW_DM_F_SCALE_VLBR : IVAS_ACTIVEW_DM_F_SCALE ); + for ( i_ts = 0; i_ts < n_ts; i_ts++ ) { for ( i = 0; i < numch_out; i++ ) @@ -1238,14 +1238,14 @@ static void ivas_get_spar_matrices( { ivas_mat_col_rearrange( tmp_dm_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); } - } + } else { if ( hMdDec->spar_md_cfg.remix_unmix_order != 3 ) { ivas_mat_col_rearrange( tmp_C1_re, order, i_ts, hMdDec->mixer_mat, b, numch_out ); } - } + } if ( dmx_ch > 0 ) { @@ -1653,8 +1653,7 @@ static void ivas_spar_dec_parse_md_bs( if ( no_ec == 0 ) { - ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, - strat, ivas_total_brate ); + ivas_decode_arith_bs( hMdDec, st0, qsi, *nB, *bands_bw, do_diff, strat, ivas_total_brate ); } else { @@ -1857,9 +1856,11 @@ static void ivas_decode_arith_bs( } ivas_fill_band_coeffs_idx( hMdDec->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF ); + return; } + /*-----------------------------------------------------------------------------------------* * Function ivas_fill_band_coeffs_idx() * @@ -1906,11 +1907,11 @@ static void ivas_fill_band_coeffs_idx( if ( coeff_type != DECX_COEFF ) { - len = pCell_dims[i].dim1 * pCell_dims[i].dim2; - mvs2s( pSymbol_re, pPtr_idx, len ); - pSymbol_re += len; - } - } + len = pCell_dims[i].dim1 * pCell_dims[i].dim2; + mvs2s( pSymbol_re, pPtr_idx, len ); + pSymbol_re += len; + } + } return; } @@ -1942,6 +1943,7 @@ static void ivas_decode_huffman_bs( drct_dim = ndec * ( ndm - 1 ); decd_dim = ndec; pred_offset = 0; + if ( hMdDec->spar_hoa_md_flag && hMdDec->spar_hoa_dirac2spar_md_flag ) { if ( i >= SPAR_DIRAC_SPLIT_START_BAND ) @@ -1968,14 +1970,14 @@ static void ivas_decode_huffman_bs( for ( j = 0; j < drct_dim; j++ ) { - ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); - } + ivas_huffman_decode( &hMdDec->huff_coeffs.drct_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].drct_index_re[j] ); + } for ( j = 0; j < decd_dim; j++ ) { - ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); - } + ivas_huffman_decode( &hMdDec->huff_coeffs.decd_huff_re[qsi], st0, &hMdDec->spar_md.band_coeffs_idx[i].decd_index_re[j] ); } + } return; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 5959626f2b..ff3c0d6ee2 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1112,7 +1112,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_VECTOR3 *Pos /* i : listener position */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_SPLIT_REND_ROT_AXIS rot_axis + const IVAS_SPLIT_REND_ROT_AXIS rot_axis #endif ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index e53892445a..1d6f434ce4 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -170,6 +170,7 @@ ivas_error ivas_spar_enc_open( return error; } } + /* PCA handle */ hSpar->hPCA = NULL; if ( hEncoderConfig->Opt_PCA_ON ) @@ -316,7 +317,6 @@ void ivas_spar_enc_close( ( *hSpar ) = NULL; } - return; } @@ -447,9 +447,7 @@ static ivas_error ivas_spar_cov_md_process( } ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det, hSpar->hMdEnc->HOA_md_ind, - &hSpar->hMdEnc->spar_md.res_ind, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], dyn_active_w_flag, nchan_transport, 1 - - ); + &hSpar->hMdEnc->spar_md.res_ind, remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order], dyn_active_w_flag, nchan_transport, 1 ); if ( nchan_transport > 1 && nchan_transport <= ( FOA_CHANNELS - 1 ) ) { @@ -474,9 +472,7 @@ static ivas_error ivas_spar_cov_md_process( if ( hSpar->hMdEnc->spar_hoa_md_flag == 0 ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer, - *dyn_active_w_flag, - hQMetaData->dirac_mono_flag ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer, *dyn_active_w_flag, hQMetaData->dirac_mono_flag ); } if ( hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag ) @@ -524,9 +520,7 @@ static ivas_error ivas_spar_cov_md_process( if ( hSpar->hMdEnc->spar_hoa_md_flag ) { - ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer, - *dyn_active_w_flag, - hQMetaData->dirac_mono_flag ); + ivas_spar_md_enc_process( hSpar->hMdEnc, hEncoderConfig, cov_real, cov_dtx_real, hMetaData, dtx_vad, nchan_inp, sba_order, hSpar->hFbMixer->prior_mixer, *dyn_active_w_flag, hQMetaData->dirac_mono_flag ); } return error; @@ -968,10 +962,5 @@ static ivas_error ivas_spar_enc_process( pop_wmops(); - /* ToDo: Commented for now */ - /*total_md_bits = hMetaData->nb_bits_tot - start_nb_bits; - total_sba_bits = ivas_sba_get_max_md_bits( st_ivas ); - assert( total_md_bits <= total_sba_bits );*/ - return error; } diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 246d582114..8a48e0e2b8 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1176,7 +1176,7 @@ ivas_error ivas_rend_openMultiBinCrend( const int32_t output_Fs ) { ivas_error error; - error = IVAS_ERR_OK; + error = ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, output_Fs #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1184,10 +1184,7 @@ ivas_error ivas_rend_openMultiBinCrend( pMultiBinPoseData->num_poses #endif ); - if ( error != IVAS_ERR_OK ) - { - return error; - } + return error; } #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 9ed4d755e3..6a4eabc953 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1279,12 +1279,14 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); inputIsm->tdRendWrapper.hHrtfTD = NULL; } + ivas_rend_closeCrend( &inputIsm->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); + ivas_reverb_close( &inputIsm->hReverb ); if ( ( error = ivas_omasa_ana_open( &inputIsm->hOMasa, inSampleRate, inputIsm->total_num_objects ) ) != IVAS_ERR_OK ) @@ -2240,13 +2242,16 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } + ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT , inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses #endif ); + ivas_reverb_close( &inputMc->hReverb ); + if ( inputMc->efapInWrapper.hEfap != NULL ) { efap_free_data( &inputMc->efapInWrapper.hEfap ); @@ -3286,8 +3291,7 @@ static ivas_error setRendInputActiveMasa( { return error; } - initRendInputBase( &inputMasa->base, inConfig, id, rendCtx, - inputMasa->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputMasa->base, inConfig, id, rendCtx, inputMasa->bufferData, MAX_BUFFER_LENGTH ); if ( ( error = getAudioConfigNumChannels( inConfig, &numInChannels ) ) != IVAS_ERR_OK ) { @@ -3309,6 +3313,7 @@ static ivas_error setRendInputActiveMasa( rendCtx.pSplitRendWrapper #endif ); + inputMasa->metadataHasBeenFed = false; if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK ) @@ -7182,13 +7187,10 @@ static ivas_error renderSplitBinauralWithPostRot( { if ( !SplitRendBFI ) { - ivas_splitBinPostRendMdDec( - &bits, - hSplitBin->hBinHrSplitPostRend, - &hSplitBin->multiBinPoseData + ivas_splitBinPostRendMdDec( &bits, hSplitBin->hBinHrSplitPostRend, &hSplitBin->multiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - , - hSplitBin->hBinHrSplitPreRend + , + hSplitBin->hBinHrSplitPreRend #endif /* SPLIT_REND_WITH_HEAD_ROT_DEBUG */ ); } @@ -7201,12 +7203,7 @@ static ivas_error renderSplitBinauralWithPostRot( { if ( bits.codec == IVAS_SPLIT_REND_CODEC_LCLD ) { - ivas_splitBinLCLDDecProcess( - hSplitBin->hSplitBinLCLDDec, - &bits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - SplitRendBFI ); + ivas_splitBinLCLDDecProcess( hSplitBin->hSplitBinLCLDDec, &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, SplitRendBFI ); isPostRendInputCldfb = 1; } else @@ -7249,14 +7246,7 @@ static ivas_error renderSplitBinauralWithPostRot( } else if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { - ivas_rend_CldfbSplitPostRendProcess( - hSplitBin->hBinHrSplitPostRend, - &hSplitBin->multiBinPoseData, - QuaternionsPost, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - tmpCrendBuffer, - isPostRendInputCldfb ); + ivas_rend_CldfbSplitPostRendProcess( hSplitBin->hBinHrSplitPostRend, &hSplitBin->multiBinPoseData, QuaternionsPost, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, tmpCrendBuffer, isPostRendInputCldfb ); } } else -- GitLab From f91923573224b95676238f0bde42bbabd5b914ad Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 13 Aug 2023 18:44:36 +0200 Subject: [PATCH 22/26] clang-format --- lib_com/ivas_fb_mixer.c | 4 ++-- lib_dec/ivas_binRenderer_internal.c | 10 +++++----- lib_dec/ivas_dec.c | 4 ++-- lib_dec/ivas_init_dec.c | 2 +- lib_rend/ivas_objectRenderer.c | 10 +++++----- lib_rend/ivas_prot_rend.h | 16 +++++++--------- lib_rend/ivas_stat_rend.h | 10 +++++----- lib_rend/lib_rend.c | 20 ++++++-------------- 8 files changed, 33 insertions(+), 43 deletions(-) diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index 0e37ce78a8..325637c937 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -831,8 +831,8 @@ static int16_t ivas_calculate_abs_fr( float short_stride_nrg = 0.0f; float cldfb_nrg = 0.0f; int16_t short_stride = pFb->fb_bin_to_band.short_stride; - const int16_t num_bins_per_short_stride_bin = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); - const int16_t num_bins_per_cldfb_band = (const int16_t) ( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); + const int16_t num_bins_per_short_stride_bin = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / short_stride ); + const int16_t num_bins_per_cldfb_band = ( const int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / pFb->fb_bin_to_band.num_cldfb_bands ); float short_stride_max_per_spar_band = 1e-9f; /*loop over all stored Filter Bank Response MDFT coefficients*/ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 5b9c94e410..cf8267766c 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -740,8 +740,8 @@ ivas_error ivas_allocate_binaural_hrtf( static ivas_error ivas_binaural_hrtf_open( HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ - const AUDIO_CONFIG input_config, /* i : output configuration */ - const RENDERER_TYPE renderer_type /* i : renderer type */ + const AUDIO_CONFIG input_config, /* i : output configuration */ + const RENDERER_TYPE renderer_type /* i : renderer type */ ) { int16_t i, j; @@ -844,7 +844,7 @@ static ivas_error ivas_binaural_hrtf_open( HrtfFastConv->rightHRIRImag_FOA[i][j] = rightHRIRImag_FOA[i][j]; } } - } + } mvr2r( fastconvReverberationTimes, HrtfFastConv->fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX ); mvr2r( fastconvReverberationEneCorrections, HrtfFastConv->fastconvReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX ); @@ -1736,8 +1736,8 @@ void ivas_binaural_cldfb( void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ - const int16_t slot_size, /* i : JBM slot size */ - float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + const int16_t slot_size, /* i : JBM slot size */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ed7563b688..2853cde8e2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -513,7 +513,7 @@ ivas_error ivas_dec( { /* loudness correction */ ivas_dirac_dec_binaural_sba_gain( output, nchan_remapped, output_frame ); - } + } /* Loudspeakers, Ambisonics or Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) @@ -774,7 +774,7 @@ ivas_error ivas_dec( { /* loudness correction */ ivas_dirac_dec_binaural_sba_gain( &output[sba_ch_idx], nchan_remapped, output_frame ); - } + } /* Loudspeakers, Ambisonics or Binaural rendering */ 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_init_dec.c b/lib_dec/ivas_init_dec.c index 576b2d7c1b..a48802a9a3 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2019,8 +2019,8 @@ ivas_error ivas_init_decoder( return error; } } - } } + } #ifdef MASA_AND_OBJECTS if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index d2563a0a65..2a8aef8e9c 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -315,7 +315,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; c_indx++; } - } + } for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { @@ -422,7 +422,7 @@ ivas_error TDREND_GetMix( { error = TDREND_REND_RenderSourceHRFilt( Src_p, hrf_left_delta, hrf_right_delta, intp_count, output_buf, subframe_length ); } - } + } /* Populate output variable */ mvr2r( output_buf[0], output[0] + subframe_idx * subframe_length, subframe_length ); /* Left */ @@ -660,9 +660,9 @@ ivas_error ivas_td_binaural_renderer_ext( const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ + const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index e2db9d48a5..2a4ae203dc 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -153,7 +153,6 @@ ivas_error ivas_sba_get_hoa_dec_matrix( const int16_t ambisonics_order /* i : Ambisonics order */ ); - void ivas_dirac_dec_binaural_sba_gain( #ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP float *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -489,7 +488,7 @@ void ivas_dirac_dec_get_frequency_axis( ); ivas_error ivas_spat_hSpatParamRendCom_config( - SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: IVAS decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, const DIRAC_CONFIG_FLAG flag_config_inp, /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ const int16_t dec_param_estim_flag, const IVAS_FORMAT ivas_format, @@ -595,7 +594,7 @@ ivas_error ivas_td_binaural_renderer_ext( const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ + const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const int16_t output_frame, /* i : output frame length */ float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); @@ -624,7 +623,6 @@ void ivas_td_binaural_close( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd /* i/o: TD binaural object renderer handle */ ); - ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ @@ -1025,7 +1023,7 @@ ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const HRTFS_HANDLE hHrtf, /* i : HRTF handle */ - const float *lr_energy_and_iac[], /* precomuputed lr energies and iac*/ + const float *lr_energy_and_iac[], /* i : precomuputed lr energies and iac */ RENDER_CONFIG_DATA *pConfig, /* i : Reverb configuration */ const int32_t output_Fs /* i : output sampling rate */ ); @@ -1481,7 +1479,7 @@ ivas_error ivas_orient_trk_Process( void ivas_set_split_rend_setup( IVAS_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i/o: combined orientation handle */ IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits ); void ivas_init_split_rend_handles( @@ -1773,9 +1771,9 @@ void masaPrerendClose( #ifdef SPLIT_REND_WITH_HEAD_ROT void ivas_split_rend_choose_default_codec( IVAS_SPLIT_REND_CODEC *pCodec, /* i/o: pointer to codec setting */ - int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */ - int16_t pcm_out /*i : flag to indicate PCM output*/ - ); + int16_t isRenderingInTd, /* i : flag: is rendering done in TD? */ + int16_t pcm_out /*i : flag to indicate PCM output*/ +); #endif /* clang-format on */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 8f6d7fa37d..f7899271fd 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -921,11 +921,11 @@ typedef struct ivas_roomAcoustics_t 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 */ + 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; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 6a4eabc953..5861dca18a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2169,11 +2169,7 @@ static ivas_error initMcBinauralRendering( /* Open TD renderer wrappers */ for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { - if ( ( error = ivas_td_binaural_open_ext( &inputMc->splitTdRendWrappers[i], - inConfig, - hRendCfg, - &inputMc->customLsInput, - outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_open_ext( &inputMc->splitTdRendWrappers[i], inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { return error; } @@ -2187,12 +2183,9 @@ static ivas_error initMcBinauralRendering( if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) -#endif - { - return error; - } + { + return error; + } } } @@ -2218,8 +2211,7 @@ static ivas_error initMcBinauralRendering( } /* determine binaural delay ( used for aligning LFE to output signal ) */ - binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, - inputMc->tdRendWrapper.binaural_latency_ns ); + binauralDelayNs = max( ( inputMc->crendWrapper != NULL ) ? inputMc->crendWrapper->binaural_latency_ns : 0, inputMc->tdRendWrapper.binaural_latency_ns ); inputMc->binauralDelaySmp = (int16_t) roundf( (float) binauralDelayNs * *inputMc->base.ctx.pOutSampleRate / 1000000000.f ); if ( inputMc->binauralDelaySmp > MAX_BIN_DELAY_SAMPLES ) @@ -8614,7 +8606,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 c70ce53f8492cffb1d3ea46474f86b6b2cb1b176 Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 13 Aug 2023 19:16:00 +0200 Subject: [PATCH 23/26] fix merge issue causing build warning --- lib_com/ivas_prot.h | 13 ------------- lib_enc/ivas_enc_cov_handler.c | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c5bcda9c02..d7cbbfa589 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4327,19 +4327,6 @@ ivas_error ivas_spar_md_enc_init const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#ifdef FIX_SBA_VANISHING_RESIDUAL -int16_t ivas_spar_get_activeW_flag( - ivas_enc_cov_handler_state_t *hCovEnc, - float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - const int16_t dtx_vad, - const int16_t nchan_inp, - const int16_t nchan_transport, - int16_t *res_ind, - const int16_t *dmx_order -); -#endif - void ivas_agc_dec_process( ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ #ifdef FIX_264_AUDIO_CHANNELS_TO_HEAP diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index e3fcdac205..3ecb96c31f 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -152,7 +152,7 @@ void ivas_spar_covar_enc_close( * *-----------------------------------------------------------------------------------------*/ -int16_t ivas_spar_get_activeW_flag( +static int16_t ivas_spar_get_activeW_flag( ivas_enc_cov_handler_state_t *hCovEnc, float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], -- GitLab From b769624ae4d8de1c3ef68b39c0a2a4d75271b903 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 14 Aug 2023 18:09:25 +0200 Subject: [PATCH 24/26] another round of formatting --- lib_com/ivas_omasa_com.c | 2 +- lib_com/ivas_prot.h | 12 +-- lib_com/ivas_stereo_td_bit_alloc.c | 2 +- lib_com/ivas_transient_det.c | 9 +- lib_com/prot.h | 16 +-- lib_dec/FEC_adapt_codebook.c | 12 +-- lib_dec/ivas_binRenderer_internal.c | 22 ++-- lib_dec/ivas_masa_dec.c | 16 +-- lib_dec/ivas_mc_paramupmix_dec.c | 20 +++- lib_dec/ivas_qmetadata_dec.c | 8 +- lib_dec/ivas_sba_dirac_stereo_dec.c | 17 ++-- lib_dec/ivas_sba_rendering_internal.c | 2 +- lib_dec/ivas_vbap.c | 6 +- lib_dec/lib_dec.c | 4 +- lib_dec/lib_dec.h | 4 +- lib_enc/enc_prm.c | 2 +- lib_enc/ivas_qmetadata_enc.c | 13 +-- lib_enc/ivas_stereo_dmx_evs.c | 2 +- lib_rend/ivas_objectRenderer.c | 20 ++-- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/lib_rend.c | 140 +++++++++++++++----------- lib_rend/lib_rend.h | 6 +- lib_util/masa_file_writer.c | 6 +- lib_util/render_config_reader.c | 4 +- 24 files changed, 192 insertions(+), 155 deletions(-) diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index bee378307b..25415e56d6 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -383,7 +383,7 @@ void ivas_combined_format_brate_sanity( /*!r : number of bits for ISM ratio index */ int16_t bits_index_ism_ratio( - const int16_t nchan_ism /* i : number of objects */ + const int16_t nchan_ism /* i : number of objects */ ) { int16_t bits_index; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d7cbbfa589..b964b4ed8b 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3898,7 +3898,7 @@ void ivas_mc_paramupmix_dec_read_BS( void ivas_mc_paramupmix_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); @@ -3907,7 +3907,7 @@ void ivas_mc_paramupmix_dec_render( const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *input_f[], /* i: core-coder transport channels */ + float *input_f[], /* i : core-coder transport channels */ float *output_f[] /* i/o: synthesized core-coder transport channels */ ); @@ -4280,7 +4280,7 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame, /* i : output frame length */ - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ ); /* AGC */ @@ -4534,8 +4534,8 @@ ivas_error ivas_spar_md_enc_process( const int16_t nchan_inp, const int16_t sba_order, /* i : Ambisonic (SBA) order */ float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ - const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */ - const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ + const int16_t dyn_active_w_flag, /* i : flag to indicate dynamic active W */ + const int16_t dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ ); void ivas_compute_spar_params( @@ -5402,7 +5402,7 @@ void ivas_binRenderer( #endif COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */ int16_t subframe_idx, /* i : subframe index */ - const int16_t numTimeSlots, /* i: : number of time slots to process */ + const int16_t numTimeSlots, /* i : number of time slots to process */ #ifdef SPLIT_REND_WITH_HEAD_ROT float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */ diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index f77a0a0933..a2c817da15 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -76,7 +76,7 @@ void tdm_bit_alloc( #ifdef MASA_AND_OBJECTS const int16_t ivas_format, /* i : IVAS format */ - const int16_t ism_mode, /* i: ISM mode in combined format */ + const int16_t ism_mode, /* i : ISM mode in combined format */ #endif const int32_t element_brate_wo_meta, /* i : element bitrate without metadata */ const int16_t tdm_lp_reuse_flag, /* i : LPC reusage flag */ diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index 1e8f53c7ca..aac25f50c9 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -211,11 +211,12 @@ void ivas_transient_det_close( * * Transient detection process call *-----------------------------------------------------------------------------------------*/ + void ivas_transient_det_process( - ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ - float *pIn_pcm, /* i : input audio channels */ - const int16_t frame_len, /* i : frame length in samples */ - int16_t transient_det[2] /* o: transient det outputs */ + ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ + float *pIn_pcm, /* i : input audio channels */ + const int16_t frame_len, /* i : frame length in samples */ + int16_t transient_det[2] /* o : transient det outputs */ ) { float in_duck_gain[L_FRAME48k]; diff --git a/lib_com/prot.h b/lib_com/prot.h index 6de0fae6a2..263f4cfe0e 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -1864,9 +1864,9 @@ void apply_envelope_enc( /*! r: Leading_sign_index, index, size, k_val */ PvqEntry mpvq_encode_vec( - const int16_t *vec_in, /* i : Signed pulse train */ - const int16_t dim_in, /* i : Dimension */ - int16_t k_val_local /* i/o : Num unit pulses */ + const int16_t *vec_in, /* i : Signed pulse train */ + const int16_t dim_in, /* i : Dimension */ + int16_t k_val_local /* i/o: Num unit pulses */ ); /*! r: Size, dim, k_val */ @@ -7991,7 +7991,7 @@ void writeTCXparam( const int16_t nbits_header, const int16_t nbits_start, const int16_t nbits_lpc, - const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ + const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ int16_t p_param[2], /* i/o: pointer to parameters from previous bs writing */ const int16_t target_bitsTCX10[2], const int16_t pre_past_flag ); @@ -8161,12 +8161,12 @@ void extend_dctN_input( /*! r: (p_max , best candidate sofar ) */ int16_t msvq_stage1_dct_search( - const float *u, /* i : target */ - const int16_t N, /* i : target length and IDCT synthesis length */ + const float *u, /* i : target */ + const int16_t N, /* i : target length and IDCT synthesis length */ const int16_t maxC_st1, /* i : number of final stage 1 candidates to provide */ - const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ + const DCTTYPE dcttype, /* e.g. DCT_T2_16_XX, DCT_T2_24_XX; */ const int16_t max_dct_trunc, /* i : maximum of truncation lenghts */ - float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ + float *invTrfMatrix, /* i : IDCT synthesis matrix for dim N */ const float *midQ_truncQ, /* i : midQ vector */ const float *dct_invScaleF, /* i : global inv scale factors */ const float *dct_scaleF, /* i : global scale factors */ diff --git a/lib_dec/FEC_adapt_codebook.c b/lib_dec/FEC_adapt_codebook.c index 961dfc6a5d..1200e2651c 100644 --- a/lib_dec/FEC_adapt_codebook.c +++ b/lib_dec/FEC_adapt_codebook.c @@ -399,12 +399,12 @@ void FEC_SinOnset( } int16_t FEC_enhACB( - const int16_t L_frame, /* i : frame length */ - const int16_t last_L_frame, /* i : frame length of last frame */ - float *exc_io, /* i/o : adaptive codebook memory */ - const int16_t new_pit, /* i : decoded first frame pitch */ - const int16_t puls_pos, /* i : decoder position of the last glottal pulses decoded in the previous frame */ - const float bfi_pitch /* i : pitch used for concealment */ + const int16_t L_frame, /* i : frame length */ + const int16_t last_L_frame, /* i : frame length of last frame */ + float *exc_io, /* i/o: adaptive codebook memory */ + const int16_t new_pit, /* i : decoded first frame pitch */ + const int16_t puls_pos, /* i : decoder position of the last glottal pulses decoded in the previous frame */ + const float bfi_pitch /* i : pitch used for concealment */ ) { int16_t Tc, P0, sign, pit_search; diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index cf8267766c..3966eae0cf 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -579,6 +579,7 @@ static ivas_error ivas_alloc_pppMem( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------------* * ivas_allocate_binaural_hrtf() * @@ -586,11 +587,11 @@ static ivas_error ivas_alloc_pppMem( *-------------------------------------------------------------------------*/ ivas_error ivas_allocate_binaural_hrtf( - HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ - const AUDIO_CONFIG input_config, /* i : input audio configuration */ - const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ - const RENDERER_TYPE renderer_type, /* i : renderer type */ - const int16_t allocate_init_flag /* i : Memory allocation flag */ + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + const AUDIO_CONFIG input_config, /* i : input audio configuration */ + const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const int16_t allocate_init_flag /* i : Memory allocation flag */ ) { if ( input_config == AUDIO_CONFIG_HOA3 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) @@ -619,6 +620,7 @@ ivas_error ivas_allocate_binaural_hrtf( } } } + if ( input_config == AUDIO_CONFIG_HOA2 || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { if ( ( HrtfFastConv->leftHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->leftHRIRImag_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRReal_HOA2 != NULL ) && ( HrtfFastConv->rightHRIRImag_HOA2 != NULL ) ) @@ -739,9 +741,9 @@ ivas_error ivas_allocate_binaural_hrtf( *-------------------------------------------------------------------------*/ static ivas_error ivas_binaural_hrtf_open( - HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ - const AUDIO_CONFIG input_config, /* i : output configuration */ - const RENDERER_TYPE renderer_type /* i : renderer type */ + HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */ + const AUDIO_CONFIG input_config, /* i : output configuration */ + const RENDERER_TYPE renderer_type /* i : renderer type */ ) { int16_t i, j; @@ -1527,8 +1529,8 @@ void ivas_binaural_hrtf_close( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ - float *input_f[], /* i : transport channels */ - float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ ) { int16_t render_lfe, idx_lfe; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 14cafaf6a2..cec88e4e6c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -2354,14 +2354,14 @@ static void read_ism_ratio_index( static void decode_ism_ratios( - uint16_t *bit_stream, /* i : bitstream */ - int16_t *next_bit_pos, /* i/o: position in bitstream */ - float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i: masa_to_total energy ratios */ - float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ - const int16_t n_ism, /* i : number of objects */ - const int16_t nbands, /* i : number of subbands */ - const int16_t numSf, /* i : number of subframes */ - const int16_t idx_separated_object /* i: index of separated object */ + uint16_t *bit_stream, /* i : bitstream */ + int16_t *next_bit_pos, /* i/o: position in bitstream */ + float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ + float ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ + const int16_t n_ism, /* i : number of objects */ + const int16_t nbands, /* i : number of subbands */ + const int16_t numSf, /* i : number of subframes */ + const int16_t idx_separated_object /* i : index of separated object */ ) { int16_t sf, band; diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 67657c2eb3..6df45b0dbb 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -484,10 +484,16 @@ void ivas_mc_paramupmix_dec( } +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_digest_tc() + * + * + *------------------------------------------------------------------------*/ + void ivas_mc_paramupmix_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - const int16_t nSamplesForRendering /* i : number of samples provided */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + const int16_t nSamplesForRendering /* i : number of samples provided */ ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; @@ -507,12 +513,18 @@ void ivas_mc_paramupmix_dec_digest_tc( } +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_render() + * + * + *------------------------------------------------------------------------*/ + void ivas_mc_paramupmix_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *input_f[], /* i: core-coder transport channels */ + float *input_f[], /* i : core-coder transport channels */ float *output_f[] /* i/o: synthesized core-coder transport channels */ ) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index d2f1361a1b..8920dc52ce 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -120,10 +120,10 @@ static void read_stream_dct_coeffs_omasa( int16_t *q_idx, float *q_dct_data, con /*! r: number of bits read */ int16_t ivas_qmetadata_dec_decode( - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ - uint16_t *bitstream, /* i : bitstream */ - int16_t *index, /* i/o: bitstream position */ - const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ + uint16_t *bitstream, /* i : bitstream */ + int16_t *index, /* i/o: bitstream position */ + const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { int16_t d, b, m; diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index ff1d93b5ba..e55d37657c 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -495,14 +495,14 @@ static void ivas_sba_dirac_stereo_compute_hb_gain( *-------------------------------------------------------------------*/ static void ivas_sba_dirac_stereo_upmix_hb( - float hb_stereo_synth[CPE_CHANNELS][L_FRAME48k], /* i/o: stereo HB synthesis signal */ - float hb_synth[L_FRAME48k], /* i : HB signal */ - float hb_gain[NB_DIV], /* i : side gains for HB signal */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t mcmasa, /* i : McMASA flag */ - const int16_t sba_mono_flag, /* i : flag for mono output */ - const int16_t bwidth, /* i : bandwidth of signal */ - const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ + float hb_stereo_synth[CPE_CHANNELS][L_FRAME48k], /* i/o: stereo HB synthesis signal */ + float hb_synth[L_FRAME48k], /* i : HB signal */ + float hb_gain[NB_DIV], /* i : side gains for HB signal */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t mcmasa, /* i : McMASA flag */ + const int16_t sba_mono_flag, /* i : flag for mono output */ + const int16_t bwidth, /* i : bandwidth of signal */ + const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ ) { int16_t i; @@ -597,7 +597,6 @@ static void ivas_sba_dirac_stereo_upmix_hb( } } - return; } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 45f40f5c7a..4cb9eb339d 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -640,7 +640,7 @@ void ivas_sba_mix_matrix_determiner( const int16_t bfi, /* i : BFI flag */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ const int16_t output_frame, /* i : output frame length */ - const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix*/ ) { int16_t i, ch; diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index 76ee5cb650..060fb13074 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -1956,9 +1956,9 @@ static int16_t determine_non_crossing_planes( *-------------------------------------------------------------------------*/ static void reorder_triplets( - VBAP_VS_TRIPLET *triplets, /* i/o : VS triplets to be reordered */ - const int16_t *target_order, /* i : Target order for VS triplets */ - const int16_t num_triplets /* i : Number of VS triplets */ + VBAP_VS_TRIPLET *triplets, /* i/o: VS triplets to be reordered */ + const int16_t *target_order, /* i : Target order for VS triplets */ + const int16_t num_triplets /* i : Number of VS triplets */ ) { VBAP_VS_TRIPLET tempTriplets[VBAP_MAX_NUM_TRIPLETS]; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 771c68f11c..8f4efe9989 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -881,8 +881,8 @@ static ivas_error IVAS_DEC_GetRenderedSamples( *---------------------------------------------------------------------*/ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o : IVAS decoder handle */ - int16_t *nSamplesBuffered /* o : number of samples still buffered */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + int16_t *nSamplesBuffered /* o : number of samples still buffered */ ) { ivas_error error; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 28690dde7c..3d61e99e81 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -159,7 +159,7 @@ ivas_error IVAS_DEC_GetSamples( int16_t *nOutSamples /* o : number of samples per channel written to output buffer */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits /* o : bitstream output for split rendering mode*/ + IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits /* o : bitstream output for split rendering mode */ #endif ); @@ -196,7 +196,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_VECTOR3 *Pos /* i : listener position */ #ifdef SPLIT_REND_WITH_HEAD_ROT , - IVAS_SPLIT_REND_ROT_AXIS rot_axis /*i : external control for rotation axis for split rendering*/ + IVAS_SPLIT_REND_ROT_AXIS rot_axis /*i : external control for rotation axis for split rendering */ #endif ); diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index 758d672d0b..61bfbf2f0f 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -329,7 +329,7 @@ void writeTCXparam( const int16_t nbits_header, const int16_t nbits_start, const int16_t nbits_lpc, - const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ + const int16_t *no_param_tns, /* i : number of TNS parameters per subframe */ int16_t p_param[2], /* i/o: pointer to parameters from previous bs writing */ const int16_t target_bitsTCX10[2], const int16_t pre_past_flag ) diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index d1e7791b21..84668dacca 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -6150,11 +6150,11 @@ static int16_t find_optimal_GR_orders( static int16_t write_stream_dct_coeffs_omasa( - int16_t *q_idx, /* i: array of indexes to be written */ - const int16_t len_stream, /* i: array length */ - BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream */ - const int16_t first_line, /* i: is first line of the matrix? 1/0*/ - const int16_t low_bitrate_mode /* i: is low bitrate mode? if yes, limit the number of bits written */ + int16_t *q_idx, /* i : array of indexes to be written */ + const int16_t len_stream, /* i : array length */ + BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream */ + const int16_t first_line, /* i : is first line of the matrix? 1/0 */ + const int16_t low_bitrate_mode /* i : is low bitrate mode? if yes, limit the number of bits written */ ) { int16_t nb_bits = 0, bits_pos; @@ -6174,6 +6174,7 @@ static int16_t write_stream_dct_coeffs_omasa( { max_bits = 1000; } + /* write DCT 0 component */ /* write sign only if not the very first DCT coeff */ if ( first_line == 0 ) @@ -6196,7 +6197,6 @@ static int16_t write_stream_dct_coeffs_omasa( nb_bits += BITS_MASA2TOTTAL_DCT0; } - if ( q_idx[0] != 0 ) { i_min = 1; @@ -6261,6 +6261,7 @@ static int16_t write_stream_dct_coeffs_omasa( } } } + if ( update_needed == 1 ) { /* re-calculate */ diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index e2b1c09a34..2ffc13d75d 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -175,7 +175,7 @@ void estimate_itd_wnd_fft( static void calc_poc( STEREO_DMX_EVS_POC_HANDLE hPOC, /* i/o: phase only correlation structure */ - STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o : correlation filter structure */ + STEREO_DMX_EVS_PHA_HANDLE hPHA, /* i/o: correlation filter structure */ const float wnd[], /* i : window coef */ const float rfft_coef[], /* i : RFFT coef */ const float specLr[], /* i : Lch real-part spectra */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index c24720c432..abb9d568de 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -465,7 +465,7 @@ static void TDREND_Clear_Update_flags( *---------------------------------------------------------------------*/ void TDREND_Update_object_positions( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ @@ -653,15 +653,15 @@ ivas_error ivas_td_binaural_open_ext( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer_ext( - const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ - const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ - const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ - const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ - const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ - const REVERB_HANDLE hReverb, /* i : Reverberator handle */ - const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */ - const int16_t output_frame, /* i : output frame length */ - float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ + const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ + const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ + const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ + const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ + const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ + const REVERB_HANDLE hReverb, /* i : Reverberator handle */ + const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ + const int16_t output_frame, /* i : output frame length */ + float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { ISM_METADATA_FRAME hIsmMetaDataFrame; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 2a4ae203dc..c519476b13 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -639,7 +639,7 @@ void TDREND_Update_listener_orientation( ); void TDREND_Update_object_positions( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 05752034bd..05883179b9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3529,6 +3529,7 @@ static ivas_error initSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REN } #endif /* SPLIT_REND_WITH_HEAD_ROT */ + ivas_error IVAS_REND_Open( IVAS_REND_HANDLE *phIvasRend, const int32_t outputSampleRate, @@ -3699,6 +3700,7 @@ ivas_error IVAS_REND_Open( return IVAS_ERR_OK; } + static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) { @@ -3726,6 +3728,7 @@ static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( return customLs; } + static ivas_error validateCustomLsLayout( const IVAS_CUSTOM_LS_DATA layout ) { @@ -3755,6 +3758,7 @@ static ivas_error validateCustomLsLayout( return IVAS_ERR_OK; } + ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( IVAS_REND_HANDLE hIvasRend, const IVAS_CUSTOM_LS_DATA layout ) @@ -3840,6 +3844,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( return IVAS_ERR_OK; } + ivas_error IVAS_REND_NumOutChannels( IVAS_REND_CONST_HANDLE hIvasRend, int16_t *numOutChannels ) @@ -3869,6 +3874,7 @@ ivas_error IVAS_REND_NumOutChannels( return IVAS_ERR_OK; } + static IVAS_REND_InputId makeInputId( AUDIO_CONFIG config, const int32_t inputIndex ) @@ -3879,6 +3885,7 @@ static IVAS_REND_InputId makeInputId( return (IVAS_REND_InputId) ( ( ( (uint32_t) getAudioConfigType( config ) ) << 8 ) | ( inputIndex + 1 ) ); } + static ivas_error getInputById( IVAS_REND_HANDLE hIvasRend, IVAS_REND_InputId inputId, @@ -3952,7 +3959,7 @@ static ivas_error getInputById( return IVAS_ERR_OK; } -/* Unfortunately code duplication here is the only way to avoid warnings about const casting */ + static ivas_error getConstInputById( IVAS_REND_CONST_HANDLE hIvasRend, const IVAS_REND_InputId inputId, @@ -4026,6 +4033,7 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } + static ivas_error findFreeInputSlot( const void *inputs, const int32_t inputStructSize, @@ -4069,7 +4077,7 @@ static ivas_error findFreeInputSlot( #ifdef SPLIT_REND_WITH_HEAD_ROT static int16_t getCldfbRendFlag( - IVAS_REND_HANDLE hIvasRend, /* i: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_AudioConfigType new_configType ) { int16_t i; @@ -4495,7 +4503,7 @@ ivas_error IVAS_REND_RemoveInput( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_GetInputNumChannels( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ int16_t *numChannels /* o : number of channels of the input */ ) @@ -4530,7 +4538,7 @@ ivas_error IVAS_REND_GetInputNumChannels( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_GetNumAllObjects( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ int16_t *numChannels /* o : number of all objects */ ) { @@ -4866,7 +4874,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_InitConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const AUDIO_CONFIG outAudioConfig /* i : output audioConfig */ ) { @@ -5175,7 +5183,7 @@ ivas_error IVAS_REND_SetSplitRendBFI( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetOrientationTrackingMode( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { @@ -5459,6 +5467,7 @@ static void renderBufferChannelLerp( return; } + /* Take one channel from input buffer and copy it to each channel in output buffer, with different gain applied per output channel */ static void renderBufferChannel( @@ -5472,6 +5481,7 @@ static void renderBufferChannel( return; } + static ivas_error rotateFrameMc( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ AUDIO_CONFIG inConfig, /* i : Input Audio config */ @@ -5609,9 +5619,10 @@ static ivas_error rotateFrameMc( return IVAS_ERR_OK; } + static ivas_error rotateFrameSba( IVAS_REND_AudioBuffer inAudio, /* i : Input Audio buffer */ - AUDIO_CONFIG inConfig, /* i : Input Audio config */ + const AUDIO_CONFIG inConfig, /* i : Input Audio config */ const IVAS_REND_HeadRotData *headRotData, /* i : Head rotation data */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ rotation_gains gains_prev, /* i/o: Previous frame rotation gains */ @@ -5730,6 +5741,7 @@ static ivas_error rotateFrameSba( return IVAS_ERR_OK; } + static ivas_error renderIsmToBinaural( const input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -5737,20 +5749,14 @@ static ivas_error renderIsmToBinaural( float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; int16_t ism_md_subframe_update_ext; + push_wmops( "renderIsmToBinaural" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, - ismInput->base.inConfig, - NULL, - ismInput->base.ctx.pCombinedOrientationData, - &ismInput->currentPos, - ismInput->hReverb, - ism_md_subframe_update_ext, - outAudio.config.numSamplesPerChannel, - tmpTDRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, + ismInput->hReverb, ism_md_subframe_update_ext, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -5762,6 +5768,7 @@ static ivas_error renderIsmToBinaural( return IVAS_ERR_OK; } + static ivas_error renderIsmToBinauralRoom( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -5805,7 +5812,6 @@ static ivas_error renderIsmToBinauralRoom( } } - if ( combinedOrientationEnabled ) { subframe_len = ismInput->base.inputBuffer.config.numSamplesPerChannel / RENDERER_HEAD_POSITIONS_PER_FRAME; @@ -5829,7 +5835,7 @@ static ivas_error renderIsmToBinauralRoom( } } } - (void) subframe_len; // avoid warning + (void) subframe_len; /* avoid warning */ } /* TODO tmu : see issue #518 */ @@ -5922,24 +5928,19 @@ static ivas_error renderIsmToBinauralReverb( ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, - ismInput->base.inConfig, - NULL, - ismInput->base.ctx.pCombinedOrientationData, - &ismInput->currentPos, - ismInput->hReverb, - ism_md_subframe_update_ext, - outAudio.config.numSamplesPerChannel, - tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, + ismInput->hReverb, ism_md_subframe_update_ext, outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); pop_wmops(); return IVAS_ERR_OK; } + static ivas_error renderIsmToMc( const input_ism *ismInput, const IVAS_REND_AudioBuffer outAudio ) @@ -5962,16 +5963,12 @@ static ivas_error renderIsmToMc( else { set_zero( currentPanGains, 16 ); - ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, - ismInput->currentPos.elevation, - ¤tPanGains[0], - ¤tPanGains[1] ); + + ivas_ism_get_stereo_gains( ismInput->currentPos.azimuth, ismInput->currentPos.elevation, ¤tPanGains[0], ¤tPanGains[1] ); set_zero( previousPanGains, 16 ); - ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, - ismInput->previousPos.elevation, - &previousPanGains[0], - &previousPanGains[1] ); + + ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &previousPanGains[0], &previousPanGains[1] ); } } else @@ -6004,6 +6001,7 @@ static ivas_error renderIsmToMc( return IVAS_ERR_OK; } + static ivas_error renderIsmToSba( const input_ism *ismInput, const AUDIO_CONFIG outConfig, @@ -6057,6 +6055,7 @@ static ivas_error renderIsmToSba( return error; } + #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderIsmToSplitBinaural( input_ism *ismInput, @@ -6205,7 +6204,8 @@ static ivas_error renderIsmToSplitBinaural( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ -static ivas_error renderIsmToMasa( + +static void renderIsmToMasa( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) { @@ -6214,14 +6214,17 @@ static ivas_error renderIsmToMasa( push_wmops( "renderIsmToMasa" ); copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer ); + ivas_omasa_ana( ismInput->hOMasa, tmpRendBuffer, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); pop_wmops(); - return IVAS_ERR_OK; + return; } + static ivas_error renderInputIsm( input_ism *ismInput, const AUDIO_CONFIG outConfig, @@ -6230,6 +6233,7 @@ static ivas_error renderInputIsm( ivas_error error; IVAS_REND_AudioBuffer inAudio; + error = IVAS_ERR_OK; inAudio = ismInput->base.inputBuffer; if ( ismInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) @@ -6273,20 +6277,22 @@ static ivas_error renderInputIsm( } break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - error = renderIsmToMasa( ismInput, outAudio ); + renderIsmToMasa( ismInput, outAudio ); break; default: return IVAS_ERR_INVALID_OUTPUT_FORMAT; } + /* Check error here to keep switch statement more compact */ if ( error != IVAS_ERR_OK ) { return error; } - return IVAS_ERR_OK; + return error; } + static ivas_error renderActiveInputsIsm( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) @@ -6304,7 +6310,6 @@ static ivas_error renderActiveInputsIsm( } if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK ) - { return error; } @@ -6313,6 +6318,7 @@ static ivas_error renderActiveInputsIsm( return IVAS_ERR_OK; } + static ivas_error renderLfeToBinaural( const input_mc *mcInput, #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -6360,12 +6366,16 @@ static ivas_error renderLfeToBinaural( frame_size = mcInput->base.inputBuffer.config.numSamplesPerChannel; num_cpy_smpl_prev_frame = mcInput->binauralDelaySmp; num_cpy_smpl_cur_frame = frame_size - num_cpy_smpl_prev_frame; + /* Assuming LFE should be delayed by less that the duration of one frame */ assert( mcInput->binauralDelaySmp < frame_size ); + /* Get delayed LFE signal from previous frame, apply gain and save in tmp buffer */ v_multc( mcInput->lfeDelayBuffer, gain, tmpLfeBuffer, num_cpy_smpl_prev_frame ); + /* Continue filling tmp buffer, now with LFE signal from current frame */ v_multc( lfeInput, gain, tmpLfeBuffer + num_cpy_smpl_prev_frame, num_cpy_smpl_cur_frame ); + /* Save remaining LFE samples of current frame for next frame */ mvr2r( lfeInput + num_cpy_smpl_cur_frame, mcInput->lfeDelayBuffer, num_cpy_smpl_prev_frame ); @@ -6402,6 +6412,7 @@ static ivas_error renderLfeToBinaural( return IVAS_ERR_OK; } + static ivas_error renderMcToBinaural( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -6440,18 +6451,12 @@ static ivas_error renderMcToBinaural( } } - if ( ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled - - && ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) ) ) + if ( ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) || ( combinedOrientationEnabled && ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) ) ) { copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); - if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, - mcInput->base.ctx.pCombinedOrientationData, - NULL, - mcInput->hReverb, - 0, - mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, + NULL, mcInput->hReverb, 0, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK ) { return error; } @@ -6515,6 +6520,7 @@ static ivas_error renderMcToBinaural( return IVAS_ERR_OK; } + static ivas_error renderMcToBinauralRoom( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -6623,6 +6629,7 @@ static ivas_error renderMcToBinauralRoom( return IVAS_ERR_OK; } + static ivas_error renderMcCustomLsToBinauralRoom( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -6736,6 +6743,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( return IVAS_ERR_OK; } + static void renderMcToMc( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) @@ -6757,6 +6765,7 @@ static void renderMcToMc( return; } + static void renderMcToSba( const input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) @@ -6778,7 +6787,8 @@ static void renderMcToSba( return; } -static ivas_error renderMcToMasa( + +static void renderMcToMasa( input_mc *mcInput, IVAS_REND_AudioBuffer outAudio ) { @@ -6787,14 +6797,17 @@ static ivas_error renderMcToMasa( push_wmops( "renderMcToMasa" ); copyBufferTo2dArray( mcInput->base.inputBuffer, tmpRendBuffer ); + ivas_mcmasa_ana( mcInput->hMcMasa, tmpRendBuffer, mcInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, mcInput->base.inputBuffer.config.numChannels ); + accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio ); pop_wmops(); - return IVAS_ERR_OK; + return; } + #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error renderMcToSplitBinaural( input_mc *mcInput, @@ -6972,9 +6985,10 @@ static ivas_error renderMcToSplitBinaural( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ + static ivas_error renderInputMc( input_mc *mcInput, - AUDIO_CONFIG outConfig, + const AUDIO_CONFIG outConfig, IVAS_REND_AudioBuffer outAudio ) { ivas_error error; @@ -7042,6 +7056,7 @@ static ivas_error renderInputMc( return error; } + static ivas_error renderActiveInputsMc( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) @@ -7067,6 +7082,7 @@ static ivas_error renderActiveInputsMc( return IVAS_ERR_OK; } + static void renderSbaToMc( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) @@ -7088,6 +7104,7 @@ static void renderSbaToMc( return; } + static void renderSbaToSba( const input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) @@ -7469,6 +7486,7 @@ static ivas_error renderSbaToSplitBinaural( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ + static ivas_error renderSbaToBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, @@ -7490,6 +7508,7 @@ static ivas_error renderSbaToBinaural( { float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; + renderSbaToMultiBinauralCldfb( sbaInput, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, @@ -8023,9 +8042,10 @@ static void renderMasaToBinaural( return; } + static void renderMasaToMasa( input_masa *masaInput, - IVAS_REND_AudioBuffer outAudio ) + const IVAS_REND_AudioBuffer outAudio ) { int16_t sf, band, dir, numDirs; float ratioSum; @@ -8035,7 +8055,6 @@ static void renderMasaToMasa( int16_t ts, i, j, l_ts; float Chan_RealBuffer[MASA_MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; float Chan_ImagBuffer[MASA_MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - int16_t band_m_idx, block_m_idx; int16_t mrange[2]; int16_t brange[2]; @@ -8047,7 +8066,6 @@ static void renderMasaToMasa( l_ts = masaInput->base.inputBuffer.config.numSamplesPerChannel / CLDFB_NO_COL_MAX; numAnalysisChannels = masaInput->hMasaPrerend->num_Cldfb_instances; - /* do processing over all CLDFB time slots */ for ( block_m_idx = 0; block_m_idx < MAX_PARAM_SPATIAL_SUBFRAMES; block_m_idx++ ) { @@ -8151,6 +8169,7 @@ static void renderMasaToMasa( return; } + static ivas_error renderInputMasa( input_masa *masaInput, const AUDIO_CONFIG outConfig, @@ -8235,6 +8254,7 @@ static ivas_error renderInputMasa( return IVAS_ERR_OK; } + static ivas_error renderActiveInputsMasa( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) @@ -8401,7 +8421,7 @@ ivas_error IVAS_REND_MergeMasaMetadata( ivas_error IVAS_REND_SetTotalNumberOfObjects( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const uint16_t total_num_objects /* i: total number of objects */ + const uint16_t total_num_objects /* i : total number of objects */ ) { if ( hIvasRend == NULL ) @@ -8414,6 +8434,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( return IVAS_ERR_OK; } + /*---------------------------------------------------------------------* * IVAS_REND_SetIsmMetadataDelay( ) * @@ -8421,8 +8442,8 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_SetIsmMetadataDelay( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const float sync_md_delay /* i: Ism Metadata Delay in ms to sync with audio delay */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const float sync_md_delay /* i : Ism Metadata Delay in ms to sync with audio delay */ ) { int16_t i; @@ -8440,6 +8461,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_GetSamples() * @@ -8542,7 +8564,6 @@ ivas_error IVAS_REND_GetSamples( /* Clear original output buffer */ set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel ); - #ifdef SPLIT_REND_WITH_HEAD_ROT outAudioOrig = outAudio; /* Use internal buffer if outputting split rendering bitstream */ @@ -8675,7 +8696,6 @@ ivas_error IVAS_REND_GetSamples( } #endif /* SPLIT_REND_WITH_HEAD_ROT */ - return IVAS_ERR_OK; } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 5f6227313a..c246f5e830 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -189,7 +189,7 @@ ivas_error IVAS_REND_RemoveInput( ); ivas_error IVAS_REND_GetInputNumChannels( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ + IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ int16_t *numChannels /* o : number of channels of the input */ ); @@ -320,8 +320,8 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects( ); ivas_error IVAS_REND_SetIsmMetadataDelay( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ - const float sync_md_delay /* i: Metadata Delay in ms to sync with audio delay */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const float sync_md_delay /* i : Metadata Delay in ms to sync with audio delay */ ); ivas_error IVAS_REND_GetNumAllObjects( diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index e7f3aca0b6..8b063fe282 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -84,9 +84,10 @@ static void getExtMasaMetadataFileName( return; } + static void delayMasaMetadata( - MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o : New input metadata which is inplace replaced with delayed metadata frame */ - MASA_META_DELAY_STORAGE *delayStorage /* i/o : Storage for 10 ms of metadata and related descriptive metadata */ + MASA_DECODER_EXT_OUT_META_HANDLE extOutMeta, /* i/o: New input metadata which is inplace replaced with delayed metadata frame */ + MASA_META_DELAY_STORAGE *delayStorage /* i/o: Storage for 10 ms of metadata and related descriptive metadata */ ) { int16_t dir, sf, band; @@ -141,6 +142,7 @@ static void delayMasaMetadata( return; } + /*---------------------------------------------------------------------* * MasaFileWriter_open() * diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 98a7bddd7a..15dd45256f 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1295,8 +1295,8 @@ ivas_error RenderConfigReader_open( *------------------------------------------------------------------------------------------*/ static ivas_error RenderConfigReader_readBinary( - const char *pReverbConfigPath, /* i : Configuration file path */ - RenderConfigReader *pRenderConfigReader /* i/o : RenderConfigReader handle */ + const char *pReverbConfigPath, /* i : Configuration file path */ + RenderConfigReader *pRenderConfigReader /* i/o: RenderConfigReader handle */ ) { uint32_t file_size; -- GitLab From 7777efbe39441d8d25b469457138910a173219bc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 14 Aug 2023 18:28:30 +0200 Subject: [PATCH 25/26] clang-format --- apps/decoder.c | 28 +++++++++------------------- lib_dec/ivas_mc_paramupmix_dec.c | 2 +- lib_rend/lib_rend.c | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ca20d4074f..0944bf6a83 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -788,6 +788,7 @@ cleanup: IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); destroy_SetOfHRTF( hSetOfHRTF ); } + IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); hrtfFileReader_close( &hrtfReader ); @@ -1377,10 +1378,10 @@ static bool parseCmdlIVAS_dec( } i += tmp; } + /*-----------------------------------------------------------------* * Option not recognized *-----------------------------------------------------------------*/ - else { fprintf( stderr, "Error: Unknown option %s or wrong number of parameters!\n\n", argv[i] ); @@ -1972,6 +1973,7 @@ static ivas_error decodeG192( goto cleanup; } } + /* Reference rotation */ if ( arg.enableReferenceRotation ) { @@ -2086,26 +2088,13 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { - error = initOnFirstGoodFrame( - hIvasDec, - arg, - numInitialBadFrames, - nOutSamples, - delayNumSamples_orig, - &delayNumSamples, - &delayTimeScale, - &bsFormat, - &afWriter, - &masaWriter, - ismWriters, - &nOutChannels, - &numObj + if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, nOutSamples, delayNumSamples_orig, + &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj #ifdef SPLIT_REND_WITH_HEAD_ROT - , - &hSplitRendFileReadWrite + , + &hSplitRendFileReadWrite #endif - ); - if ( error != IVAS_ERR_OK ) + ) ) != IVAS_ERR_OK ) { goto cleanup; } @@ -2334,6 +2323,7 @@ cleanup: * * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. *---------------------------------------------------------------------*/ + static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 6df45b0dbb..35d48f2c63 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -516,7 +516,7 @@ void ivas_mc_paramupmix_dec_digest_tc( /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec_render() * - * + * *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_dec_render( diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 05883179b9..7949e0faa9 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8672,7 +8672,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 ccf5d2ef01e61dca2630b356b7c34846af727381 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 14 Aug 2023 18:32:23 +0200 Subject: [PATCH 26/26] formatting --- apps/decoder.c | 7 ++++++- apps/encoder.c | 8 ++++++-- apps/renderer.c | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 0944bf6a83..b46b6db31c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -59,7 +59,7 @@ #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* - * Local constants, enums, structures + * Local constants *------------------------------------------------------------------------------------------*/ #if !defined( DEBUGGING ) && !defined( WMOPS ) @@ -90,6 +90,11 @@ static #endif #define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 + +/*------------------------------------------------------------------------------------------* + * Local structure for storing cmdln arguments + *------------------------------------------------------------------------------------------*/ + typedef struct { char *inputBitstreamFilename; diff --git a/apps/encoder.c b/apps/encoder.c index 71161123de..0ef304f4fb 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -47,7 +47,7 @@ #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* - * Local constants, enums, structures + * Local constants, enums *------------------------------------------------------------------------------------------*/ #if !defined( DEBUGGING ) && !defined( WMOPS ) @@ -109,7 +109,11 @@ typedef union _EncInputFormatConfig } EncInputFormatConfig; -/* Struct for storing cmdln arguments */ + +/*------------------------------------------------------------------------------------------* + * Local structure for storing cmdln arguments + *------------------------------------------------------------------------------------------*/ + typedef struct { char *inputWavFilename; diff --git a/apps/renderer.c b/apps/renderer.c index cddaac77df..37bf0ea3d5 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -399,6 +399,7 @@ static void IsmPositionProvider_getNextFrame( IsmPositionProvider *positionProvi static void IsmPositionProvider_close( IsmPositionProvider *positionProvider ); static LfeRoutingConfig *LfeRoutingConfig_open( void ); + static void LfeRoutingConfig_close( LfeRoutingConfig *lfeRoutingCfg ); static void readFromShorthandMetadata( IsmPositionProvider *positionProvider, ObjectPositionBuffer *objectMetadataBuffer, const uint32_t objIdx ); -- GitLab