From ab818046b145ac314bfc7e29e69a9de0aa07aa28 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Sep 2023 11:12:12 +0200 Subject: [PATCH 1/9] remove duplicated SR constants definition --- apps/renderer.c | 2 +- lib_com/common_api_types.h | 1 + lib_com/ivas_cnst.h | 2 +- lib_dec/lib_dec.c | 1 - lib_rend/lib_rend.h | 13 ------------- lib_util/split_render_file_read_write.c | 2 +- 6 files changed, 4 insertions(+), 17 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index a1b24888b7..9d250fb2b7 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -67,7 +67,7 @@ #define RENDERER_MAX_METADATA_LINE_LENGTH 1024 #ifdef SPLIT_REND_WITH_HEAD_ROT -#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) +#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ ) #endif #define IVAS_MAX16B_FLT 32767.0f diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 7e56c3ca32..ce3ecec707 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -196,6 +196,7 @@ typedef struct _IVAS_JBM_TRACE_DATA #define IVAS_MAX_SPLIT_REND_BITRATE 768000 #define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#define IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 typedef enum { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index b7f24440b4..67a6e29a6a 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1847,7 +1847,7 @@ typedef enum #define SPLIT_REND_512k 512000 #define SPLIT_REND_768k 768000 #define SPLIT_REND_MAX_BRATE SPLIT_REND_768k -#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 + #endif /*----------------------------------------------------------------------------------* diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 4d7c9edf3d..356b16a10d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -3494,7 +3494,6 @@ ivas_error IVAS_DEC_GetCldfbSamples( ) { Decoder_Struct *st_ivas; - ivas_error error; int16_t ch, b, slot_idx, num_chs, maxBand, num_samples; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 404984e285..d6fd94b728 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -48,19 +48,6 @@ #define RENDERER_MAX_BIN_INPUTS 1 #endif -#ifdef SPLIT_REND_WITH_HEAD_ROT -/*----------------------------------------------------------------------------------* - * Split rendering bitrate constants - *----------------------------------------------------------------------------------*/ - -#define SPLIT_REND_256k 256000 -#define SPLIT_REND_320k 320000 -#define SPLIT_REND_384k 384000 -#define SPLIT_REND_512k 512000 -#define SPLIT_REND_768k 768000 -#define SPLIT_REND_MAX_BRATE SPLIT_REND_768k -#define SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 -#endif /*---------------------------------------------------------------------* * Renderer structures diff --git a/lib_util/split_render_file_read_write.c b/lib_util/split_render_file_read_write.c index 5028ac88bb..1a08a69297 100644 --- a/lib_util/split_render_file_read_write.c +++ b/lib_util/split_render_file_read_write.c @@ -354,7 +354,7 @@ ivas_error split_rend_read_bits_from_file( { return IVAS_ERR_FAILED_FILE_READ; } - for ( i = 0; i < SPLIT_REND_ADDITIONAL_BYTES_TO_READ; i++ ) + for ( i = 0; i < IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ; i++ ) { bits[num_bytes + i] = 0; } -- GitLab From 4f4cca09b0f6d6c425cf7f88a930d60074c9782f Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Sep 2023 11:31:52 +0200 Subject: [PATCH 2/9] harmonize structures names ivas_split_rend_bits_t and, IVAS_SPLIT_REND_BITS_DATA --- Workspace_msvc/lib_rend.vcxproj | 6 +- Workspace_msvc/lib_rend.vcxproj.filters | 6 -- lib_com/common_api_types.h | 4 +- lib_rend/ivas_PredDecoder.c | 3 +- lib_rend/ivas_PredEncoder.c | 3 +- lib_rend/ivas_cldfb_codec_bitstream.c | 57 ------------ lib_rend/ivas_cldfb_codec_bitstream.h | 48 ---------- lib_rend/ivas_lcld_decoder.c | 54 +++++++---- lib_rend/ivas_lcld_encoder.c | 32 +++---- lib_rend/ivas_lcld_prot.h | 116 ++++++++++++++++-------- lib_rend/ivas_prot_rend.h | 16 ++-- lib_rend/ivas_splitRend_lcld_dec.c | 2 +- lib_rend/ivas_splitRend_lcld_enc.c | 2 +- lib_rend/ivas_splitRendererPost.c | 8 +- lib_rend/ivas_splitRendererPre.c | 14 +-- lib_rend/ivas_splitRenderer_utils.c | 6 +- lib_rend/lib_rend.c | 10 +- 17 files changed, 162 insertions(+), 225 deletions(-) delete mode 100644 lib_rend/ivas_cldfb_codec_bitstream.c delete mode 100644 lib_rend/ivas_cldfb_codec_bitstream.h diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 204f1a9661..e0bcd06033 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -150,7 +150,6 @@ - @@ -178,7 +177,7 @@ - + @@ -191,11 +190,10 @@ - + - diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters index fd7b1620ce..406ba2c85e 100644 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -5,9 +5,6 @@ rend_c - - rend_c - rend_c @@ -206,9 +203,6 @@ rend_h - - rend_h - diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index ce3ecec707..c841cc02c0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -236,7 +236,7 @@ typedef enum } IVAS_SPLIT_REND_RENDERER_SELECTION; -typedef struct ivas_split_rend_bits_t +typedef struct _IVAS_SPLIT_REND_BITS_DATA { uint8_t *bits_buf; int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/ @@ -246,7 +246,7 @@ typedef struct ivas_split_rend_bits_t IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; -} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; +} IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; typedef struct _IVAS_SPLIT_REND_CONFIG { diff --git a/lib_rend/ivas_PredDecoder.c b/lib_rend/ivas_PredDecoder.c index a0642ff0ea..914435e2fe 100644 --- a/lib_rend/ivas_PredDecoder.c +++ b/lib_rend/ivas_PredDecoder.c @@ -38,7 +38,6 @@ #include "ivas_prot_rend.h" #include "ivas_lcld_prot.h" #include "ivas_lcld_rom_tables.h" -#include "ivas_cldfb_codec_bitstream.h" #include "wmc_auto.h" @@ -194,7 +193,7 @@ void DeletePredictionDecoder( int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int16_t iBitsRead = 0; int32_t c; diff --git a/lib_rend/ivas_PredEncoder.c b/lib_rend/ivas_PredEncoder.c index 280ea6de64..804a00a6a1 100644 --- a/lib_rend/ivas_PredEncoder.c +++ b/lib_rend/ivas_PredEncoder.c @@ -38,7 +38,6 @@ #include "ivas_lcld_rom_tables.h" #include "prot.h" #include "ivas_prot_rend.h" -#include "ivas_cldfb_codec_bitstream.h" #include "wmc_auto.h" @@ -490,7 +489,7 @@ void ApplyForwardPredictors( int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsWritten = 0; int32_t c; diff --git a/lib_rend/ivas_cldfb_codec_bitstream.c b/lib_rend/ivas_cldfb_codec_bitstream.c deleted file mode 100644 index 591f8f484d..0000000000 --- a/lib_rend/ivas_cldfb_codec_bitstream.c +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 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. - -*******************************************************************************************************/ - -#include "ivas_cldfb_codec_bitstream.h" -#include -#include "options.h" -#ifdef SPLIT_REND_WITH_HEAD_ROT -#include -#include -#include "prot.h" -#include "wmc_auto.h" - -/*------------------------------------------------------------------------------------------* - * Function BSForceBack() - * - * - *------------------------------------------------------------------------------------------*/ - -int32_t BSForceBack( - ivas_split_rend_bits_t *pBits, - int32_t iValue, - int32_t iBitCount ) -{ - pBits->bits_read -= iBitCount; - - return ( iValue >> iBitCount ); -} -#endif diff --git a/lib_rend/ivas_cldfb_codec_bitstream.h b/lib_rend/ivas_cldfb_codec_bitstream.h deleted file mode 100644 index 0fd6d6a223..0000000000 --- a/lib_rend/ivas_cldfb_codec_bitstream.h +++ /dev/null @@ -1,48 +0,0 @@ -/****************************************************************************************************** - - (C) 2022-2023 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 _IVAS_CLDFB_CODEC_BITSTREAM_H_ -#define _IVAS_CLDFB_CODEC_BITSTREAM_H_ - -#include "lib_rend.h" -#include "ivas_prot_rend.h" -#include "options.h" - -#ifdef SPLIT_REND_WITH_HEAD_ROT - -int32_t BSForceBack( - ivas_split_rend_bits_t *pBits, - int32_t iValue, - int32_t iBitCount ); - -#endif -#endif /* _BITSTREAM_H_ */ diff --git a/lib_rend/ivas_lcld_decoder.c b/lib_rend/ivas_lcld_decoder.c index 47d1e5f601..7825f249c6 100644 --- a/lib_rend/ivas_lcld_decoder.c +++ b/lib_rend/ivas_lcld_decoder.c @@ -35,7 +35,6 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT #include "ivas_lcld_prot.h" #include "ivas_lcld_rom_tables.h" -#include "ivas_cldfb_codec_bitstream.h" #include "prot.h" #include #include "ivas_prot_rend.h" @@ -735,24 +734,24 @@ static void InvQuantizeSpectrum( const int32_t iNumGroups, const int32_t *piGrou static void InvMSCoding( const int32_t iNumBlocks, const int32_t iNumBands, const int32_t *piBandwidths, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, float ***pppfReal, float ***pppfImag ); -static int32_t ReadHeaderInformation( int32_t *piNumBands, ivas_split_rend_bits_t *pBits ); +static int32_t ReadHeaderInformation( int32_t *piNumBands, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, ivas_split_rend_bits_t *pBits ); +static int32_t ReadMSInformation( const int32_t iNumBands, int32_t *piMSMode, int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits ); +static int32_t ReadGroupInformation( const int32_t iChannels, const int32_t iNumBlocks, int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], int32_t *piSymbol, ivas_split_rend_bits_t *pBits ); +static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], int32_t *piSymbol, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t ReadRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ivas_split_rend_bits_t *pBits ); +static int32_t ReadRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t ReadAllocInformation( int32_t *piAllocOffset, ivas_split_rend_bits_t *pBits ); +static int32_t ReadAllocInformation( int32_t *piAllocOffset, IVAS_SPLIT_REND_BITS_HANDLE pBits ); #ifdef ROM_TO_RAM 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, ivas_split_rend_bits_t *pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ); +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, IVAS_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, ivas_split_rend_bits_t *pBits ); +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, IVAS_SPLIT_REND_BITS_HANDLE pBits ); #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 ); @@ -766,7 +765,7 @@ static void ComputeAllocation( const int32_t iChannels, const int32_t *piNumGrou int32_t DecodeLCLDFrame( LCLDDecoder *psLCLDDecoder, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, float ***pppfLCLDReal, float ***pppfLCLDImag ) { @@ -1114,7 +1113,7 @@ static void InvMSCoding( /* Currently only the number of bands in frame */ static int32_t ReadHeaderInformation( int32_t *piNumBands, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsRead; @@ -1132,7 +1131,7 @@ static int32_t ReadMSInformation( int32_t *piMSFlags, int32_t *piLRPhaseDiffs, int32_t *piMSPredCoefs, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsRead; @@ -1269,7 +1268,7 @@ static int32_t ReadGroupInformation( int32_t *piCommonGrouping, int32_t *piNumGroups, int32_t **ppiGroupLengths, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t c, k, iBitsRead; @@ -1366,10 +1365,21 @@ static int32_t ReadGroupInformation( } +static int32_t BSForceBack( + IVAS_SPLIT_REND_BITS_HANDLE pBits, + int32_t iValue, + int32_t iBitCount ) +{ + pBits->bits_read -= iBitCount; + + return ( iValue >> iBitCount ); +} + + static int32_t ReadHuff( const uint32_t ( *pauiHuffDecTable )[HUFF_DEC_TABLE_SIZE], int32_t *piSymbol, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsRead; int32_t iSymbol; @@ -1408,7 +1418,7 @@ static int32_t ReadRMSEnvelope( const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t b, k, n; int32_t iBitsRead, iLastRMSVal; @@ -1441,7 +1451,11 @@ static int32_t ReadRMSEnvelope( #ifdef ENABLE_PMOD_ADJUST -static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, ivas_split_rend_bits_t *pBits, int32_t iChannels, int32_t iNumBands ) +static int32_t ReadPmodInformation( + int32_t **ppiHiSMRFlags, + IVAS_SPLIT_REND_BITS_HANDLE pBits, + int32_t iChannels, + int32_t iNumBands ) { int32_t iBitsRead; int32_t c; @@ -1498,7 +1512,7 @@ static int32_t ReadPmodInformation( int32_t **ppiHiSMRFlags, ivas_split_rend_bit static int32_t ReadAllocInformation( int32_t *piAllocOffset, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsRead; @@ -1509,6 +1523,8 @@ static int32_t ReadAllocInformation( return iBitsRead; } + + #ifdef ROM_TO_RAM static int32_t ReadLCLDData( const int32_t iNumGroups, @@ -1521,7 +1537,7 @@ static int32_t ReadLCLDData( int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, uint32_t ( *c_apauiHuffDecTables[2 * ALLOC_TABLE_SIZE] )[HUFF_DEC_TABLE_SIZE] ) #else static int32_t ReadLCLDData( @@ -1535,7 +1551,7 @@ static int32_t ReadLCLDData( int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) #endif { int32_t b, k, m, n; diff --git a/lib_rend/ivas_lcld_encoder.c b/lib_rend/ivas_lcld_encoder.c index 82c0438cec..31634c8a21 100644 --- a/lib_rend/ivas_lcld_encoder.c +++ b/lib_rend/ivas_lcld_encoder.c @@ -38,7 +38,6 @@ #include "ivas_lcld_prot.h" #include "ivas_lcld_rom_tables.h" #include "prot.h" -#include "ivas_cldfb_codec_bitstream.h" #include "ivas_prot_rend.h" #ifdef ENABLE_PMOD_ADJUST #include "ton_corr.h" @@ -482,20 +481,19 @@ static void RemoveRMSEnvelope( const int32_t iNumBands, const int32_t *piBandwid static int32_t CountLCLDBits( 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 **ppiQReal, int32_t **ppiQImag ); -static int32_t WriteHeaderInformation( const int32_t iNumBands, ivas_split_rend_bits_t *pBits ); +static int32_t WriteHeaderInformation( const int32_t iNumBands, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, ivas_split_rend_bits_t *pBits, int32_t iChannels, int32_t iNumBands ); +static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, IVAS_SPLIT_REND_BITS_HANDLE pBits, int32_t iChannels, int32_t iNumBands ); -static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, int32_t iNumMSPredBands, ivas_split_rend_bits_t *pBits ); +static int32_t WriteMSInformation( const int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiffs, const int32_t *piMSPredCoefs, int32_t iNumMSPredBands, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t WriteGroupInformation( const int32_t iChannels, const int32_t iCommonGrouping, const int32_t *piNumGroups, int32_t **ppiGroupLengths, ivas_split_rend_bits_t *pBits ); +static int32_t WriteGroupInformation( const int32_t iChannels, const int32_t iCommonGrouping, const int32_t *piNumGroups, int32_t **ppiGroupLengths, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t WriteRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, ivas_split_rend_bits_t *pBits ); +static int32_t WriteRMSEnvelope( const int32_t iChannels, const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -static int32_t WriteAllocInformation( const int32_t iAllocOffset, - ivas_split_rend_bits_t *pBits ); +static int32_t WriteAllocInformation( const int32_t iAllocOffset, IVAS_SPLIT_REND_BITS_HANDLE pBits ); -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, ivas_split_rend_bits_t *pBits ); +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, IVAS_SPLIT_REND_BITS_HANDLE pBits ); 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, int32_t **ppiPredEnable, float **ppfA1Real, float **ppfA1Imag ); @@ -512,7 +510,7 @@ int32_t EncodeLCLDFrame( float ***pppfLCLDImag, int32_t *piBitsWritten, const int32_t available_bits, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t n; int32_t iAvailableBits, iBitsWritten; @@ -1436,7 +1434,7 @@ static int32_t CountLCLDBits( /* Currently only the number of bands in frame */ static int32_t WriteHeaderInformation( const int32_t iNumBands, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsWritten; @@ -1455,7 +1453,7 @@ static int32_t WriteMSInformation( const int32_t *piLRPhaseDiff, const int32_t *piMSPredCoef, int32_t iNumMSPredBands, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsWritten; int32_t iMSPredAll = ( iNumMSPredBands == iNumBands ); @@ -1566,7 +1564,7 @@ static int32_t WriteGroupInformation( const int32_t iCommonGrouping, const int32_t *piNumGroups, int32_t **ppiGroupLengths, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t c, k, n, iBitsWritten; @@ -1642,7 +1640,7 @@ static int32_t WriteRMSEnvelope( const int32_t *piNumGroups, const int32_t iNumBands, int32_t ***pppiRMSEnvelope, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t k, n; int32_t iBitsWritten; @@ -1684,7 +1682,7 @@ static int32_t WriteRMSEnvelope( #ifdef ENABLE_PMOD_ADJUST static int32_t WritePmodInformation( const int32_t **ppiHiSMRFlags, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, int32_t iChannels, int32_t iNumBands ) { @@ -1747,7 +1745,7 @@ static int32_t WritePmodInformation( static int32_t WriteAllocInformation( const int32_t iAllocOffset, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsWritten; @@ -1776,7 +1774,7 @@ static int32_t WriteLCLDData( int32_t **ppiSignImag, int32_t **ppiQReal, int32_t **ppiQImag, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t n; int32_t iBitsWritten; diff --git a/lib_rend/ivas_lcld_prot.h b/lib_rend/ivas_lcld_prot.h index fa92e1be5d..ad35e50f00 100644 --- a/lib_rend/ivas_lcld_prot.h +++ b/lib_rend/ivas_lcld_prot.h @@ -38,6 +38,7 @@ #include "lib_rend.h" #include "ivas_lcld_rom_tables.h" +/* clang-format off */ typedef struct LCLD_ENCODER LCLDEncoder; @@ -49,7 +50,8 @@ ivas_error CreateLCLDEncoder( const int32_t iAllowSidePred ); void DeleteLCLDEncoder( - LCLDEncoder *psLCLDEncoder ); + LCLDEncoder *psLCLDEncoder +); int32_t EncodeLCLDFrame( LCLDEncoder *psLCLDEncoder, @@ -57,10 +59,11 @@ int32_t EncodeLCLDFrame( float ***pppfLCLDImag, int32_t *piNumiBites, const int32_t available_bits, - ivas_split_rend_bits_t *pBits ); + IVAS_SPLIT_REND_BITS_HANDLE pBits ); int32_t GetNumGroups( - LCLDEncoder *psLCLDEncoder ); + LCLDEncoder *psLCLDEncoder +); typedef struct LCLD_DECODER LCLDDecoder; @@ -71,13 +74,15 @@ ivas_error CreateLCLDDecoder( const int32_t iChannels ); void DeleteLCLDDecoder( - LCLDDecoder *psLCLDDecoder ); + LCLDDecoder *psLCLDDecoder +); int32_t DecodeLCLDFrame( LCLDDecoder *psLCLDDecoder, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, float ***pppfLCLDReal, - float ***pppfLCLDImag ); + float ***pppfLCLDImag +); /*----------------------------------------------------------------------------------* @@ -85,13 +90,15 @@ int32_t DecodeLCLDFrame( *----------------------------------------------------------------------------------*/ int32_t quantPhase( - float phase ); + float phase +); void cplxmult( float *pr1, float *pi1, float r2, - float i2 ); + float i2 +); #ifdef SIMPLE_PHASE void rot_pm_pi( @@ -100,7 +107,8 @@ void rot_pm_pi( void rot_p_pi_2( float *pr, - float *pi ); + float *pi +); void rot_m_pi_2( float *pr, @@ -108,43 +116,53 @@ void rot_m_pi_2( void rot_zero( float *pr, - float *pi ); + float *pi +); #endif int32_t requantPhase( - int32_t phaseQ ); + int32_t phaseQ +); int32_t quantPred( - const float pred ); + const float pred +); float dequantPhase( - const int32_t phaseQ ); + const int32_t phaseQ +); float dequantPred( - int32_t predQ ); + int32_t predQ +); int32_t PrepEncode( int32_t *piQuant, const int32_t *piMSFlags, - const int32_t numBands ); + const int32_t numBands +); void EncodePhase( int32_t *phaseQuant, const int32_t numMSBands, - const int32_t diffDim ); + const int32_t diffDim +); void DecodePhase( int32_t *phaseQuant, const int32_t numMSBands, - const int32_t diffDim ); + const int32_t diffDim +); int32_t EncodePredCoef( int32_t *predQuant, - const int32_t numMSBands ); + const int32_t numMSBands +); void DecodePredCoef( int32_t *phaseQuant, - const int32_t numMSBands ); + const int32_t numMSBands +); void writeMSPred( int32_t *phaseQuant, @@ -153,14 +171,16 @@ void writeMSPred( const int32_t numMSBands, int32_t numBands, void *fid, - int32_t *piMsFlags ); + int32_t *piMsFlags +); int32_t CountMSBits( int32_t iNumBands, const int32_t iMSMode, const int32_t *piMSFlags, const int32_t *piLRPhaseDiff, - const int32_t *piMSPredCoef ); + const int32_t *piMSPredCoef +); /*----------------------------------------------------------------------------------* @@ -175,9 +195,13 @@ typedef struct NOISE_GEN float *pfNoiseBuffer; } NoiseGen; -NoiseGen *CreateNoiseGen( void ); +NoiseGen *CreateNoiseGen( + void +); -void DeleteNoiseGen( NoiseGen *psNoiseGen ); +void DeleteNoiseGen( + NoiseGen *psNoiseGen +); inline float GetNoise( NoiseGen *psNoiseGen ) { @@ -199,7 +223,8 @@ extern void PerceptualModel( const int32_t iMaxQuantBands, const int32_t *piRMSEnvelope, int32_t *piExcitation, - int32_t *piSMR ); + int32_t *piSMR +); extern void PerceptualModelStereo( const int32_t iMaxQuantBands, @@ -209,13 +234,14 @@ extern void PerceptualModelStereo( int32_t *piExcitation0, int32_t *piExcitation1, int32_t *piSMR0, - int32_t *piSMR1 ); + int32_t *piSMR1 +); + /*----------------------------------------------------------------------------------* * PredEncoder/PredDecoder prototypes *----------------------------------------------------------------------------------*/ - typedef struct PREDICTION_ENCODER { int32_t iChannels; @@ -242,25 +268,29 @@ typedef struct PREDICTION_ENCODER ivas_error CreatePredictionEncoder( PredictionEncoder **psPredictionEncoder_out, const int32_t iChannels, - const int32_t iNumBlocks ); + const int32_t iNumBlocks +); void DeletePredictionEncoder( - PredictionEncoder *psPredictionEncoder ); + PredictionEncoder *psPredictionEncoder +); int32_t ComputePredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, - float ***pppfImag ); + float ***pppfImag +); void ApplyForwardPredictors( PredictionEncoder *psPredictionEncoder, float ***pppfReal, - float ***pppfImag ); - + float ***pppfImag +); int32_t WritePredictors( PredictionEncoder *psPredictionEncoder, - ivas_split_rend_bits_t *pBits ); + IVAS_SPLIT_REND_BITS_HANDLE pBits +); typedef struct PREDICTION_DECODER { @@ -288,19 +318,23 @@ typedef struct PREDICTION_DECODER ivas_error CreatePredictionDecoder( PredictionDecoder **psPredictionDecoder_out, const int32_t iChannels, - const int32_t iNumBlocks ); + const int32_t iNumBlocks +); void DeletePredictionDecoder( - PredictionDecoder *psPredictionDecoder ); + PredictionDecoder *psPredictionDecoder +); int32_t ReadPredictors( PredictionDecoder *psPredictionDecoder, - ivas_split_rend_bits_t *pBits ); + IVAS_SPLIT_REND_BITS_HANDLE pBits +); void ApplyInversePredictros( PredictionDecoder *psPredictionDecoder, float ***pppfReal, - float ***pppfImag ); + float ***pppfImag +); /*----------------------------------------------------------------------------------* @@ -310,10 +344,12 @@ void ApplyInversePredictros( typedef struct RMS_ENVELOPE_GROUPING RMSEnvelopeGrouping; RMSEnvelopeGrouping *CreateRMSEnvelopeGrouping( - const int32_t iNumBlocks ); + const int32_t iNumBlocks +); void DeleteRMSEnvelopeGrouping( - RMSEnvelopeGrouping *psRMSEnvelopeGrouping ); + RMSEnvelopeGrouping *psRMSEnvelopeGrouping +); void ComputeEnvelopeGrouping( RMSEnvelopeGrouping *psRMSEnvelopeGrouping, @@ -324,9 +360,11 @@ void ComputeEnvelopeGrouping( float ***pppfImag, int32_t *piNumGroups, int32_t *piGroupLengths, - int32_t ***pppiRMSEnvelope ); + int32_t ***pppiRMSEnvelope +); #endif +/* clang-format on */ #endif /* _LCLD_ENCODER_H_ */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 35b807539b..61be4c26f2 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1417,7 +1417,7 @@ void ivas_splitBinLCLDEncProcess( float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int32_t available_bits, - ivas_split_rend_bits_t *pBits + IVAS_SPLIT_REND_BITS_HANDLE pBits ); ivas_error ivas_splitBinLCLDDecOpen( @@ -1432,7 +1432,7 @@ void ivas_splitBinLCLDDecClose( void ivas_splitBinLCLDDecProcess( BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t bfi @@ -1474,7 +1474,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, int16_t codec_frame_size_ms, - ivas_split_rend_bits_t *pBits, + IVAS_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, @@ -1490,7 +1490,7 @@ void ivas_rend_CldfbSplitPreRendProcess( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t target_md_bits, const int16_t low_res_pre_rend_rot ); @@ -1513,7 +1513,7 @@ void ivas_splitBinPostRendClose( BIN_HR_SPLIT_POST_REND_HANDLE *hBinHrSplitPostRend ); void ivas_splitBinPostRendMdDec( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG @@ -1759,7 +1759,7 @@ void ivas_mat_mult_2by2_complex( ); void ivas_split_rend_bitstream_init( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t buf_len_bytes, uint8_t *pbuf ); @@ -1795,13 +1795,13 @@ void ivas_SplitRenderer_getdiagdiff( ); void ivas_split_rend_bitstream_write_int32( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t val, const int32_t bits ); int32_t ivas_split_rend_bitstream_read_int32( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t bits ); diff --git a/lib_rend/ivas_splitRend_lcld_dec.c b/lib_rend/ivas_splitRend_lcld_dec.c index 9868a8d0b5..1d81dfebc9 100644 --- a/lib_rend/ivas_splitRend_lcld_dec.c +++ b/lib_rend/ivas_splitRend_lcld_dec.c @@ -165,7 +165,7 @@ void ivas_splitBinLCLDDecClose( void ivas_splitBinLCLDDecProcess( BIN_HR_SPLIT_LCLD_DEC_HANDLE hSplitBinLCLDDec, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, float Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int16_t bfi ) diff --git a/lib_rend/ivas_splitRend_lcld_enc.c b/lib_rend/ivas_splitRend_lcld_enc.c index 0a4090a480..a0789d63a8 100644 --- a/lib_rend/ivas_splitRend_lcld_enc.c +++ b/lib_rend/ivas_splitRend_lcld_enc.c @@ -156,7 +156,7 @@ void ivas_splitBinLCLDEncProcess( float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], const int32_t available_bits, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int32_t iBitsWritten; diff --git a/lib_rend/ivas_splitRendererPost.c b/lib_rend/ivas_splitRendererPost.c index 68bfb726ad..090a959e8b 100644 --- a/lib_rend/ivas_splitRendererPost.c +++ b/lib_rend/ivas_splitRendererPost.c @@ -205,7 +205,7 @@ static int32_t ivas_split_rend_huffman_code_bits_present( static int16_t ivas_split_rend_huffman_decode_opt( ivas_split_rend_huffman_cfg_t *huff_cfg, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int16_t *idx_trav_list ) { int32_t i, ind, code, num_bits, code_b, num_bits_read; @@ -343,7 +343,7 @@ static void ivas_split_rend_unquant_md( *-----------------------------------------------------------------------------------------*/ static void ivas_splitBinPostRendMdBase2Dec( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int16_t num_subframes, @@ -484,7 +484,7 @@ static void ivas_splitBinPostRendMdBase2Dec( *-----------------------------------------------------------------------------------------*/ static void ivas_splitBinPostRendMdHuffDec( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, const int16_t num_subframes, @@ -661,7 +661,7 @@ static void ivas_splitBinPostRendMdHuffDec( *-----------------------------------------------------------------------------------------*/ void ivas_splitBinPostRendMdDec( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData #ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG diff --git a/lib_rend/ivas_splitRendererPre.c b/lib_rend/ivas_splitRendererPre.c index 6e97d70a5d..bba54f8c8b 100644 --- a/lib_rend/ivas_splitRendererPre.c +++ b/lib_rend/ivas_splitRendererPre.c @@ -835,7 +835,7 @@ static void ivas_SplitRenderer_code_md_base2( const int16_t bands_pitch, const int16_t pred_real_bands_roll, const int16_t pred_imag_bands_roll, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int16_t pos_idx, b, ch1, ch2, sf_idx; int16_t min_pred_idx, min_gd_idx, min_p_gd_idx, pred_code_len, gd_code_len, p_gd_code_len, num_poses; @@ -994,7 +994,7 @@ static void ivas_SplitRenderer_code_md_huff( const int16_t bands_pitch, const int16_t pred_real_bands_roll, const int16_t pred_imag_bands_roll, - ivas_split_rend_bits_t *pBits ) + IVAS_SPLIT_REND_BITS_HANDLE pBits ) { int16_t pos_idx, b, ch1, ch2, sf_idx, num_poses; int16_t sym_adj_idx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; @@ -1175,7 +1175,7 @@ static void ivas_SplitRenderer_quant_code( const BIN_HR_SPLIT_PRE_REND_HANDLE hBinHrSplitPreRend, const IVAS_QUATERNION headPosition, MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int16_t low_res_pre_rend_rot, const int32_t target_md_bits ) { @@ -1552,7 +1552,7 @@ void ivas_rend_CldfbSplitPreRendProcess( MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, float Cldfb_In_BinReal[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t target_md_bits, const int16_t low_res_pre_rend_rot ) { @@ -2193,7 +2193,7 @@ void ivas_split_renderer_close( static ivas_error splitRendLc3plusEncodeAndWrite( SPLIT_REND_WRAPPER *hSplitBin, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t SplitRendBitRate, float *in[] ) { @@ -2246,7 +2246,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural( const IVAS_QUATERNION headPosition, const int32_t SplitRendBitRate, const int16_t codec_frame_size_ms, - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int16_t max_bands, float *in[], const int16_t low_res_pre_rend_rot, @@ -2469,7 +2469,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural( const int32_t SplitRendBitRate, IVAS_SPLIT_REND_CODEC splitCodec, int16_t codec_frame_size_ms, - ivas_split_rend_bits_t *pBits, + IVAS_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, diff --git a/lib_rend/ivas_splitRenderer_utils.c b/lib_rend/ivas_splitRenderer_utils.c index 3583294f61..7e361c4e26 100644 --- a/lib_rend/ivas_splitRenderer_utils.c +++ b/lib_rend/ivas_splitRenderer_utils.c @@ -92,7 +92,7 @@ void ivas_mat_mult_2by2_complex( *------------------------------------------------------------------------*/ void ivas_split_rend_bitstream_init( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t buf_len_bytes, uint8_t *pbuf ) { @@ -385,7 +385,7 @@ void ivas_SplitRenderer_getdiagdiff( *------------------------------------------------------------------------*/ int32_t ivas_split_rend_bitstream_read_int32( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t bits ) { int32_t val, k, bit_val; @@ -415,7 +415,7 @@ int32_t ivas_split_rend_bitstream_read_int32( *------------------------------------------------------------------------*/ void ivas_split_rend_bitstream_write_int32( - ivas_split_rend_bits_t *pBits, + IVAS_SPLIT_REND_BITS_HANDLE pBits, const int32_t val, const int32_t bits ) { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 1d634f4d8b..231327d017 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -344,7 +344,7 @@ static float *getSmplPtr( #ifdef SPLIT_REND_WITH_HEAD_ROT static void convertBitsBufferToInternalBitsBuff( const IVAS_REND_BitstreamBuffer outBits, - ivas_split_rend_bits_t *hBits ) + IVAS_SPLIT_REND_BITS_HANDLE hBits ) { hBits->bits_buf = outBits.bits; hBits->bits_read = outBits.config.bitsRead; @@ -359,7 +359,7 @@ static void convertBitsBufferToInternalBitsBuff( static void convertInternalBitsBuffToBitsBuffer( IVAS_REND_BitstreamBuffer *hOutBits, - const ivas_split_rend_bits_t bits ) + const IVAS_SPLIT_REND_BITS_DATA bits ) { hOutBits->bits = bits.bits_buf; hOutBits->config.bitsRead = bits.bits_read; @@ -7356,7 +7356,7 @@ static void renderSbaToSba( #ifdef SPLIT_REND_WITH_HEAD_ROT static ivas_error splitBinLc3plusDecode( SPLIT_POST_REND_WRAPPER *hSplitBin, - ivas_split_rend_bits_t *bits, + IVAS_SPLIT_REND_BITS_HANDLE bits, float outputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k], IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction ) { @@ -7405,7 +7405,7 @@ static ivas_error renderSplitBinauralWithPostRot( float Cldfb_ImagBuffer_Binaural_5ms[MAX_PARAM_SPATIAL_SUBFRAMES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES]; int16_t sf_idx, ch_idx; - ivas_split_rend_bits_t bits; + IVAS_SPLIT_REND_BITS_DATA bits; float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float tmpCrendBuffer_sf[BINAURAL_CHANNELS][L_FRAME48k]; COMBINED_ORIENTATION_HANDLE pCombinedOrientationData; @@ -8961,7 +8961,7 @@ static ivas_error getSamplesInternal( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - ivas_split_rend_bits_t bits; + IVAS_SPLIT_REND_BITS_DATA bits; int16_t cldfb_in_flag; float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; -- GitLab From 93b82a74dc430aff9b8c5cdf411c28de9b7983c7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Sep 2023 11:59:05 +0200 Subject: [PATCH 3/9] clang-format --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 231327d017..5a7f06c950 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8995,7 +8995,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From 6b9acded0598b877036623a19135cc124469c95c Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 28 Sep 2023 12:47:11 +0200 Subject: [PATCH 4/9] Revert "Harmonize ISM MD public structures." changes --- apps/renderer.c | 17 +-- lib_com/common_api_types.h | 185 ++++++++++++++++----------------- lib_com/ivas_error_utils.h | 7 +- lib_rend/ivas_objectRenderer.c | 4 +- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/lib_rend.c | 20 ++-- lib_rend/lib_rend.h | 8 +- 7 files changed, 121 insertions(+), 122 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 190d7c35e5..0a3ff6b53d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -100,10 +100,10 @@ typedef struct uint16_t numObjects; IsmFileReader *ismReaders[RENDERER_MAX_ISM_INPUTS]; uint32_t numPositions[RENDERER_MAX_ISM_INPUTS]; - IVAS_ISM_METADATA *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ - uint16_t *positionDurations[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ - uint32_t currentPositionIdxs[RENDERER_MAX_ISM_INPUTS]; /* Index of current position as listed in the metadata file */ - uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS]; /* Number of frames spent at current position */ + IVAS_REND_AudioObjectPosition *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ + uint16_t *positionDurations[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ + uint32_t currentPositionIdxs[RENDERER_MAX_ISM_INPUTS]; /* Index of current position as listed in the metadata file */ + uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS]; /* Number of frames spent at current position */ } IsmPositionProvider; typedef struct @@ -123,7 +123,7 @@ typedef struct typedef struct { - IVAS_ISM_METADATA positions[RENDERER_MAX_ISM_INPUTS]; + IVAS_REND_AudioObjectPosition positions[RENDERER_MAX_ISM_INPUTS]; int16_t numObjects; } ObjectPositionBuffer; @@ -437,7 +437,7 @@ static int8_t parseUint32( const char *line, uint32_t *ret ); static int8_t parseInt32( const char *line, int32_t *ret ); -static void parseObjectPosition( char *line, IVAS_ISM_METADATA *position, uint16_t *positionDuration ); +static void parseObjectPosition( char *line, IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration ); static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs ); @@ -3291,13 +3291,14 @@ static void parseOptionalInputValues( static void parseObjectPosition( char *line, - IVAS_ISM_METADATA *position, + IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration ) { char *endptr; int16_t read_values; float meta_prm[8] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f }; + readNextMetadataChunk( line, "," ); *positionDuration = (uint16_t) strtol( line, &endptr, 10 ); readNextMetadataChunk( line, "\n" ); @@ -3340,7 +3341,7 @@ static void parseIsm( if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 ) { positionProvider->numPositions[idx] = numberOfObjectPositionsToRead; - positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_ISM_METADATA ) ); + positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); for ( i = 0; i < numberOfObjectPositionsToRead; ++i ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index c841cc02c0..6554e6c04c 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -48,7 +48,6 @@ #define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) #define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) - #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 #define IVAS_MAX_OUTPUT_CHANNELS 16 @@ -56,9 +55,14 @@ #define IVAS_CLDFB_NO_CHANNELS_MAX 60 #define IVAS_MAX_INPUT_LFE_CHANNELS 4 + #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 #define IVAS_ROOM_ABS_COEFF 6 +#ifdef SPLIT_REND_WITH_HEAD_ROT +#define IVAS_MAX_SPLIT_REND_BITRATE 768000 +#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#endif /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations @@ -96,7 +100,7 @@ typedef enum _IVAS_AUDIO_CONFIG /*----------------------------------------------------------------------------------* - * Common API structures and enums + * Common API structures *----------------------------------------------------------------------------------*/ typedef enum _IVAS_ENC_FEC_INDICATOR @@ -104,7 +108,6 @@ typedef enum _IVAS_ENC_FEC_INDICATOR IVAS_ENC_FEC_LO, IVAS_ENC_FEC_HI, IVAS_ENC_FEC_UNDEFINED = 0xffff - } IVAS_ENC_FEC_INDICATOR; typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG @@ -112,7 +115,6 @@ typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG int16_t channelAwareModeEnabled; IVAS_ENC_FEC_INDICATOR fec_indicator; int16_t fec_offset; - } IVAS_ENC_CHANNEL_AWARE_CONFIG; typedef struct _IVAS_ISM_METADATA @@ -125,7 +127,6 @@ typedef struct _IVAS_ISM_METADATA float yaw; float pitch; int16_t non_diegetic_flag; - } IVAS_ISM_METADATA; typedef struct @@ -134,70 +135,7 @@ typedef struct } IVAS_QUATERNION; -typedef struct -{ - float x, y, z; - -} IVAS_VECTOR3; - -typedef enum -{ - IVAS_HEAD_ORIENT_TRK_NONE, - IVAS_HEAD_ORIENT_TRK_REF, - IVAS_HEAD_ORIENT_TRK_AVG, - IVAS_HEAD_ORIENT_TRK_REF_VEC, - IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV - -} IVAS_HEAD_ORIENT_TRK_T; - -typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; -typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; - -typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; -typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; -typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; - -typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; -typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; - -typedef struct _IVAS_LS_CUSTOM_LAYOUT -{ - int16_t num_spk; - float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; - float elevation[IVAS_MAX_OUTPUT_CHANNELS]; - int16_t num_lfe; - int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; - -} IVAS_CUSTOM_LS_DATA; - -typedef struct _IVAS_JBM_TRACE_DATA -{ - uint32_t systemTimestamp_ms; - uint16_t extBufferedSamples; - uint16_t lastDecodedWasActive; - int32_t output_Fs; - int16_t dataUnit_flag; - uint16_t sequenceNumber; - uint32_t timeStamp; - uint32_t rcvTime; - - int16_t partial_frame; - int16_t partialCopyOffset; - -} IVAS_JBM_TRACE_DATA; - - #ifdef SPLIT_REND_WITH_HEAD_ROT -/*----------------------------------------------------------------------------------* - * Split rendering API constants, structures, and enums - *----------------------------------------------------------------------------------*/ - -#define IVAS_MAX_SPLIT_REND_BITRATE 768000 -#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) -#define IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 - typedef enum { DEFAULT_AXIS, @@ -207,14 +145,12 @@ typedef enum YAW_PITCH, YAW_ROLL, PITCH_ROLL - } IVAS_SPLIT_REND_ROT_AXIS; typedef enum { IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB, - } IVAS_SPLIT_REND_POSE_CORRECTION_MODE; typedef enum @@ -223,7 +159,6 @@ typedef enum IVAS_SPLIT_REND_CODEC_LC3PLUS, IVAS_SPLIT_REND_CODEC_DEFAULT, /* Will use LCLD for CLDFB rendering paths and LC3plus for TD rendering paths */ IVAS_SPLIT_REND_CODEC_NONE - } IVAS_SPLIT_REND_CODEC; typedef enum @@ -233,7 +168,6 @@ typedef enum IVAS_SPLIT_REND_RENDERER_SELECTION_PARAMBIN, IVAS_SPLIT_REND_RENDERER_SELECTION_TDREND, IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT, - } IVAS_SPLIT_REND_RENDERER_SELECTION; typedef struct _IVAS_SPLIT_REND_BITS_DATA @@ -245,32 +179,33 @@ typedef struct _IVAS_SPLIT_REND_BITS_DATA int16_t codec_frame_size_ms; IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; - } IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; +#endif -typedef struct _IVAS_SPLIT_REND_CONFIG +typedef struct { - int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ - int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ - int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ - /*The axis can be set dynamically per frame based on a file input */ - /*possible values: - 1 - (1dof correction. By default YAW correction) - 2 - (2dof correction. By default YAW and PITCH correction) - 3 - (3dof correction. By default YAW, PITCH and ROLL correction) - */ - int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ - int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; - IVAS_SPLIT_REND_CODEC codec; - IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; + float x, y, z; +} IVAS_VECTOR3; -} IVAS_SPLIT_REND_CONFIG_DATA; -#endif +typedef enum +{ + IVAS_HEAD_ORIENT_TRK_NONE, + IVAS_HEAD_ORIENT_TRK_REF, + IVAS_HEAD_ORIENT_TRK_AVG, + IVAS_HEAD_ORIENT_TRK_REF_VEC, + IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV -/*----------------------------------------------------------------------------------* - * Renderer API structures and enums - *----------------------------------------------------------------------------------*/ +} IVAS_HEAD_ORIENT_TRK_T; + +typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; +typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; + +typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; +typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; +typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; +typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; + +typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; #ifdef DEBUGGING typedef enum @@ -278,10 +213,20 @@ typedef enum IVAS_RENDER_TYPE_OVERRIDE_NONE, IVAS_RENDER_TYPE_OVERRIDE_CREND, IVAS_RENDER_TYPE_OVERRIDE_FASTCONV - } IVAS_RENDER_TYPE_OVERRIDE; #endif +typedef struct +{ + float azimuth; + float elevation; + float radius; + float yaw; + float pitch; + int16_t non_diegetic_flag; + +} IVAS_REND_AudioObjectPosition; + typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t override; @@ -301,6 +246,27 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG } IVAS_ROOM_ACOUSTICS_CONFIG_DATA; +#ifdef SPLIT_REND_WITH_HEAD_ROT + +typedef struct _IVAS_SPLIT_REND_CONFIG +{ + int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: + 1 - (1dof correction. By default YAW correction) + 2 - (2dof correction. By default YAW and PITCH correction) + 3 - (3dof correction. By default YAW, PITCH and ROLL correction) + */ + int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ + int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; + IVAS_SPLIT_REND_CODEC codec; + IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; +} IVAS_SPLIT_REND_CONFIG_DATA; +#endif + typedef struct _IVAS_RENDER_CONFIG { #ifdef DEBUGGING @@ -311,7 +277,36 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; #endif float directivity[IVAS_MAX_NUM_OBJECTS * 3]; - } IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; +typedef struct _IVAS_LS_CUSTOM_LAYOUT +{ + int16_t num_spk; + float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; + float elevation[IVAS_MAX_OUTPUT_CHANNELS]; + int16_t num_lfe; + int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; + +} IVAS_CUSTOM_LS_DATA; + +typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; +typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; + + +typedef struct _IVAS_JBM_TRACE_DATA +{ + uint32_t systemTimestamp_ms; + uint16_t extBufferedSamples; + uint16_t lastDecodedWasActive; + int32_t output_Fs; + int16_t dataUnit_flag; + uint16_t sequenceNumber; + uint32_t timeStamp; + uint32_t rcvTime; + + int16_t partial_frame; + int16_t partialCopyOffset; + +} IVAS_JBM_TRACE_DATA; + #endif /* COMMON_API_TYPES_H */ diff --git a/lib_com/ivas_error_utils.h b/lib_com/ivas_error_utils.h index f08bd29d84..b9a6b3f872 100644 --- a/lib_com/ivas_error_utils.h +++ b/lib_com/ivas_error_utils.h @@ -30,13 +30,14 @@ *******************************************************************************************************/ -/* options.h needed for debugging/development features - * It should be stripped for delivery along with debugging switches */ #include "options.h" -#include "ivas_error.h" + #include #include #include + +#include "ivas_error.h" + #ifdef DEBUGGING #include #endif diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 3947dec9bb..3db14715aa 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -674,7 +674,7 @@ ivas_error ivas_td_binaural_renderer_ext( const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ - const IVAS_ISM_METADATA *currentPos, /* i : Object position */ + const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const int32_t output_Fs, /* i : output sampling rate */ @@ -699,10 +699,12 @@ ivas_error ivas_td_binaural_renderer_ext( } push_wmops( "ivas_td_binaural_renderer_ext" ); + inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; hIsmMetaData[0] = NULL; + if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { ivas_format = MC_FORMAT; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index f69fc5cb4e..25e84c6ee2 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -571,7 +571,7 @@ ivas_error ivas_td_binaural_renderer_ext( const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ - const IVAS_ISM_METADATA *currentPos, /* i : Object position */ + const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const int32_t output_Fs, /* i : output sampling rate */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ef33587e1c..bcbb658fbf 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -125,8 +125,8 @@ typedef struct typedef struct { input_base base; - IVAS_ISM_METADATA currentPos; - IVAS_ISM_METADATA previousPos; + IVAS_REND_AudioObjectPosition currentPos; + IVAS_REND_AudioObjectPosition previousPos; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; @@ -1215,10 +1215,10 @@ static void initRendInputBase( } -static IVAS_ISM_METADATA defaultObjectPosition( +static IVAS_REND_AudioObjectPosition defaultObjectPosition( void ) { - IVAS_ISM_METADATA pos; + IVAS_REND_AudioObjectPosition pos; pos.azimuth = 0.0f; pos.elevation = 0.0f; @@ -1232,8 +1232,8 @@ static IVAS_ISM_METADATA defaultObjectPosition( static int8_t checkObjectPositionChanged( - IVAS_ISM_METADATA *currentPos, - IVAS_ISM_METADATA *previousPos ) + IVAS_REND_AudioObjectPosition *currentPos, + IVAS_REND_AudioObjectPosition *previousPos ) { return !( fabs( currentPos->azimuth - previousPos->azimuth ) < EPSILON && fabs( currentPos->elevation - previousPos->elevation ) < EPSILON ); @@ -4900,7 +4900,7 @@ ivas_error IVAS_REND_FeedInputAudio( ivas_error IVAS_REND_FeedInputObjectMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_ISM_METADATA objectPosition /* i : object position struct */ + const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ) { input_base *inputBase; @@ -4941,7 +4941,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const int16_t inputIndex, /* i : Index of the input */ - const IVAS_ISM_METADATA objectPosition /* i : object position struct */ + const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ) { /* Validate function arguments */ @@ -6000,8 +6000,8 @@ static ivas_error renderIsmToBinauralRoom( ivas_error error; pan_vector currentPanGains; IVAS_REND_AudioBuffer tmpMcBuffer; - IVAS_ISM_METADATA rotatedPosPrev; - IVAS_ISM_METADATA rotatedPos; + IVAS_REND_AudioObjectPosition rotatedPosPrev; + IVAS_REND_AudioObjectPosition rotatedPos; const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData; int8_t combinedOrientationEnabled; float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index d6fd94b728..2a600d29db 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -207,13 +207,13 @@ ivas_error IVAS_REND_FeedInputAudio( ivas_error IVAS_REND_FeedInputObjectMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_ISM_METADATA objectPosition /* i : object position struct */ + const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ); ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const int16_t inputIndex, /* i : Index of the input */ - const IVAS_ISM_METADATA objectPosition /* i : object position struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const int16_t inputIndex, /* i : Index of the input */ + const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ); ivas_error IVAS_REND_FeedInputMasaMetadata( -- GitLab From 44fa8b8567270576c977979655e4fe56f6a7fe2e Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 28 Sep 2023 12:52:26 +0200 Subject: [PATCH 5/9] clang-format --- lib_com/common_api_types.h | 2 +- lib_rend/lib_rend.c | 158 ++++++++++++++++++------------------- 2 files changed, 80 insertions(+), 80 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 6554e6c04c..68dbfdd440 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -47,7 +47,7 @@ #define IVAS_NUM_FRAMES_PER_SEC 50 #define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) -#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) +#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 #define IVAS_MAX_OUTPUT_CHANNELS 16 diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index bcbb658fbf..1d31daa84a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2215,14 +2215,14 @@ static ivas_error initMcBinauralRendering( if ( !reconfigureFlag || !useTDRend ) { #endif - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) - { - if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { - ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); - inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); + inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + } } - } #ifdef FIX_513_REND_MC_ALLOC } #endif @@ -2247,7 +2247,7 @@ static ivas_error initMcBinauralRendering( if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) { #endif - ivas_reverb_close( &inputMc->hReverb ); + ivas_reverb_close( &inputMc->hReverb ); #ifdef FIX_513_REND_MC_ALLOC } #endif @@ -2256,10 +2256,10 @@ static ivas_error initMcBinauralRendering( if ( !reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { #endif - if ( inputMc->efapInWrapper.hEfap != NULL ) - { - efap_free_data( &inputMc->efapInWrapper.hEfap ); - } + if ( inputMc->efapInWrapper.hEfap != NULL ) + { + efap_free_data( &inputMc->efapInWrapper.hEfap ); + } #ifdef FIX_513_REND_MC_ALLOC } #endif @@ -2309,14 +2309,14 @@ static ivas_error initMcBinauralRendering( #endif { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) #endif - { - return error; - } + { + return error; + } #ifdef FIX_513_REND_MC_ALLOC } #endif @@ -2363,7 +2363,7 @@ static ivas_error initMcMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2491,7 +2491,7 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev[pos_idx] ); } #else - initRotGains( inputMc->rot_gains_prev ); + initRotGains( inputMc->rot_gains_prev ); #endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); @@ -2507,7 +2507,7 @@ static ivas_error setRendInputActiveMc( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg @@ -2562,7 +2562,7 @@ static void clearInputMc( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2774,7 +2774,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { @@ -2792,7 +2792,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2862,7 +2862,7 @@ static ivas_error initSbaMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) @@ -2900,7 +2900,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2909,7 +2909,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); #else - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -2921,9 +2921,9 @@ static ivas_error setRendInputActiveSba( initRotGains( inputSba->rot_gains_prev[pos_idx] ); } #else - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains( inputSba->rot_gains_prev ); #endif if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -2995,7 +2995,7 @@ static void clearInputSba( ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif ivas_dirac_ana_close( &( inputSba->hDirAC ) ); @@ -3311,7 +3311,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDiracDecBin[i] = NULL; } #else - decDummy->hDiracDecBin = NULL; + decDummy->hDiracDecBin = NULL; #endif decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; @@ -3433,7 +3433,7 @@ static ivas_error setRendInputActiveMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0, rendCtx.pSplitRendWrapper ); #else - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); #endif inputMasa->metadataHasBeenFed = false; @@ -3539,7 +3539,7 @@ static void freeDecoderDummy( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); #else - ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); + ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); #endif /* TC buffer */ @@ -4415,7 +4415,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, @@ -4834,7 +4834,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); @@ -4851,8 +4851,8 @@ ivas_error IVAS_REND_FeedInputAudio( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -4884,7 +4884,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -4898,8 +4898,8 @@ ivas_error IVAS_REND_FeedInputAudio( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedInputObjectMetadata( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ) { @@ -4939,8 +4939,8 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const int16_t inputIndex, /* i : Index of the input */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const int16_t inputIndex, /* i : Index of the input */ const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ ) { @@ -5981,7 +5981,7 @@ static int16_t getNumSubframesInBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * cldfb2tdSampleFact ) ); #else - return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif } @@ -6137,9 +6137,9 @@ static ivas_error renderIsmToBinauralRoom( NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { @@ -6560,7 +6560,7 @@ static ivas_error renderLfeToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); #else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); #endif push_wmops( "renderLfeToBinaural" ); @@ -6619,12 +6619,12 @@ static ivas_error renderLfeToBinaural( } } #else /* SPLIT_REND_WITH_HEAD_ROT */ - /* Copy LFE to left and right ears */ - for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) - { - writePtr = getSmplPtr( outAudio, ear_idx, 0 ); - v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); - } + /* Copy LFE to left and right ears */ + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + writePtr = getSmplPtr( outAudio, ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); + } #endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6694,7 +6694,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6714,8 +6714,8 @@ static ivas_error renderMcToBinaural( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6727,7 +6727,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6801,7 +6801,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6821,8 +6821,8 @@ static ivas_error renderMcToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6834,7 +6834,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6897,7 +6897,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6929,8 +6929,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6941,7 +6941,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7872,8 +7872,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) #else - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7892,8 +7892,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7962,7 +7962,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -7996,7 +7996,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8087,7 +8087,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8500,7 +8500,7 @@ static ivas_error renderInputMasa( if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8529,7 +8529,7 @@ static ivas_error renderInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT renderMasaToBinaural( masaInput, outAudio, 0 ); #else - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); #endif break; /* ToDo */ @@ -8806,7 +8806,7 @@ static ivas_error getSamplesInternal( if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) #else - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8823,8 +8823,8 @@ static ivas_error getSamplesInternal( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -8937,9 +8937,9 @@ static ivas_error getSamplesInternal( #ifndef DISABLE_LIMITER #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ @@ -9021,7 +9021,7 @@ ivas_error IVAS_REND_GetSamples( return getSamplesInternal( hIvasRend, outAudio, NULL ); #else - return getSamplesInternal( hIvasRend, outAudio ); + return getSamplesInternal( hIvasRend, outAudio ); #endif } -- GitLab From 52ddfb5d0ffd73429701162fa66729f9146e9ff5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 28 Sep 2023 15:49:52 +0200 Subject: [PATCH 6/9] fix revert issue --- lib_com/common_api_types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 68dbfdd440..56359700d9 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -62,6 +62,7 @@ #ifdef SPLIT_REND_WITH_HEAD_ROT #define IVAS_MAX_SPLIT_REND_BITRATE 768000 #define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#define IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 #endif /*----------------------------------------------------------------------------------* -- GitLab From 7a0d6a46eb658d9d198b403e797fa8bd52bf5ae6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 10 Oct 2023 15:58:52 +0200 Subject: [PATCH 7/9] update with main wrt. IVAS_ISM_METADATA struct --- apps/renderer.c | 16 ++-- lib_com/common_api_types.h | 11 --- lib_rend/ivas_objectRenderer.c | 2 +- lib_rend/ivas_prot_rend.h | 2 +- lib_rend/lib_rend.c | 144 ++++++++++++++++----------------- lib_rend/lib_rend.h | 8 +- 6 files changed, 86 insertions(+), 97 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 3d6fc4a3be..7147c1edd2 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -100,10 +100,10 @@ typedef struct uint16_t numObjects; IsmFileReader *ismReaders[RENDERER_MAX_ISM_INPUTS]; uint32_t numPositions[RENDERER_MAX_ISM_INPUTS]; - IVAS_REND_AudioObjectPosition *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ - uint16_t *positionDurations[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ - uint32_t currentPositionIdxs[RENDERER_MAX_ISM_INPUTS]; /* Index of current position as listed in the metadata file */ - uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS]; /* Number of frames spent at current position */ + IVAS_ISM_METADATA *positions[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ + uint16_t *positionDurations[RENDERER_MAX_ISM_INPUTS]; /* size: [RENDERER_MAX_ISM_INPUTS][numPositions[object_index]] */ + uint32_t currentPositionIdxs[RENDERER_MAX_ISM_INPUTS]; /* Index of current position as listed in the metadata file */ + uint16_t durationCounters[RENDERER_MAX_ISM_INPUTS]; /* Number of frames spent at current position */ } IsmPositionProvider; typedef struct @@ -123,7 +123,7 @@ typedef struct typedef struct { - IVAS_REND_AudioObjectPosition positions[RENDERER_MAX_ISM_INPUTS]; + IVAS_ISM_METADATA positions[RENDERER_MAX_ISM_INPUTS]; int16_t numObjects; } ObjectPositionBuffer; @@ -433,7 +433,7 @@ static int8_t parseUint32( const char *line, uint32_t *ret ); static int8_t parseInt32( const char *line, int32_t *ret ); -static void parseObjectPosition( char *line, IVAS_REND_AudioObjectPosition *position, uint16_t *positionDuration ); +static void parseObjectPosition( char *line, IVAS_ISM_METADATA *position, uint16_t *positionDuration ); static void parseMetadata( char *metadataString, char *inDir, InputConfig *inConfig, IsmPositionProvider *positionProvider, MasaFileReader **masaReaders, LfeRoutingConfig **lfeRoutingConfigs ); @@ -3283,7 +3283,7 @@ static void parseOptionalInputValues( static void parseObjectPosition( char *line, - IVAS_REND_AudioObjectPosition *position, + IVAS_ISM_METADATA *position, uint16_t *positionDuration ) { char *endptr; @@ -3333,7 +3333,7 @@ static void parseIsm( if ( parseUint32( line, &numberOfObjectPositionsToRead ) == 0 ) { positionProvider->numPositions[idx] = numberOfObjectPositionsToRead; - positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_REND_AudioObjectPosition ) ); + positionProvider->positions[idx] = malloc( numberOfObjectPositionsToRead * sizeof( IVAS_ISM_METADATA ) ); positionProvider->positionDurations[idx] = malloc( numberOfObjectPositionsToRead * sizeof( uint16_t ) ); for ( i = 0; i < numberOfObjectPositionsToRead; ++i ) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 56359700d9..5ef9241be6 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -217,17 +217,6 @@ typedef enum } IVAS_RENDER_TYPE_OVERRIDE; #endif -typedef struct -{ - float azimuth; - float elevation; - float radius; - float yaw; - float pitch; - int16_t non_diegetic_flag; - -} IVAS_REND_AudioObjectPosition; - typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG { int16_t override; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 3db14715aa..314f30af10 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -674,7 +674,7 @@ ivas_error ivas_td_binaural_renderer_ext( const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i : Combined head and external orientations */ - const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ + const IVAS_ISM_METADATA *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const int32_t output_Fs, /* i : output sampling rate */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 1dcca87f1f..2606c42b22 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -571,7 +571,7 @@ ivas_error ivas_td_binaural_renderer_ext( const AUDIO_CONFIG inConfig, /* i : Input audio configuration */ const LSSETUP_CUSTOM_STRUCT *customLsInput, /* i : Input custom loudspeaker layout */ const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i : Combined head and external orientations */ - const IVAS_REND_AudioObjectPosition *currentPos, /* i : Object position */ + const IVAS_ISM_METADATA *currentPos, /* i : Object position */ const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const int16_t ism_md_subframe_update_ext, /* i : Metadata Delay in subframes to sync with audio delay */ const int32_t output_Fs, /* i : output sampling rate */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 818ba41191..f314d42cb5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -125,8 +125,8 @@ typedef struct typedef struct { input_base base; - IVAS_REND_AudioObjectPosition currentPos; - IVAS_REND_AudioObjectPosition previousPos; + IVAS_ISM_METADATA currentPos; + IVAS_ISM_METADATA previousPos; TDREND_WRAPPER tdRendWrapper; CREND_WRAPPER_HANDLE crendWrapper; REVERB_HANDLE hReverb; @@ -1215,10 +1215,10 @@ static void initRendInputBase( } -static IVAS_REND_AudioObjectPosition defaultObjectPosition( +static IVAS_ISM_METADATA defaultObjectPosition( void ) { - IVAS_REND_AudioObjectPosition pos; + IVAS_ISM_METADATA pos; pos.azimuth = 0.0f; pos.elevation = 0.0f; @@ -1234,8 +1234,8 @@ static IVAS_REND_AudioObjectPosition defaultObjectPosition( static int8_t checkObjectPositionChanged( - IVAS_REND_AudioObjectPosition *currentPos, - IVAS_REND_AudioObjectPosition *previousPos ) + IVAS_ISM_METADATA *currentPos, + IVAS_ISM_METADATA *previousPos ) { return !( fabs( currentPos->azimuth - previousPos->azimuth ) < EPSILON && fabs( currentPos->elevation - previousPos->elevation ) < EPSILON ); @@ -2322,7 +2322,7 @@ static ivas_error initMcMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2450,7 +2450,7 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev[pos_idx] ); } #else - initRotGains( inputMc->rot_gains_prev ); + initRotGains( inputMc->rot_gains_prev ); #endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); @@ -2464,7 +2464,7 @@ static ivas_error setRendInputActiveMc( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, FALSE ) ) != IVAS_ERR_OK ) @@ -2514,7 +2514,7 @@ static void clearInputMc( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2726,7 +2726,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { @@ -2744,7 +2744,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2814,7 +2814,7 @@ static ivas_error initSbaMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) @@ -2852,7 +2852,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2861,7 +2861,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); #else - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -2873,9 +2873,9 @@ static ivas_error setRendInputActiveSba( initRotGains( inputSba->rot_gains_prev[pos_idx] ); } #else - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains( inputSba->rot_gains_prev ); #endif if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -2947,7 +2947,7 @@ static void clearInputSba( ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif ivas_dirac_ana_close( &( inputSba->hDirAC ) ); @@ -3263,7 +3263,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDiracDecBin[i] = NULL; } #else - decDummy->hDiracDecBin = NULL; + decDummy->hDiracDecBin = NULL; #endif decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; @@ -3385,7 +3385,7 @@ static ivas_error setRendInputActiveMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0, rendCtx.pSplitRendWrapper ); #else - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); #endif inputMasa->metadataHasBeenFed = false; @@ -3491,7 +3491,7 @@ static void freeDecoderDummy( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); #else - ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); + ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); #endif /* TC buffer */ @@ -4367,7 +4367,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, FALSE ) ) != IVAS_ERR_OK ) @@ -4778,7 +4778,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); @@ -4795,8 +4795,8 @@ ivas_error IVAS_REND_FeedInputAudio( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -4828,7 +4828,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -4842,9 +4842,9 @@ ivas_error IVAS_REND_FeedInputAudio( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedInputObjectMetadata( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_REND_InputId inputId, /* i : ID of the input */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ ) { input_base *inputBase; @@ -4883,9 +4883,9 @@ ivas_error IVAS_REND_FeedInputObjectMetadata( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const int16_t inputIndex, /* i : Index of the input */ - const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const int16_t inputIndex, /* i : Index of the input */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ ) { /* Validate function arguments */ @@ -5920,7 +5920,7 @@ static int16_t getNumSubframesInBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * cldfb2tdSampleFact ) ); #else - return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif } @@ -6076,9 +6076,9 @@ static ivas_error renderIsmToBinauralRoom( NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { @@ -6499,7 +6499,7 @@ static ivas_error renderLfeToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); #else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); #endif push_wmops( "renderLfeToBinaural" ); @@ -6558,12 +6558,12 @@ static ivas_error renderLfeToBinaural( } } #else /* SPLIT_REND_WITH_HEAD_ROT */ - /* Copy LFE to left and right ears */ - for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) - { - writePtr = getSmplPtr( outAudio, ear_idx, 0 ); - v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); - } + /* Copy LFE to left and right ears */ + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + writePtr = getSmplPtr( outAudio, ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); + } #endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6633,7 +6633,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6653,8 +6653,8 @@ static ivas_error renderMcToBinaural( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6666,7 +6666,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6740,7 +6740,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6760,8 +6760,8 @@ static ivas_error renderMcToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6773,7 +6773,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6836,7 +6836,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6868,8 +6868,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6880,7 +6880,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7808,8 +7808,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) #else - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7828,8 +7828,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7898,7 +7898,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -7932,7 +7932,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8023,7 +8023,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8436,7 +8436,7 @@ static ivas_error renderInputMasa( if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8465,7 +8465,7 @@ static ivas_error renderInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT renderMasaToBinaural( masaInput, outAudio, 0 ); #else - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); #endif break; /* ToDo */ @@ -8742,7 +8742,7 @@ static ivas_error getSamplesInternal( if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) #else - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8759,8 +8759,8 @@ static ivas_error getSamplesInternal( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -8873,9 +8873,9 @@ static ivas_error getSamplesInternal( #ifndef DISABLE_LIMITER #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ @@ -8916,7 +8916,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, @@ -8957,7 +8957,7 @@ ivas_error IVAS_REND_GetSamples( return getSamplesInternal( hIvasRend, outAudio, NULL ); #else - return getSamplesInternal( hIvasRend, outAudio ); + return getSamplesInternal( hIvasRend, outAudio ); #endif } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 2a600d29db..d6fd94b728 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -207,13 +207,13 @@ ivas_error IVAS_REND_FeedInputAudio( ivas_error IVAS_REND_FeedInputObjectMetadata( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ - const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ ); ivas_error IVAS_REND_FeedInputObjectMetadataToOMasa( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ - const int16_t inputIndex, /* i : Index of the input */ - const IVAS_REND_AudioObjectPosition objectPosition /* i : object position struct */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const int16_t inputIndex, /* i : Index of the input */ + const IVAS_ISM_METADATA objectPosition /* i : object position struct */ ); ivas_error IVAS_REND_FeedInputMasaMetadata( -- GitLab From dc3e9c7da17e02edea9570ae434657d320b4a128 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 10 Oct 2023 16:20:02 +0200 Subject: [PATCH 8/9] clang-format + revert undesirable changes in common_api_types.h --- lib_com/common_api_types.h | 176 ++++++++++++++++++++----------------- lib_rend/lib_rend.c | 2 +- 2 files changed, 96 insertions(+), 82 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 5ef9241be6..12aff5c0a8 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -47,7 +47,8 @@ #define IVAS_NUM_FRAMES_PER_SEC 50 #define IVAS_MAX_FRAME_SIZE ( 48000 / IVAS_NUM_FRAMES_PER_SEC ) -#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) +#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC ) + #define IVAS_MAX_NUM_OBJECTS 4 #define IVAS_MAX_INPUT_CHANNELS 16 #define IVAS_MAX_OUTPUT_CHANNELS 16 @@ -55,15 +56,9 @@ #define IVAS_CLDFB_NO_CHANNELS_MAX 60 #define IVAS_MAX_INPUT_LFE_CHANNELS 4 - #define IVAS_MAX_PARAM_SPATIAL_SUBFRAMES 4 #define IVAS_ROOM_ABS_COEFF 6 -#ifdef SPLIT_REND_WITH_HEAD_ROT -#define IVAS_MAX_SPLIT_REND_BITRATE 768000 -#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) -#define IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 -#endif /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations @@ -101,7 +96,7 @@ typedef enum _IVAS_AUDIO_CONFIG /*----------------------------------------------------------------------------------* - * Common API structures + * Common API structures and enums *----------------------------------------------------------------------------------*/ typedef enum _IVAS_ENC_FEC_INDICATOR @@ -109,6 +104,7 @@ typedef enum _IVAS_ENC_FEC_INDICATOR IVAS_ENC_FEC_LO, IVAS_ENC_FEC_HI, IVAS_ENC_FEC_UNDEFINED = 0xffff + } IVAS_ENC_FEC_INDICATOR; typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG @@ -116,6 +112,7 @@ typedef struct _IVAS_ENC_CHANNEL_AWARE_CONFIG int16_t channelAwareModeEnabled; IVAS_ENC_FEC_INDICATOR fec_indicator; int16_t fec_offset; + } IVAS_ENC_CHANNEL_AWARE_CONFIG; typedef struct _IVAS_ISM_METADATA @@ -128,6 +125,7 @@ typedef struct _IVAS_ISM_METADATA float yaw; float pitch; int16_t non_diegetic_flag; + } IVAS_ISM_METADATA; typedef struct @@ -136,7 +134,69 @@ typedef struct } IVAS_QUATERNION; +typedef struct +{ + float x, y, z; + +} IVAS_VECTOR3; + +typedef enum +{ + IVAS_HEAD_ORIENT_TRK_NONE, + IVAS_HEAD_ORIENT_TRK_REF, + IVAS_HEAD_ORIENT_TRK_AVG, + IVAS_HEAD_ORIENT_TRK_REF_VEC, + IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV + +} IVAS_HEAD_ORIENT_TRK_T; + +typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; +typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; + +typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; +typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; +typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; +typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; +typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; + +typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; +typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; + +typedef struct _IVAS_LS_CUSTOM_LAYOUT +{ + int16_t num_spk; + float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; + float elevation[IVAS_MAX_OUTPUT_CHANNELS]; + int16_t num_lfe; + int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; + +} IVAS_CUSTOM_LS_DATA; + +typedef struct _IVAS_JBM_TRACE_DATA +{ + uint32_t systemTimestamp_ms; + uint16_t extBufferedSamples; + uint16_t lastDecodedWasActive; + int32_t output_Fs; + int16_t dataUnit_flag; + uint16_t sequenceNumber; + uint32_t timeStamp; + uint32_t rcvTime; + + int16_t partial_frame; + int16_t partialCopyOffset; + +} IVAS_JBM_TRACE_DATA; + + #ifdef SPLIT_REND_WITH_HEAD_ROT +/*----------------------------------------------------------------------------------* + * Split rendering API constants, structures, and enums + *----------------------------------------------------------------------------------*/ + +#define IVAS_MAX_SPLIT_REND_BITRATE 768000 +#define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + typedef enum { DEFAULT_AXIS, @@ -146,12 +206,14 @@ typedef enum YAW_PITCH, YAW_ROLL, PITCH_ROLL + } IVAS_SPLIT_REND_ROT_AXIS; typedef enum { IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE, IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB, + } IVAS_SPLIT_REND_POSE_CORRECTION_MODE; typedef enum @@ -160,6 +222,7 @@ typedef enum IVAS_SPLIT_REND_CODEC_LC3PLUS, IVAS_SPLIT_REND_CODEC_DEFAULT, /* Will use LCLD for CLDFB rendering paths and LC3plus for TD rendering paths */ IVAS_SPLIT_REND_CODEC_NONE + } IVAS_SPLIT_REND_CODEC; typedef enum @@ -169,6 +232,7 @@ typedef enum IVAS_SPLIT_REND_RENDERER_SELECTION_PARAMBIN, IVAS_SPLIT_REND_RENDERER_SELECTION_TDREND, IVAS_SPLIT_REND_RENDERER_SELECTION_DEFAULT, + } IVAS_SPLIT_REND_RENDERER_SELECTION; typedef struct _IVAS_SPLIT_REND_BITS_DATA @@ -180,33 +244,32 @@ typedef struct _IVAS_SPLIT_REND_BITS_DATA int16_t codec_frame_size_ms; IVAS_SPLIT_REND_CODEC codec; IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction; -} IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; -#endif -typedef struct -{ - float x, y, z; -} IVAS_VECTOR3; +} IVAS_SPLIT_REND_BITS_DATA, *IVAS_SPLIT_REND_BITS_HANDLE; -typedef enum +typedef struct _IVAS_SPLIT_REND_CONFIG { - IVAS_HEAD_ORIENT_TRK_NONE, - IVAS_HEAD_ORIENT_TRK_REF, - IVAS_HEAD_ORIENT_TRK_AVG, - IVAS_HEAD_ORIENT_TRK_REF_VEC, - IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV - -} IVAS_HEAD_ORIENT_TRK_T; - -typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; -typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; + int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ + int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ + int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ + /*The axis can be set dynamically per frame based on a file input */ + /*possible values: + 1 - (1dof correction. By default YAW correction) + 2 - (2dof correction. By default YAW and PITCH correction) + 3 - (3dof correction. By default YAW, PITCH and ROLL correction) + */ + int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ + int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ + IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; + IVAS_SPLIT_REND_CODEC codec; + IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; -typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE; -typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE; -typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE; -typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE; +} IVAS_SPLIT_REND_CONFIG_DATA; +#endif -typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE; +/*----------------------------------------------------------------------------------* + * Renderer API structures and enums + *----------------------------------------------------------------------------------*/ #ifdef DEBUGGING typedef enum @@ -214,6 +277,7 @@ typedef enum IVAS_RENDER_TYPE_OVERRIDE_NONE, IVAS_RENDER_TYPE_OVERRIDE_CREND, IVAS_RENDER_TYPE_OVERRIDE_FASTCONV + } IVAS_RENDER_TYPE_OVERRIDE; #endif @@ -236,27 +300,6 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG } IVAS_ROOM_ACOUSTICS_CONFIG_DATA; -#ifdef SPLIT_REND_WITH_HEAD_ROT - -typedef struct _IVAS_SPLIT_REND_CONFIG -{ - int32_t splitRendBitRate; /*Bit rate for split rendering mode, if "pcm_out" is set then "splitRendBitRate" is used as a limit for MD bitrate */ - int16_t hq_mode; /*High quality 3DOF mode with additional side information. Requires more pre-renditions. */ - int16_t dof; /*flag to specify if pose correction is needed for 1, 2 or 3 degree of freedoms*/ - /*The axis can be set dynamically per frame based on a file input */ - /*possible values: - 1 - (1dof correction. By default YAW correction) - 2 - (2dof correction. By default YAW and PITCH correction) - 3 - (3dof correction. By default YAW, PITCH and ROLL correction) - */ - int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/ - int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */ - IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode; - IVAS_SPLIT_REND_CODEC codec; - IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection; -} IVAS_SPLIT_REND_CONFIG_DATA; -#endif - typedef struct _IVAS_RENDER_CONFIG { #ifdef DEBUGGING @@ -267,36 +310,7 @@ typedef struct _IVAS_RENDER_CONFIG IVAS_SPLIT_REND_CONFIG_DATA split_rend_config; #endif float directivity[IVAS_MAX_NUM_OBJECTS * 3]; -} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; - -typedef struct _IVAS_LS_CUSTOM_LAYOUT -{ - int16_t num_spk; - float azimuth[IVAS_MAX_OUTPUT_CHANNELS]; - float elevation[IVAS_MAX_OUTPUT_CHANNELS]; - int16_t num_lfe; - int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS]; - -} IVAS_CUSTOM_LS_DATA; - -typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE; -typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; - -typedef struct _IVAS_JBM_TRACE_DATA -{ - uint32_t systemTimestamp_ms; - uint16_t extBufferedSamples; - uint16_t lastDecodedWasActive; - int32_t output_Fs; - int16_t dataUnit_flag; - uint16_t sequenceNumber; - uint32_t timeStamp; - uint32_t rcvTime; - - int16_t partial_frame; - int16_t partialCopyOffset; - -} IVAS_JBM_TRACE_DATA; +} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE; #endif /* COMMON_API_TYPES_H */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4084baeef4..e505058edf 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8823,7 +8823,7 @@ static ivas_error getSamplesInternal( convertBitsBufferToInternalBitsBuff( *hBits, &bits ); if ( ( error = ivas_renderMultiBinToSplitBinaural( &hIvasRend->splitRendWrapper, hIvasRend->headRotData.headPositions[0], hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate, hIvasRend->hRendererConfig->split_rend_config.codec, hIvasRend->hRendererConfig->split_rend_config.codec_frame_size_ms, - &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From ef8b6eeea8f51c3cc499fe801434b237701b7a08 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 10 Oct 2023 16:46:30 +0200 Subject: [PATCH 9/9] fix SR build --- lib_com/common_api_types.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 12aff5c0a8..c841cc02c0 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -196,6 +196,7 @@ typedef struct _IVAS_JBM_TRACE_DATA #define IVAS_MAX_SPLIT_REND_BITRATE 768000 #define IVAS_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) +#define IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ 1 typedef enum { -- GitLab