From 590126df96e489dacec0ad4b72d40acafa16f72f Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Fri, 5 Apr 2024 17:28:19 +1100 Subject: [PATCH 01/14] Adding ISAR pre prend API --- lib_dec/ivas_init_dec.c | 5 +- lib_dec/lib_dec.c | 3 +- lib_isar/isar_prot.h | 65 ++------------- lib_isar/isar_splitRendererPre.c | 136 +++++++++++++++++++++++-------- lib_isar/lib_isar_post_rend.c | 55 ------------- lib_isar/lib_isar_pre_rend.h | 86 +++++++++++++++++++ lib_rend/ivas_prot_rend.h | 76 ----------------- lib_rend/lib_rend.c | 11 +-- 8 files changed, 205 insertions(+), 232 deletions(-) create mode 100644 lib_isar/lib_isar_pre_rend.h diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4e93dd6357..f8a6a1c5b7 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -41,6 +41,7 @@ #include "prot.h" #ifdef SPLIT_REND_WITH_HEAD_ROT #include "common_api_types.h" +#include "lib_isar_pre_rend.h" #endif #include #include @@ -281,7 +282,7 @@ static ivas_error ivas_dec_init_split_rend( } #endif - error = isar_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ); + error = isar_pre_rend_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ); return error; } #endif @@ -2701,7 +2702,7 @@ void ivas_destroy_dec( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural renderer handle */ - isar_split_renderer_close( &st_ivas->hSplitBinRend.splitrend ); + isar_pre_rend_close( &st_ivas->hSplitBinRend.splitrend, NULL ); for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 563736f20f..358ccc10bd 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -35,6 +35,7 @@ #include "ivas_prot.h" #include "ivas_prot_rend.h" #include "isar_prot.h" +#include "lib_isar_pre_rend.h" #include "prot.h" #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" @@ -1199,7 +1200,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Quaternion.y = 0.0f; Quaternion.z = 0.0f; } - if ( ( error = isar_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, + if ( ( error = isar_pre_rend_MultiBinToSplitBinaural( &hSplitBinRend->splitrend, Quaternion, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, st_ivas->hRenderConfig->split_rend_config.codec, diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index a9917abb07..a85a609f01 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -175,11 +175,6 @@ void isar_SplitRenderer_getdiagdiff( const int16_t min_val, const int16_t max_val ); -void isar_renderSplitGetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); - void isar_split_rend_get_quant_params( const int16_t num_md_bands, int16_t pred_real_bands_yaw[IVAS_SPLIT_REND_NUM_QUANT_STRATS], @@ -232,6 +227,12 @@ void isar_rend_CldfbSplitPostRendProcess( void isar_init_multi_bin_pose_data( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData ); +void isar_renderSplitGetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis +); + void isar_rend_CldfbSplitPreRendProcess( const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, const IVAS_QUATERNION headPosition, @@ -246,19 +247,6 @@ void isar_rend_CldfbSplitPreRendProcess( void isar_init_split_post_rend_handles( ISAR_SPLIT_POST_REND_WRAPPER *hSplitRendWrapper ); -ivas_error isar_splitBinPreRendOpen( - ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend, -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const int32_t output_Fs -#else - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -#endif -); - -void ivas_splitBinPreRendClose( - ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ); - void isar_set_split_rend_ht_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData ); @@ -286,17 +274,6 @@ int32_t isar_get_lcld_bitrate( int8_t isar_get_lc3plus_bitrate_id( const int32_t SplitRendBitRate ); -ivas_error isar_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitBinRend, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t output_Fs, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t num_subframes ); - -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend ); - int32_t isar_get_split_rend_md_target_brate( const int32_t SplitRendBitRate, const int16_t pcm_out_flag ); @@ -309,22 +286,6 @@ ivas_error isar_split_rend_choose_default_codec( const int16_t num_subframes /* i : number of subframes */ ); -ivas_error isar_renderMultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, - const IVAS_QUATERNION headPosition, - const int32_t SplitRendBitRate, - ISAR_SPLIT_REND_CODEC splitCodec, - int16_t codec_frame_size_ms, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - float *output[], - const int16_t low_res_pre_rend_rot, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t ro_md_flag ); - void ISAR_SPLIT_REND_BITStream_init( ISAR_SPLIT_REND_BITS_HANDLE pBits, const int32_t buf_len_bytes, @@ -357,20 +318,6 @@ ISAR_POST_REND_AudioConfigType isar_getAudioConfigType( void isar_init_split_rend_handles( SPLIT_REND_WRAPPER *hSplitRendWrapper ); -void closeSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer ); - -ivas_error initSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const IVAS_AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ); - #endif /* clang-format on */ diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 44967419a0..fae4dd1c76 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -41,6 +41,7 @@ #include "prot.h" #include "ivas_cnst.h" #include "isar_rom_post_rend.h" +#include "lib_isar_pre_rend.h" #include "isar_prot.h" #ifdef DEBUGGING #include "debug.h" @@ -50,6 +51,8 @@ #include "string.h" #endif +#define MAX_BUFFER_LENGTH_PER_CHANNEL ( L_FRAME48k ) +#define MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL ( MAX_BUFFER_LENGTH_PER_CHANNEL * 2 ) /*------------------------------------------------------------------------- * Local functions @@ -1491,7 +1494,7 @@ void isar_rend_CldfbSplitPreRendProcess( * *------------------------------------------------------------------------*/ -ivas_error isar_splitBinPreRendOpen( +static ivas_error isar_splitBinPreRendOpen( ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1570,7 +1573,7 @@ ivas_error isar_splitBinPreRendOpen( * *------------------------------------------------------------------------*/ -void ivas_splitBinPreRendClose( +static void ivas_splitBinPreRendClose( ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE *hBinHrSplitPreRend ) { if ( ( *hBinHrSplitPreRend ) != NULL ) @@ -1633,6 +1636,20 @@ void isar_set_split_rend_ht_setup( return; } +/*-------------------------------------------------------------------------* + * isar_pre_rend_GetMultiBinPoseData() + * + * + *-------------------------------------------------------------------------*/ + +void isar_pre_rend_GetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis +) +{ + isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, pMultiBinPoseData, rot_axis ); +} /*-------------------------------------------------------------------------* * isar_set_split_rend_setup() @@ -1640,6 +1657,7 @@ void isar_set_split_rend_ht_setup( * Setup IVAS split rendering *-------------------------------------------------------------------------*/ + ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, @@ -1710,30 +1728,6 @@ void isar_init_split_rend_handles( return; } -/*------------------------------------------------------------------------- - * Function closeSplitRend() - * - * - *------------------------------------------------------------------------*/ - -void closeSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) -{ - isar_split_renderer_close( pSplitRendWrapper ); - - if ( pSplitRendEncBuffer->data != NULL ) - { - free( pSplitRendEncBuffer->data ); - pSplitRendEncBuffer->data = NULL; - } - - pSplitRendEncBuffer->config.numChannels = 0; - pSplitRendEncBuffer->config.numSamplesPerChannel = 0; - - return; -} - /*------------------------------------------------------------------------- * Function split_renderer_open_lc3plus() * @@ -1804,12 +1798,12 @@ static ivas_error split_renderer_open_lc3plus( /*------------------------------------------------------------------------- - * Function isar_split_renderer_open() + * Function isar_pre_rend_open() * * *------------------------------------------------------------------------*/ -ivas_error isar_split_renderer_open( +ivas_error isar_pre_rend_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, @@ -1944,13 +1938,74 @@ ivas_error isar_split_renderer_open( /*------------------------------------------------------------------------- - * Function isar_split_renderer_close() + * Function isar_pre_rend_init() * * *------------------------------------------------------------------------*/ -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend ) +ivas_error isar_pre_rend_init( + SPLIT_REND_WRAPPER *pSplitRendWrapper, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer, + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + IVAS_REND_HeadRotData headRotData, + const int32_t outputSampleRate, + const AUDIO_CONFIG outConfig, + const int16_t cldfb_in_flag, + const int16_t num_subframes ) +{ + ivas_error error; + IVAS_REND_AudioBufferConfig bufConfig; + + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); + } + else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); + } + + if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*allocate for CLDFB in and change to TD during process if needed*/ + bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; + bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; + bufConfig.is_cldfb = 1; + pSplitRendEncBuffer->config = bufConfig; + + if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + } + else + { + IVAS_REND_AudioBufferConfig bufConfig2; + + bufConfig2.numSamplesPerChannel = 0; + bufConfig2.numChannels = 0; + bufConfig2.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig2; + pSplitRendEncBuffer->data = NULL; + } + + return IVAS_ERR_OK; +} + +/*------------------------------------------------------------------------- + * Function isar_pre_rend_close() + * + * + *------------------------------------------------------------------------*/ + +void isar_pre_rend_close( + SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer ) { int16_t i; @@ -2006,6 +2061,19 @@ void isar_split_renderer_close( } } + if ( pSplitRendEncBuffer != NULL ) + { + + if ( pSplitRendEncBuffer->data != NULL ) + { + free( pSplitRendEncBuffer->data ); + pSplitRendEncBuffer->data = NULL; + } + + pSplitRendEncBuffer->config.numChannels = 0; + pSplitRendEncBuffer->config.numSamplesPerChannel = 0; + } + return; } @@ -2282,12 +2350,12 @@ static void lc3plusTimeAlignCldfbPoseCorr( /*------------------------------------------------------------------------- - * Function isar_renderMultiBinToSplitBinaural() + * Function isar_pre_rend_MultiBinToSplitBinaural() * * *------------------------------------------------------------------------*/ -ivas_error isar_renderMultiBinToSplitBinaural( +ivas_error isar_pre_rend_MultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, const IVAS_QUATERNION headPosition, const int32_t SplitRendBitRate, @@ -2307,7 +2375,7 @@ ivas_error isar_renderMultiBinToSplitBinaural( int32_t bit_len, target_md_bits, actual_md_bits, available_bits; error = IVAS_ERR_OK; - push_wmops( "isar_renderMultiBinToSplitBinaural" ); + push_wmops( "isar_pre_rend_MultiBinToSplitBinaural" ); if ( hSplitBin->multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) { diff --git a/lib_isar/lib_isar_post_rend.c b/lib_isar/lib_isar_post_rend.c index f25614b554..319f5b3e91 100644 --- a/lib_isar/lib_isar_post_rend.c +++ b/lib_isar/lib_isar_post_rend.c @@ -632,61 +632,6 @@ static void clearInputSplitRend( } -ivas_error initSplitRend( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ) -{ - ivas_error error; - IVAS_REND_AudioBufferConfig bufConfig; - - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) - { - isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); - } - else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) - { - isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); - } - - if ( ( error = isar_split_renderer_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } - - /*allocate for CLDFB in and change to TD during process if needed*/ - bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; - bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; - bufConfig.is_cldfb = 1; - pSplitRendEncBuffer->config = bufConfig; - - if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } - } - else - { - IVAS_REND_AudioBufferConfig bufConfig2; - - bufConfig2.numSamplesPerChannel = 0; - bufConfig2.numChannels = 0; - bufConfig2.is_cldfb = 0; - pSplitRendEncBuffer->config = bufConfig2; - pSplitRendEncBuffer->data = NULL; - } - - return IVAS_ERR_OK; -} - - /*------------------------------------------------------------------------- * ISAR_POST_REND_Open() * diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h new file mode 100644 index 0000000000..b7ff3d9cc8 --- /dev/null +++ b/lib_isar/lib_isar_pre_rend.h @@ -0,0 +1,86 @@ +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef LIB_ISAR_PRE_REND_H +#define LIB_ISAR_PRE_REND_H + +#include "common_api_types.h" +#include "isar_stat.h" +#include "isar_prot.h" + +ivas_error isar_pre_rend_open( + SPLIT_REND_WRAPPER *hSplitBinRend, + const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + const int32_t output_Fs, + const int16_t cldfb_in_flag, + const int16_t pcm_out_flag, + const int16_t num_subframes ); + +ivas_error isar_pre_rend_init( + SPLIT_REND_WRAPPER *pSplitRendWrapper, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer, + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + IVAS_REND_HeadRotData headRotData, + const int32_t outputSampleRate, + const IVAS_AUDIO_CONFIG outConfig, + const int16_t cldfb_in_flag, + const int16_t num_subframes ); + +void isar_pre_rend_close( + SPLIT_REND_WRAPPER *hSplitBinRend, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer ); + +void isar_pre_rend_GetMultiBinPoseData( + const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, + const ISAR_SPLIT_REND_ROT_AXIS rot_axis +); + +ivas_error isar_pre_rend_MultiBinToSplitBinaural( + SPLIT_REND_WRAPPER *hSplitBin, + const IVAS_QUATERNION headPosition, + const int32_t SplitRendBitRate, + ISAR_SPLIT_REND_CODEC splitCodec, + int16_t codec_frame_size_ms, + ISAR_SPLIT_REND_BITS_HANDLE pBits, + float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], + const int16_t max_bands, + float *output[], + const int16_t low_res_pre_rend_rot, + const int16_t cldfb_in_flag, + const int16_t pcm_out_flag, + const int16_t ro_md_flag +); + + +#endif /* LIB_ISAR_PRE_REND_H */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 163797e7b3..6d4d98162f 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1393,82 +1393,6 @@ ivas_error ivas_orient_trk_Process( IVAS_QUATERNION *pTrkRot /* o : tracked rotation */ ); -#ifdef SPLIT_REND_WITH_HEAD_ROT - - -/*----------------------------------------------------------------------------------* - * Split binaural renderer prototypes - *----------------------------------------------------------------------------------*/ - -void isar_set_split_rend_ht_setup( - ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData -); - -void isar_init_split_rend_handles( - SPLIT_REND_WRAPPER *hSplitRendWrapper -); - -ivas_error isar_split_renderer_open( - SPLIT_REND_WRAPPER *hSplitBinRend, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, - const int32_t output_Fs, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t num_subframes -); - -void isar_split_renderer_close( - SPLIT_REND_WRAPPER *hSplitBinRend -); - -void isar_init_multi_bin_pose_data( - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -); - -void isar_renderSplitGetMultiBinPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis -); - -void isar_renderSplitUpdateNoCorrectionPoseData( - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData -); - -ivas_error isar_renderMultiBinToSplitBinaural( - SPLIT_REND_WRAPPER *hSplitBin, - const IVAS_QUATERNION headPosition, - const int32_t SplitRendBitRate, - ISAR_SPLIT_REND_CODEC splitCodec, - int16_t codec_frame_size_ms, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - const int16_t max_bands, - float *output[], - const int16_t low_res_pre_rend_rot, - const int16_t cldfb_in_flag, - const int16_t pcm_out_flag, - const int16_t ro_md_flag -); - -#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG -void isar_log_cldfb2wav_data( - float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - HANDLE_CLDFB_FILTER_BANK *cldfbSyn, - const int16_t num_chs, - const int16_t num_freq_bands, - const int32_t output_Fs, - const int16_t start_slot_idx, - const int16_t md_band_idx, - const char *filename -); -#endif - -#endif /*----------------------------------------------------------------------------------* * Rendering & merging to MASA format diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac9eac2250..7056d03905 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -37,6 +37,7 @@ #include "ivas_prot_rend.h" #include "isar_prot.h" #include "isar_stat.h" +#include "lib_isar_pre_rend.h" #include "ivas_cnst.h" #include "ivas_rom_com.h" #include "ivas_rom_rend.h" @@ -3586,7 +3587,7 @@ ivas_error IVAS_REND_AddInput( return error; } - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -4421,14 +4422,14 @@ int16_t IVAS_REND_FeedRenderConfig( { int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } - if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -7672,7 +7673,7 @@ static ivas_error getSamplesInternal( } } - if ( ( error = isar_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, + if ( ( error = isar_pre_rend_MultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag ) ) != IVAS_ERR_OK ) { return error; @@ -7837,7 +7838,7 @@ void IVAS_REND_Close( #ifdef SPLIT_REND_WITH_HEAD_ROT /* Split binaural rendering */ - closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); + isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); #endif closeHeadRotation( hIvasRend ); -- GitLab From 6b0dcb4bbfbf43bb391b1b6134efbf75f37f8650 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 8 Apr 2024 10:58:25 +1000 Subject: [PATCH 02/14] isar clean up --- apps/isar_post_rend.c | 71 -------- lib_com/basop_util.c | 4 - lib_com/options.h | 8 +- lib_dec/ivas_binRenderer_internal.c | 23 +-- lib_dec/ivas_init_dec.c | 13 -- lib_dec/ivas_jbm_dec.c | 4 - lib_dec/ivas_omasa_dec.c | 6 - lib_dec/ivas_osba_dec.c | 17 -- lib_dec/lib_dec.c | 11 -- lib_isar/isar_PredEncoder.c | 80 --------- lib_isar/isar_lcld_decoder.c | 167 +------------------ lib_isar/isar_lcld_encoder.c | 155 +---------------- lib_isar/isar_lcld_prot.h | 10 -- lib_isar/isar_lcld_rom_tables.c | 3 +- lib_isar/isar_splitRendererPre.c | 38 +---- lib_rend/ivas_dirac_dec_binaural_functions.c | 21 --- lib_rend/lib_rend.c | 6 - 17 files changed, 9 insertions(+), 628 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index 3dd7ed99a5..3b131759e1 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -119,16 +119,12 @@ typedef struct OutputConfig outConfig; char inMetadataFilePaths[RENDERER_MAX_ISM_INPUTS][POST_REND_MAX_CLI_ARG_LENGTH]; int16_t numInMetadataFiles; - char outMetadataFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; char headRotationFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; char splitRendBFIFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; - char renderConfigFilePath[POST_REND_MAX_CLI_ARG_LENGTH]; ISAR_POST_REND_COMPLEXITY_LEVEL complexityLevel; bool delayCompensationEnabled; bool quietModeEnabled; bool sceneDescriptionInput; - int16_t nonDiegeticPan; - float nonDiegeticPanGain; IVAS_RENDER_FRAMESIZE render_framesize; } CmdlnArgs; @@ -139,7 +135,6 @@ typedef enum CmdLnOptionId_outputFile, CmdLnOptionId_sampleRate, CmdLnOptionId_trajFile, - CmdLnOptionId_renderConfigFile, CmdLnOptionId_orientationTracking, CmdLnOptionId_complexityLevel, CmdLnOptionId_noDelayCmp, @@ -148,7 +143,6 @@ typedef enum CmdLnOptionId_listFormats, CmdLnOptionId_SplitRendBFIFile, CmdLnOptionId_framing, - CmdLnOptionId_nonDiegeticPan, } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -224,12 +218,6 @@ static const CmdLnParser_Option cliOptions[] = { .matchShort = "fr", .description = "Set Render audio framing.", }, - { - .id = CmdLnOptionId_nonDiegeticPan, - .match = "non_diegetic_panning", - .matchShort = "non_diegetic_pan", - .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n", - }, }; @@ -355,36 +343,6 @@ static bool parseInConfig( return true; } -static bool parseDiegeticPan( - char *value, - float *nonDiegeticPan ) -{ - to_upper( value ); - - if ( ( strcmp( value, "CENTER" ) == 0 ) || ( strchr( value, 'C' ) != NULL ) ) - { - *nonDiegeticPan = 0.f; - } - else if ( ( strcmp( value, "LEFT" ) == 0 ) || ( strchr( value, 'L' ) != NULL ) ) - { - *nonDiegeticPan = 1.f; - } - else if ( ( strcmp( value, "RIGHT" ) == 0 ) || ( strchr( value, 'R' ) != NULL ) ) - { - *nonDiegeticPan = -1.f; - } - else - { - *nonDiegeticPan = (float) atof( value ) / 90.f; - - if ( *nonDiegeticPan > 1.0f || *nonDiegeticPan < -1.0f ) - { - fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); - return false; - } - } - return true; -} static bool parseRenderFramesize( char *value, @@ -505,12 +463,7 @@ static CmdlnArgs defaultArgs( args.numInMetadataFiles = 0; clearString( args.headRotationFilePath ); - clearString( args.outMetadataFilePath ); clearString( args.splitRendBFIFilePath ); - clearString( args.renderConfigFilePath ); - - args.nonDiegeticPan = 0; - args.nonDiegeticPanGain = 0.f; args.delayCompensationEnabled = true; args.quietModeEnabled = false; @@ -575,10 +528,6 @@ static void parseOption( assert( numOptionValues == 1 ); strncpy( args->splitRendBFIFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 ); break; - case CmdLnOptionId_renderConfigFile: - assert( numOptionValues == 1 ); - strncpy( args->renderConfigFilePath, optionValues[0], POST_REND_MAX_CLI_ARG_LENGTH - 1 ); - break; case CmdLnOptionId_complexityLevel: assert( numOptionValues == 1 ); args->complexityLevel = (int32_t) ( strtol( optionValues[0], NULL, 10 ) ); @@ -608,15 +557,6 @@ static void parseOption( exit( -1 ); } - break; - case CmdLnOptionId_nonDiegeticPan: - assert( numOptionValues == 1 ); - if ( !parseDiegeticPan( optionValues[0], &args->nonDiegeticPanGain ) ) - { - fprintf( stderr, "Unknown option for diegetic panning: %s\n", optionValues[0] ); - exit( -1 ); - } - args->nonDiegeticPan = 1; break; default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); @@ -854,7 +794,6 @@ int main( IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS]; int16_t cldfb_in_flag, CLDFBframeSize_smpls; SplitRendBFIFileReader *splitRendBFIReader = NULL; - RenderConfigReader *renderConfigReader = NULL; AudioFileReader *audioReader = NULL; AudioFileWriter *audioWriter; int32_t inBufferSize; @@ -918,15 +857,6 @@ int main( SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader ); } - if ( !isEmptyString( args.renderConfigFilePath ) ) - { - if ( RenderConfigReader_open( args.renderConfigFilePath, &renderConfigReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", args.renderConfigFilePath ); - exit( -1 ); - } - } - strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); hSplitRendFileReadWrite = NULL; if ( ( args.inConfig.numBinBuses > 0 ) && ( args.inConfig.binBuses[0].audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) @@ -1386,7 +1316,6 @@ int main( RotationFileReader_close( &externalOrientationFileReader ); ISAR_POST_REND_Close( &hIsarPostRend ); - RenderConfigReader_close( &renderConfigReader ); #ifdef DEBUGGING dbgclose(); diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index d733349024..1d511a5409 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1085,11 +1085,7 @@ Word32 Sqrt_l( return L_deposit_l( 0 ); } -#if 0 /* original version creates an overflow warning */ - e = s_and(norm_l(L_x), 0xFFFE); /* get next lower EVEN norm. exp */ -#else e = s_and( norm_l( L_x ), 0x7FFE ); /* get next lower EVEN norm. exp */ -#endif L_x = L_shl( L_x, e ); /* L_x is normalized to [0.25..1) */ *exp = e; move16(); /* return 2*exponent (or Q1) */ diff --git a/lib_com/options.h b/lib_com/options.h index 29c285f82f..724e5b7431 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,13 +154,7 @@ /* only BE switches wrt selection floating point code */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REBD_FIX_SBA_PRE_ROT -#define LCLD_PLC_IMPROVEMENT -#define LCLD_CLEAN_UPS -#define FIX_766_OMASA_SPLIT_REND /* Nokia: issue #766: split-rendering support for OMASA */ -#endif +#define SPLIT_REND_WITH_HEAD_ROT /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_NUM_SUBFRAME_UPDATE diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f14b09c0e8..55f6dcf876 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -1945,10 +1945,8 @@ void ivas_binRenderer( int16_t chIdx, k; #ifdef SPLIT_REND_WITH_HEAD_ROT int16_t pos_idx, num_poses; -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT float RealBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; float ImagBuffer_local[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif #endif push_wmops( "fastconv_binaural_rendering" ); @@ -1970,7 +1968,7 @@ void ivas_binRenderer( } } } -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT + for ( chIdx = 0; chIdx < hBinRenderer->hInputSetup->nchan_out_woLFE; chIdx++ ) { for ( k = 0; k < numTimeSlots; k++ ) @@ -1979,7 +1977,6 @@ void ivas_binRenderer( mvr2r( ImagBuffer[chIdx][k], ImagBuffer_local[chIdx][k], CLDFB_NO_CHANNELS_MAX ); } } -#endif #else for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) { @@ -2038,7 +2035,7 @@ void ivas_binRenderer( Quaternions_ref = &hCombinedOrientationData->Quaternions[0]; Quaternions_rel.w = -3.0f; /*euler*/ Quaternions_abs.w = -3.0f; -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT + if ( hCombinedOrientationData->shd_rot_max_order == 0 ) { /*HOA signal already rotated by DirAC*/ @@ -2051,12 +2048,9 @@ void ivas_binRenderer( /*euler*/ Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ } -#else - Quat2EulerDegree( *Quaternions_ref, &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/ -#endif + for ( pos_idx = 1; pos_idx < pMultiBinPoseData->num_poses; pos_idx++ ) { -#ifdef SPLIT_REBD_FIX_SBA_PRE_ROT for ( chIdx = 0; chIdx < hBinRenderer->hInputSetup->nchan_out_woLFE; chIdx++ ) { for ( k = 0; k < numTimeSlots; k++ ) @@ -2073,17 +2067,6 @@ void ivas_binRenderer( Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; QuatToRotMat( Quaternions_abs, Rmat_local ); -#else - Quaternions_rel.x = pMultiBinPoseData->relative_head_poses[pos_idx][0] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][0]; - Quaternions_rel.y = pMultiBinPoseData->relative_head_poses[pos_idx][1] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][1]; - Quaternions_rel.z = pMultiBinPoseData->relative_head_poses[pos_idx][2] - pMultiBinPoseData->relative_head_poses[pos_idx - 1][2]; - Quaternions_abs.x = Quaternions_abs.x + Quaternions_rel.x; - Quaternions_abs.y = Quaternions_abs.y + Quaternions_rel.y; - Quaternions_abs.z = Quaternions_abs.z + Quaternions_rel.z; - - QuatToRotMat( Quaternions_rel, Rmat_local ); -#endif - if ( hBinRenderer->hInputSetup->is_loudspeaker_setup ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4e93dd6357..b3690fe3bb 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -98,12 +98,8 @@ static ivas_error ivas_dec_reconfig_split_rend( #ifndef SPLIT_REND_WITH_HEAD_ROT cldfbMode = CLDFB_ANALYSIS; #else -#ifdef FIX_766_OMASA_SPLIT_REND if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { cldfb_in_flag = 0; } @@ -204,14 +200,9 @@ static ivas_error ivas_dec_reconfig_split_rend( } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) /* td-rend not needed? */ -#else - if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) && - ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) ) -#endif #else if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) #endif @@ -270,12 +261,8 @@ static ivas_error ivas_dec_init_split_rend( } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) -#else - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) -#endif { cldfb_in_flag = 0; } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 7f44639f7c..d9651461c4 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -933,16 +933,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( v_multc( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN, st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available ); } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { -#endif #endif delay_signal( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND } -#endif #endif } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 321a998c8f..e3829d8396 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -751,11 +751,9 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( ivas_error error; float *p_sepobj[MAX_NUM_OBJECTS]; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif #endif for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) @@ -769,7 +767,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, nchan_transport_orig, cldfb_slots; @@ -807,7 +804,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( } else { -#endif #endif if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -818,9 +814,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( v_add( output_f[n], p_sepobj[n], output_f[n], *nSamplesRendered ); } #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND } -#endif #endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index a338b2f477..37ddcd37d2 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -138,11 +138,9 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( float *p_sepobj[BINAURAL_CHANNELS]; int16_t channel_offset; #ifdef SPLIT_REND_WITH_HEAD_ROT -#ifdef FIX_766_OMASA_SPLIT_REND int16_t slot_idx_start; slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered; -#endif #endif for ( n = 0; n < BINAURAL_CHANNELS; n++ ) @@ -162,20 +160,13 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig; -#ifdef FIX_766_OMASA_SPLIT_REND int16_t cldfb_slots; -#else - int16_t cldfb_slots, slot_idx_start; -#endif float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX]; num_cldfb_bands = st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels; nchan_transport_orig = st_ivas->nchan_transport; st_ivas->nchan_transport = st_ivas->nchan_ism; -#ifndef FIX_766_OMASA_SPLIT_REND - slot_idx_start = st_ivas->hTcBuffer->n_samples_rendered / num_cldfb_bands; -#endif if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; @@ -191,19 +182,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#else - st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] = -#endif ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_RealBuffer[b] ); -#ifdef FIX_766_OMASA_SPLIT_REND st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#else - st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] = -#endif ( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 563736f20f..890e63f0d1 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -941,9 +941,6 @@ ivas_error IVAS_DEC_GetSamples( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ -#endif } { /* check if we need to run the setup function, tc decoding and feeding the renderer */ @@ -1110,7 +1107,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } else { -#ifdef FIX_766_OMASA_SPLIT_REND /* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -1120,9 +1116,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( { slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; } -#else - slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; -#endif } @@ -1151,7 +1144,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( } else { -#ifdef FIX_766_OMASA_SPLIT_REND /* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */ if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { @@ -1161,9 +1153,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( { slots_rendered_new = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; } -#else - slots_rendered_new = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity; -#endif } for ( i = 0; i < BINAURAL_CHANNELS * numPoses; ++i ) diff --git a/lib_isar/isar_PredEncoder.c b/lib_isar/isar_PredEncoder.c index 50476def74..29ad80329e 100644 --- a/lib_isar/isar_PredEncoder.c +++ b/lib_isar/isar_PredEncoder.c @@ -100,17 +100,6 @@ ivas_error CreatePredictionEncoder( psPredictionEncoder->iSubSetId = 0; psPredictionEncoder->iMaxNumPredBands = iMaxNumPredBands; psPredictionEncoder->iNumSubSets = iNumSubSets; -#ifndef LCLD_CLEAN_UPS - if ( ( psPredictionEncoder->pfWindow = (float *) malloc( sizeof( float ) * LCLD_PRED_WIN_LEN ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LCLD PredictionEncoder Module \n" ) ); - } - - for ( n = 0; n < LCLD_PRED_WIN_LEN; n++ ) - { - psPredictionEncoder->pfWindow[n] = 0.54f - 0.46f * cosf( 2.0f * M_PI * ( (float) n + 0.5f ) / (float) LCLD_PRED_WIN_LEN ); - } -#endif if ( ( psPredictionEncoder->piPredChanEnable = (int32_t *) malloc( sizeof( int32_t ) * iChannels ) ) == NULL ) { @@ -280,9 +269,6 @@ void DeletePredictionEncoder( PredictionEncoder *psPredictionEncoder ) { int32_t n; -#ifndef LCLD_CLEAN_UPS - free( psPredictionEncoder->pfWindow ); -#endif for ( n = 0; n < psPredictionEncoder->iChannels; n++ ) { int32_t k; @@ -499,17 +485,6 @@ void ComputePredictors( activate_bit( &psPredictionEncoder->piPredChanEnable[c], psPredictionEncoder->iSubSetId ); psPredictionEncoder->piNumPredBands[c] = iPredBands + bstep; } -#ifndef LCLD_CLEAN_UPS - else if ( iPredBands > 0 ) - { - for ( b = iPredBands; b < LCLD_BANDS; b += bstep ) - { - psPredictionEncoder->ppiPredBandEnable[c][b] = 0; - } - activate_bit( &psPredictionEncoder->piPredChanEnable[c], psPredictionEncoder->iSubSetId ); - psPredictionEncoder->piNumPredBands[c] = iPredBands; - } -#endif else { for ( b = b0; b < LCLD_BANDS; b += bstep ) @@ -529,61 +504,6 @@ void ComputePredictors( * * *-------------------------------------------------------------------*/ -#ifndef LCLD_CLEAN_UPS -void ApplyForwardPredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag ) -{ - int32_t c; - for ( c = 0; c < psPredictionEncoder->iChannels; c++ ) - { - int32_t b; - if ( psPredictionEncoder->piPredChanEnable[c] > 0 ) - { - for ( b = 0; b < LCLD_BANDS; b++ ) - { - if ( psPredictionEncoder->ppiPredBandEnable[c][b] == 1 ) - { - int32_t n; - float fOldReal = 0.0f; - float fOldImag = 0.0f; - float fA1Real; - float fA1Imag; - - int32_t iSubset = b % psPredictionEncoder->iNumSubSets; - if ( iSubset != psPredictionEncoder->iSubSetId ) - { - fOldReal = psPredictionEncoder->ppfInpPrevReal[c][b]; - fOldImag = psPredictionEncoder->ppfInpPrevImag[c][b]; - } - psPredictionEncoder->ppfInpPrevReal[c][b] = pppfReal[c][psPredictionEncoder->iNumBlocks - 1][b]; - psPredictionEncoder->ppfInpPrevImag[c][b] = pppfImag[c][psPredictionEncoder->iNumBlocks - 1][b]; - - fA1Real = psPredictionEncoder->ppfA1Real[c][b]; - fA1Imag = psPredictionEncoder->ppfA1Imag[c][b]; - for ( n = 0; n < psPredictionEncoder->iNumBlocks; n++ ) - { - float fReal; - float fImag; - - fReal = pppfReal[c][n][b] + fA1Real * fOldReal - fA1Imag * fOldImag; - fImag = pppfImag[c][n][b] + fA1Real * fOldImag + fA1Imag * fOldReal; - - fOldReal = pppfReal[c][n][b]; - fOldImag = pppfImag[c][n][b]; - - pppfReal[c][n][b] = fReal; - pppfImag[c][n][b] = fImag; - } - } - } - } - } - - return; -} -#endif /*-------------------------------------------------------------------* * Function WritePredictors() diff --git a/lib_isar/isar_lcld_decoder.c b/lib_isar/isar_lcld_decoder.c index 0cba1c1ebb..8f3bf1f117 100644 --- a/lib_isar/isar_lcld_decoder.c +++ b/lib_isar/isar_lcld_decoder.c @@ -722,13 +722,8 @@ static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZ static int32_t ReadRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ISAR_SPLIT_REND_BITS_HANDLE pBits ); static int32_t ReadAllocInformation( int32_t *piAllocOffset, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef LCLD_PLC_IMPROVEMENT static int32_t ReadLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t iNumChannels, int32_t **ppiDecodingUnresolved, int32_t **ppiPredEnable, const int32_t iNumSubSets, const int32_t iSubSetId, int32_t ***pppiAlloc, int32_t ***pppiSignReal, int32_t ***pppiSignImag, int32_t ***pppiQReal, int32_t ***pppiQImag, int32_t **ppiDecodingFailed, ISAR_SPLIT_REND_BITS_HANDLE pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); -#else -static int32_t -ReadLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); -#endif static void ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiSMR, const int32_t iAllocOffset, int32_t ***pppiAlloc ); void SetDecodingUnresolved( LCLDDecoder *psLCLDDecoder ) @@ -876,7 +871,7 @@ int32_t DecodeLCLDFrame( } ComputeAllocation( psLCLDDecoder->iChannels, (const int32_t *) psLCLDDecoder->piNumGroups, psLCLDDecoder->iNumBands, psLCLDDecoder->pppiSMR, psLCLDDecoder->iAllocOffset, psLCLDDecoder->pppiAlloc ); -#ifdef LCLD_PLC_IMPROVEMENT + ReadLCLDData( psLCLDDecoder->piNumGroups, psLCLDDecoder->ppiGroupLengths, @@ -894,29 +889,6 @@ int32_t DecodeLCLDFrame( psLCLDDecoder->psPredictionDecoder->ppiDecodingFailed, pBits, psLCLDDecoder->c_apauiHuffDecTable_RAM ); -#else - if ( AnyDecodingUnresolved( psLCLDDecoder->psPredictionDecoder ) ) - { - return 1; - } - for ( n = 0; n < psLCLDDecoder->iChannels; n++ ) - { - ReadLCLDData( - psLCLDDecoder->piNumGroups[n], - (const int32_t *) psLCLDDecoder->ppiGroupLengths[n], - psLCLDDecoder->iNumBands, - psLCLDDecoder->piBandwidths, - (const int32_t *) psLCLDDecoder->psPredictionDecoder->ppiPredBandEnable[n], - psLCLDDecoder->pppiAlloc[n], - psLCLDDecoder->pppiLCLDSignReal[n], - psLCLDDecoder->pppiLCLDSignImag[n], - psLCLDDecoder->pppiQLCLDReal[n], - psLCLDDecoder->pppiQLCLDImag[n], - pBits, - psLCLDDecoder->c_apauiHuffDecTable_RAM ); - } - SetDecodingPassed( psLCLDDecoder->psPredictionDecoder ); -#endif for ( n = 0; n < psLCLDDecoder->iChannels; n++ ) { @@ -1552,7 +1524,6 @@ static int32_t ReadAllocInformation( return iBitsRead; } -#ifdef LCLD_PLC_IMPROVEMENT static int32_t ReadLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, @@ -1726,142 +1697,6 @@ static int32_t ReadLCLDData( return iBitsRead; } -#else -static int32_t ReadLCLDData( - const int32_t iNumGroups, - const int32_t *piGroupLengths, - const int32_t iNumBands, - const int32_t *piBandwidths, - const int32_t *piPredEnable, - int32_t **ppiAlloc, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - int32_t **ppiQReal, - int32_t **ppiQImag, - ISAR_SPLIT_REND_BITS_HANDLE pBits, - uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ) -{ - int32_t b, k, m, n; - int32_t iBitsRead, iBlockOffest, iFBOffset; - int32_t iAlloc, iHuffDim, iHuffMod; - - iBitsRead = 0; - iBlockOffest = 0; - for ( n = 0; n < iNumGroups; n++ ) - { - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - if ( iAlloc > 0 ) - { - const uint32_t( *pauiHuffmanTable )[HUFF_DEC_TABLE_SIZE] = NULL; - const uint32_t( *pauiHuffmanTableDPCM )[HUFF_DEC_TABLE_SIZE] = NULL; -#ifdef USE_DEMOD_TABLES - const int32_t( *paiDemodTable )[2] = NULL; -#endif - pauiHuffmanTable = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[iAlloc]; - pauiHuffmanTableDPCM = (const uint32_t( * )[HUFF_DEC_TABLE_SIZE]) c_apauiHuffDecTables[ALLOC_TABLE_SIZE + iAlloc]; -#ifdef USE_DEMOD_TABLES - paiDemodTable = c_apaiDemodTables[iAlloc]; -#endif - for ( m = 0; m < piBandwidths[b]; m++ ) - { - int32_t iQuantValue1 = 0; - int32_t iQuantValue2 = 0; - - if ( piPredEnable[iFBOffset] == 1 ) - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iSymbol, pBits ); -#ifdef USE_DEMOD_TABLES - iQuantValue1 = paiDemodTable[iSymbol][0]; - iQuantValue2 = paiDemodTable[iSymbol][1]; -#else - iQuantValue1 = iSymbol / iHuffMod; - iQuantValue2 = iSymbol % iHuffMod; -#endif - } - else - { - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue1, pBits ); - iBitsRead += ReadHuff( pauiHuffmanTableDPCM, &iQuantValue2, pBits ); - } - } - else - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - - iBitsRead += ReadHuff( pauiHuffmanTable, &iSymbol, pBits ); -#ifdef USE_DEMOD_TABLES - iQuantValue1 = paiDemodTable[iSymbol][0]; - iQuantValue2 = paiDemodTable[iSymbol][1]; -#else - iQuantValue1 = iSymbol / iHuffMod; - iQuantValue2 = iSymbol % iHuffMod; -#endif - } - else - { - iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue1, pBits ); - iBitsRead += ReadHuff( pauiHuffmanTable, &iQuantValue2, pBits ); - } - } - - ppiQReal[iBlockOffest][iFBOffset] = iQuantValue1; - ppiQImag[iBlockOffest][iFBOffset] = iQuantValue2; - - if ( iQuantValue1 > 0 ) - { - ppiSignReal[iBlockOffest][iFBOffset] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 ); - iBitsRead += 1; - } - else - { - ppiSignReal[iBlockOffest][iFBOffset] = 0; - } - if ( iQuantValue2 > 0 ) - { - ppiSignImag[iBlockOffest][iFBOffset] = ISAR_SPLIT_REND_BITStream_read_int32( pBits, 1 ); - iBitsRead += 1; - } - else - { - ppiSignImag[iBlockOffest][iFBOffset] = 0; - } - - iFBOffset++; - } - } - else - { - for ( m = 0; m < piBandwidths[b]; m++ ) - { - ppiSignReal[iBlockOffest][iFBOffset] = 0; - ppiSignImag[iBlockOffest][iFBOffset] = 0; - iFBOffset++; - } - } - } - - iBlockOffest++; - } - } - - return iBitsRead; -} -#endif - static void ComputeAllocation( const int32_t iChannels, diff --git a/lib_isar/isar_lcld_encoder.c b/lib_isar/isar_lcld_encoder.c index fe230fcc05..67ec7569da 100644 --- a/lib_isar/isar_lcld_encoder.c +++ b/lib_isar/isar_lcld_encoder.c @@ -198,14 +198,7 @@ ivas_error CreateLCLDEncoder( psLCLDEncoder->piBandwidths = c_aiBandwidths48; psLCLDEncoder->iNumBands = DEF_BANDS_48; /* 22 bands = 50 CLDFB bands (rather than 23 bands) */ -#ifdef LCLD_CLEAN_UPS iMaxNumPredBands = min( c_aiNumLcldBandsPerBand[psLCLDEncoder->iNumBands - 1], 50 ); -#else - for ( n = 0; n < psLCLDEncoder->iNumBands; n++ ) - { - iMaxNumPredBands += psLCLDEncoder->piBandwidths[n]; - } -#endif if ( iRealOnlyOut == 1 ) { iMaxNumPredBands = 0; @@ -556,11 +549,8 @@ static int32_t WriteRMSEnvelope( const int32_t iChannels, const int32_t *piNumGr static int32_t WriteAllocInformation( const int32_t iAllocOffset, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#ifdef LCLD_PLC_IMPROVEMENT static int32_t WriteLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t iNumChannels, int32_t **ppiPredEnable, const int32_t iNumSubSets, const int32_t iSubSetId, int32_t ***pppiAlloc, int32_t ***pppiSignReal, int32_t ***pppiSignImag, int32_t ***pppiQReal, int32_t ***pppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#else -static int32_t WriteLCLDData( const int32_t iNumGroups, const int32_t *piGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t *piPredEnable, int32_t **ppiAlloc, int32_t **ppiSignReal, int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, ISAR_SPLIT_REND_BITS_HANDLE pBits ); -#endif + static int32_t ComputeAllocation( const int32_t iChannels, const int32_t *piNumGroups, int32_t **ppiGroupLengths, const int32_t iNumBands, const int32_t *piBandwidths, float ***pppfReal, float ***pppfImag, int32_t ***pppiSMR, const int32_t iAvailableBits, int32_t *piAllocOffset, int32_t ***pppiAlloc, int32_t ***pppiQReal, int32_t ***pppiQImag, int32_t ***pppiSignReal, int32_t ***pppiSignImag, PredictionEncoder *psPredictionEncoder ); /*------------------------------------------------------------------------------------------* @@ -746,7 +736,6 @@ int32_t EncodeLCLDFrame( iBitsWritten += WriteAllocInformation( psLCLDEncoder->iAllocOffset, pBits ); iAudioBitsWritten = iBitsWritten; -#ifdef LCLD_PLC_IMPROVEMENT iBitsWritten += WriteLCLDData( psLCLDEncoder->piNumGroups, psLCLDEncoder->ppiGroupLengths, psLCLDEncoder->iNumBands, @@ -760,22 +749,6 @@ int32_t EncodeLCLDFrame( psLCLDEncoder->pppiQLCLDReal, psLCLDEncoder->pppiQLCLDImag, pBits ); -#else - for ( n = 0; n < psLCLDEncoder->iChannels; n++ ) - { - iBitsWritten += WriteLCLDData( psLCLDEncoder->piNumGroups[n], - (const int32_t *) psLCLDEncoder->ppiGroupLengths[n], - psLCLDEncoder->iNumBands, - psLCLDEncoder->piBandwidths, - (const int32_t *) psLCLDEncoder->psPredictionEncoder->ppiPredBandEnable[n], - psLCLDEncoder->pppiAlloc[n], - psLCLDEncoder->pppiLCLDSignReal[n], - psLCLDEncoder->pppiLCLDSignImag[n], - psLCLDEncoder->pppiQLCLDReal[n], - psLCLDEncoder->pppiQLCLDImag[n], - pBits ); - } -#endif *piBitsWritten = iBitsWritten; iAudioBitsWritten = iBitsWritten - iAudioBitsWritten; @@ -1642,7 +1615,7 @@ static int32_t WriteAllocInformation( return iBitsWritten; } -#ifdef LCLD_PLC_IMPROVEMENT + static int32_t WriteLCLDData( const int32_t *piNumGroups, int32_t **ppiGroupLengths, @@ -1772,130 +1745,6 @@ static int32_t WriteLCLDData( return iBitsWritten; } -#else -static int32_t WriteLCLDData( - const int32_t iNumGroups, - const int32_t *piGroupLengths, - const int32_t iNumBands, - const int32_t *piBandwidths, - const int32_t *piPredEnable, - int32_t **ppiAlloc, - int32_t **ppiSignReal, - int32_t **ppiSignImag, - int32_t **ppiQReal, - int32_t **ppiQImag, - ISAR_SPLIT_REND_BITS_HANDLE pBits ) -{ - int32_t n; - int32_t iBitsWritten; - int32_t iBlockOffest; - - iBitsWritten = 0; - iBlockOffest = 0; - - for ( n = 0; n < iNumGroups; n++ ) - { - int32_t k; - for ( k = 0; k < piGroupLengths[n]; k++ ) - { - int32_t b; - int32_t iFBOffset; - - iFBOffset = 0; - for ( b = 0; b < iNumBands; b++ ) - { - int32_t m; - int32_t iAlloc; - int32_t iHuffDim; - int32_t iHuffMod; - - iAlloc = ppiAlloc[n][b]; - - iHuffDim = c_aiHuffmanDim[iAlloc]; - iHuffMod = c_aiHuffmanMod[iAlloc]; - - if ( iAlloc > 0 ) - { - const uint16_t( *pauiHuffmanTable )[2] = NULL; - const uint16_t( *pauiHuffmanTableDPCM )[2] = NULL; - pauiHuffmanTable = c_apauiHuffEncTabels[iAlloc]; - pauiHuffmanTableDPCM = c_apauiHuffEncTabels[ALLOC_TABLE_SIZE + iAlloc]; - for ( m = 0; m < piBandwidths[b]; m++ ) - { - int32_t iQuantValue1; - int32_t iQuantValue2; - - iQuantValue1 = ppiQReal[iBlockOffest][iFBOffset]; - iQuantValue2 = ppiQImag[iBlockOffest][iFBOffset]; - - if ( piPredEnable[iFBOffset] == 1 ) - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iSymbol = iQuantValue1; - iSymbol *= iHuffMod; - iSymbol += iQuantValue2; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iSymbol][1], pauiHuffmanTableDPCM[iSymbol][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iSymbol][0]; - } - else - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue1][1], pauiHuffmanTableDPCM[iQuantValue1][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iQuantValue1][0]; - - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTableDPCM[iQuantValue2][1], pauiHuffmanTableDPCM[iQuantValue2][0] ); - iBitsWritten += pauiHuffmanTableDPCM[iQuantValue2][0]; - } - } - else - { - if ( iHuffDim == 2 ) - { - int32_t iSymbol; - iSymbol = iQuantValue1; - iSymbol *= iHuffMod; - iSymbol += iQuantValue2; - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iSymbol][1], pauiHuffmanTable[iSymbol][0] ); - iBitsWritten += pauiHuffmanTable[iSymbol][0]; - } - else - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iQuantValue1][1], pauiHuffmanTable[iQuantValue1][0] ); - iBitsWritten += pauiHuffmanTable[iQuantValue1][0]; - - ISAR_SPLIT_REND_BITStream_write_int32( pBits, pauiHuffmanTable[iQuantValue2][1], pauiHuffmanTable[iQuantValue2][0] ); - iBitsWritten += pauiHuffmanTable[iQuantValue2][0]; - } - } - - if ( iQuantValue1 > 0 ) - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, ppiSignReal[iBlockOffest][iFBOffset], 1 ); - iBitsWritten += 1; - } - if ( iQuantValue2 > 0 ) - { - ISAR_SPLIT_REND_BITStream_write_int32( pBits, ppiSignImag[iBlockOffest][iFBOffset], 1 ); - iBitsWritten += 1; - } - - iFBOffset++; - } - } - else - { - iFBOffset += piBandwidths[b]; - } - } - - iBlockOffest++; - } - } - - return iBitsWritten; -} -#endif static int32_t ComputeAllocation( const int32_t iChannels, diff --git a/lib_isar/isar_lcld_prot.h b/lib_isar/isar_lcld_prot.h index 094d40698c..048d3da65e 100644 --- a/lib_isar/isar_lcld_prot.h +++ b/lib_isar/isar_lcld_prot.h @@ -241,9 +241,6 @@ typedef struct PREDICTION_ENCODER float **ppfPredStateImagTmp; float **ppfInpPrevReal; /* channels, bands */ float **ppfInpPrevImag; -#ifndef LCLD_CLEAN_UPS - float *pfWindow; -#endif float pfRxxReal[2]; float pfRxxImag[2]; @@ -276,13 +273,6 @@ void ComputePredictors( float ***pppfImag ); -#ifndef LCLD_CLEAN_UPS -void ApplyForwardPredictors( - PredictionEncoder *psPredictionEncoder, - float ***pppfReal, - float ***pppfImag -); -#endif int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, diff --git a/lib_isar/isar_lcld_rom_tables.c b/lib_isar/isar_lcld_rom_tables.c index 63c3751474..85bc36494e 100644 --- a/lib_isar/isar_lcld_rom_tables.c +++ b/lib_isar/isar_lcld_rom_tables.c @@ -42,12 +42,11 @@ const int32_t c_aiNumLcldBandsPerBand[MAX_BANDS_48] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 21, 24, 27, 31, 37, 43, 50, 60 }; -#ifdef LCLD_PLC_IMPROVEMENT const int32_t c_aiBandIdPerLcldBand[LCLD_BANDS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22 }; -#endif + /* phi = (-12:12)'/12 *pi; tmp = [cos(phi),sin(phi)]; tmp = tmp';sprintf('{%.8ff, %.8ff},\n',tmp(:)) */ const float c_afRotRealImag[PHASE_MAX_VAL - PHASE_MIN_VAL + 1][2] = { diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 44967419a0..cc6624bf58 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1818,13 +1818,7 @@ ivas_error isar_split_renderer_open( const int16_t num_subframes ) { ivas_error error, ch, num_ch; -#ifndef SPLIT_REND_WITH_HEAD_ROT - CLDFB_TYPE cldfbMode; -#endif uint8_t isCldfbNeeded = 0; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#endif if ( ( error = isar_split_rend_validate_config( pSplitRendConfig, pcm_out_flag ) ) != IVAS_ERR_OK ) { @@ -1834,27 +1828,14 @@ ivas_error isar_split_renderer_open( if ( cldfb_in_flag == 0 ) { isCldfbNeeded = 1; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#endif } else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT - isCldfbNeeded = 1; -#else isCldfbNeeded = 1; - cldfbMode = CLDFB_SYNTHESIS; -#endif } else if ( pcm_out_flag && cldfb_in_flag ) { -#ifdef SPLIT_REND_WITH_HEAD_ROT - isCldfbNeeded = 1; -#else isCldfbNeeded = 1; - cldfbMode = CLDFB_SYNTHESIS; -#endif } hSplitRendWrapper->hCldfbHandles = NULL; @@ -1871,30 +1852,23 @@ ivas_error isar_split_renderer_open( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL; } -#endif num_ch = hSplitRendWrapper->multiBinPoseData.num_poses * BINAURAL_CHANNELS; for ( ch = 0; ch < num_ch; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode, -#else CLDFB_ANALYSIS, -#endif OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, OutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) @@ -1902,7 +1876,6 @@ ivas_error isar_split_renderer_open( return error; } } -#endif } if ( pSplitRendConfig->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) @@ -1977,7 +1950,6 @@ void isar_split_renderer_close( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( hSplitBinRend->hCldfbHandles->cldfbSyn[ch] != NULL ) @@ -1986,7 +1958,6 @@ void isar_split_renderer_close( hSplitBinRend->hCldfbHandles->cldfbSyn[ch] = NULL; } } -#endif free( hSplitBinRend->hCldfbHandles ); hSplitBinRend->hCldfbHandles = NULL; @@ -2379,11 +2350,8 @@ ivas_error isar_renderMultiBinToSplitBinaural( Cldfb_In_BinReal_p[slot_idx] = Cldfb_In_BinReal[ch][slot_idx]; Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); -#else + cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); -#endif } if ( ( error = splitRendLc3plusEncodeAndWrite( hSplitBin, pBits, SplitRendBitRate, output ) ) != IVAS_ERR_OK ) @@ -2407,11 +2375,7 @@ ivas_error isar_renderMultiBinToSplitBinaural( Cldfb_In_BinImag_p[slot_idx] = Cldfb_In_BinImag[ch][slot_idx]; } -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbAna[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbAna[ch] ); -#else cldfbSynthesis( Cldfb_In_BinReal_p, Cldfb_In_BinImag_p, output[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); -#endif } pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 562f07b234..a15654155a 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -800,13 +800,8 @@ static void ivas_dirac_dec_binaural_internal( ivas_dirac_dec_binaural_formulate_input_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, subframe, subFrameTotalEne, IIReneLimiter ); -#ifdef FIX_766_OMASA_SPLIT_REND ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData ); -#else - ivas_dirac_dec_binaural_formulate_target_covariance_matrices( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat, subframe, - hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] > 0, subFrameTotalEne, IIReneLimiter, st_ivas->hMasaIsmData ); -#endif #endif nchanSeparateChannels = 0; @@ -837,19 +832,11 @@ static void ivas_dirac_dec_binaural_internal( for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ ) { mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); } -#else - for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) - { - mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - } -#endif } } else @@ -918,19 +905,11 @@ static void ivas_dirac_dec_binaural_internal( /* copy from temporary buffer to the main split rendering buffer */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef FIX_766_OMASA_SPLIT_REND for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ ) { mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX ); } -#else - for ( i = 0; i < CLDFB_SLOTS_PER_SUBFRAME; i++ ) - { - mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][subframe * CLDFB_SLOTS_PER_SUBFRAME + i], CLDFB_NO_CHANNELS_MAX ); - } -#endif } hDiracDecBin->hDiffuseDist = NULL; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ac9eac2250..224d14dae3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7823,12 +7823,6 @@ void IVAS_REND_Close( { clearInputMasa( &hIvasRend->inputsMasa[i] ); } -#ifdef SPLIT_REND_WITH_HEAD_ROT - // for ( i = 0; i < RENDERER_MAX_BIN_INPUTS; ++i ) - // { - // clearInputSplitRend( &hIvasRend->inputsSplitPost[i] ); - // } -#endif /* clear Config. Renderer */ ivas_render_config_close( &( hIvasRend->hRendererConfig ) ); -- GitLab From acfdbd6a2eca9ea2dd032bf008a4307d8276c94f Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 8 Apr 2024 12:03:57 +1000 Subject: [PATCH 03/14] temp change in yml file to check self-tests BE --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 177d90e355..9b89409a51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -255,7 +255,7 @@ stages: .rules-merge-request: extends: .rules-basis rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' # && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'push' when: never -- GitLab From fcf80cb6c0a85be7ee892b79385bba85ce9c041d Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 8 Apr 2024 13:05:28 +1000 Subject: [PATCH 04/14] remove nested SPLIT_REND_WITH_HEAD_ROT instances in ivas_dec_init.c --- lib_dec/ivas_init_dec.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 93839c0644..8773483dbe 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -76,9 +76,6 @@ static ivas_error ivas_dec_reconfig_split_rend( ivas_error error; int16_t cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag; SPLIT_REND_WRAPPER *hSplitRendWrapper; -#ifndef SPLIT_REND_WITH_HEAD_ROT - CLDFB_TYPE cldfbMode; -#endif hSplitRendWrapper = &st_ivas->hSplitBinRend.splitrend; pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; @@ -95,38 +92,26 @@ static ivas_error ivas_dec_reconfig_split_rend( isar_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS ); isCldfbNeeded = 0; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#else + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { cldfb_in_flag = 0; } -#endif if ( st_ivas->renderer_type != RENDERER_DISABLE ) { if ( cldfb_in_flag == 0 ) { isCldfbNeeded = 1; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_ANALYSIS; -#endif } else if ( st_ivas->hRenderConfig->split_rend_config.codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag ) { isCldfbNeeded = 1; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_SYNTHESIS; -#endif } else if ( pcm_out_flag && cldfb_in_flag ) { isCldfbNeeded = 1; -#ifndef SPLIT_REND_WITH_HEAD_ROT - cldfbMode = CLDFB_SYNTHESIS; -#endif } } else if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) @@ -151,18 +136,12 @@ static ivas_error ivas_dec_reconfig_split_rend( for ( ch = 0; ch < num_ch; ch++ ) { -#ifndef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), cldfbMode, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) -#else if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) -#endif - { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) ); } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) @@ -170,7 +149,6 @@ static ivas_error ivas_dec_reconfig_split_rend( return error; } } -#endif } else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL ) { @@ -184,7 +162,6 @@ static ivas_error ivas_dec_reconfig_split_rend( } } -#ifdef SPLIT_REND_WITH_HEAD_ROT for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { if ( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL ) @@ -193,19 +170,14 @@ static ivas_error ivas_dec_reconfig_split_rend( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL; } } -#endif free( hSplitRendWrapper->hCldfbHandles ); hSplitRendWrapper->hCldfbHandles = NULL; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) /* td-rend not needed? */ -#else - if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) -#endif { for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { @@ -260,13 +232,11 @@ static ivas_error ivas_dec_init_split_rend( return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) { cldfb_in_flag = 0; } -#endif error = isar_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ); return error; -- GitLab From 7086e8ca0617faa93666e59be4c1e4851310a7e5 Mon Sep 17 00:00:00 2001 From: rtyag Date: Mon, 8 Apr 2024 13:09:53 +1000 Subject: [PATCH 05/14] revert the #if 0 clean up from basop_util.c --- lib_com/basop_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 1d511a5409..d733349024 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1085,7 +1085,11 @@ Word32 Sqrt_l( return L_deposit_l( 0 ); } +#if 0 /* original version creates an overflow warning */ + e = s_and(norm_l(L_x), 0xFFFE); /* get next lower EVEN norm. exp */ +#else e = s_and( norm_l( L_x ), 0x7FFE ); /* get next lower EVEN norm. exp */ +#endif L_x = L_shl( L_x, e ); /* L_x is normalized to [0.25..1) */ *exp = e; move16(); /* return 2*exponent (or Q1) */ -- GitLab From 9852d61afaff64d5667d8d44560163da1f58749d Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 8 Apr 2024 14:43:41 +1000 Subject: [PATCH 06/14] Temporary change to run full suite of tests --- .gitignore | 1 + .gitlab-ci.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 376f1a4170..32b5db376a 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,7 @@ scripts/testv/stvOMASA_*.met scripts/testv/stvOMASA_*.csv scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav +scripts/testv/stvO* # default reference binary name IVAS_cod_ref* IVAS_dec_ref* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 177d90e355..9b89409a51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -255,7 +255,7 @@ stages: .rules-merge-request: extends: .rules-basis rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' # && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'push' when: never -- GitLab From 38a672c96bab4b85a5ed3ccfbd7fc22ec5b33cb9 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 8 Apr 2024 16:54:36 +1000 Subject: [PATCH 07/14] Moving isar_split_rend_choose_default_codec() under isar_pre_rend_open() --- lib_dec/ivas_init_dec.c | 13 ++++++------ lib_isar/isar_splitRendererPre.c | 35 ++++++++++++++++++++++---------- lib_isar/lib_isar_pre_rend.h | 7 ++++--- lib_rend/lib_rend.c | 16 +++++++-------- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f8a6a1c5b7..bb341ca6e9 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -265,11 +265,12 @@ static ivas_error ivas_dec_init_split_rend( } } - if ( ( error = isar_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) - { - return error; - } + // if ( ( error = isar_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) + // { + // return error; + // } + int16_t mixed_td_cldfb_flag = 0; #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef FIX_766_OMASA_SPLIT_REND if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) || @@ -278,11 +279,11 @@ static ivas_error ivas_dec_init_split_rend( if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) #endif { - cldfb_in_flag = 0; + mixed_td_cldfb_flag = 1; } #endif - error = isar_pre_rend_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ); + error = isar_pre_rend_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag ); return error; } #endif diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index fae4dd1c76..4307ebcd5c 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1805,11 +1805,12 @@ static ivas_error split_renderer_open_lc3plus( ivas_error isar_pre_rend_open( SPLIT_REND_WRAPPER *hSplitRendWrapper, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t OutSampleRate, const int16_t cldfb_in_flag, const int16_t pcm_out_flag, - const int16_t num_subframes ) + const int16_t num_subframes, + const int16_t mixed_td_cldfb_flag ) { ivas_error error, ch, num_ch; #ifndef SPLIT_REND_WITH_HEAD_ROT @@ -1820,19 +1821,31 @@ ivas_error isar_pre_rend_open( cldfbMode = CLDFB_ANALYSIS; #endif + int16_t cldfb_in_flag_local = cldfb_in_flag; + + if ( ( error = isar_split_rend_choose_default_codec( &(pSplitRendConfig->codec), &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) num_subframes ) ) != IVAS_ERR_OK ) + { + return error; + } + + if(mixed_td_cldfb_flag) + { + cldfb_in_flag_local = 0; + } + if ( ( error = isar_split_rend_validate_config( pSplitRendConfig, pcm_out_flag ) ) != IVAS_ERR_OK ) { return error; } - if ( cldfb_in_flag == 0 ) + if ( cldfb_in_flag_local == 0 ) { isCldfbNeeded = 1; #ifndef SPLIT_REND_WITH_HEAD_ROT cldfbMode = CLDFB_ANALYSIS; #endif } - else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag ) + else if ( pSplitRendConfig->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag_local ) { #ifdef SPLIT_REND_WITH_HEAD_ROT isCldfbNeeded = 1; @@ -1841,7 +1854,7 @@ ivas_error isar_pre_rend_open( cldfbMode = CLDFB_SYNTHESIS; #endif } - else if ( pcm_out_flag && cldfb_in_flag ) + else if ( pcm_out_flag && cldfb_in_flag_local ) { #ifdef SPLIT_REND_WITH_HEAD_ROT isCldfbNeeded = 1; @@ -1946,7 +1959,7 @@ ivas_error isar_pre_rend_open( ivas_error isar_pre_rend_init( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const AUDIO_CONFIG outConfig, @@ -1967,7 +1980,7 @@ ivas_error isar_pre_rend_init( isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); } - if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -2386,10 +2399,10 @@ ivas_error isar_pre_rend_MultiBinToSplitBinaural( /* Needs to be done at runtime. If this was in another API function, * there would be no guarantee that the user did not change * the split rendering config before calling the main rendering function */ - if ( ( error = isar_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } + // if ( ( error = isar_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, 0 ) ) != IVAS_ERR_OK ) + // { + // return error; + // } if ( cldfb_in_flag == 0 ) diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index b7ff3d9cc8..9b33b21d08 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -39,16 +39,17 @@ ivas_error isar_pre_rend_open( SPLIT_REND_WRAPPER *hSplitBinRend, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, + ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, const int32_t output_Fs, const int16_t cldfb_in_flag, const int16_t pcm_out_flag, - const int16_t num_subframes ); + const int16_t num_subframes, + const int16_t mixed_td_cldfb_flag ); ivas_error isar_pre_rend_init( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, IVAS_REND_HeadRotData headRotData, const int32_t outputSampleRate, const IVAS_AUDIO_CONFIG outConfig, diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 7056d03905..bfcf41fd48 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3582,10 +3582,10 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); - if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + // if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + // { + // return error; + // } if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { @@ -4424,10 +4424,10 @@ int16_t IVAS_REND_FeedRenderConfig( cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - { - return error; - } + // if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + // { + // return error; + // } if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { -- GitLab From eddf9a0af230bb5454af07f20101c8641514f153 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 8 Apr 2024 17:04:49 +1000 Subject: [PATCH 08/14] Removing commented code. --- lib_dec/ivas_init_dec.c | 5 ----- lib_isar/isar_splitRendererPre.c | 9 --------- lib_rend/lib_rend.c | 10 ---------- 3 files changed, 24 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index bb341ca6e9..2d2cf6501a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -265,11 +265,6 @@ static ivas_error ivas_dec_init_split_rend( } } - // if ( ( error = isar_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK ) - // { - // return error; - // } - int16_t mixed_td_cldfb_flag = 0; #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef FIX_766_OMASA_SPLIT_REND diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 4307ebcd5c..959a76b2b6 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -2396,15 +2396,6 @@ ivas_error isar_pre_rend_MultiBinToSplitBinaural( set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData ); } - /* Needs to be done at runtime. If this was in another API function, - * there would be no guarantee that the user did not change - * the split rendering config before calling the main rendering function */ - // if ( ( error = isar_split_rend_choose_default_codec( &splitCodec, &codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, 0 ) ) != IVAS_ERR_OK ) - // { - // return error; - // } - - if ( cldfb_in_flag == 0 ) { /*TD input*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index bfcf41fd48..05c5b65822 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3582,11 +3582,6 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); - // if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - // { - // return error; - // } - if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; @@ -4424,11 +4419,6 @@ int16_t IVAS_REND_FeedRenderConfig( cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - // if ( ( error = isar_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec, &hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) - // { - // return error; - // } - if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; -- GitLab From 2a69d3b53416a4d3d296cc9a09c2c26d550f8e60 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Mon, 8 Apr 2024 17:09:21 +1000 Subject: [PATCH 09/14] Moving isar_pre_rend_init() out of the pre_render API --- lib_isar/isar_splitRendererPre.c | 61 ------------------------------ lib_isar/lib_isar_pre_rend.h | 10 ----- lib_rend/lib_rend.c | 64 +++++++++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 73 deletions(-) diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 959a76b2b6..b29b1d8baa 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1949,67 +1949,6 @@ ivas_error isar_pre_rend_open( return IVAS_ERR_OK; } - -/*------------------------------------------------------------------------- - * Function isar_pre_rend_init() - * - * - *------------------------------------------------------------------------*/ - -ivas_error isar_pre_rend_init( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ) -{ - ivas_error error; - IVAS_REND_AudioBufferConfig bufConfig; - - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) - { - if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) - { - isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); - } - else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) - { - isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); - } - - if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - /*allocate for CLDFB in and change to TD during process if needed*/ - bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; - bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; - bufConfig.is_cldfb = 1; - pSplitRendEncBuffer->config = bufConfig; - - if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERR_FAILED_ALLOC; - } - } - else - { - IVAS_REND_AudioBufferConfig bufConfig2; - - bufConfig2.numSamplesPerChannel = 0; - bufConfig2.numChannels = 0; - bufConfig2.is_cldfb = 0; - pSplitRendEncBuffer->config = bufConfig2; - pSplitRendEncBuffer->data = NULL; - } - - return IVAS_ERR_OK; -} - /*------------------------------------------------------------------------- * Function isar_pre_rend_close() * diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index 9b33b21d08..13965a547e 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -46,16 +46,6 @@ ivas_error isar_pre_rend_open( const int16_t num_subframes, const int16_t mixed_td_cldfb_flag ); -ivas_error isar_pre_rend_init( - SPLIT_REND_WRAPPER *pSplitRendWrapper, - IVAS_REND_AudioBuffer *pSplitRendEncBuffer, - ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, - IVAS_REND_HeadRotData headRotData, - const int32_t outputSampleRate, - const IVAS_AUDIO_CONFIG outConfig, - const int16_t cldfb_in_flag, - const int16_t num_subframes ); - void isar_pre_rend_close( SPLIT_REND_WRAPPER *hSplitBinRend, IVAS_REND_AudioBuffer *pSplitRendEncBuffer ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 05c5b65822..9553ee415d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3548,6 +3548,66 @@ static int16_t getCldfbRendFlag( return isCldfbRend; } +/*------------------------------------------------------------------------- + * Function ivas_pre_rend_init() + * + * + *------------------------------------------------------------------------*/ + +static ivas_error ivas_pre_rend_init( + SPLIT_REND_WRAPPER *pSplitRendWrapper, + IVAS_REND_AudioBuffer *pSplitRendEncBuffer, + ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, + IVAS_REND_HeadRotData headRotData, + const int32_t outputSampleRate, + const AUDIO_CONFIG outConfig, + const int16_t cldfb_in_flag, + const int16_t num_subframes ) +{ + ivas_error error; + IVAS_REND_AudioBufferConfig bufConfig; + + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) + { + isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData, headRotData.sr_pose_pred_axis ); + } + else if ( pSplit_rend_config->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) + { + isar_renderSplitUpdateNoCorrectionPoseData( pSplit_rend_config, &pSplitRendWrapper->multiBinPoseData ); + } + + if ( ( error = isar_pre_rend_open( pSplitRendWrapper, pSplit_rend_config, outputSampleRate, cldfb_in_flag, outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM, num_subframes, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*allocate for CLDFB in and change to TD during process if needed*/ + bufConfig.numSamplesPerChannel = MAX_CLDFB_BUFFER_LENGTH_PER_CHANNEL; + bufConfig.numChannels = BINAURAL_CHANNELS * pSplitRendWrapper->multiBinPoseData.num_poses; + bufConfig.is_cldfb = 1; + pSplitRendEncBuffer->config = bufConfig; + + if ( ( pSplitRendEncBuffer->data = malloc( bufConfig.numChannels * bufConfig.numSamplesPerChannel * sizeof( float ) ) ) == NULL ) + { + return IVAS_ERR_FAILED_ALLOC; + } + } + else + { + IVAS_REND_AudioBufferConfig bufConfig2; + + bufConfig2.numSamplesPerChannel = 0; + bufConfig2.numChannels = 0; + bufConfig2.is_cldfb = 0; + pSplitRendEncBuffer->config = bufConfig2; + pSplitRendEncBuffer->data = NULL; + } + + return IVAS_ERR_OK; +} + #endif @@ -3582,7 +3642,7 @@ ivas_error IVAS_REND_AddInput( int16_t cldfb_in_flag; cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) ); - if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } @@ -4419,7 +4479,7 @@ int16_t IVAS_REND_FeedRenderConfig( cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN ); isar_pre_rend_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer ); - if ( ( error = isar_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From c1c0b52b16b05616c6685995778ee4fcd18af4d3 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 9 Apr 2024 12:13:21 +1000 Subject: [PATCH 10/14] add new header file to msvs project --- Workspace_msvc/lib_isar.vcxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj index 100d1afa75..5536c5f92d 100644 --- a/Workspace_msvc/lib_isar.vcxproj +++ b/Workspace_msvc/lib_isar.vcxproj @@ -169,6 +169,7 @@ + -- GitLab From 8bcdac7e5660bbbd120e289b0f300b1c288f76f8 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 9 Apr 2024 13:37:25 +1000 Subject: [PATCH 11/14] fix clang formatting --- lib_dec/lib_dec.c | 16 ++++++++-------- lib_isar/isar_prot.h | 3 +-- lib_isar/isar_splitRendererPre.c | 7 +++---- lib_isar/lib_isar_pre_rend.h | 6 ++---- lib_rend/lib_rend.c | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6ae2828ea2..b7740d55b7 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1190,14 +1190,14 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( Quaternion.z = 0.0f; } if ( ( error = isar_pre_rend_MultiBinToSplitBinaural( &hSplitBinRend->splitrend, - Quaternion, - st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, - st_ivas->hRenderConfig->split_rend_config.codec, - st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, - splitRendBits, - Cldfb_RealBuffer_Binaural, - Cldfb_ImagBuffer_Binaural, - max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK ) + Quaternion, + st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, + st_ivas->hRenderConfig->split_rend_config.codec, + st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, + splitRendBits, + Cldfb_RealBuffer_Binaural, + Cldfb_ImagBuffer_Binaural, + max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h index a85a609f01..9288ccaf1f 100644 --- a/lib_isar/isar_prot.h +++ b/lib_isar/isar_prot.h @@ -230,8 +230,7 @@ void isar_init_multi_bin_pose_data( void isar_renderSplitGetMultiBinPoseData( const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis -); + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); void isar_rend_CldfbSplitPreRendProcess( const ISAR_BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, diff --git a/lib_isar/isar_splitRendererPre.c b/lib_isar/isar_splitRendererPre.c index 21a0284016..52be145f44 100644 --- a/lib_isar/isar_splitRendererPre.c +++ b/lib_isar/isar_splitRendererPre.c @@ -1645,8 +1645,7 @@ void isar_set_split_rend_ht_setup( void isar_pre_rend_GetMultiBinPoseData( const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis -) + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ) { isar_renderSplitGetMultiBinPoseData( pSplit_rend_config, pMultiBinPoseData, rot_axis ); } @@ -1817,12 +1816,12 @@ ivas_error isar_pre_rend_open( int16_t cldfb_in_flag_local = cldfb_in_flag; - if ( ( error = isar_split_rend_choose_default_codec( &(pSplitRendConfig->codec), &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) num_subframes ) ) != IVAS_ERR_OK ) + if ( ( error = isar_split_rend_choose_default_codec( &( pSplitRendConfig->codec ), &pSplitRendConfig->codec_frame_size_ms, cldfb_in_flag_local, pcm_out_flag, (int16_t) num_subframes ) ) != IVAS_ERR_OK ) { return error; } - if(mixed_td_cldfb_flag) + if ( mixed_td_cldfb_flag ) { cldfb_in_flag_local = 0; } diff --git a/lib_isar/lib_isar_pre_rend.h b/lib_isar/lib_isar_pre_rend.h index 13965a547e..d8b8b2583e 100644 --- a/lib_isar/lib_isar_pre_rend.h +++ b/lib_isar/lib_isar_pre_rend.h @@ -53,8 +53,7 @@ void isar_pre_rend_close( void isar_pre_rend_GetMultiBinPoseData( const ISAR_SPLIT_REND_CONFIG_DATA *pSplit_rend_config, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - const ISAR_SPLIT_REND_ROT_AXIS rot_axis -); + const ISAR_SPLIT_REND_ROT_AXIS rot_axis ); ivas_error isar_pre_rend_MultiBinToSplitBinaural( SPLIT_REND_WRAPPER *hSplitBin, @@ -70,8 +69,7 @@ ivas_error isar_pre_rend_MultiBinToSplitBinaural( const int16_t low_res_pre_rend_rot, const int16_t cldfb_in_flag, const int16_t pcm_out_flag, - const int16_t ro_md_flag -); + const int16_t ro_md_flag ); #endif /* LIB_ISAR_PRE_REND_H */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d72a7f8a3c..98a2bc4f32 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7724,7 +7724,7 @@ static ivas_error getSamplesInternal( } if ( ( error = isar_pre_rend_MultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0, ro_md_flag ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From ad18ee729b8c943aed2bfcc2b351f3a8979e689f Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Wed, 10 Apr 2024 10:22:33 +0200 Subject: [PATCH 12/14] Restore removed TODO comment --- lib_dec/lib_dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index b7740d55b7..d280862187 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -942,6 +942,9 @@ ivas_error IVAS_DEC_GetSamples( { return error; } +#ifdef SPLIT_REND_WITH_HEAD_ROT + /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ +#endif } { /* check if we need to run the setup function, tc decoding and feeding the renderer */ -- GitLab From cee261e3e6c9df593a3033c8a7cbb44ed114a782 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Thu, 11 Apr 2024 09:43:44 +0200 Subject: [PATCH 13/14] Revert "Restore removed TODO comment" This reverts commit ad18ee729b8c943aed2bfcc2b351f3a8979e689f. --- lib_dec/lib_dec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index d280862187..b7740d55b7 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -942,9 +942,6 @@ ivas_error IVAS_DEC_GetSamples( { return error; } -#ifdef SPLIT_REND_WITH_HEAD_ROT - /* :TODO: change nSamplesAsked also if we are in 5ms 0dof split rendering... */ -#endif } { /* check if we need to run the setup function, tc decoding and feeding the renderer */ -- GitLab From b59a0c941883aab78fd6c72edcee1f6d5d29c047 Mon Sep 17 00:00:00 2001 From: rtyag Date: Fri, 12 Apr 2024 15:59:20 +1000 Subject: [PATCH 14/14] revert the temp YML change --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b1cbab9e55..ec54d7a410 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -255,7 +255,7 @@ stages: .rules-merge-request: extends: .rules-basis rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' # && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # only have MR pipelines for MRs to main - if: $CI_PIPELINE_SOURCE == 'push' when: never -- GitLab