From 7e7a6546b86a5e2d6dd364013fdc94da3ffff054 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Wed, 1 Feb 2023 22:06:20 +0100 Subject: [PATCH 1/9] start to fix not finished --- lib_com/ivas_prot.h | 17 ++++ lib_com/options.h | 2 +- lib_dec/ivas_dec.c | 11 +++ lib_dec/ivas_init_dec.c | 5 ++ lib_dec/ivas_ism_param_dec.c | 5 ++ lib_dec/ivas_mct_dec.c | 5 ++ lib_dec/ivas_stat_dec.h | 77 +++++++++++++++++++ lib_rend/ivas_crend.c | 47 ++++++++++- lib_rend/ivas_lib_rend_internal.h | 6 ++ lib_rend/ivas_rom_rend.h | 4 + lib_rend/ivas_stat_rend.h | 3 + lib_rend/lib_rend.c | 46 +++++++++++ lib_rend/lib_rend.h | 124 ++++++++++++++++++++++++++++++ 13 files changed, 350 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6f4d27d5e8..834f49cf16 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5411,6 +5411,7 @@ ivas_error ivas_crend_process( #else +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H IVAS_REND_AudioConfigType getAudioConfigType( const IVAS_REND_AudioConfig config ); @@ -5421,10 +5422,16 @@ ivas_error getAudioConfigNumChannels( IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( AUDIO_CONFIG config ); +#endif ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif RENDER_CONFIG_DATA *hRendCfg, #ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, @@ -5433,8 +5440,13 @@ ivas_error ivas_rend_initCrend( ivas_error ivas_rend_openCrend( CREND_WRAPPER_HANDLE *pCrend, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif RENDER_CONFIG_DATA *hRendCfg, int16_t Opt_Headrotation, #ifdef HRTF_BINARY_FILE @@ -5451,8 +5463,13 @@ ivas_error ivas_rend_closeCrend( ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif DECODER_CONFIG_HANDLE hDecoderConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, diff --git a/lib_com/options.h b/lib_com/options.h index 5dddf236ea..bf63497d57 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,7 +166,7 @@ #define FIX_309_PREMPH_MEM_SCE /* FhG: issue 309 - fix overwriting of mem_preemph_enc in ivas preprocessing for SCE and tcxonly modes*/ #define FIX_317 /* FhG: issue 317 - address sanitizer error in MDCT-Stereo PLC */ - +//#define FIX_197_CREND_INTERFACE_LIB_REND_H /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index e4a08b0540..085dc656dd 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -209,8 +209,13 @@ ivas_error ivas_dec( { #ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + AUDIO_CONFIG_7_1_4, + AUDIO_CONFIG_BINAURAL_ROOM, +#else IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, +#endif NULL, NULL, NULL, @@ -406,8 +411,14 @@ ivas_error ivas_dec( { #ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, +#else getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ), + +#endif st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 763c83dc39..ae45029c8e 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1220,8 +1220,13 @@ ivas_error ivas_init_decoder( } if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + st_ivas->intern_config, + st_ivas->hDecoderConfig->output_config, +#else getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), +#endif st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, #ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 2b6d0b6876..13dd1afbc9 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1087,8 +1087,13 @@ static ivas_error ivas_ism_bitrate_switching( /* Open Crend Binaural renderer */ #ifdef FIX_197_CREND_INTERFACE if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + st_ivas->intern_config, + st_ivas->hOutSetup.output_config, +#else getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hOutSetup.output_config ), +#endif st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, #ifdef HRTF_BINARY_FILE diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 7b2fa2982c..571f0121b5 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1134,8 +1134,13 @@ static ivas_error ivas_mc_dec_reconfig( else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + st_ivas->intern_config, + st_ivas->hDecoderConfig->output_config, +#else getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), +#endif st_ivas->hRenderConfig, st_ivas->hDecoderConfig->Opt_Headrotation, #ifdef HRTF_BINARY_FILE st_ivas->hSetOfHRTF, diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index dab905865d..23804dafda 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -40,9 +40,13 @@ #include "ivas_cnst.h" #include "ivas_stat_com.h" #include "ivas_stat_rend.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think +#else #ifndef FIX_197_CREND_INTERFACE #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think #endif +#endif #ifndef FIX_197_CREND_INTERFACE @@ -1820,6 +1824,16 @@ typedef struct ivas_hrtfs_file_header_t #endif +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +/* Main Crend wrapper structure */ +typedef struct ivas_binaural_crend_wrapper_struct +{ + int32_t binaural_latency_ns; + CREND_HANDLE hCrend; + HRTFS_HANDLE hHrtfCrend; +} CREND_WRAPPER, *CREND_WRAPPER_HANDLE; +#endif + /*----------------------------------------------------------------------------------* * LFE decoder structure *----------------------------------------------------------------------------------*/ @@ -1889,6 +1903,69 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +/*----------------------------------------------------------------------------------* + * Loudspeaker Configuration Conversion structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_LS_setupconversion_struct +{ + float *dmxMtx[MAX_OUTPUT_CHANNELS]; + float *targetEnergyPrev[MAX_OUTPUT_CHANNELS]; + float *dmxEnergyPrev[MAX_OUTPUT_CHANNELS]; + int16_t sfbOffset[MAX_SFB + 2]; + int16_t sfbCnt; + +} LSSETUP_CONVERSION_STRUCT, *LSSETUP_CONVERSION_HANDLE; + + +typedef struct ivas_LS_setupconversion_matrix +{ + int16_t index; + float value; +} LS_CONVERSION_MATRIX; + +typedef struct ivas_LS_setupconversion_mapping +{ + AUDIO_CONFIG input_config; + AUDIO_CONFIG output_config; + const LS_CONVERSION_MATRIX *conversion_matrix; +} LS_CONVERSION_MAPPING; + +typedef struct ivas_mono_downmix_renderer_struct +{ + float inputEnergy[CLDFB_NO_CHANNELS_MAX]; + float protoEnergy[CLDFB_NO_CHANNELS_MAX]; + +} MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE; + + +/*----------------------------------------------------------------------------------* + * Custom Loudspeaker configuration structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_LS_setup_custom +{ + int16_t is_planar_setup; /* flag to indicate if setup is planar or not */ + int16_t num_spk; /* number of custom loudspeakers */ + float ls_azimuth[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker azimuths */ + float ls_elevation[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker elevations */ + int16_t num_lfe; /* number of LFE channels */ + int16_t lfe_idx[MAX_OUTPUT_CHANNELS]; /* index for LFE channel insertion */ + int16_t separate_ch_found; /* flag to indicate if a center channel was found */ + float separate_ch_gains[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ + +} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; + +/* Channel types in a channel-based config */ +typedef enum +{ + CHANNEL_TYPE_UNUSED = 0, + CHANNEL_TYPE_SPEAKER, + CHANNEL_TYPE_LFE +} ChannelType; + +#endif #endif /*----------------------------------------------------------------------------------* * diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index cf29f0c988..2b88f16fd7 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1468,8 +1468,13 @@ ivas_error ivas_crend_process( ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif RENDER_CONFIG_DATA *hRendCfg, #ifdef HRTF_BINARY_FILE HRTFS_CREND_HANDLE hSetOfHRTF, @@ -1482,8 +1487,15 @@ ivas_error ivas_rend_initCrend( IVAS_REND_AudioConfigType inConfigType; HRTFS_HANDLE hHrtf; ivas_error error; +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + IVAS_REND_AudioConfig inRendConfig; + inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); + inConfigType = getAudioConfigType( inRendConfig ); +#else inConfigType = getAudioConfigType( inConfig ); + +#endif hHrtf = pCrend->hHrtfCrend; /* Do all error checks up front so that the nested if later is easier */ @@ -1517,8 +1529,11 @@ ivas_error ivas_rend_initCrend( } #endif - +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = getAudioConfigNumChannels( inRendConfig, &nchan_in ) ) != IVAS_ERR_OK ) +#else if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1998,8 +2013,13 @@ ivas_error ivas_rend_openCrend( #else CREND_WRAPPER *pCrend, #endif +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif RENDER_CONFIG_DATA *hRendCfg, #ifdef FIX_197_CREND_INTERFACE int16_t Opt_Headrotation, @@ -2182,7 +2202,11 @@ ivas_error ivas_rend_openCrend( if ( ( hRendCfg != NULL ) && ( hRendCfg->roomAcoustics.late_reverb_on ) ) { if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + inConfig, +#else getIvasAudioConfigFromRendAudioConfig( inConfig ), +#endif #ifdef FIX_197_CREND_INTERFACE ( *pCrend )->hHrtfCrend, #else @@ -2534,8 +2558,13 @@ static ivas_error ivas_rend_crendConvolver( ivas_error ivas_rend_crendProcess( const CREND_WRAPPER *pCrend, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + const AUDIO_CONFIG inConfig, + const AUDIO_CONFIG outConfig, +#else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, +#endif #ifdef FIX_197_CREND_INTERFACE DECODER_CONFIG_HANDLE hDecoderConfig, HEAD_TRACK_DATA_HANDLE hHeadTrackData, @@ -2555,12 +2584,24 @@ ivas_error ivas_rend_crendProcess( AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + IVAS_REND_AudioConfig inRendConfig; + IVAS_REND_AudioConfig outRendConfig; + inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); + outRendConfig = getRendAudioConfigFromIvasAudioConfig( outConfig ); +#endif push_wmops( "ivas_rend_crendProcess" ); +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + in_config = getIvasAudioConfigFromRendAudioConfig( inRendConfig ); + inConfigType = getAudioConfigType( inRendConfig ); + getAudioConfigNumChannels( outRendConfig, &nchan_out ); +#else in_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); inConfigType = getAudioConfigType( inConfig ); getAudioConfigNumChannels( outConfig, &nchan_out ); +#endif output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); #ifdef FIX_197_CREND_INTERFACE subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -2607,7 +2648,11 @@ ivas_error ivas_rend_crendProcess( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index 4d36ecf7f0..febd2f3d63 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -49,6 +49,9 @@ typedef struct float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#endif +#endif typedef struct { int32_t binaural_latency_ns; @@ -56,6 +59,9 @@ typedef struct TDREND_HRFILT_FiltSet_t *hHrtfTD; } TDREND_WRAPPER; +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifndef FIX_197_CREND_INTERFACE +#endif typedef struct { int32_t binaural_latency_ns; diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index cba0fffb1b..deccdf66cb 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -39,7 +39,11 @@ #include "debug.h" #endif #include "ivas_cnst.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "ivas_stat_dec.h" +#else #include "ivas_stat_rend.h" +#endif /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 975656dffb..9f177aed0c 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -38,6 +38,9 @@ #include "cnst.h" #include "ivas_cnst.h" #include "ivas_stat_com.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "ivas_stat_dec.h" +#endif #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index c3b3ef07c2..0e1df11874 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -39,8 +39,12 @@ #include "ivas_rom_rend.h" #include "ivas_lib_rend_internal.h" #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "ivas_stat_dec.h" +#else #include "lib_rend.h" #endif +#endif #include "prot.h" #include "wmc_auto.h" @@ -1064,8 +1068,13 @@ static ivas_error setRendInputActiveIsm( else if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) { error = ivas_rend_openCrend( &inputIsm->crendWrapper, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + AUDIO_CONFIG_7_1_4, + getIvasAudioConfigFromRendAudioConfig( outConfig ), +#else IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, +#endif hRendCfg, #ifdef FIX_197_CREND_INTERFACE 0, @@ -1771,8 +1780,13 @@ static ivas_error initMcBinauralRendering( { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + getIvasAudioConfigFromRendAudioConfig( ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_REND_AUDIO_CONFIG_7_1_4 : inConfig ), + getIvasAudioConfigFromRendAudioConfig( outConfig ), +#else ( inConfig == IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_REND_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, +#endif hRendCfg, #ifdef FIX_197_CREND_INTERFACE 0, @@ -2051,7 +2065,11 @@ static ivas_error updateSbaPanGains( { case IVAS_REND_AUDIO_CONFIG_BINAURAL: #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + error = ivas_rend_openCrend( &inputSba->crendWrapper, getIvasAudioConfigFromRendAudioConfig( inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, 0, +#else error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, 0, +#endif #ifdef HRTF_BINARY_FILE NULL, #endif @@ -2070,7 +2088,11 @@ static ivas_error updateSbaPanGains( return error; } #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + error = ivas_rend_openCrend( &inputSba->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), hRendCfg, 0, +#else error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, 0, +#endif #ifdef HRTF_BINARY_FILE NULL, #endif @@ -4138,7 +4160,11 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); +#else ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); +#endif #else ivas_rend_crendProcess( &ismInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM, tmpCrendBuffer, *ismInput->base.ctx.pOutSampleRate ); #endif @@ -4444,7 +4470,11 @@ static ivas_error renderMcToBinaural( /* call CREND */ #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -4500,7 +4530,11 @@ static ivas_error renderMcToBinauralRoom( /* call CREND */ #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, mcInput->base.inConfig, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -4571,7 +4605,11 @@ static ivas_error renderMcCustomLsToBinauralRoom( /* call CREND */ #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_rend_crendProcess( &mcInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -4803,7 +4841,11 @@ static ivas_error renderSbaToBinaural( /* call CREND */ #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif @@ -4867,7 +4909,11 @@ static ivas_error renderSbaToBinauralRoom( /* call CREND */ #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_rend_crendProcess( &sbaInput->crendWrapper, IVAS_REND_AUDIO_CONFIG_7_1_4, outConfig, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index b2ca45c70c..739daac4c9 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -40,15 +40,128 @@ #include "options.h" #include "common_api_types.h" #include "ivas_error.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "cnst.h" +#endif #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "ivas_stat_dec.h" +#else #include "ivas_stat_rend.h" #endif +#endif #define RENDERER_MAX_ISM_INPUTS 4 #define RENDERER_MAX_MC_INPUTS 1 #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 + +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + +#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? + +typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +typedef struct +{ + int16_t numSamplesPerChannel; + int16_t numChannels; +} IVAS_REND_AudioBufferConfig; + +typedef struct +{ + IVAS_REND_AudioBufferConfig config; + float *data; +} IVAS_REND_AudioBuffer; + +typedef struct +{ + IVAS_REND_AudioBufferConfig config; + const float *data; +} IVAS_REND_ReadOnlyAudioBuffer; + +typedef struct +{ + float azimuth; + float elevation; +} IVAS_REND_AudioObjectPosition; + +typedef struct IVAS_REND *IVAS_REND_HANDLE; +typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; + +typedef enum +{ + IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED = 0, + IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS, + IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED, + IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL, + IVAS_REND_AUDIO_CONFIG_TYPE_MASA, + 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 = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, + + 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; + +typedef struct +{ + int16_t numLfeChannels; + float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +} IVAS_REND_LfeRouting; + +typedef struct +{ + int8_t headRotEnabled; + IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; + float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; +} IVAS_REND_HeadRotData; + + +#endif + #ifndef FIX_197_CREND_INTERFACE #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 @@ -151,6 +264,17 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( /*----------------------------------------------------------------------------------* * Function prototypes *----------------------------------------------------------------------------------*/ +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +IVAS_REND_AudioConfigType getAudioConfigType( + const IVAS_REND_AudioConfig config ); + +ivas_error getAudioConfigNumChannels( + const IVAS_REND_AudioConfig config, + int16_t *numChannels ); + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); +#endif /* Functions to be called before rendering */ -- GitLab From 289fa5c9200a9a014df4909ddccd7ef4d81dae25 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 2 Feb 2023 15:00:26 +0100 Subject: [PATCH 2/9] build ok --- lib_com/options.h | 5 +++-- lib_dec/ivas_stat_dec.h | 10 ++++------ lib_rend/ivas_crend.c | 4 +--- lib_rend/ivas_lib_rend_internal.h | 29 ++++++++++++++++++++++++----- lib_rend/ivas_rom_rend.h | 6 +++++- lib_rend/ivas_stat_rend.h | 4 ++-- lib_rend/lib_rend.c | 24 ------------------------ lib_rend/lib_rend.h | 14 ++++++-------- 8 files changed, 45 insertions(+), 51 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bf63497d57..96c3593467 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -166,8 +166,9 @@ #define FIX_309_PREMPH_MEM_SCE /* FhG: issue 309 - fix overwriting of mem_preemph_enc in ivas preprocessing for SCE and tcxonly modes*/ #define FIX_317 /* FhG: issue 317 - address sanitizer error in MDCT-Stereo PLC */ -//#define FIX_197_CREND_INTERFACE_LIB_REND_H - +#ifdef FIX_197_CREND_INTERFACE +#define FIX_197_CREND_INTERFACE_LIB_REND_H +#endif /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 23804dafda..359cc6ceb6 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -48,7 +48,7 @@ #endif #endif -#ifndef FIX_197_CREND_INTERFACE +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) @@ -824,7 +824,7 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; } ivas_spar_md_dec_state_t; -#ifndef FIX_197_CREND_INTERFACE +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t @@ -997,7 +997,7 @@ typedef struct mct_dec_data_structure } MCT_DEC_DATA, *MCT_DEC_HANDLE; -#ifndef FIX_197_CREND_INTERFACE +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) /*----------------------------------------------------------------------------------* * EFAP structures @@ -1186,7 +1186,7 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#ifndef FIX_197_CREND_INTERFACE +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) /*----------------------------------------------------------------------------------* * Binaural Rendering structure @@ -1903,7 +1903,6 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure *----------------------------------------------------------------------------------*/ @@ -1965,7 +1964,6 @@ typedef enum CHANNEL_TYPE_LFE } ChannelType; -#endif #endif /*----------------------------------------------------------------------------------* * diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 2b88f16fd7..06aa1ec963 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -41,11 +41,9 @@ #include "ivas_rom_binaural_crend_head.h" #ifdef FIX_197_CREND_INTERFACE #include "ivas_stat_rend.h" -#include "lib_rend.h" -#else +#endif #include "lib_rend.h" #include "ivas_lib_rend_internal.h" -#endif #ifdef DEBUGGING #include "debug.h" #endif diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index febd2f3d63..cd696a0c51 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -41,7 +41,16 @@ #ifndef IVAS_LIB_REND_INTERNALS_H #define IVAS_LIB_REND_INTERNALS_H +#ifdef FIX_197_CREND_INTERFACE +AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( + IVAS_REND_AudioConfig config ); + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); +#endif + #ifndef FIX_197_CREND_INTERFACE + typedef struct { int8_t headRotEnabled; @@ -49,9 +58,6 @@ typedef struct float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#endif -#endif typedef struct { int32_t binaural_latency_ns; @@ -60,8 +66,7 @@ typedef struct } TDREND_WRAPPER; #ifndef FIX_197_CREND_INTERFACE_LIB_REND_H -#ifndef FIX_197_CREND_INTERFACE -#endif + typedef struct { int32_t binaural_latency_ns; @@ -69,6 +74,8 @@ typedef struct HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER; +#endif + IVAS_REND_AudioConfigType getAudioConfigType( const IVAS_REND_AudioConfig config ); @@ -76,8 +83,10 @@ ivas_error getAudioConfigNumChannels( const IVAS_REND_AudioConfig config, int16_t *numChannels ); +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); +#endif ivas_error ivas_rend_openCrend( CREND_WRAPPER *pCrend, @@ -119,6 +128,16 @@ ivas_error ivas_rend_crendConvolver( const int16_t i_ts ); #endif +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +typedef struct +{ + int32_t binaural_latency_ns; + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; + TDREND_HRFILT_FiltSet_t *hHrtfTD; +} TDREND_WRAPPER; + +#endif + ivas_error ivas_rend_TDObjRenderFrame( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index deccdf66cb..d7009c63b7 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -39,10 +39,14 @@ #include "debug.h" #endif #include "ivas_cnst.h" -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifndef FIX_197_CREND_INTERFACE #include "ivas_stat_dec.h" #else +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_stat_rend.h" +#else +#include "ivas_stat_dec.h" +#endif #endif /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 9f177aed0c..1d4ef4f919 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -47,7 +47,7 @@ #define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ -#ifdef FIX_197_CREND_INTERFACE +#if defined( FIX_197_CREND_INTERFACE ) && !defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? @@ -1059,7 +1059,6 @@ typedef struct BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; TDREND_HRFILT_FiltSet_t *hHrtfTD; } TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; -#endif /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure @@ -1121,5 +1120,6 @@ typedef enum CHANNEL_TYPE_SPEAKER, CHANNEL_TYPE_LFE } ChannelType; +#endif #endif /* IVAS_STAT_REND_H */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0e1df11874..93aa4caacb 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -38,12 +38,8 @@ #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" #include "ivas_lib_rend_internal.h" -#ifdef FIX_197_CREND_INTERFACE #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_stat_dec.h" -#else -#include "lib_rend.h" -#endif #endif #include "prot.h" #include "wmc_auto.h" @@ -5319,23 +5315,3 @@ int32_t IVAS_REND_GetCntFramesLimited( return hIvasRend->hLimiter->cnt_frames_limited; } #endif - -#ifdef FIX_197_CREND_INTERFACE -ivas_error ivas_rend_initEfap( - AUDIO_CONFIG outConfig, - EFAP_HANDLE *hEfap ) -{ - ivas_error err; - IVAS_REND_AudioConfig audioCfg; - EFAP_WRAPPER wrap; - LSSETUP_CUSTOM_STRUCT customLsOut; - wrap.hEfap = NULL; - wrap.pCustomLsSetup = NULL; - audioCfg = getRendAudioConfigFromIvasAudioConfig( outConfig ); - memset( &customLsOut, 0, sizeof( LSSETUP_CUSTOM_STRUCT ) ); - err = initEfap( &wrap, audioCfg, &customLsOut ); - *hEfap = wrap.hEfap; - - return err; -} -#endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 739daac4c9..951df3880b 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -44,9 +44,7 @@ #include "cnst.h" #endif #ifdef FIX_197_CREND_INTERFACE -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_stat_dec.h" -#else +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_stat_rend.h" #endif #endif @@ -254,10 +252,10 @@ typedef uint16_t IVAS_REND_InputId; #else - +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); - +#endif #endif /* clang-format off */ @@ -271,9 +269,6 @@ IVAS_REND_AudioConfigType getAudioConfigType( ivas_error getAudioConfigNumChannels( const IVAS_REND_AudioConfig config, int16_t *numChannels ); - -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ); #endif /* Functions to be called before rendering */ @@ -416,11 +411,14 @@ int32_t IVAS_REND_GetCntFramesLimited( #endif #ifdef FIX_197_CREND_INTERFACE +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H + ivas_error ivas_rend_initEfap( AUDIO_CONFIG outConfig, EFAP_HANDLE *hEfap ); #endif +#endif /* clang-format on */ #endif -- GitLab From 01f184c0e7f2efb899de65eabbf63275c4d24ffe Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 2 Feb 2023 17:02:46 +0100 Subject: [PATCH 3/9] simplified version --- lib_com/ivas_prot.h | 20 +- lib_dec/ivas_stat_dec.h | 77 +-- lib_rend/ivas_crend.c | 18 +- lib_rend/ivas_lib_rend_internal.h | 31 +- lib_rend/ivas_rom_rend.h | 8 - lib_rend/ivas_stat_rend.h | 1018 ----------------------------- lib_rend/lib_rend.h | 135 +--- 7 files changed, 31 insertions(+), 1276 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 834f49cf16..d1d66ccf82 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -40,13 +40,15 @@ #include "stat_enc.h" #include "stat_dec.h" #include "stat_com.h" -#ifdef FIX_197_CREND_INTERFACE -#include "ivas_stat_rend.h" -#endif #include "ivas_stat_enc.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" #include "ivas_error_utils.h" +#ifdef FIX_197_CREND_INTERFACE +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "lib_rend.h" +#endif +#endif /* clang-format off */ @@ -5411,18 +5413,6 @@ ivas_error ivas_crend_process( #else -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H -IVAS_REND_AudioConfigType getAudioConfigType( - const IVAS_REND_AudioConfig config ); - -ivas_error getAudioConfigNumChannels( - const IVAS_REND_AudioConfig config, - int16_t *numChannels ); - -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ); - -#endif ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 359cc6ceb6..ffedbd5b36 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -48,8 +48,6 @@ #endif #endif -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) - /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) *----------------------------------------------------------------------------------*/ @@ -73,7 +71,7 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; -#endif + /*----------------------------------------------------------------------------------* * DFT Stereo decoder structure *----------------------------------------------------------------------------------*/ @@ -824,8 +822,6 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; } ivas_spar_md_dec_state_t; -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) - /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t { @@ -864,8 +860,6 @@ typedef struct ivas_td_decorr_state_t } ivas_td_decorr_state_t; -#endif - /* PCA structure */ typedef struct { @@ -997,8 +991,6 @@ typedef struct mct_dec_data_structure } MCT_DEC_DATA, *MCT_DEC_HANDLE; -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) - /*----------------------------------------------------------------------------------* * EFAP structures *----------------------------------------------------------------------------------*/ @@ -1131,7 +1123,6 @@ typedef struct renderer_struct } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; -#endif /*----------------------------------------------------------------------------------* * MASA decoder structures *----------------------------------------------------------------------------------*/ @@ -1186,8 +1177,6 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) - /*----------------------------------------------------------------------------------* * Binaural Rendering structure *----------------------------------------------------------------------------------*/ @@ -1824,7 +1813,7 @@ typedef struct ivas_hrtfs_file_header_t #endif -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifdef FIX_197_CREND_INTERFACE /* Main Crend wrapper structure */ typedef struct ivas_binaural_crend_wrapper_struct { @@ -1903,68 +1892,6 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -/*----------------------------------------------------------------------------------* - * Loudspeaker Configuration Conversion structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_LS_setupconversion_struct -{ - float *dmxMtx[MAX_OUTPUT_CHANNELS]; - float *targetEnergyPrev[MAX_OUTPUT_CHANNELS]; - float *dmxEnergyPrev[MAX_OUTPUT_CHANNELS]; - int16_t sfbOffset[MAX_SFB + 2]; - int16_t sfbCnt; - -} LSSETUP_CONVERSION_STRUCT, *LSSETUP_CONVERSION_HANDLE; - - -typedef struct ivas_LS_setupconversion_matrix -{ - int16_t index; - float value; -} LS_CONVERSION_MATRIX; - -typedef struct ivas_LS_setupconversion_mapping -{ - AUDIO_CONFIG input_config; - AUDIO_CONFIG output_config; - const LS_CONVERSION_MATRIX *conversion_matrix; -} LS_CONVERSION_MAPPING; - -typedef struct ivas_mono_downmix_renderer_struct -{ - float inputEnergy[CLDFB_NO_CHANNELS_MAX]; - float protoEnergy[CLDFB_NO_CHANNELS_MAX]; - -} MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Custom Loudspeaker configuration structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_LS_setup_custom -{ - int16_t is_planar_setup; /* flag to indicate if setup is planar or not */ - int16_t num_spk; /* number of custom loudspeakers */ - float ls_azimuth[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker azimuths */ - float ls_elevation[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker elevations */ - int16_t num_lfe; /* number of LFE channels */ - int16_t lfe_idx[MAX_OUTPUT_CHANNELS]; /* index for LFE channel insertion */ - int16_t separate_ch_found; /* flag to indicate if a center channel was found */ - float separate_ch_gains[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ - -} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; - -/* Channel types in a channel-based config */ -typedef enum -{ - CHANNEL_TYPE_UNUSED = 0, - CHANNEL_TYPE_SPEAKER, - CHANNEL_TYPE_LFE -} ChannelType; - -#endif /*----------------------------------------------------------------------------------* * * Main IVAS decoder structure diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 06aa1ec963..f836491ae8 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1467,8 +1467,8 @@ ivas_error ivas_crend_process( ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H - const AUDIO_CONFIG inConfig, - const AUDIO_CONFIG outConfig, + const AUDIO_CONFIG inIvasConfig, + const AUDIO_CONFIG outIvasConfig, #else const IVAS_REND_AudioConfig inConfig, const IVAS_REND_AudioConfig outConfig, @@ -1486,14 +1486,14 @@ ivas_error ivas_rend_initCrend( HRTFS_HANDLE hHrtf; ivas_error error; #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H - IVAS_REND_AudioConfig inRendConfig; + IVAS_REND_AudioConfig inConfig; + IVAS_REND_AudioConfig outConfig; - inRendConfig = getRendAudioConfigFromIvasAudioConfig( inConfig ); - inConfigType = getAudioConfigType( inRendConfig ); -#else + inConfig = getRendAudioConfigFromIvasAudioConfig( inIvasConfig ); + outConfig = getRendAudioConfigFromIvasAudioConfig( outIvasConfig ); +#endif inConfigType = getAudioConfigType( inConfig ); -#endif hHrtf = pCrend->hHrtfCrend; /* Do all error checks up front so that the nested if later is easier */ @@ -1527,11 +1527,7 @@ ivas_error ivas_rend_initCrend( } #endif -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H - if ( ( error = getAudioConfigNumChannels( inRendConfig, &nchan_in ) ) != IVAS_ERR_OK ) -#else if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index cd696a0c51..ab6afd4628 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -31,9 +31,7 @@ *******************************************************************************************************/ #include "ivas_error.h" -#ifdef FIX_197_CREND_INTERFACE -#include "ivas_stat_rend.h" -#else +#ifndef FIX_197_CREND_INTERFACE #include "lib_rend.h" #endif #include "ivas_stat_dec.h" @@ -41,23 +39,14 @@ #ifndef IVAS_LIB_REND_INTERNALS_H #define IVAS_LIB_REND_INTERNALS_H -#ifdef FIX_197_CREND_INTERFACE -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig config ); - -IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( - AUDIO_CONFIG config ); -#endif - -#ifndef FIX_197_CREND_INTERFACE - +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; - +#endif typedef struct { int32_t binaural_latency_ns; @@ -65,7 +54,7 @@ typedef struct TDREND_HRFILT_FiltSet_t *hHrtfTD; } TDREND_WRAPPER; -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifndef FIX_197_CREND_INTERFACE typedef struct { @@ -88,6 +77,8 @@ AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); #endif +#ifndef FIX_197_CREND_INTERFACE + ivas_error ivas_rend_openCrend( CREND_WRAPPER *pCrend, const IVAS_REND_AudioConfig inConfig, @@ -128,16 +119,6 @@ ivas_error ivas_rend_crendConvolver( const int16_t i_ts ); #endif -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -typedef struct -{ - int32_t binaural_latency_ns; - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_HRFILT_FiltSet_t *hHrtfTD; -} TDREND_WRAPPER; - -#endif - ivas_error ivas_rend_TDObjRenderFrame( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ const IVAS_REND_AudioConfig inConfig, /* i : Input audio configuration */ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index d7009c63b7..0cf4dec24b 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -39,15 +39,7 @@ #include "debug.h" #endif #include "ivas_cnst.h" -#ifndef FIX_197_CREND_INTERFACE #include "ivas_stat_dec.h" -#else -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_stat_rend.h" -#else -#include "ivas_stat_dec.h" -#endif -#endif /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 1d4ef4f919..57c8a290ca 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -38,1028 +38,11 @@ #include "cnst.h" #include "ivas_cnst.h" #include "ivas_stat_com.h" -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_stat_dec.h" -#endif #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think #endif #define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ - -#if defined( FIX_197_CREND_INTERFACE ) && !defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) - -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? - -typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -typedef struct -{ - int16_t numSamplesPerChannel; - int16_t numChannels; -} IVAS_REND_AudioBufferConfig; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - float *data; -} IVAS_REND_AudioBuffer; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - const float *data; -} IVAS_REND_ReadOnlyAudioBuffer; - -typedef struct -{ - float azimuth; - float elevation; -} IVAS_REND_AudioObjectPosition; - -typedef struct IVAS_REND *IVAS_REND_HANDLE; -typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; - -typedef enum -{ - IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED = 0, - IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS, - IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED, - IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL, - IVAS_REND_AUDIO_CONFIG_TYPE_MASA, - 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 = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, - - 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; - -typedef struct -{ - int16_t numLfeChannels; - float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -} IVAS_REND_LfeRouting; - -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -} IVAS_REND_HeadRotData; - -/*----------------------------------------------------------------------------------* - * Binaural Rendering structure - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -/* Binaural reverberator structure */ -typedef struct ivas_binaural_reverb_struct -{ - float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; - float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; - float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - float binauralCoherenceCrossmixGains[CLDFB_NO_CHANNELS_MAX]; - float binauralCoherenceDirectGains[CLDFB_NO_CHANNELS_MAX]; - float reverbEqGains[CLDFB_NO_CHANNELS_MAX]; - float loopAttenuationFactor[CLDFB_NO_CHANNELS_MAX]; - - float *outputBufferReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - float *outputBufferImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - int16_t numBins; - - int16_t useBinauralCoherence; - int16_t loopBufLength[CLDFB_NO_CHANNELS_MAX]; - int16_t loopBufLengthMax[CLDFB_NO_CHANNELS_MAX]; - int16_t preDelayBufferIndex; - int16_t preDelayBufferLength; - - int16_t taps[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - int16_t *tapPhaseShiftType[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; - - int16_t blockSize; - uint32_t binRend_RandNext; - int16_t highestBinauralCoherenceBin; - - float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; - float foa_enc[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; - -} REVERB_STRUCT, *REVERB_STRUCT_HANDLE; - -/* AGC structure */ -typedef struct ivas_agc_dec_chan_state_t -{ - float lastGain; - int16_t gainExpVal; - -} ivas_agc_dec_chan_state_t; - -typedef struct ivas_agc_dec_state_t -{ - ivas_agc_com_state_t agc_com; - ivas_agc_dec_chan_state_t *gain_state; - ivas_agc_chan_data_t *gain_data; - -} ivas_agc_dec_state_t; - -/* TD decorr */ -typedef struct ivas_td_decorr_APD_filt_state_t -{ - int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; - int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; - float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; - float *state[IVAS_MAX_DECORR_APD_SECTIONS]; - -} ivas_td_decorr_APD_filt_state_t; - -typedef struct ivas_td_decorr_state_t -{ - ivas_trans_det_state_t *pTrans_det; - float *look_ahead_buf; - ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; - - int16_t num_apd_outputs; - int16_t num_apd_sections; - int16_t ducking_flag; - -} ivas_td_decorr_state_t; - -/* Parametric binaural data structure */ -typedef struct ivas_dirac_dec_binaural_data_structure -{ - float ChEnePrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossRePrev[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImPrev[CLDFB_NO_CHANNELS_MAX]; - float ChEne[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossRe[CLDFB_NO_CHANNELS_MAX]; - float ChCrossIm[CLDFB_NO_CHANNELS_MAX]; - float ChEneOutPrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossReOutPrev[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImOutPrev[CLDFB_NO_CHANNELS_MAX]; - float ChEneOut[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float ChCrossReOut[CLDFB_NO_CHANNELS_MAX]; - float ChCrossImOut[CLDFB_NO_CHANNELS_MAX]; - float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; /* +1 refers to SeparateChannel */ - float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float diffuseFieldCoherence[CLDFB_NO_CHANNELS_MAX]; - float diffuseFieldCoherenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float diffuseFieldCoherenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float diffuseFieldCoherenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - uint8_t renderStereoOutputInsteadOfBinaural; - float frameMeanDiffuseness[CLDFB_NO_CHANNELS_MAX]; - float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; - uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ - uint16_t useTdDecorr; - ivas_td_decorr_state_t *hTdDecorr; - -} DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; - -typedef struct ivas_binaural_rendering_conv_module_struct -{ - float ***filterTapsLeftReal; - float ***filterTapsLeftImag; - float ***filterTapsRightReal; - float ***filterTapsRightImag; - - float ***filterStatesLeftReal; - float ***filterStatesLeftImag; - - int16_t numTapsArray[BINAURAL_CONVBANDS]; - int16_t numTaps; - -} BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; - -/*----------------------------------------------------------------------------------* - * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) - *----------------------------------------------------------------------------------*/ -typedef struct ivas_output_setup_structure -{ - AUDIO_CONFIG output_config; - int16_t nchan_out_woLFE; /* number of output audio channels without LFE */ - int16_t ambisonics_order; - int8_t is_loudspeaker_setup; - int8_t is_planar_setup; - int8_t is_binaural_setup; - - int16_t num_lfe; - int16_t index_lfe[1]; - const float *ls_azimuth; - const float *ls_elevation; - - uint8_t separateChannelEnabled; - int16_t separateChannelIndex; - -} IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; - -/*----------------------------------------------------------------------------------* - * EFAP structures - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct EFAP_VERTEX -{ - float azi; /* azimuth of the loudspeaker */ - float ele; /* elevation of the loudspeaker */ - float pos[3]; /* [x y z] cartesian coordinate vector */ - int16_t idx; /* integer, that corresponds to the first index for the LS in the 1D output */ - int16_t isNaN; /* used to indicate if the vertex is a virtual speaker */ - EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ - -} EFAP_VERTEX; - -typedef struct EFAP_VERTEX_DATA -{ - EFAP_VERTEX *vertexArray; /* Array of vertices */ - int16_t numVtx; /* Number of vertices */ - int16_t *vtxOrder; /* Array that indicates the order of the vertex ranked by increasing azimuth */ - -} EFAP_VERTEX_DATA; - -typedef struct EFAP_POLYSET -{ - int16_t chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ - int16_t isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ - int16_t numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */ - float polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ - float polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ - -} EFAP_POLYSET; - -typedef struct EFAP_LS_TRIANGLE -{ - int16_t LS[3]; /* Array indicating the loudspeaker index of the triangle vertices */ - -} EFAP_LS_TRIANGLE; - -typedef struct EFAP_POLYSET_DATA -{ - EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */ - int16_t numPoly; /* Number of polygons */ - EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */ - int16_t numTri; /* Number of triangles */ - -} EFAP_POLYSET_DATA; - -typedef struct EFAP -{ - int16_t numSpk; /* Number of loudspeakers */ - float *aziSpk; /* Loudspeaker azimuths */ - float *eleSpk; /* Loudspeaker elevations */ - EFAP_VERTEX_DATA vtxData; /* Vertex Data, contains all the data concerning the vertex */ - EFAP_POLYSET_DATA polyData; /* Polygon data */ - float **dmTranspose; /* Downmix Matrix used for redistributing the energy of ghosts LS and its transpose */ - float *bufferLong; /* tmp buffer that will be given as a parameter for computing the gain; this is a 1D array of length numVtx */ - float *bufferShort; /* tmp buffer that will be given as a parameter for computing the gain; this is the result of downMixMatrix*bufferLong, length is numSpk */ - int16_t numTot; /* Total number of real + ghost loudspeakers, used later for freeing memory */ - -} EFAP, *EFAP_HANDLE; - - -/*----------------------------------------------------------------------------------* - * VBAP structures - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -enum SpeakerNodeGroup -{ - SPEAKER_NODE_BOTTOM_HALF, - SPEAKER_NODE_HORIZONTAL, - SPEAKER_NODE_TOP_HALF, - SPEAKER_NODE_BACK, - SPEAKER_NODE_ALL -}; - -/* Defines a single virtual surface triplet of loudspeakers - * with a precalculated inverse matrix */ -typedef struct vbap_vs_triplet_structure -{ - uint8_t speaker_node[3]; - float inverse_matrix[3][3]; - -} VBAP_VS_TRIPLET; - -/* Defines a single speaker node */ -typedef struct vbap_speaker_node_structure -{ - float azi_deg; - float ele_deg; - float unit_vec[3]; - enum SpeakerNodeGroup group; - -} VBAP_SPEAKER_NODE; - -/* Storage structure for fast runtime triplet search */ -typedef struct triplet_search_structure -{ - VBAP_VS_TRIPLET *triplets; - int16_t num_triplets; - int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; - -} VBAP_SEARCH_STRUCT; - -/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ -typedef struct vbap_data_structure -{ - VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ - int16_t num_search_structs; - int16_t num_speaker_nodes; - int16_t num_speaker_nodes_internal; - int16_t top_virtual_speaker_node_index; /* These indices can be negative */ - int16_t bottom_virtual_speaker_node_index; - int16_t back_virtual_speaker_node_index; - float *bottom_virtual_speaker_node_division_gains; - float *top_virtual_speaker_node_division_gains; - float *back_virtual_speaker_node_division_gains; - -} VBAP_DATA, *VBAP_HANDLE; - - -/*----------------------------------------------------------------------------------* - * renderer structures - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct renderer_struct -{ - float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; - float interpolator[L_FRAME48k]; - -} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; - -/* Fastconv binaural data structure */ -typedef struct ivas_binaural_rendering_struct -{ - /* Common variables for all modules */ - IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ - EFAP_HANDLE hEFAPdata; /* EFAP structure*/ - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ - - /* Convolution module structure */ - BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; - - /* Variables related to reverb module */ - float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; - REVERB_STRUCT_HANDLE hReverb; - -} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Head tracking data structure - *----------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? - -typedef struct ivas_binaural_head_track_struct -{ - int16_t num_quaternions; - IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; - float Rmat[3][3]; - float Rmat_prev[3][3]; - - uint8_t lrSwitchedNext; - uint8_t lrSwitchedCurrent; - float lrSwitchInterpVal; - - int16_t shd_rot_max_order; - -} HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; - -/* Reverberator structures */ - - -typedef struct ivas_roomAcoustics_t -{ - int16_t override; - int16_t use_brir; - int16_t late_reverb_on; - int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ - float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ - float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ - float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ - float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */ - float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ - -} ivas_roomAcoustics_t; - -typedef struct ivas_render_config_t -{ -#ifdef DEBUGGING - ivas_renderTypeOverride renderer_type_override; -#endif - ivas_roomAcoustics_t roomAcoustics; - -} RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; - - -typedef struct ivas_rev_delay_line_t -{ - float *pBuffer; - uint16_t MaxDelay; - int16_t Delay; - uint16_t BufferPos; - float Gain; - -} ivas_rev_delay_line_t; - -typedef struct ivas_rev_iir_filter_t -{ - uint16_t MaxTaps; - uint16_t nr_taps; - uint16_t isFIR; - float Output; - float CoefA[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - float CoefB[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - float pBuffer[IVAS_REV_MAX_IIR_FILTER_LENGTH]; - -} ivas_rev_iir_filter_t; - - -typedef float rv_fftwf_type_complex[2]; /* complex type of fftwf library */ - -/* Convertion block for FFT filter: from time domain to frequency domain (with OLS) and back */ -typedef struct ivas_reverb_t2f_f2t_t -{ - int16_t fft_size; - int16_t log2_fft_size; - int16_t block_size; - int16_t hist_size; /* rv_fft_size - rv_block_size */ - float fft_history_L[RV_FILTER_MAX_HISTORY]; - float fft_history_R[RV_FILTER_MAX_HISTORY]; - -} ivas_reverb_t2f_f2t_t; - -/* FFT filter with its frequency response coefficients */ -typedef struct ivas_reverb_fft_filter_t -{ - int16_t fft_size; - float fft_spectrum[RV_FILTER_MAX_FFT_SIZE]; - -} ivas_reverb_fft_filter_t; - - -typedef struct ivas_reverb_state_t -{ - RENDER_CONFIG_DATA pConfig; - - /* input downmixer: */ - float dmx_gain; /* downmix gain */ - - /* predelay: */ - ivas_rev_delay_line_t predelay_line; - float *pPredelay_buffer; - - /* jot reverberator: */ - uint16_t nr_of_branches; /* number of feedback loops */ - ivas_rev_delay_line_t delay_line[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delays */ - float *loop_delay_buffer[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delay sample buffers */ - ivas_rev_iir_filter_t t60[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop filters */ - float gain_matrix[IVAS_REV_MAX_NR_BRANCHES][IVAS_REV_MAX_NR_BRANCHES]; /* feedback matrix */ - float mixer[BINAURAL_CHANNELS][IVAS_REV_MAX_NR_BRANCHES]; /* output mixer matrix */ - - /* binauralization filters: */ - int16_t do_corr_filter; - ivas_reverb_t2f_f2t_t fft_filter_ols; - ivas_reverb_fft_filter_t fft_filter_correl_0; - ivas_reverb_fft_filter_t fft_filter_correl_1; - ivas_reverb_fft_filter_t fft_filter_color_0; - ivas_reverb_fft_filter_t fft_filter_color_1; - uint16_t fft_size; /* fft processing size */ - uint16_t fft_subblock_size; /* fft block processing size */ - uint16_t num_fft_subblocks; /* number of fft subblocks */ - uint16_t full_block_size; /* full block processing size */ - -} REVERB_DATA, *REVERB_HANDLE; - - -typedef struct ivas_orient_trk_state_t -{ - OTR_TRACKING_T trackingType; - float centerAdaptationRate; - float offCenterAdaptationRate; - float adaptationAngle; - - float alpha; - - float absYaw; /* absolute orientation */ - float absPitch; - float absRoll; - - float absAvgYaw; /* average absolute orientation */ - float absAvgPitch; - float absAvgRoll; - - float refYaw; /* reference orientation */ - float refPitch; - float refRoll; - - float trkYaw; /* tracked orientation */ - float trkPitch; - float trkRoll; - -} ivas_orient_trk_state_t; - - -/*----------------------------------------------------------------------------------* - * TD ISm Object Renderer structure - *----------------------------------------------------------------------------------*/ - - -typedef struct -{ - int16_t modelROM; /* Flag that indicates that the model resides in ROM (controls init/dealloc). */ - int16_t UseItdModel; /* Controls whether ITD model is used. */ - int16_t SplineDegree; /* Degree of the spline functions */ - int16_t K; /* Length of filter */ - int16_t elevDim2; - int16_t elevDim3; - int16_t AlphaN; /* Number of rows in Alpha matrices */ - int16_t num_unique_azim_splines; - int16_t elevSegSamples; - - int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const int16_t *azimDim2; - const int16_t *azimDim3; - const int16_t *azim_start_idx; - const int16_t *azimSegSamples; - const int16_t *azimShapeIdx; - const int16_t *azimShapeSampFactor; - - const float *elevKSeq; /* Array, N x elevDim2 x elevDim3 */ - const float *AlphaL; /* Array, size AlphaN x K */ - const float *AlphaR; /* Array, size AlphaN x K */ - const float *elevBsShape; - float **azimKSeq; /* Array, length azimDim3+1 */ - const float **azimBsShape; - - int16_t azimDim3Max; - int16_t iSecFirst[HRTF_MODEL_N_SECTIONS]; /* Indices for start of sections */ - int16_t iSecLast[HRTF_MODEL_N_SECTIONS]; /* Indices for end of sections */ - const float *EL; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ - const float *ER; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ - - /* Pointers for allocation of dynamic memory */ - float *AlphaL_dyn; - float *AlphaR_dyn; - float *EL_dyn; - float *ER_dyn; - float *elevBsShape_dyn; - float *elevKSeq_dyn; - int16_t *azimDim2_dyn; - int16_t *azimDim3_dyn; - int16_t *azim_start_idx_dyn; - int16_t *azimSegSamples_dyn; - int16_t *azimShapeIdx_dyn; - int16_t *azimShapeSampFactor_dyn; - float **azimBsShape_dyn; - -} ModelParams_t; - -typedef struct -{ - int16_t N; /* Polynomial degree */ - - int16_t elevDim2; - int16_t elevDim3; - const float *elevKSeq; /* Array, length elevDim3-2 */ - int16_t azimDim2; - int16_t azimDim3; - const float *azimKSeq; /* Array, length azimDim3-2 */ - const float *W; /* Array, size (elevDim3*azimDim3) x K */ - - int16_t azimBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t azimBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const float *azimBsShape; - int16_t azimSegSamples; - - int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - const float *elevBsShape; - int16_t elevSegSamples; - float resamp_factor; - - /* Pointers for allocation of dynamic memory */ - float *elevKSeq_dyn; - float *azimKSeq_dyn; - float *W_dyn; - float *azimBsShape_dyn; - float *elevBsShape_dyn; - -} ModelParamsITD_t; - -typedef struct -{ - float val; - int16_t i; - -} ValueIndex_t; - -/* Shared memory for use when evaluating BSpline HR filter model*/ -typedef struct -{ - float BM[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - ValueIndex_t BMEnergiesL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - ValueIndex_t BMEnergiesR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - int16_t UseIndsL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - int16_t UseIndsR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - float *hrfModL; - float *hrfModR; - float elevBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float azimBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float BM_ITD[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; - float elevBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float azimBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; - float itdMod; - -} ModelEval_t; - -/* Mixer listener */ -typedef struct -{ - int16_t PoseUpdated; - float Pos[3]; - float Front[3]; - float Up[3]; - float Right[3]; - - int16_t VelUpdated; - float Vel[3]; - -} TDREND_MIX_Listener_t; - -/* HR filter */ -typedef struct TDREND_HRFILT_FiltSet_struct -{ - int32_t SampleRate; /* Sample rate of the HR filter */ - int16_t NumPos; - int16_t NumElev; - float Dist; - float *ItdSet_p; - int16_t FiltLength; - float *Azim_p; - float *Elev_p; - float *ItdSetNominal_p; - float *LeftFiltSet_p; - float *RightFiltSet_p; - ModelParams_t ModelParams; - ModelEval_t ModelEval; - ModelParamsITD_t ModelParamsITD; - TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ - -} TDREND_HRFILT_FiltSet_t; - - -/* Distance attenuation */ -typedef struct -{ - TDREND_DistAttenModel_t DistAttenModel; - float RefDist; - float MaxDist; - float RollOffFactor; - -} TDREND_DistAtten_t; - -/* Directional attenuation */ -typedef struct -{ - float ConeInnerAngle; - float ConeOuterAngle; - float ConeOuterGain; - -} TDREND_DirAtten_t; - -/* Mixer spatial specification */ -typedef struct -{ - int16_t UseCommonDistAttenModel; /* Common distance attenuation model flag */ - TDREND_DistAttenModel_t DistAttenModel; /* Distance attenuation model */ - -} TDREND_MixSpatSpec_t; - - -typedef struct TDREND_SRC_REND_s -{ - int16_t InputAvailable; - TDREND_PlayStatus_t PlayStatus; - - /* Gains */ - int16_t SrcGainUpdated; - float SrcGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float SrcGainMin_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; - float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; -} TDREND_SRC_REND_t; - - -/* Source spatial parameters */ -typedef struct -{ - int16_t Updated; - TDREND_PosType_t PosType; - float Pos_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; - float Front_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; - int16_t DirAttenEnabled; - TDREND_DirAtten_t DirAtten; - int16_t DistAttenEnabled; - TDREND_DistAtten_t DistAtten; - -} TDREND_SRC_SPATIAL_t; - -typedef struct -{ - float *InputFrame_p; /* Input frame pointer */ - TDREND_SRC_SPATIAL_t *SrcSpatial_p; - TDREND_SRC_REND_t *SrcRend_p; - int16_t itd; - int16_t previtd; - int16_t filterlength; - float mem_itd[ITD_MEM_LEN]; - float hrf_left_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; /* Todo: Should we allocate these buffers with malloc() instead of the maximum length? */ - float hrf_right_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; - float azim_prev; - float elev_prev; - float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; - float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; - float Gain; -} TDREND_SRC_t; - -/* Top level TD binaural renderer handle */ -typedef struct ivas_binaural_td_rendering_struct -{ - TDREND_MixSpatSpec_t *TdRend_MixSpatSpec_p; - TDREND_DirAtten_t *DirAtten_p; - int16_t NumOfSrcs; - int16_t MaxSrcInd; - - TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; - - float Gain; /* Mixer gain */ - TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */ - TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */ - - int16_t UseCommonDistAttenModel; /* Use common dist atten model (TRUE/FALSE) */ - int16_t DistAttenEnabled; /* (TRUE/FALSE) */ - TDREND_DistAttenModel_t DistAttenModel; /* Common distance attenuation model */ - -} BINAURAL_TD_OBJECT_RENDERER, *BINAURAL_TD_OBJECT_RENDERER_HANDLE; - -/*------------------------------------------------------------------------------------------* - * Crend structures - *------------------------------------------------------------------------------------------*/ -// VE2AT: move to ivas_rom_rend.h ? -typedef struct ivas_hrtfs_structure -{ - float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; - float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; - float latency_s; - uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - uint16_t num_iterations_diffuse[BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; - uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; - uint16_t index_frequency_max_diffuse; - int16_t max_num_ir; - int16_t max_num_iterations; - float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ - float gain_lfe; - -} HRTFS_DATA, *HRTFS_HANDLE; - - -/* Main Crend structure */ -typedef struct ivas_crend_state_t -{ - float *freq_buffer_re[MAX_INTERN_CHANNELS]; - float *freq_buffer_im[MAX_INTERN_CHANNELS]; - float *freq_buffer_re_diffuse; - float *freq_buffer_im_diffuse; - float *prev_out_buffer[BINAURAL_CHANNELS]; - float *lfe_delay_line; - float m_fYaw; - float m_fPitch; - float m_fRoll; - ivas_orient_trk_state_t *hTrack; - REVERB_HANDLE hReverb; - int16_t delay_line_rw_index; - int16_t diffuse_delay_line_rw_index; - -} CREND_DATA, *CREND_HANDLE; - -/* Main Crend wrapper structure */ -typedef struct ivas_binaural_crend_wrapper_struct -{ - int32_t binaural_latency_ns; - CREND_HANDLE hCrend; - HRTFS_HANDLE hHrtfCrend; -} CREND_WRAPPER, *CREND_WRAPPER_HANDLE; - - -#ifdef HRTF_BINARY_FILE - -/* htrfs from binary files. */ - -typedef struct ivas_hrtfs_crend_structure -{ - HRTFS_DATA *hHRTF_hrir_combined; - HRTFS_DATA *hHRTF_hrir_hoa3; - HRTFS_DATA *hHRTF_brir_combined; - -} HRTFS_CREND, *HRTFS_CREND_HANDLE; - -typedef struct ivas_hrtfs_header_t -{ - int32_t rend_type; - int32_t input_cfg; - int32_t frequency; - uint32_t data_size; - -} ivas_hrtfs_header_t; - -typedef struct ivas_hrtfs_file_header_t -{ - char identifier[8]; - int32_t file_size; - int16_t nb_hrtf; - int32_t max_data_size; - -} ivas_hrtfs_file_header_t; - -#endif - -#ifdef HRTF_BINARY_FILE -typedef struct ivas_hrtfs_fastconv_struct -{ - float FASTCONV_HRIR_latency_s; - float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; - - float FASTCONV_HOA3_latency_s; - float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; - - float FASTCONV_BRIR_latency_s; - float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; - - float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; - float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; -} HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; - -#endif - -#ifdef HRTF_BINARY_FILE -typedef struct ivas_hrtfs_parambin_struct -{ - float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; - float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; - - float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX]; - float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; - float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; -} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; - -#endif - -/*----------------------------------------------------------------------------------* - * LFE decoder structure - *----------------------------------------------------------------------------------*/ - -typedef struct ivas_lfe_dec_data_structure -{ - ivas_filters_process_state_t filter_state; - LFE_WINDOW_HANDLE pWindow_state; - const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; - float lfe_block_delay_s; - int16_t lfe_prior_buf_len; - float *prior_out_buffer; - - float *prevsynth_buf; - float *lfe_delay_buf; - int16_t lfe_addl_delay; - int16_t bfi_count; - -} LFE_DEC_DATA, *LFE_DEC_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Limiter structure - *----------------------------------------------------------------------------------*/ - -typedef struct -{ - int16_t max_num_channels; - int16_t num_channels; - float **channel_ptrs; - int32_t sampling_rate; - float gain; - float release_heuristic; - float attack_constant; - int16_t strong_saturation_count; -#ifdef DEBUGGING - int32_t cnt_frames_limited; /* counter of frames in which the limiter is applied */ -#endif - -} IVAS_LIMITER, *IVAS_LIMITER_HANDLE; - - -/*----------------------------------------------------------------------------------* - * Decoder configuration structure - *----------------------------------------------------------------------------------*/ - -typedef struct decoder_config_structure -{ - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t orientation_tracking; /* indicates orientation tracking type */ - float no_diegetic_pan; - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - - /* temp. development parameters */ -#ifdef DEBUGGING - int16_t forceSubframeBinauralization; /* Flag for forcing Parametric binauralizer to subframe mode */ - int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ -#endif - -} DECODER_CONFIG, *DECODER_CONFIG_HANDLE; - -typedef struct -{ - int32_t binaural_latency_ns; - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_HRFILT_FiltSet_t *hHrtfTD; -} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; - /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure *----------------------------------------------------------------------------------*/ @@ -1120,6 +103,5 @@ typedef enum CHANNEL_TYPE_SPEAKER, CHANNEL_TYPE_LFE } ChannelType; -#endif #endif /* IVAS_STAT_REND_H */ diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 951df3880b..98d2c48548 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -40,13 +40,8 @@ #include "options.h" #include "common_api_types.h" #include "ivas_error.h" -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "cnst.h" -#endif #ifdef FIX_197_CREND_INTERFACE -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_stat_rend.h" -#endif +#include "ivas_cnst.h" #endif #define RENDERER_MAX_ISM_INPUTS 4 @@ -54,116 +49,17 @@ #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 +#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H - -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? - -typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -typedef struct -{ - int16_t numSamplesPerChannel; - int16_t numChannels; -} IVAS_REND_AudioBufferConfig; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - float *data; -} IVAS_REND_AudioBuffer; - -typedef struct -{ - IVAS_REND_AudioBufferConfig config; - const float *data; -} IVAS_REND_ReadOnlyAudioBuffer; - -typedef struct -{ - float azimuth; - float elevation; -} IVAS_REND_AudioObjectPosition; - -typedef struct IVAS_REND *IVAS_REND_HANDLE; -typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; - -typedef enum -{ - IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED = 0, - IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS, - IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED, - IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL, - IVAS_REND_AUDIO_CONFIG_TYPE_MASA, - 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 = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, - - 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; - -typedef struct -{ - int16_t numLfeChannels; - float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; -} IVAS_REND_LfeRouting; - typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; - - #endif -#ifndef FIX_197_CREND_INTERFACE - -#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 - typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; typedef struct @@ -250,19 +146,19 @@ typedef enum typedef uint16_t IVAS_REND_InputId; - -#else -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H -AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( - IVAS_REND_AudioConfig config ); -#endif -#endif - /* clang-format off */ /*----------------------------------------------------------------------------------* * Function prototypes *----------------------------------------------------------------------------------*/ -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifdef FIX_197_CREND_INTERFACE +AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( + IVAS_REND_AudioConfig config ); + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); +#endif + +#ifdef FIX_197_CREND_INTERFACE IVAS_REND_AudioConfigType getAudioConfigType( const IVAS_REND_AudioConfig config ); @@ -410,15 +306,6 @@ int32_t IVAS_REND_GetCntFramesLimited( ); #endif -#ifdef FIX_197_CREND_INTERFACE -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H - -ivas_error ivas_rend_initEfap( - AUDIO_CONFIG outConfig, - EFAP_HANDLE *hEfap - ); -#endif -#endif /* clang-format on */ #endif -- GitLab From 09ac3db9a635ffae84a9fa6123bdcd4713acd159 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 2 Feb 2023 17:13:12 +0100 Subject: [PATCH 4/9] more simplified --- lib_dec/ivas_stat_dec.h | 6 ------ lib_rend/ivas_lib_rend_internal.h | 2 +- lib_rend/ivas_rom_rend.h | 2 +- lib_rend/ivas_stat_rend.h | 7 +------ 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ffedbd5b36..9faded1e41 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -40,13 +40,7 @@ #include "ivas_cnst.h" #include "ivas_stat_com.h" #include "ivas_stat_rend.h" -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#else -#ifndef FIX_197_CREND_INTERFACE -#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#endif -#endif /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index ab6afd4628..1f64f86445 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -33,8 +33,8 @@ #include "ivas_error.h" #ifndef FIX_197_CREND_INTERFACE #include "lib_rend.h" -#endif #include "ivas_stat_dec.h" +#endif #ifndef IVAS_LIB_REND_INTERNALS_H #define IVAS_LIB_REND_INTERNALS_H diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 0cf4dec24b..cba0fffb1b 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -39,7 +39,7 @@ #include "debug.h" #endif #include "ivas_cnst.h" -#include "ivas_stat_dec.h" +#include "ivas_stat_rend.h" /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 57c8a290ca..f193cd4c70 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -34,12 +34,7 @@ #define IVAS_STAT_REND_H #include -#ifdef FIX_197_CREND_INTERFACE -#include "cnst.h" -#include "ivas_cnst.h" -#include "ivas_stat_com.h" -#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#endif + #define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ -- GitLab From dad7dc85a00c2d139c65c7483400c19cd4294aa9 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 2 Feb 2023 18:16:09 +0100 Subject: [PATCH 5/9] version merged with main --- lib_com/ivas_prot.h | 17 + lib_dec/ivas_stat_dec.h | 21 +- lib_rend/ivas_crend.c | 11 +- lib_rend/ivas_lib_rend_internal.h | 10 + lib_rend/ivas_stat_rend.h | 1096 +++++++++++++++++++++++++++++ lib_rend/lib_rend.h | 17 +- 6 files changed, 1165 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d1d66ccf82..5db88c3f40 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -40,6 +40,11 @@ #include "stat_enc.h" #include "stat_dec.h" #include "stat_com.h" +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifdef FIX_197_CREND_INTERFACE +#include "ivas_stat_rend.h" +#endif +#endif #include "ivas_stat_enc.h" #include "ivas_stat_dec.h" #include "ivas_stat_com.h" @@ -5413,6 +5418,18 @@ ivas_error ivas_crend_process( #else +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +IVAS_REND_AudioConfigType getAudioConfigType( + const IVAS_REND_AudioConfig config ); + +ivas_error getAudioConfigNumChannels( + const IVAS_REND_AudioConfig config, + int16_t *numChannels ); + +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); +#endif + ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9faded1e41..a770ae7cf9 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -40,12 +40,16 @@ #include "ivas_cnst.h" #include "ivas_stat_com.h" #include "ivas_stat_rend.h" +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think - +#endif +#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) *----------------------------------------------------------------------------------*/ +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H + typedef struct ivas_output_setup_structure { AUDIO_CONFIG output_config; @@ -65,7 +69,8 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; - +#endif +#endif /*----------------------------------------------------------------------------------* * DFT Stereo decoder structure *----------------------------------------------------------------------------------*/ @@ -816,6 +821,8 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; } ivas_spar_md_dec_state_t; +#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t { @@ -854,6 +861,8 @@ typedef struct ivas_td_decorr_state_t } ivas_td_decorr_state_t; +#endif + /* PCA structure */ typedef struct { @@ -985,6 +994,8 @@ typedef struct mct_dec_data_structure } MCT_DEC_DATA, *MCT_DEC_HANDLE; +#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + /*----------------------------------------------------------------------------------* * EFAP structures *----------------------------------------------------------------------------------*/ @@ -1117,6 +1128,7 @@ typedef struct renderer_struct } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; +#endif /*----------------------------------------------------------------------------------* * MASA decoder structures *----------------------------------------------------------------------------------*/ @@ -1171,6 +1183,8 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; +#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + /*----------------------------------------------------------------------------------* * Binaural Rendering structure *----------------------------------------------------------------------------------*/ @@ -1807,6 +1821,7 @@ typedef struct ivas_hrtfs_file_header_t #endif +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #ifdef FIX_197_CREND_INTERFACE /* Main Crend wrapper structure */ typedef struct ivas_binaural_crend_wrapper_struct @@ -1816,6 +1831,7 @@ typedef struct ivas_binaural_crend_wrapper_struct HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER, *CREND_WRAPPER_HANDLE; #endif +#endif /*----------------------------------------------------------------------------------* * LFE decoder structure @@ -1886,6 +1902,7 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; +#endif /*----------------------------------------------------------------------------------* * * Main IVAS decoder structure diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index f836491ae8..b86a484f3d 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -36,14 +36,23 @@ #include "ivas_prot.h" #include "ivas_cnst.h" #include "ivas_rom_rend.h" +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_stat_dec.h" +#endif #include #include "ivas_rom_binaural_crend_head.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#include "lib_rend.h" +#include "ivas_lib_rend_internal.h" +#else #ifdef FIX_197_CREND_INTERFACE #include "ivas_stat_rend.h" -#endif +#include "lib_rend.h" +#else #include "lib_rend.h" #include "ivas_lib_rend_internal.h" +#endif +#endif #ifdef DEBUGGING #include "debug.h" #endif diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index 1f64f86445..4d3b475ce9 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -31,9 +31,19 @@ *******************************************************************************************************/ #include "ivas_error.h" +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #ifndef FIX_197_CREND_INTERFACE #include "lib_rend.h" #include "ivas_stat_dec.h" +#endif +#else +#ifdef FIX_197_CREND_INTERFACE +#include "ivas_stat_rend.h" +#else +#include "lib_rend.h" +#endif +#include "ivas_stat_dec.h" + #endif #ifndef IVAS_LIB_REND_INTERNALS_H diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index f193cd4c70..d80caceb92 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -34,10 +34,1104 @@ #define IVAS_STAT_REND_H #include +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ + +/*----------------------------------------------------------------------------------* + * Loudspeaker Configuration Conversion structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_LS_setupconversion_struct +{ + float *dmxMtx[MAX_OUTPUT_CHANNELS]; + float *targetEnergyPrev[MAX_OUTPUT_CHANNELS]; + float *dmxEnergyPrev[MAX_OUTPUT_CHANNELS]; + int16_t sfbOffset[MAX_SFB + 2]; + int16_t sfbCnt; + +} LSSETUP_CONVERSION_STRUCT, *LSSETUP_CONVERSION_HANDLE; + + +typedef struct ivas_LS_setupconversion_matrix +{ + int16_t index; + float value; +} LS_CONVERSION_MATRIX; + +typedef struct ivas_LS_setupconversion_mapping +{ + AUDIO_CONFIG input_config; + AUDIO_CONFIG output_config; + const LS_CONVERSION_MATRIX *conversion_matrix; +} LS_CONVERSION_MAPPING; + +typedef struct ivas_mono_downmix_renderer_struct +{ + float inputEnergy[CLDFB_NO_CHANNELS_MAX]; + float protoEnergy[CLDFB_NO_CHANNELS_MAX]; + +} MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE; + + +/*----------------------------------------------------------------------------------* + * Custom Loudspeaker configuration structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_LS_setup_custom +{ + int16_t is_planar_setup; /* flag to indicate if setup is planar or not */ + int16_t num_spk; /* number of custom loudspeakers */ + float ls_azimuth[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker azimuths */ + float ls_elevation[MAX_OUTPUT_CHANNELS]; /* custom loudspeaker elevations */ + int16_t num_lfe; /* number of LFE channels */ + int16_t lfe_idx[MAX_OUTPUT_CHANNELS]; /* index for LFE channel insertion */ + int16_t separate_ch_found; /* flag to indicate if a center channel was found */ + float separate_ch_gains[MAX_OUTPUT_CHANNELS]; /* gains to pan McMASA separateChannel in case no center channel is present */ + +} LSSETUP_CUSTOM_STRUCT, *LSSETUP_CUSTOM_HANDLE; + +/* Channel types in a channel-based config */ +typedef enum +{ + CHANNEL_TYPE_UNUSED = 0, + CHANNEL_TYPE_SPEAKER, + CHANNEL_TYPE_LFE +} ChannelType; + +#else + +#ifdef FIX_197_CREND_INTERFACE +#include "cnst.h" +#include "ivas_cnst.h" +#include "ivas_stat_com.h" +#include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think +#endif #define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ + +#ifdef FIX_197_CREND_INTERFACE + +#define RENDERER_HEAD_POSITIONS_PER_FRAME 4 // todo (Marc) -> renanr IVAS_RENDERER_HEAD_POSITIONS_PER_FRAME ? + +typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +typedef struct +{ + int16_t numSamplesPerChannel; + int16_t numChannels; +} IVAS_REND_AudioBufferConfig; + +typedef struct +{ + IVAS_REND_AudioBufferConfig config; + float *data; +} IVAS_REND_AudioBuffer; + +typedef struct +{ + IVAS_REND_AudioBufferConfig config; + const float *data; +} IVAS_REND_ReadOnlyAudioBuffer; + +typedef struct +{ + float azimuth; + float elevation; +} IVAS_REND_AudioObjectPosition; + +typedef struct IVAS_REND *IVAS_REND_HANDLE; +typedef struct IVAS_REND const *IVAS_REND_CONST_HANDLE; + +typedef enum +{ + IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED = 0, + IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS, + IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED, + IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL, + IVAS_REND_AUDIO_CONFIG_TYPE_MASA, + 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 = IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL << 8 | 1, + + 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; + +typedef struct +{ + int16_t numLfeChannels; + float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; +} IVAS_REND_LfeRouting; + +#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + +typedef struct +{ + int8_t headRotEnabled; + IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; + float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; +} IVAS_REND_HeadRotData; + +#endif +/*----------------------------------------------------------------------------------* + * Binaural Rendering structure + *----------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? +/* Binaural reverberator structure */ +typedef struct ivas_binaural_reverb_struct +{ + float *loopBufReal[CLDFB_NO_CHANNELS_MAX]; + float *loopBufImag[CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferReal[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float preDelayBufferImag[REVERB_PREDELAY_MAX + 1][CLDFB_NO_CHANNELS_MAX]; + float **tapPointersReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + float **tapPointersImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + + float binauralCoherenceCrossmixGains[CLDFB_NO_CHANNELS_MAX]; + float binauralCoherenceDirectGains[CLDFB_NO_CHANNELS_MAX]; + float reverbEqGains[CLDFB_NO_CHANNELS_MAX]; + float loopAttenuationFactor[CLDFB_NO_CHANNELS_MAX]; + + float *outputBufferReal[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + float *outputBufferImag[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + + int16_t numBins; + + int16_t useBinauralCoherence; + int16_t loopBufLength[CLDFB_NO_CHANNELS_MAX]; + int16_t loopBufLengthMax[CLDFB_NO_CHANNELS_MAX]; + int16_t preDelayBufferIndex; + int16_t preDelayBufferLength; + + int16_t taps[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + int16_t *tapPhaseShiftType[CLDFB_NO_CHANNELS_MAX][BINAURAL_CHANNELS]; + + int16_t blockSize; + uint32_t binRend_RandNext; + int16_t highestBinauralCoherenceBin; + + float dmxmtx[BINAURAL_CHANNELS][MAX_OUTPUT_CHANNELS]; + float foa_enc[MAX_OUTPUT_CHANNELS][FOA_CHANNELS]; + +} REVERB_STRUCT, *REVERB_STRUCT_HANDLE; + +/* AGC structure */ +typedef struct ivas_agc_dec_chan_state_t +{ + float lastGain; + int16_t gainExpVal; + +} ivas_agc_dec_chan_state_t; + +typedef struct ivas_agc_dec_state_t +{ + ivas_agc_com_state_t agc_com; + ivas_agc_dec_chan_state_t *gain_state; + ivas_agc_chan_data_t *gain_data; + +} ivas_agc_dec_state_t; + +/* TD decorr */ +typedef struct ivas_td_decorr_APD_filt_state_t +{ + int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; + int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; + float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; + float *state[IVAS_MAX_DECORR_APD_SECTIONS]; + +} ivas_td_decorr_APD_filt_state_t; + +typedef struct ivas_td_decorr_state_t +{ + ivas_trans_det_state_t *pTrans_det; + float *look_ahead_buf; + ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; + + int16_t num_apd_outputs; + int16_t num_apd_sections; + int16_t ducking_flag; + +} ivas_td_decorr_state_t; + +/* Parametric binaural data structure */ +typedef struct ivas_dirac_dec_binaural_data_structure +{ + float ChEnePrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float ChCrossRePrev[CLDFB_NO_CHANNELS_MAX]; + float ChCrossImPrev[CLDFB_NO_CHANNELS_MAX]; + float ChEne[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float ChCrossRe[CLDFB_NO_CHANNELS_MAX]; + float ChCrossIm[CLDFB_NO_CHANNELS_MAX]; + float ChEneOutPrev[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float ChCrossReOutPrev[CLDFB_NO_CHANNELS_MAX]; + float ChCrossImOutPrev[CLDFB_NO_CHANNELS_MAX]; + float ChEneOut[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float ChCrossReOut[CLDFB_NO_CHANNELS_MAX]; + float ChCrossImOut[CLDFB_NO_CHANNELS_MAX]; + float processMtxRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; /* +1 refers to SeparateChannel */ + float processMtxIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; + float processMtxDecRe[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float processMtxDecIm[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float diffuseFieldCoherence[CLDFB_NO_CHANNELS_MAX]; + float diffuseFieldCoherenceX[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + float diffuseFieldCoherenceY[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + float diffuseFieldCoherenceZ[BINAURAL_COHERENCE_DIFFERENCE_BINS]; + float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; + REVERB_STRUCT_HANDLE hReverb; + uint8_t renderStereoOutputInsteadOfBinaural; + float frameMeanDiffuseness[CLDFB_NO_CHANNELS_MAX]; + float processMtxRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; + float processMtxImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS + 1][CLDFB_NO_CHANNELS_MAX]; + float processMtxDecRePrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + float processMtxDecImPrev[BINAURAL_CHANNELS][BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX]; + uint16_t useSubframeMode; /* 0 = process in 20 ms frames, 1 = process in 5 ms subframes */ + uint16_t useTdDecorr; + ivas_td_decorr_state_t *hTdDecorr; + +} DIRAC_DEC_BIN_DATA, *DIRAC_DEC_BIN_HANDLE; + +typedef struct ivas_binaural_rendering_conv_module_struct +{ + float ***filterTapsLeftReal; + float ***filterTapsLeftImag; + float ***filterTapsRightReal; + float ***filterTapsRightImag; + + float ***filterStatesLeftReal; + float ***filterStatesLeftImag; + + int16_t numTapsArray[BINAURAL_CONVBANDS]; + int16_t numTaps; + +} BINRENDERER_CONV_MODULE, *BINRENDERER_CONV_MODULE_HANDLE; + +/*----------------------------------------------------------------------------------* + * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) + *----------------------------------------------------------------------------------*/ +typedef struct ivas_output_setup_structure +{ + AUDIO_CONFIG output_config; + int16_t nchan_out_woLFE; /* number of output audio channels without LFE */ + int16_t ambisonics_order; + int8_t is_loudspeaker_setup; + int8_t is_planar_setup; + int8_t is_binaural_setup; + + int16_t num_lfe; + int16_t index_lfe[1]; + const float *ls_azimuth; + const float *ls_elevation; + + uint8_t separateChannelEnabled; + int16_t separateChannelIndex; + +} IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; + +/*----------------------------------------------------------------------------------* + * EFAP structures + *----------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? +typedef struct EFAP_VERTEX +{ + float azi; /* azimuth of the loudspeaker */ + float ele; /* elevation of the loudspeaker */ + float pos[3]; /* [x y z] cartesian coordinate vector */ + int16_t idx; /* integer, that corresponds to the first index for the LS in the 1D output */ + int16_t isNaN; /* used to indicate if the vertex is a virtual speaker */ + EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ + +} EFAP_VERTEX; + +typedef struct EFAP_VERTEX_DATA +{ + EFAP_VERTEX *vertexArray; /* Array of vertices */ + int16_t numVtx; /* Number of vertices */ + int16_t *vtxOrder; /* Array that indicates the order of the vertex ranked by increasing azimuth */ + +} EFAP_VERTEX_DATA; + +typedef struct EFAP_POLYSET +{ + int16_t chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ + int16_t isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ + int16_t numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */ + float polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ + float polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ + +} EFAP_POLYSET; + +typedef struct EFAP_LS_TRIANGLE +{ + int16_t LS[3]; /* Array indicating the loudspeaker index of the triangle vertices */ + +} EFAP_LS_TRIANGLE; + +typedef struct EFAP_POLYSET_DATA +{ + EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */ + int16_t numPoly; /* Number of polygons */ + EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */ + int16_t numTri; /* Number of triangles */ + +} EFAP_POLYSET_DATA; + +typedef struct EFAP +{ + int16_t numSpk; /* Number of loudspeakers */ + float *aziSpk; /* Loudspeaker azimuths */ + float *eleSpk; /* Loudspeaker elevations */ + EFAP_VERTEX_DATA vtxData; /* Vertex Data, contains all the data concerning the vertex */ + EFAP_POLYSET_DATA polyData; /* Polygon data */ + float **dmTranspose; /* Downmix Matrix used for redistributing the energy of ghosts LS and its transpose */ + float *bufferLong; /* tmp buffer that will be given as a parameter for computing the gain; this is a 1D array of length numVtx */ + float *bufferShort; /* tmp buffer that will be given as a parameter for computing the gain; this is the result of downMixMatrix*bufferLong, length is numSpk */ + int16_t numTot; /* Total number of real + ghost loudspeakers, used later for freeing memory */ + +} EFAP, *EFAP_HANDLE; + + +/*----------------------------------------------------------------------------------* + * VBAP structures + *----------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? +enum SpeakerNodeGroup +{ + SPEAKER_NODE_BOTTOM_HALF, + SPEAKER_NODE_HORIZONTAL, + SPEAKER_NODE_TOP_HALF, + SPEAKER_NODE_BACK, + SPEAKER_NODE_ALL +}; + +/* Defines a single virtual surface triplet of loudspeakers + * with a precalculated inverse matrix */ +typedef struct vbap_vs_triplet_structure +{ + uint8_t speaker_node[3]; + float inverse_matrix[3][3]; + +} VBAP_VS_TRIPLET; + +/* Defines a single speaker node */ +typedef struct vbap_speaker_node_structure +{ + float azi_deg; + float ele_deg; + float unit_vec[3]; + enum SpeakerNodeGroup group; + +} VBAP_SPEAKER_NODE; + +/* Storage structure for fast runtime triplet search */ +typedef struct triplet_search_structure +{ + VBAP_VS_TRIPLET *triplets; + int16_t num_triplets; + int16_t initial_search_indices[VBAP_NUM_SEARCH_SECTORS]; + +} VBAP_SEARCH_STRUCT; + +/* VBAP data structure. Contains the formed virtual surface arrangement * and supporting data. */ +typedef struct vbap_data_structure +{ + VBAP_SEARCH_STRUCT search_struct[2]; /* Default to max two groups in this implementation */ + int16_t num_search_structs; + int16_t num_speaker_nodes; + int16_t num_speaker_nodes_internal; + int16_t top_virtual_speaker_node_index; /* These indices can be negative */ + int16_t bottom_virtual_speaker_node_index; + int16_t back_virtual_speaker_node_index; + float *bottom_virtual_speaker_node_division_gains; + float *top_virtual_speaker_node_division_gains; + float *back_virtual_speaker_node_division_gains; + +} VBAP_DATA, *VBAP_HANDLE; + + +/*----------------------------------------------------------------------------------* + * renderer structures + *----------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? +typedef struct renderer_struct +{ + float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; + float interpolator[L_FRAME48k]; + +} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; + +/* Fastconv binaural data structure */ +typedef struct ivas_binaural_rendering_struct +{ + /* Common variables for all modules */ + IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ + EFAP_HANDLE hEFAPdata; /* EFAP structure*/ + float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ + int16_t max_band; /* band upto which rendering is performed */ + int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ + int16_t timeSlots; /* number of time slots of binaural renderer */ + int16_t nInChannels; /* number input channels */ + int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ + IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ + + /* Convolution module structure */ + BINRENDERER_CONV_MODULE_HANDLE hBinRenConvModule; + + /* Variables related to reverb module */ + float earlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; + REVERB_STRUCT_HANDLE hReverb; + +} BINAURAL_RENDERER, *BINAURAL_RENDERER_HANDLE; + + +/*----------------------------------------------------------------------------------* + * Head tracking data structure + *----------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? + +typedef struct ivas_binaural_head_track_struct +{ + int16_t num_quaternions; + IVAS_QUATERNION Quaternions[MAX_PARAM_SPATIAL_SUBFRAMES]; + float Rmat[3][3]; + float Rmat_prev[3][3]; + + uint8_t lrSwitchedNext; + uint8_t lrSwitchedCurrent; + float lrSwitchInterpVal; + + int16_t shd_rot_max_order; + +} HEAD_TRACK_DATA, *HEAD_TRACK_DATA_HANDLE; + +/* Reverberator structures */ + + +typedef struct ivas_roomAcoustics_t +{ + int16_t override; + int16_t use_brir; + int16_t late_reverb_on; + int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */ + float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */ + float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */ + float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ + float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */ + float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ + +} ivas_roomAcoustics_t; + +typedef struct ivas_render_config_t +{ +#ifdef DEBUGGING + ivas_renderTypeOverride renderer_type_override; +#endif + ivas_roomAcoustics_t roomAcoustics; + +} RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE; + + +typedef struct ivas_rev_delay_line_t +{ + float *pBuffer; + uint16_t MaxDelay; + int16_t Delay; + uint16_t BufferPos; + float Gain; + +} ivas_rev_delay_line_t; + +typedef struct ivas_rev_iir_filter_t +{ + uint16_t MaxTaps; + uint16_t nr_taps; + uint16_t isFIR; + float Output; + float CoefA[IVAS_REV_MAX_IIR_FILTER_LENGTH]; + float CoefB[IVAS_REV_MAX_IIR_FILTER_LENGTH]; + float pBuffer[IVAS_REV_MAX_IIR_FILTER_LENGTH]; + +} ivas_rev_iir_filter_t; + + +typedef float rv_fftwf_type_complex[2]; /* complex type of fftwf library */ + +/* Convertion block for FFT filter: from time domain to frequency domain (with OLS) and back */ +typedef struct ivas_reverb_t2f_f2t_t +{ + int16_t fft_size; + int16_t log2_fft_size; + int16_t block_size; + int16_t hist_size; /* rv_fft_size - rv_block_size */ + float fft_history_L[RV_FILTER_MAX_HISTORY]; + float fft_history_R[RV_FILTER_MAX_HISTORY]; + +} ivas_reverb_t2f_f2t_t; + +/* FFT filter with its frequency response coefficients */ +typedef struct ivas_reverb_fft_filter_t +{ + int16_t fft_size; + float fft_spectrum[RV_FILTER_MAX_FFT_SIZE]; + +} ivas_reverb_fft_filter_t; + + +typedef struct ivas_reverb_state_t +{ + RENDER_CONFIG_DATA pConfig; + + /* input downmixer: */ + float dmx_gain; /* downmix gain */ + + /* predelay: */ + ivas_rev_delay_line_t predelay_line; + float *pPredelay_buffer; + + /* jot reverberator: */ + uint16_t nr_of_branches; /* number of feedback loops */ + ivas_rev_delay_line_t delay_line[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delays */ + float *loop_delay_buffer[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop delay sample buffers */ + ivas_rev_iir_filter_t t60[IVAS_REV_MAX_NR_BRANCHES]; /* feedback loop filters */ + float gain_matrix[IVAS_REV_MAX_NR_BRANCHES][IVAS_REV_MAX_NR_BRANCHES]; /* feedback matrix */ + float mixer[BINAURAL_CHANNELS][IVAS_REV_MAX_NR_BRANCHES]; /* output mixer matrix */ + + /* binauralization filters: */ + int16_t do_corr_filter; + ivas_reverb_t2f_f2t_t fft_filter_ols; + ivas_reverb_fft_filter_t fft_filter_correl_0; + ivas_reverb_fft_filter_t fft_filter_correl_1; + ivas_reverb_fft_filter_t fft_filter_color_0; + ivas_reverb_fft_filter_t fft_filter_color_1; + uint16_t fft_size; /* fft processing size */ + uint16_t fft_subblock_size; /* fft block processing size */ + uint16_t num_fft_subblocks; /* number of fft subblocks */ + uint16_t full_block_size; /* full block processing size */ + +} REVERB_DATA, *REVERB_HANDLE; + + +typedef struct ivas_orient_trk_state_t +{ + OTR_TRACKING_T trackingType; + float centerAdaptationRate; + float offCenterAdaptationRate; + float adaptationAngle; + + float alpha; + + float absYaw; /* absolute orientation */ + float absPitch; + float absRoll; + + float absAvgYaw; /* average absolute orientation */ + float absAvgPitch; + float absAvgRoll; + + float refYaw; /* reference orientation */ + float refPitch; + float refRoll; + + float trkYaw; /* tracked orientation */ + float trkPitch; + float trkRoll; + +} ivas_orient_trk_state_t; + + +/*----------------------------------------------------------------------------------* + * TD ISm Object Renderer structure + *----------------------------------------------------------------------------------*/ + + +typedef struct +{ + int16_t modelROM; /* Flag that indicates that the model resides in ROM (controls init/dealloc). */ + int16_t UseItdModel; /* Controls whether ITD model is used. */ + int16_t SplineDegree; /* Degree of the spline functions */ + int16_t K; /* Length of filter */ + int16_t elevDim2; + int16_t elevDim3; + int16_t AlphaN; /* Number of rows in Alpha matrices */ + int16_t num_unique_azim_splines; + int16_t elevSegSamples; + + int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + const int16_t *azimDim2; + const int16_t *azimDim3; + const int16_t *azim_start_idx; + const int16_t *azimSegSamples; + const int16_t *azimShapeIdx; + const int16_t *azimShapeSampFactor; + + const float *elevKSeq; /* Array, N x elevDim2 x elevDim3 */ + const float *AlphaL; /* Array, size AlphaN x K */ + const float *AlphaR; /* Array, size AlphaN x K */ + const float *elevBsShape; + float **azimKSeq; /* Array, length azimDim3+1 */ + const float **azimBsShape; + + int16_t azimDim3Max; + int16_t iSecFirst[HRTF_MODEL_N_SECTIONS]; /* Indices for start of sections */ + int16_t iSecLast[HRTF_MODEL_N_SECTIONS]; /* Indices for end of sections */ + const float *EL; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ + const float *ER; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */ + + /* Pointers for allocation of dynamic memory */ + float *AlphaL_dyn; + float *AlphaR_dyn; + float *EL_dyn; + float *ER_dyn; + float *elevBsShape_dyn; + float *elevKSeq_dyn; + int16_t *azimDim2_dyn; + int16_t *azimDim3_dyn; + int16_t *azim_start_idx_dyn; + int16_t *azimSegSamples_dyn; + int16_t *azimShapeIdx_dyn; + int16_t *azimShapeSampFactor_dyn; + float **azimBsShape_dyn; + +} ModelParams_t; + +typedef struct +{ + int16_t N; /* Polynomial degree */ + + int16_t elevDim2; + int16_t elevDim3; + const float *elevKSeq; /* Array, length elevDim3-2 */ + int16_t azimDim2; + int16_t azimDim3; + const float *azimKSeq; /* Array, length azimDim3-2 */ + const float *W; /* Array, size (elevDim3*azimDim3) x K */ + + int16_t azimBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + int16_t azimBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + const float *azimBsShape; + int16_t azimSegSamples; + + int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + const float *elevBsShape; + int16_t elevSegSamples; + float resamp_factor; + + /* Pointers for allocation of dynamic memory */ + float *elevKSeq_dyn; + float *azimKSeq_dyn; + float *W_dyn; + float *azimBsShape_dyn; + float *elevBsShape_dyn; + +} ModelParamsITD_t; + +typedef struct +{ + float val; + int16_t i; + +} ValueIndex_t; + +/* Shared memory for use when evaluating BSpline HR filter model*/ +typedef struct +{ + float BM[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + ValueIndex_t BMEnergiesL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + ValueIndex_t BMEnergiesR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + int16_t UseIndsL[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + int16_t UseIndsR[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + float *hrfModL; + float *hrfModR; + float elevBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + float azimBfVec[HRTF_MODEL_BSPLINE_NUM_COEFFS][HRTF_MODEL_BSPLINE_NUM_COEFFS]; + float BM_ITD[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ]; + float elevBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + float azimBfVecITD[HRTF_MODEL_BSPLINE_NUM_COEFFS]; + float itdMod; + +} ModelEval_t; + +/* Mixer listener */ +typedef struct +{ + int16_t PoseUpdated; + float Pos[3]; + float Front[3]; + float Up[3]; + float Right[3]; + + int16_t VelUpdated; + float Vel[3]; + +} TDREND_MIX_Listener_t; + +/* HR filter */ +typedef struct TDREND_HRFILT_FiltSet_struct +{ + int32_t SampleRate; /* Sample rate of the HR filter */ + int16_t NumPos; + int16_t NumElev; + float Dist; + float *ItdSet_p; + int16_t FiltLength; + float *Azim_p; + float *Elev_p; + float *ItdSetNominal_p; + float *LeftFiltSet_p; + float *RightFiltSet_p; + ModelParams_t ModelParams; + ModelEval_t ModelEval; + ModelParamsITD_t ModelParamsITD; + TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ + +} TDREND_HRFILT_FiltSet_t; + + +/* Distance attenuation */ +typedef struct +{ + TDREND_DistAttenModel_t DistAttenModel; + float RefDist; + float MaxDist; + float RollOffFactor; + +} TDREND_DistAtten_t; + +/* Directional attenuation */ +typedef struct +{ + float ConeInnerAngle; + float ConeOuterAngle; + float ConeOuterGain; + +} TDREND_DirAtten_t; + +/* Mixer spatial specification */ +typedef struct +{ + int16_t UseCommonDistAttenModel; /* Common distance attenuation model flag */ + TDREND_DistAttenModel_t DistAttenModel; /* Distance attenuation model */ + +} TDREND_MixSpatSpec_t; + + +typedef struct TDREND_SRC_REND_s +{ + int16_t InputAvailable; + TDREND_PlayStatus_t PlayStatus; + + /* Gains */ + int16_t SrcGainUpdated; + float SrcGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; + float SrcGainMin_p[SPAT_BIN_MAX_INPUT_CHANNELS]; + float SrcGainMax_p[SPAT_BIN_MAX_INPUT_CHANNELS]; + float DirGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; + float DistGain_p[SPAT_BIN_MAX_INPUT_CHANNELS]; +} TDREND_SRC_REND_t; + + +/* Source spatial parameters */ +typedef struct +{ + int16_t Updated; + TDREND_PosType_t PosType; + float Pos_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; + float Front_p[3 * SPAT_BIN_MAX_INPUT_CHANNELS]; + int16_t DirAttenEnabled; + TDREND_DirAtten_t DirAtten; + int16_t DistAttenEnabled; + TDREND_DistAtten_t DistAtten; + +} TDREND_SRC_SPATIAL_t; + +typedef struct +{ + float *InputFrame_p; /* Input frame pointer */ + TDREND_SRC_SPATIAL_t *SrcSpatial_p; + TDREND_SRC_REND_t *SrcRend_p; + int16_t itd; + int16_t previtd; + int16_t filterlength; + float mem_itd[ITD_MEM_LEN]; + float hrf_left_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; /* Todo: Should we allocate these buffers with malloc() instead of the maximum length? */ + float hrf_right_prev[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; + float azim_prev; + float elev_prev; + float mem_hrf_left[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; + float mem_hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH - 1]; + float Gain; +} TDREND_SRC_t; + +/* Top level TD binaural renderer handle */ +typedef struct ivas_binaural_td_rendering_struct +{ + TDREND_MixSpatSpec_t *TdRend_MixSpatSpec_p; + TDREND_DirAtten_t *DirAtten_p; + int16_t NumOfSrcs; + int16_t MaxSrcInd; + + TDREND_SRC_t *Sources[MAX_NUM_TDREND_CHANNELS]; + + float Gain; /* Mixer gain */ + TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */ + TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */ + + int16_t UseCommonDistAttenModel; /* Use common dist atten model (TRUE/FALSE) */ + int16_t DistAttenEnabled; /* (TRUE/FALSE) */ + TDREND_DistAttenModel_t DistAttenModel; /* Common distance attenuation model */ + +} BINAURAL_TD_OBJECT_RENDERER, *BINAURAL_TD_OBJECT_RENDERER_HANDLE; + +/*------------------------------------------------------------------------------------------* + * Crend structures + *------------------------------------------------------------------------------------------*/ +// VE2AT: move to ivas_rom_rend.h ? +typedef struct ivas_hrtfs_structure +{ + float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; + float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; + float latency_s; + uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + uint16_t num_iterations_diffuse[BINAURAL_CHANNELS]; + uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; + uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; + uint16_t index_frequency_max_diffuse; + int16_t max_num_ir; + int16_t max_num_iterations; + float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ + float gain_lfe; + +} HRTFS_DATA, *HRTFS_HANDLE; + + +/* Main Crend structure */ +typedef struct ivas_crend_state_t +{ + float *freq_buffer_re[MAX_INTERN_CHANNELS]; + float *freq_buffer_im[MAX_INTERN_CHANNELS]; + float *freq_buffer_re_diffuse; + float *freq_buffer_im_diffuse; + float *prev_out_buffer[BINAURAL_CHANNELS]; + float *lfe_delay_line; + float m_fYaw; + float m_fPitch; + float m_fRoll; + ivas_orient_trk_state_t *hTrack; + REVERB_HANDLE hReverb; + int16_t delay_line_rw_index; + int16_t diffuse_delay_line_rw_index; + +} CREND_DATA, *CREND_HANDLE; + +/* Main Crend wrapper structure */ +typedef struct ivas_binaural_crend_wrapper_struct +{ + int32_t binaural_latency_ns; + CREND_HANDLE hCrend; + HRTFS_HANDLE hHrtfCrend; +} CREND_WRAPPER, *CREND_WRAPPER_HANDLE; + + +#ifdef HRTF_BINARY_FILE + +/* htrfs from binary files. */ + +typedef struct ivas_hrtfs_crend_structure +{ + HRTFS_DATA *hHRTF_hrir_combined; + HRTFS_DATA *hHRTF_hrir_hoa3; + HRTFS_DATA *hHRTF_brir_combined; + +} HRTFS_CREND, *HRTFS_CREND_HANDLE; + +typedef struct ivas_hrtfs_header_t +{ + int32_t rend_type; + int32_t input_cfg; + int32_t frequency; + uint32_t data_size; + +} ivas_hrtfs_header_t; + +typedef struct ivas_hrtfs_file_header_t +{ + char identifier[8]; + int32_t file_size; + int16_t nb_hrtf; + int32_t max_data_size; + +} ivas_hrtfs_file_header_t; + +#endif + +#ifdef HRTF_BINARY_FILE +typedef struct ivas_hrtfs_fastconv_struct +{ + float FASTCONV_HRIR_latency_s; + float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; + float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; + float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; + float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][7]; + + float FASTCONV_HOA3_latency_s; + float leftHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; + float leftHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; + float rightHRIRReal_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; + float rightHRIRImag_HOA3[BINAURAL_CONVBANDS][HRTF_SH_CHANNELS][7]; + + float FASTCONV_BRIR_latency_s; + float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]; + + float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; + float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; +} HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; + +#endif + +#ifdef HRTF_BINARY_FILE +typedef struct ivas_hrtfs_parambin_struct +{ + float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; + float hrtfShCoeffsIm[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]; + + float parametricReverberationTimes[CLDFB_NO_CHANNELS_MAX]; + float parametricReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; + float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; +} HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; + +#endif + +/*----------------------------------------------------------------------------------* + * LFE decoder structure + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_lfe_dec_data_structure +{ + ivas_filters_process_state_t filter_state; + LFE_WINDOW_HANDLE pWindow_state; + const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; + int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; + float lfe_block_delay_s; + int16_t lfe_prior_buf_len; + float *prior_out_buffer; + + float *prevsynth_buf; + float *lfe_delay_buf; + int16_t lfe_addl_delay; + int16_t bfi_count; + +} LFE_DEC_DATA, *LFE_DEC_HANDLE; + + +/*----------------------------------------------------------------------------------* + * Limiter structure + *----------------------------------------------------------------------------------*/ + +typedef struct +{ + int16_t max_num_channels; + int16_t num_channels; + float **channel_ptrs; + int32_t sampling_rate; + float gain; + float release_heuristic; + float attack_constant; + int16_t strong_saturation_count; +#ifdef DEBUGGING + int32_t cnt_frames_limited; /* counter of frames in which the limiter is applied */ +#endif + +} IVAS_LIMITER, *IVAS_LIMITER_HANDLE; + + +/*----------------------------------------------------------------------------------* + * Decoder configuration structure + *----------------------------------------------------------------------------------*/ + +typedef struct decoder_config_structure +{ + int32_t ivas_total_brate; /* IVAS total bitrate in bps */ + int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ + int32_t output_Fs; /* output signal sampling frequency in Hz */ + int16_t nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ + int16_t orientation_tracking; /* indicates orientation tracking type */ + float no_diegetic_pan; + int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + + /* temp. development parameters */ +#ifdef DEBUGGING + int16_t forceSubframeBinauralization; /* Flag for forcing Parametric binauralizer to subframe mode */ + int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ +#endif + +} DECODER_CONFIG, *DECODER_CONFIG_HANDLE; + +#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + +typedef struct +{ + int32_t binaural_latency_ns; + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; + TDREND_HRFILT_FiltSet_t *hHrtfTD; +} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE; + +#endif +#endif + /*----------------------------------------------------------------------------------* * Loudspeaker Configuration Conversion structure *----------------------------------------------------------------------------------*/ @@ -99,4 +1193,6 @@ typedef enum CHANNEL_TYPE_LFE } ChannelType; +#endif + #endif /* IVAS_STAT_REND_H */ diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 98d2c48548..5361a791bf 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -41,7 +41,11 @@ #include "common_api_types.h" #include "ivas_error.h" #ifdef FIX_197_CREND_INTERFACE +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_cnst.h" +#else +#include "ivas_stat_rend.h" +#endif #endif #define RENDERER_MAX_ISM_INPUTS 4 @@ -49,6 +53,8 @@ #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 +#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) + #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H @@ -146,10 +152,8 @@ typedef enum typedef uint16_t IVAS_REND_InputId; -/* clang-format off */ -/*----------------------------------------------------------------------------------* - * Function prototypes - *----------------------------------------------------------------------------------*/ +#endif + #ifdef FIX_197_CREND_INTERFACE AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); @@ -167,6 +171,11 @@ ivas_error getAudioConfigNumChannels( int16_t *numChannels ); #endif +/* clang-format off */ +/*----------------------------------------------------------------------------------* + * Function prototypes + *----------------------------------------------------------------------------------*/ + /* Functions to be called before rendering */ ivas_error IVAS_REND_Open( -- GitLab From f823842af0449241d57ba4c48210ec9b3542e89b Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 6 Feb 2023 13:48:49 +0100 Subject: [PATCH 6/9] Simplify preprocessor logic around FIX_197_CREND_INTERFACE switch --- lib_dec/ivas_stat_dec.h | 10 +++------- lib_rend/ivas_stat_rend.h | 4 ++-- lib_rend/lib_rend.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index a770ae7cf9..4c28a941d2 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -40,10 +40,7 @@ #include "ivas_cnst.h" #include "ivas_stat_com.h" #include "ivas_stat_rend.h" -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) #include "common_api_types.h" // VE2AT: don't we want to avoid this include in the library? I admit that the rules hefre are not 100% clear to me but introducing it just for IVAS_QUATERNION is not necessry I think -#endif -#if !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) /*----------------------------------------------------------------------------------* * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) *----------------------------------------------------------------------------------*/ @@ -69,7 +66,6 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; -#endif #endif /*----------------------------------------------------------------------------------* * DFT Stereo decoder structure @@ -821,7 +817,7 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; } ivas_spar_md_dec_state_t; -#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t @@ -994,7 +990,7 @@ typedef struct mct_dec_data_structure } MCT_DEC_DATA, *MCT_DEC_HANDLE; -#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H /*----------------------------------------------------------------------------------* * EFAP structures @@ -1183,7 +1179,7 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#if ( !defined( FIX_197_CREND_INTERFACE ) || defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H /*----------------------------------------------------------------------------------* * Binaural Rendering structure diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index d80caceb92..2bbedd16e2 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -206,7 +206,7 @@ typedef struct float lfeOutputGains[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; } IVAS_REND_LfeRouting; -#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct { @@ -1120,7 +1120,7 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 5361a791bf..1791be0932 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -53,7 +53,7 @@ #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 -#if ( defined( FIX_197_CREND_INTERFACE ) || !defined( FIX_197_CREND_INTERFACE ) ) && defined( FIX_197_CREND_INTERFACE_LIB_REND_H ) +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 -- GitLab From aa7883ff28da09650a03603284b6528030834b1e Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 6 Feb 2023 14:29:22 +0100 Subject: [PATCH 7/9] Further cleanup of lib_rend.h --- lib_com/ivas_prot.h | 4 ++-- lib_rend/ivas_lib_rend_internal.h | 33 +++++++++++++++++++------------ lib_rend/ivas_stat_rend.h | 3 +++ lib_rend/lib_rend.c | 3 --- lib_rend/lib_rend.h | 18 ++++------------- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 5db88c3f40..03ac199fa4 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -5416,7 +5416,7 @@ ivas_error ivas_crend_process( float output[][L_FRAME48k] /* i/o: input/output audio channels */ ); -#else +#else /* FIX_197_CREND_INTERFACE */ #ifndef FIX_197_CREND_INTERFACE_LIB_REND_H IVAS_REND_AudioConfigType getAudioConfigType( @@ -5428,7 +5428,7 @@ ivas_error getAudioConfigNumChannels( IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( AUDIO_CONFIG config ); -#endif +#endif /* FIX_197_CREND_INTERFACE_LIB_REND_H */ ivas_error ivas_rend_initCrend( CREND_WRAPPER *pCrend, diff --git a/lib_rend/ivas_lib_rend_internal.h b/lib_rend/ivas_lib_rend_internal.h index 4d3b475ce9..d7096576b9 100644 --- a/lib_rend/ivas_lib_rend_internal.h +++ b/lib_rend/ivas_lib_rend_internal.h @@ -30,33 +30,37 @@ *******************************************************************************************************/ +#ifndef IVAS_LIB_REND_INTERNALS_H +#define IVAS_LIB_REND_INTERNALS_H + +#include "options.h" #include "ivas_error.h" + #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#ifndef FIX_197_CREND_INTERFACE #include "lib_rend.h" +#include "ivas_cnst.h" +#include #include "ivas_stat_dec.h" -#endif -#else + +#else /* FIX_197_CREND_INTERFACE_LIB_REND_H */ + #ifdef FIX_197_CREND_INTERFACE #include "ivas_stat_rend.h" -#else +#else /* FIX_197_CREND_INTERFACE */ #include "lib_rend.h" -#endif -#include "ivas_stat_dec.h" +#endif /* FIX_197_CREND_INTERFACE */ -#endif +#include "ivas_stat_dec.h" -#ifndef IVAS_LIB_REND_INTERNALS_H -#define IVAS_LIB_REND_INTERNALS_H +#endif /* FIX_197_CREND_INTERFACE_LIB_REND_H */ -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct { int8_t headRotEnabled; IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; } IVAS_REND_HeadRotData; -#endif + typedef struct { int32_t binaural_latency_ns; @@ -82,10 +86,13 @@ ivas_error getAudioConfigNumChannels( const IVAS_REND_AudioConfig config, int16_t *numChannels ); -#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H +#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +IVAS_REND_AudioConfig getRendAudioConfigFromIvasAudioConfig( + AUDIO_CONFIG config ); +#endif + AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); -#endif #ifndef FIX_197_CREND_INTERFACE diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 2bbedd16e2..312307f4e9 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -34,6 +34,9 @@ #define IVAS_STAT_REND_H #include +#include "options.h" +#include "ivas_cnst.h" + #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #define MAX_SPEAKERS 12 /* Max number of speakers (including LFE) in a channel-based config */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 93aa4caacb..37a474bee3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -38,9 +38,6 @@ #include "ivas_rom_dec.h" #include "ivas_rom_rend.h" #include "ivas_lib_rend_internal.h" -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_stat_dec.h" -#endif #include "prot.h" #include "wmc_auto.h" diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 1791be0932..7fbcf092cd 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -40,13 +40,10 @@ #include "options.h" #include "common_api_types.h" #include "ivas_error.h" -#ifdef FIX_197_CREND_INTERFACE -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -#include "ivas_cnst.h" -#else + +#if defined FIX_197_CREND_INTERFACE && !defined FIX_197_CREND_INTERFACE_LIB_REND_H #include "ivas_stat_rend.h" #endif -#endif #define RENDERER_MAX_ISM_INPUTS 4 #define RENDERER_MAX_MC_INPUTS 1 @@ -57,15 +54,6 @@ #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H -typedef struct -{ - int8_t headRotEnabled; - IVAS_QUATERNION headPositions[RENDERER_HEAD_POSITIONS_PER_FRAME]; - float crossfade[L_FRAME48k / RENDERER_HEAD_POSITIONS_PER_FRAME]; -} IVAS_REND_HeadRotData; -#endif - typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS]; typedef struct @@ -154,6 +142,7 @@ typedef uint16_t IVAS_REND_InputId; #endif +#ifndef FIX_197_CREND_INTERFACE_LIB_REND_H #ifdef FIX_197_CREND_INTERFACE AUDIO_CONFIG getIvasAudioConfigFromRendAudioConfig( IVAS_REND_AudioConfig config ); @@ -170,6 +159,7 @@ ivas_error getAudioConfigNumChannels( const IVAS_REND_AudioConfig config, int16_t *numChannels ); #endif +#endif /* clang-format off */ /*----------------------------------------------------------------------------------* -- GitLab From 0467f4a1286abb526d0b2694308cf310f61e3929 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Mon, 6 Feb 2023 14:49:31 +0100 Subject: [PATCH 8/9] Fix build when FIX_197_CREND_INTERFACE is disabled --- lib_dec/ivas_stat_dec.h | 25 ++++++++++++++----------- lib_rend/lib_rend.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4c28a941d2..d2ba313e57 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -45,7 +45,7 @@ * Output configuration for renderer (e.g. DirAC, MASA, Binaural Renderer...) *----------------------------------------------------------------------------------*/ -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#if !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H typedef struct ivas_output_setup_structure { @@ -817,7 +817,7 @@ typedef struct ivas_spar_md_dec_state_t int16_t spar_hoa_md_flag; } ivas_spar_md_dec_state_t; -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#if !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H /* AGC structure */ typedef struct ivas_agc_dec_chan_state_t @@ -857,7 +857,7 @@ typedef struct ivas_td_decorr_state_t } ivas_td_decorr_state_t; -#endif +#endif /* !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H */ /* PCA structure */ typedef struct @@ -990,7 +990,7 @@ typedef struct mct_dec_data_structure } MCT_DEC_DATA, *MCT_DEC_HANDLE; -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#if !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H /*----------------------------------------------------------------------------------* * EFAP structures @@ -1179,7 +1179,7 @@ typedef struct ivas_masa_decoder_struct } MASA_DECODER, *MASA_DECODER_HANDLE; -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#if !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H /*----------------------------------------------------------------------------------* * Binaural Rendering structure @@ -1302,7 +1302,7 @@ typedef struct ivas_hrtfs_fastconv_struct float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX]; } HRTFS_FASTCONV, *HRTFS_FASTCONV_HANDLE; -#endif +#endif /* HRTF_BINARY_FILE */ #ifdef HRTF_BINARY_FILE typedef struct ivas_hrtfs_parambin_struct @@ -1315,7 +1315,7 @@ typedef struct ivas_hrtfs_parambin_struct float parametricEarlyPartEneCorrection[CLDFB_NO_CHANNELS_MAX]; } HRTFS_PARAMBIN, *HRTFS_PARAMBIN_HANDLE; -#endif +#endif /* HRTF_BINARY_FILE */ typedef struct ivas_binaural_rendering_struct { @@ -1815,10 +1815,11 @@ typedef struct ivas_hrtfs_file_header_t } ivas_hrtfs_file_header_t; -#endif +#endif /* HRTF_BINARY_FILE */ #ifdef FIX_197_CREND_INTERFACE_LIB_REND_H #ifdef FIX_197_CREND_INTERFACE + /* Main Crend wrapper structure */ typedef struct ivas_binaural_crend_wrapper_struct { @@ -1826,8 +1827,9 @@ typedef struct ivas_binaural_crend_wrapper_struct CREND_HANDLE hCrend; HRTFS_HANDLE hHrtfCrend; } CREND_WRAPPER, *CREND_WRAPPER_HANDLE; -#endif -#endif + +#endif /* FIX_197_CREND_INTERFACE */ +#endif /* FIX_197_CREND_INTERFACE_LIB_REND_H */ /*----------------------------------------------------------------------------------* * LFE decoder structure @@ -1898,7 +1900,8 @@ typedef struct decoder_config_structure } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -#endif +#endif /* !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H */ + /*----------------------------------------------------------------------------------* * * Main IVAS decoder structure diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 7fbcf092cd..789b426070 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -50,7 +50,7 @@ #define RENDERER_MAX_SBA_INPUTS 1 #define RENDERER_MAX_MASA_INPUTS 1 -#ifdef FIX_197_CREND_INTERFACE_LIB_REND_H +#if !defined FIX_197_CREND_INTERFACE || defined FIX_197_CREND_INTERFACE_LIB_REND_H #define RENDERER_HEAD_POSITIONS_PER_FRAME 4 -- GitLab From 98b19ca3842418092aa37d9c9dc863629ec2af83 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 9 Feb 2023 16:42:39 +0100 Subject: [PATCH 9/9] fix compilation issue --- lib_dec/ivas_stat_dec.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9833177d21..446bbb5816 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1508,6 +1508,9 @@ typedef struct TDREND_HRFILT_FiltSet_struct ModelEval_t ModelEval; ModelParamsITD_t ModelParamsITD; TDREND_HRFILT_Method_t FilterMethod; /* HR filtering method */ +#ifdef FIX_310_TD_REND_DELAY + float latency_s; +#endif } TDREND_HRFILT_FiltSet_t; -- GitLab