diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj
index 944e2646671876747db0be1722dcb5d559c82a38..3c7ea3e597de37d9377fc8ad745a158d37ca713c 100644
--- a/Workspace_msvc/lib_dec.vcxproj
+++ b/Workspace_msvc/lib_dec.vcxproj
@@ -147,7 +147,6 @@
-
@@ -313,7 +312,6 @@
-
@@ -350,4 +348,4 @@
-
+
\ No newline at end of file
diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters
index 5197d664574099c3d400b8411e230c14545bf555..8eddbb60a098e2b807e849b7bc72e1fe003e8a53 100644
--- a/Workspace_msvc/lib_dec.vcxproj.filters
+++ b/Workspace_msvc/lib_dec.vcxproj.filters
@@ -277,9 +277,6 @@
decoder_all_c
-
- decoder_all_c
-
decoder_all_c
@@ -520,9 +517,6 @@
-
- decoder_h
-
decoder_h
@@ -575,4 +569,4 @@
{c33b80b3-67ce-466b-91c0-4adfc9efcb5c}
-
+
\ No newline at end of file
diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj
index fceeb731ced2445a5434805d422d30654718782a..5bee827041dc1972467edee3601f784b4573bba5 100644
--- a/Workspace_msvc/lib_isar.vcxproj
+++ b/Workspace_msvc/lib_isar.vcxproj
@@ -197,4 +197,4 @@
-
+
\ No newline at end of file
diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj
index 854c99a979e4ae274d9c002b2ca6686a96e75870..1d55ed1942020a6c9b8e85bb05eb8bcd93cdd398 100644
--- a/Workspace_msvc/lib_rend.vcxproj
+++ b/Workspace_msvc/lib_rend.vcxproj
@@ -138,6 +138,7 @@
+
diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters
index 2d1d7d46c0b86e517f6f5a9a35d3c5a985a4caac..f290958973e373f377ef6d8c71668ec1155027ad 100644
--- a/Workspace_msvc/lib_rend.vcxproj.filters
+++ b/Workspace_msvc/lib_rend.vcxproj.filters
@@ -119,6 +119,9 @@
rend_c
+
+ rend_c
+
diff --git a/apps/decoder.c b/apps/decoder.c
index 350fba302b7ba94ff5961e985635d5430baea46d..41089d057e230d20fb65f02c48a9db930b5ac612 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -171,12 +171,11 @@ typedef struct
static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
-static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
+static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
+#else
+static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
- IVAS_DEC_HANDLE hIvasDec,
- int16_t *pcmBuf );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
@@ -757,11 +756,11 @@ int main(
if ( arg.voipMode )
{
- error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- &splitRendBits,
+ error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
+#else
+ error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf );
#endif
- hIvasDec, pcmBuf );
}
else
{
@@ -2127,7 +2126,7 @@ static ivas_error decodeG192(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
if ( !isSplitRend )
{
- /* Ensure split rendering output struct is not used when not outputting to a split rendering format */
+ /* Ensure split rendering output struct is not used when not outputting to a split rendering output configuration */
splitRendBits = NULL;
}
#endif
@@ -2467,11 +2466,11 @@ static ivas_error decodeG192(
}
/* decode transport channels, do TSM and feed to renderer */
- if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec,
-#ifndef FIX_1119_SPLIT_RENDERING_VOIP
- isSplitRend,
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, splitRendBits ) ) != IVAS_ERR_OK )
+#else
+ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK )
#endif
- splitRendBits ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -3392,15 +3391,11 @@ static ivas_error decodeVoIP(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
if ( isSplitRend )
{
- if ( ( error = IVAS_DEC_VoIP_GetSplitBinauralBitstream( hIvasDec, (void *) pcmBuf, splitRendBits,
#ifdef SUPPORT_JBM_TRACEFILE
- writeJbmTraceFileFrameWrapper,
- jbmTraceWriter,
+ if ( ( error = IVAS_DEC_VoIP_GetSplitBinauralBitstream( hIvasDec, (void *) pcmBuf, splitRendBits, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
+#else
+ if ( ( error = IVAS_DEC_VoIP_GetSplitBinauralBitstream( hIvasDec, (void *) pcmBuf, splitRendBits, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
- &bitstreamReadDone,
- &nSamplesRendered,
- ¶metersAvailableForEditing,
- systemTime_ms ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSplitBinauralBitstream: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
@@ -3502,15 +3497,13 @@ static ivas_error decodeVoIP(
{
#ifndef FIX_1119_SPLIT_RENDERING_VOIP
SplitFileReadWrite *splitRendWriter = NULL;
-#endif
- if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples,
+#endif
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- &vec_pos_len,
+ if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
#else
- NULL,
+ if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
#endif
- delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
&bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -3535,6 +3528,7 @@ static ivas_error decodeVoIP(
goto cleanup;
}
}
+
if ( !isSplitCoded )
{
#endif
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 895cb3ac07a1680669d4de9edae8509c1548e7e4..b702dc027fba871c5ed5894228a7d92f831334de 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -5196,6 +5196,43 @@ void ivas_binaural_add_LFE(
float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */
);
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+
+/*---------------------------------------------------------------------------------*
+ * Multi-pose ring buffer Prototypes
+*-----------------------------------------------------------------------------------*/
+
+ivas_error ivas_CLDFB_RINGBUF_Open(
+ ISAR_CLDFB_RINGBUF_HANDLE *ph,
+ const int16_t capacity_columns
+);
+
+void ivas_CLDFB_RINGBUF_Close(
+ ISAR_CLDFB_RINGBUF_HANDLE *ph
+);
+
+void ivas_CLDFB_RINGBUF_Push(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ const float *real,
+ const float *imag,
+ const int16_t num_bands
+);
+
+void ivas_CLDFB_RINGBUF_Pop(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ float *real,
+ float *imag,
+ const int16_t num_bands
+);
+
+void ivas_CLDFB_RINGBUF_GetByIdx(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ float **p_real,
+ float **p_imag,
+ const int16_t idx
+);
+
+#endif
/*----------------------------------------------------------------------------------*
* renderer prototypes
diff --git a/lib_dec/cldfb_ring_buffer.h b/lib_dec/cldfb_ring_buffer.h
deleted file mode 100644
index 68143bdfa047e7c37dca1e5f18c9ad8574754a02..0000000000000000000000000000000000000000
--- a/lib_dec/cldfb_ring_buffer.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 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 CLDFB_RING_BUFFER_H
-#define CLDFB_RING_BUFFER_H
-
-#include "ivas_error.h"
-#include
-
-#ifdef FIX_1119_SPLIT_RENDERING_VOIP
-
-typedef struct CldfbRingBuf *CLDFB_RINGBUF_HANDLE;
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_Open()
- *
- * Allocate a ring buffer for CLDFB data with the given capacity of CLDFB columns.
- * Each column is expected to contain at most CLDFB_NO_CHANNELS_MAX frequency bands.
- *
- * May return IVAS_ERR_FAILED_ALLOC on failed allocation, or IVAS_ERR_OK otherwise.
- *---------------------------------------------------------------------*/
-ivas_error CLDFB_RINGBUF_Open( CLDFB_RINGBUF_HANDLE *ph, int16_t capacity_columns );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_Close()
- *
- * Dellocate CLDFB ring buffer. The given handle will be set to NULL.
- *---------------------------------------------------------------------*/
-void CLDFB_RINGBUF_Close( CLDFB_RINGBUF_HANDLE *ph );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_Push()
- *
- * Push a single column onto the back of the CLDFB ring buffer from real and imag arrays.
- *---------------------------------------------------------------------*/
-void CLDFB_RINGBUF_Push( CLDFB_RINGBUF_HANDLE h, const float *real, const float *imag, uint16_t num_bands );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_Pop()
- *
- * Pop a single column from the front of the CLDFB ring buffer into real and imag arrays.
- *---------------------------------------------------------------------*/
-void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16_t num_bands );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_GetByIdx()
- *
- * Get pointers into a specific column in the CLDFB ring buffer based on given index.
- * Non-negative indices access from the front of the ring buffer, negative indexes access
- * from the back, similar to Python arrays. For example:
- *
- * - index 0 accesses the front of the buffer, i.e. the oldest CLDFB column in the queue.
- * - index -1 accesses the back of the buffer, i.e. the newest (last pushed) CLDFB column in the queue.
- *---------------------------------------------------------------------*/
-void CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_imag, int16_t idx );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_IsEmpty()
- *
- * Returns 1 if the ring buffer is empty, or 0 otherwise.
- *---------------------------------------------------------------------*/
-int16_t CLDFB_RINGBUF_IsEmpty( CLDFB_RINGBUF_HANDLE h );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_IsFull()
- *
- * Returns 1 if the ring buffer is full, or 0 otherwise.
- *---------------------------------------------------------------------*/
-int16_t CLDFB_RINGBUF_IsFull( CLDFB_RINGBUF_HANDLE h );
-
-/*---------------------------------------------------------------------*
- * CLDFB_RINGBUF_Size()
- *
- * Returns the number of CLDFB columns currently stored in the ring buffer.
- *---------------------------------------------------------------------*/
-uint16_t CLDFB_RINGBUF_Size( CLDFB_RINGBUF_HANDLE h );
-
-#endif /* FIX_1119_SPLIT_RENDERING_VOIP */
-#endif
diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c
index 0ea8d67a6a71040e7ab3175d117ed9eb96020c02..b53d8cc200e37b05b5d7afff622016d7f9cc0174 100644
--- a/lib_dec/ivas_dirac_dec.c
+++ b/lib_dec/ivas_dirac_dec.c
@@ -1670,7 +1670,7 @@ static void binRenderer_split(
for ( ch = 0; ch < nchan_out; ch++ )
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_Push(
+ ivas_CLDFB_RINGBUF_Push(
hSplitBinRend->hMultiBinCldfbData[pos_idx * BINAURAL_CHANNELS + ch],
Cldfb_RealBuffer_Binaural_loc[pos_idx][ch][slot_idx],
Cldfb_ImagBuffer_Binaural_loc[pos_idx][ch][slot_idx],
diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c
index bb013b8d78946487a4d910c59aa7a5f323d3bbb2..b0ce85ce51f4b7b4ed9909e243f2a3494820669e 100644
--- a/lib_dec/ivas_mc_param_dec.c
+++ b/lib_dec/ivas_mc_param_dec.c
@@ -1787,7 +1787,7 @@ void ivas_param_mc_dec_render(
for ( ch = 0; ch < nchan_out_cldfb; ch++ )
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_Push(
+ ivas_CLDFB_RINGBUF_Push(
st_ivas->hSplitBinRend->hMultiBinCldfbData[pos_idx * BINAURAL_CHANNELS + ch],
Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx],
Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c
index 1cd2490b0e241363da1e72561551eb566538f75f..d6c5ceec40972c7f8dd0a6cde4ce0a62091f9ff1 100644
--- a/lib_dec/ivas_mc_paramupmix_dec.c
+++ b/lib_dec/ivas_mc_paramupmix_dec.c
@@ -792,7 +792,7 @@ static void ivas_mc_paramupmix_dec_sf(
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_Push(
+ ivas_CLDFB_RINGBUF_Push(
st_ivas->hSplitBinRend->hMultiBinCldfbData[pos_idx * BINAURAL_CHANNELS + ch],
Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx],
Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c
index ec33f6a114df70a81d4086fa682180fbefca275b..fdbca49b316f7b8f3d39bbaba5529e82d66dfc1c 100644
--- a/lib_dec/ivas_omasa_dec.c
+++ b/lib_dec/ivas_omasa_dec.c
@@ -793,7 +793,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
/* note: this intentionally differs from OSBA by: no scaling by 0.5 */
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_GetByIdx( st_ivas->hSplitBinRend->hMultiBinCldfbData[n], &re, &im, slot_idx - cldfb_slots );
+ ivas_CLDFB_RINGBUF_GetByIdx( st_ivas->hSplitBinRend->hMultiBinCldfbData[n], &re, &im, slot_idx - cldfb_slots );
v_add( re, Cldfb_RealBuffer, re, num_cldfb_bands );
v_add( im, Cldfb_ImagBuffer, im, num_cldfb_bands );
#else
diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c
index e9bf8a388418b9d0e8adde6e6776cdb93ab2fce7..185f90530689360c36a4a4330df0c920e0bb998a 100644
--- a/lib_dec/ivas_osba_dec.c
+++ b/lib_dec/ivas_osba_dec.c
@@ -188,7 +188,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
cldfbAnalysis_ts( &( output_f[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend->splitrend.hCldfbHandles->cldfbAna[n] );
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_GetByIdx( st_ivas->hSplitBinRend->hMultiBinCldfbData[n], &re, &im, slot_idx - cldfb_slots );
+ ivas_CLDFB_RINGBUF_GetByIdx( st_ivas->hSplitBinRend->hMultiBinCldfbData[n], &re, &im, slot_idx - cldfb_slots );
v_add( re, Cldfb_RealBuffer, re, num_cldfb_bands );
v_add( im, Cldfb_ImagBuffer, im, num_cldfb_bands );
#else
diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c
index b74d2b6d8e8f0a069ad4a2aaf9a51af59f9c6ebf..9d2e7734de54eac0ef6cd9570da16f743d902597 100644
--- a/lib_dec/ivas_output_config.c
+++ b/lib_dec/ivas_output_config.c
@@ -509,11 +509,11 @@ RENDERER_TYPE ivas_renderer_secondary_select(
{
renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
}
- else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM
+ else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+#else
+ else if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && ( output_config == IVAS_AUDIO_CONFIG_BINAURAL || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
#endif
- ) )
{
renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
}
diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h
index 70e07c577d280aa520fdfd69fe8f36b0c2e1a7dc..0831079213419953e5984c67f4f4b4ea0a82fe86 100644
--- a/lib_dec/ivas_stat_dec.h
+++ b/lib_dec/ivas_stat_dec.h
@@ -40,9 +40,6 @@
#include "stat_dec.h"
#include "ivas_stat_com.h"
#include "ivas_stat_rend.h"
-#ifdef FIX_1119_SPLIT_RENDERING_VOIP
-#include "cldfb_ring_buffer.h"
-#endif
/*----------------------------------------------------------------------------------*
@@ -831,8 +828,8 @@ typedef struct
float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
} ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA, *ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE;
-#endif
+#endif
typedef struct
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
@@ -850,7 +847,7 @@ typedef struct
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
TD_RINGBUF_HANDLE hMultiBinTdData;
- CLDFB_RINGBUF_HANDLE hMultiBinCldfbData[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];
+ ISAR_CLDFB_RINGBUF_HANDLE hMultiBinCldfbData[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS];
#else
ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE hMultiBinCldfbData; /*scratch buffer for frame by frame processing*/
#endif
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index ab29c22adcd22eedae6e872316cc6c1c096b3c5f..41a83239fa5add2bb2b168625b54689cd084a95f 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -114,11 +114,11 @@ static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, c
static ivas_error evs_dec_main( Decoder_Struct *st_ivas );
static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled );
static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig );
-static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels,
-#ifndef FIX_1119_SPLIT_RENDERING_VOIP
- const int16_t isSplitRend,
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
+#else
+static ivas_error ivas_dec_setup_all( IVAS_DEC_HANDLE hIvasDec, uint8_t *nTransportChannels, const int16_t isSplitRend, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
#endif
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
static ivas_error apa_setup( IVAS_DEC_HANDLE hIvasDec, const bool isInitialized_voip, const uint16_t nTransportChannels );
static PCM_RESOLUTION pcm_type_API_to_internal( const IVAS_DEC_PCM_TYPE pcmType );
static void *pcm_buffer_offset( void *buffer, const IVAS_DEC_PCM_TYPE pcmType, const int32_t offset );
@@ -130,8 +130,8 @@ static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *h
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
-static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas );
-static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct *st_ivas );
+static int16_t get_render_frame_size_samples( const DECODER_CONFIG_HANDLE hDecoderConfig );
+static int16_t ivas_dec_split_rend_cldfb_in( const RENDERER_TYPE renderer_type );
#endif
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered );
@@ -641,13 +641,23 @@ ivas_error IVAS_DEC_GetRenderFramesize(
return IVAS_ERR_OK;
}
+
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
-static int16_t get_render_frame_size_samples( Decoder_Struct *st_ivas )
+/*---------------------------------------------------------------------*
+ * get_render_frame_size_samples( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+static int16_t get_render_frame_size_samples(
+ const DECODER_CONFIG_HANDLE hDecoderConfig /* i : configuration structure */
+)
{
- return (int16_t) ( st_ivas->hDecoderConfig->output_Fs * st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) );
+ return (int16_t) ( hDecoderConfig->output_Fs * hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) );
}
#endif
+
/*---------------------------------------------------------------------*
* IVAS_DEC_GetGetRenderFramesizeSamples( )
*
@@ -665,7 +675,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples(
}
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- *render_framesize = get_render_frame_size_samples( hIvasDec->st_ivas );
+ *render_framesize = get_render_frame_size_samples( hIvasDec->st_ivas->hDecoderConfig );
#else
*render_framesize = (int16_t) ( hIvasDec->st_ivas->hDecoderConfig->output_Fs * hIvasDec->st_ivas->hDecoderConfig->render_framesize / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif
@@ -673,6 +683,7 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples(
return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* IVAS_DEC_GetGetRenderFramesizeMs( )
*
@@ -1164,11 +1175,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder(
* Setup all decoder parts (IVAS decoder, ISAR)
*-----------------------------------------------------------------*/
- if ( ( error = ivas_dec_setup_all( hIvasDec, &nTransportChannels,
-#ifndef FIX_1119_SPLIT_RENDERING_VOIP
- isSplitRend,
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+ if ( ( error = ivas_dec_setup_all( hIvasDec, &nTransportChannels, splitRendBits ) ) != IVAS_ERR_OK )
+#else
+ if ( ( error = ivas_dec_setup_all( hIvasDec, &nTransportChannels, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK )
#endif
- splitRendBits ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1858,11 +1869,19 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+/*---------------------------------------------------------------------*
+ * isar_get_frame_size( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
static int16_t isar_get_frame_size(
- Decoder_Struct *st_ivas )
+ Decoder_Struct *st_ivas /* i : IVAS decoder handle */
+)
{
int32_t output_Fs;
int16_t nSamplesPerChannel;
+
output_Fs = st_ivas->hDecoderConfig->output_Fs;
if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS &&
@@ -1880,25 +1899,35 @@ static int16_t isar_get_frame_size(
return nSamplesPerChannel;
}
+
+/*---------------------------------------------------------------------*
+ * isar_render_poses( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
static ivas_error isar_render_poses(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */
- int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */
- bool *needNewFrame /* o : indication that the decoder needs a new frame */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */
+ int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */
+ bool *needNewFrame /* o : indication that the decoder needs a new frame */
)
{
- Decoder_Struct *st_ivas;
float pcmBuf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES * L_FRAME48k];
+ Decoder_Struct *st_ivas;
ivas_error error;
- ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
int16_t numPoses;
- error = IVAS_ERR_OK;
- st_ivas = hIvasDec->st_ivas;
+ if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
*needNewFrame = false;
- hSplitBinRend = st_ivas->hSplitBinRend;
- numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;
+ st_ivas = hIvasDec->st_ivas;
+
+ numPoses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
/* init flush buffer for rate switch if not already initizalized */
if ( hIvasDec->flushbuffer == NULL )
@@ -1917,29 +1946,34 @@ static ivas_error isar_render_poses(
{
return error;
}
+
if ( !hIvasDec->hasBeenFedFirstGoodFrame )
{
return IVAS_ERR_OK;
}
- if ( !ivas_dec_split_rend_cldfb_in( st_ivas ) )
+ if ( !ivas_dec_split_rend_cldfb_in( st_ivas->renderer_type ) )
{
- ivas_TD_RINGBUF_PushInterleaved( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples );
+ ivas_TD_RINGBUF_PushInterleaved( st_ivas->hSplitBinRend->hMultiBinTdData, pcmBuf, *nOutSamples );
}
return error;
}
+
+/*---------------------------------------------------------------------*
+ * isar_generate_metadata_and_bitstream( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
static ivas_error isar_generate_metadata_and_bitstream(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- float **p_head_pose_buf,
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ float **p_head_pose_buf, /* i/o: PCM buffer with head-pose data */
int16_t nSamples, /* i : duration of audio (in samples per channel) for which metadata should be generated */
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
)
{
- Decoder_Struct *st_ivas;
- AUDIO_CONFIG output_config;
- int32_t output_Fs;
ivas_error error;
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
int16_t max_band;
@@ -1951,15 +1985,11 @@ static ivas_error isar_generate_metadata_and_bitstream(
float *p_Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX];
float *p_Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX];
- error = IVAS_ERR_OK;
- st_ivas = hIvasDec->st_ivas;
- output_config = st_ivas->hDecoderConfig->output_config;
- output_Fs = st_ivas->hDecoderConfig->output_Fs;
hSplitBinRend = st_ivas->hSplitBinRend;
- max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 );
- pcm_out_flag = ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
- cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas );
+ max_band = (int16_t) ( ( BINAURAL_MAXBANDS * st_ivas->hDecoderConfig->output_Fs ) / 48000 );
+ pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
+ cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas->renderer_type );
if ( cldfb_in_flag )
{
@@ -1969,32 +1999,25 @@ static ivas_error isar_generate_metadata_and_bitstream(
num_poses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;
- for ( i = 0; i < (int16_t) ( BINAURAL_CHANNELS * num_poses ); ++i )
+ for ( i = 0; i < BINAURAL_CHANNELS * num_poses; ++i )
{
for ( j = 0; j < num_cldfb_slots; ++j )
{
/* Save pointers to first CLDFB column in the ring buffer. Allows us to save
* significant amounts of memory by not copying CLDFB values into a separate buffer. */
- CLDFB_RINGBUF_GetByIdx(
- hSplitBinRend->hMultiBinCldfbData[i],
- &p_Cldfb_RealBuffer_Binaural[i][j],
- &p_Cldfb_ImagBuffer_Binaural[i][j],
- 0 );
+ ivas_CLDFB_RINGBUF_GetByIdx( hSplitBinRend->hMultiBinCldfbData[i], &p_Cldfb_RealBuffer_Binaural[i][j], &p_Cldfb_ImagBuffer_Binaural[i][j], 0 );
+
/* Pop the CLDFB column we just saved pointers to. This is fine as long as we use
* the saved columns only before any new columns are pushed to the buffer - the new
* columns could potentially overwrite the old columns we wanted to use.
* This requirement is fulfilled in this case. */
- CLDFB_RINGBUF_Pop(
- hSplitBinRend->hMultiBinCldfbData[i],
- NULL,
- NULL,
- CLDFB_NO_CHANNELS_MAX );
+ ivas_CLDFB_RINGBUF_Pop( hSplitBinRend->hMultiBinCldfbData[i], NULL, NULL, CLDFB_NO_CHANNELS_MAX );
}
}
}
else
{
- ivas_TD_RINGBUF_PopChannels( hIvasDec->st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, nSamples );
+ ivas_TD_RINGBUF_PopChannels( st_ivas->hSplitBinRend->hMultiBinTdData, p_head_pose_buf, nSamples );
}
@@ -2057,7 +2080,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
ivas_error error;
float head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES][L_FRAME48k];
float *p_head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES];
- int32_t i;
+ int16_t i;
int16_t pcm_out_flag;
int16_t numSamplesPerChannelToOutput;
@@ -2066,7 +2089,6 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
- error = IVAS_ERR_UNKNOWN;
st_ivas = hIvasDec->st_ivas;
if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
@@ -2077,11 +2099,11 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
numSamplesPerChannelToOutput = isar_get_frame_size( st_ivas );
- error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = isar_render_poses( hIvasDec, numSamplesPerChannelToOutput, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
{
return error;
}
+
if ( !hIvasDec->hasBeenFedFirstGoodFrame )
{
return IVAS_ERR_OK;
@@ -2092,8 +2114,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
p_head_pose_buf[i] = head_pose_buf[i];
}
- error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, *nOutSamples, splitRendBits );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, *nOutSamples, splitRendBits ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -2306,7 +2327,7 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
}
#endif
- return error;
+ return IVAS_ERR_OK;
}
@@ -3702,13 +3723,16 @@ ivas_error IVAS_DEC_TSM_SetQuality(
#endif
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+
/*---------------------------------------------------------------------*
* ivas_dec_voip_get_samples_common( )
*
* Main function to output one frame in VoIP. Holds common code for
* regular output configs and split rendering configs.
*---------------------------------------------------------------------*/
+
static ivas_error ivas_dec_voip_get_samples_common
+
#else
/*---------------------------------------------------------------------*
* IVAS_DEC_VoIP_GetSamples( )
@@ -3724,7 +3748,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples
const IVAS_DEC_PCM_TYPE pcmType, /* i : type for the decoded PCM resolution */
void *pcmBuf, /* o : output synthesis signal */
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
+ float **p_head_pose_buf, /* i : PCM buffer with head-pose data */
#endif
#ifdef SUPPORT_JBM_TRACEFILE
JbmTraceFileWriterFn jbmWriterFn,
@@ -3746,12 +3771,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples
ivas_error error;
uint8_t nOutChannels;
-#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- int32_t i;
- float head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES][L_FRAME48k];
- float *p_head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES];
-#endif
-
if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3768,12 +3787,20 @@ ivas_error IVAS_DEC_VoIP_GetSamples
return IVAS_ERR_WRONG_PARAMS;
}
-#ifndef FIX_1119_SPLIT_RENDERING_VOIP
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+ if ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
+ hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) &&
+ splitRendBits == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+#else
if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
{
return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Split rendering is not integrated with VoIP mode" );
}
+
#endif
/* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */
@@ -3797,7 +3824,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples
extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs;
dataUnit = NULL;
-
/* pop one access unit from the jitter buffer */
result = JB4_PopDataUnit( hVoIP->hJBM, systemTimestamp_ms, extBufferedTime_ms, &dataUnit, &scale, &maxScaling );
if ( result != 0 )
@@ -3921,13 +3947,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples
{
if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame )
{
- if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec,
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- splitRendBits
+ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, splitRendBits ) ) != IVAS_ERR_OK )
#else
- 0, NULL
+ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, 0, NULL ) ) != IVAS_ERR_OK )
#endif
- ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -3950,7 +3974,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples
}
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ if ( splitRendBits != NULL )
{
/* Render head poses from time-scaled transport channels */
if ( ( error = isar_render_poses( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &tmp ) ) != IVAS_ERR_OK )
@@ -3976,24 +4000,16 @@ ivas_error IVAS_DEC_VoIP_GetSamples
}
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- if ( hIvasDec->hasDecodedFirstGoodFrame &&
- ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
- hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( hIvasDec->hasDecodedFirstGoodFrame && splitRendBits != NULL )
{
- for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
- {
- p_head_pose_buf[i] = head_pose_buf[i];
- }
-
/* Analyse head poses over entire frame, generate ISAR metadata and maybe encode if split coded */
- error = isar_generate_metadata_and_bitstream( hIvasDec, p_head_pose_buf, *nSamplesRendered, splitRendBits );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = isar_generate_metadata_and_bitstream( st_ivas, p_head_pose_buf, *nSamplesRendered, splitRendBits ) ) != IVAS_ERR_OK )
{
return error;
}
/* Synthesise PCM output if split PCM */
- if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( st_ivas->hDecoderConfig->render_framesize == IVAS_RENDER_FRAMESIZE_5MS )
{
@@ -4018,6 +4034,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples
}
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+
/*---------------------------------------------------------------------*
* IVAS_DEC_VoIP_GetSamples( )
*
@@ -4045,6 +4062,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
pcmType,
pcmBuf,
NULL,
+ NULL,
#ifdef SUPPORT_JBM_TRACEFILE
jbmWriterFn,
jbmWriter,
@@ -4055,6 +4073,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
systemTimestamp_ms );
}
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_VoIP_GetSplitBinauralBitstream( )
+ *
+ * Main function to decode one split-rendering frame in VoIP
+ *---------------------------------------------------------------------*/
+
/*! r: error code */
ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
@@ -4063,15 +4088,17 @@ ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream(
ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
#ifdef SUPPORT_JBM_TRACEFILE
JbmTraceFileWriterFn jbmWriterFn,
- void *jbmWriter
+ void *jbmWriter,
#endif
- ,
bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */
uint16_t *nSamplesRendered, /* o : number of samples rendered */
bool *parametersAvailableForEditing, /* o : indicates whether objects editing is available */
const uint32_t systemTimestamp_ms /* i : current system timestamp */
)
{
+ int16_t i;
+ float head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES][L_FRAME48k];
+ float *pp_head_pose_buf[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES];
ivas_error error = IVAS_ERR_UNKNOWN;
int16_t nSamplesPerChannel = 0;
@@ -4080,12 +4107,19 @@ ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream(
return error;
}
+ /* Set pointers to beginning of head pose buffers */
+ for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
+ {
+ pp_head_pose_buf[i] = head_pose_buf[i];
+ }
+
return ivas_dec_voip_get_samples_common(
hIvasDec,
nSamplesPerChannel,
IVAS_DEC_PCM_INT16,
pcmBuf,
splitRendBits,
+ pp_head_pose_buf,
#ifdef SUPPORT_JBM_TRACEFILE
jbmWriterFn,
jbmWriter,
@@ -5200,7 +5234,7 @@ static ivas_error ivas_create_handle_isar(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
hSplitBinRend->hMultiBinTdData = NULL;
- for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i )
+ for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
{
hSplitBinRend->hMultiBinCldfbData[i] = NULL;
}
@@ -5237,11 +5271,11 @@ static void ivas_destroy_handle_isar(
{
ivas_TD_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinTdData );
}
- for ( i = 0; i < (int16_t) ( MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS ); ++i )
+ for ( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; ++i )
{
if ( ( *hSplitBinRend )->hMultiBinCldfbData[i] != NULL )
{
- CLDFB_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinCldfbData[i] );
+ ivas_CLDFB_RINGBUF_Close( &( *hSplitBinRend )->hMultiBinCldfbData[i] );
}
}
#else
@@ -5421,17 +5455,33 @@ static ivas_error ivas_dec_reconfig_split_rend(
return IVAS_ERR_OK;
}
+
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
-static int16_t ivas_dec_split_rend_cldfb_in( Decoder_Struct *st_ivas )
-{
+/*-------------------------------------------------------------------*
+ * ivas_dec_split_rend_cldfb_in()
+ *
+ *
+ *-------------------------------------------------------------------*/
- return st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
- st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
- st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ||
- st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM;
+static int16_t ivas_dec_split_rend_cldfb_in(
+ const RENDERER_TYPE renderer_type /* i : renderer type */
+)
+{
+ if ( renderer_type == RENDERER_BINAURAL_FASTCONV ||
+ renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
+ renderer_type == RENDERER_BINAURAL_PARAMETRIC ||
+ renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
}
#endif
+
/*-------------------------------------------------------------------*
* ivas_dec_init_split_rend()
*
@@ -5453,7 +5503,7 @@ static ivas_error ivas_dec_init_split_rend(
cldfb_in_flag = 0;
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas );
+ cldfb_in_flag = ivas_dec_split_rend_cldfb_in( st_ivas->renderer_type );
#else
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
@@ -5466,16 +5516,16 @@ static ivas_error ivas_dec_init_split_rend(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
+
num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
assert( num_poses <= MAX_HEAD_ROT_POSES );
if ( cldfb_in_flag )
{
- for ( i = 0; i < (int16_t) ( num_poses * BINAURAL_CHANNELS ); ++i )
+ for ( i = 0; i < num_poses * BINAURAL_CHANNELS; ++i )
{
/* note: this is intra-frame heap memory */
- error = CLDFB_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinCldfbData[i], CLDFB_NO_COL_MAX );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_CLDFB_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinCldfbData[i], CLDFB_NO_COL_MAX ) ) != IVAS_ERR_OK )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
}
@@ -5483,8 +5533,7 @@ static ivas_error ivas_dec_init_split_rend(
}
else
{
- error = ivas_TD_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinTdData, get_render_frame_size_samples( st_ivas ), num_poses * BINAURAL_CHANNELS );
- if ( error != IVAS_ERR_OK )
+ if ( ( error = ivas_TD_RINGBUF_Open( &st_ivas->hSplitBinRend->hMultiBinTdData, get_render_frame_size_samples( st_ivas->hDecoderConfig ), num_poses * BINAURAL_CHANNELS ) ) != IVAS_ERR_OK )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
}
diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h
index 73c55bd1f02ded1c139238eb4533c7d7c0348920..18298954c462251bb940489845102786ab9c675f 100644
--- a/lib_dec/lib_dec.h
+++ b/lib_dec/lib_dec.h
@@ -332,12 +332,11 @@ ivas_error IVAS_DEC_VoIP_GetSplitBinauralBitstream(
ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
#ifdef SUPPORT_JBM_TRACEFILE
JbmTraceFileWriterFn jbmWriterFn,
- void* jbmWriter
+ void* jbmWriter,
#endif
- ,
bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */
- uint16_t *nSamplesRendered,
- bool *parametersAvailableForEditing,
+ uint16_t *nSamplesRendered, /* o : number of samples rendered */
+ bool *parametersAvailableForEditing, /* o : indicates whether objects editing is available */
const uint32_t systemTimestamp_ms /* i : current system timestamp */
);
#endif
diff --git a/lib_isar/isar_prot.h b/lib_isar/isar_prot.h
index f842b0a53b3302a822a96921596618d42865c497..53d70184f04a4bb3a684912de2dcebd1343bf5ca 100644
--- a/lib_isar/isar_prot.h
+++ b/lib_isar/isar_prot.h
@@ -189,13 +189,13 @@ void isar_splitBinLCLDEncClose(
void isar_splitBinLCLDEncProcess(
ISAR_BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, /* i/o: ISAR LCLD encoder handle */
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- float *Cldfb_In_Real[][CLDFB_NO_COL_MAX],
- float *Cldfb_In_Imag[][CLDFB_NO_COL_MAX],
+ float *Cldfb_In_Real[][CLDFB_NO_COL_MAX], /* i/o: Binaural signals, real part */
+ float *Cldfb_In_Imag[][CLDFB_NO_COL_MAX], /* i/o: Binaural signals, imag. part */
#else
float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
#endif
- const int32_t available_bits,
+ const int32_t available_bits, /* i : available bit-budget */
ISAR_SPLIT_REND_BITS_HANDLE pBits /* i/o: ISAR bits handle */
);
diff --git a/lib_isar/isar_splitRend_lcld_enc.c b/lib_isar/isar_splitRend_lcld_enc.c
index 171b5162b3a005e9b9542879435fc8156762130d..1ecb83887b7927708f7c161cb6655b9cfc9e557f 100644
--- a/lib_isar/isar_splitRend_lcld_enc.c
+++ b/lib_isar/isar_splitRend_lcld_enc.c
@@ -159,14 +159,14 @@ void isar_splitBinLCLDEncClose(
void isar_splitBinLCLDEncProcess(
ISAR_BIN_HR_SPLIT_LCLD_ENC_HANDLE hSplitBinLCLDEnc, /* i/o: ISAR LCLD encoder handle */
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- float *Cldfb_In_Real[][CLDFB_NO_COL_MAX],
- float *Cldfb_In_Imag[][CLDFB_NO_COL_MAX],
+ float *Cldfb_In_Real[][CLDFB_NO_COL_MAX], /* i/o: Binaural signals, real part */
+ float *Cldfb_In_Imag[][CLDFB_NO_COL_MAX], /* i/o: Binaural signals, imag. part */
#else
float Cldfb_In_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
float Cldfb_In_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
#endif
- const int32_t available_bits,
- ISAR_SPLIT_REND_BITS_HANDLE pBits /* i/o: ISAR bits handle */
+ const int32_t available_bits, /* i : available bit-budget */
+ ISAR_SPLIT_REND_BITS_HANDLE pBits /* i/o: ISAR bits handle */
)
{
int32_t iBitsWritten, itr, available_bits_itr, rem_itr, available_bits_local;
diff --git a/lib_isar/isar_stat.h b/lib_isar/isar_stat.h
index 587c3c8ea7309fc6a4fe0fe3cbc66dbebfdcd0f8..b244370dd3eceed843c49f02de1087c21a0e0b9e 100644
--- a/lib_isar/isar_stat.h
+++ b/lib_isar/isar_stat.h
@@ -345,4 +345,17 @@ typedef struct
} SPLIT_REND_WRAPPER;
+#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+typedef struct
+{
+ float *real;
+ float *imag;
+ uint32_t capacity;
+ uint32_t write_pos;
+ uint32_t read_pos;
+ int16_t is_full;
+
+} ISAR_CLDFB_RINGBUF, *ISAR_CLDFB_RINGBUF_HANDLE;
+#endif
+
#endif /* ISAR_STAT_H */
diff --git a/lib_dec/cldfb_ring_buffer.c b/lib_rend/ivas_cldfb_ring_buffer.c
similarity index 53%
rename from lib_dec/cldfb_ring_buffer.c
rename to lib_rend/ivas_cldfb_ring_buffer.c
index 959929d5720d4cee0d8cc238171326fad3520bde..5d1d2a055cbb50b71f732330d2091d252b3bf1d7 100644
--- a/lib_dec/cldfb_ring_buffer.c
+++ b/lib_rend/ivas_cldfb_ring_buffer.c
@@ -30,33 +30,67 @@
*******************************************************************************************************/
-#include "cldfb_ring_buffer.h"
+#include
+#include "options.h"
#include "cnst.h"
#include "prot.h"
-#include "ivas_error_utils.h"
+#include "ivas_prot.h"
#include
-#include
-#include
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+#include "wmc_auto.h"
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
+/*---------------------------------------------------------------------*
+ * CLDFB ring-buffer functions needed in split-rendering outputs
+ *---------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------*
+ * ivas_cldfb_ringbuf_IsEmpty()
+ *
+ * Returns 1 if the ring buffer is empty, or 0 otherwise.
+ *---------------------------------------------------------------------*/
+
+static int16_t ivas_cldfb_ringbuf_IsEmpty(
+ ISAR_CLDFB_RINGBUF_HANDLE h )
+{
+ return (int16_t) ( h->read_pos == h->write_pos && !h->is_full );
+}
+
-struct CldfbRingBuf
+/*---------------------------------------------------------------------*
+ * ivas_cldfb_ringbuf_IsFull()
+ *
+ * Returns 1 if the ring buffer is full, or 0 otherwise.
+ *---------------------------------------------------------------------*/
+
+static int16_t ivas_cldfb_ringbuf_IsFull(
+ ISAR_CLDFB_RINGBUF_HANDLE h )
{
- float *real;
- float *imag;
- uint32_t capacity;
- uint32_t write_pos;
- uint32_t read_pos;
- int16_t is_full;
-};
-
-ivas_error CLDFB_RINGBUF_Open( CLDFB_RINGBUF_HANDLE *ph, int16_t capacity_columns )
+ return h->is_full;
+}
+
+
+/*---------------------------------------------------------------------*
+ * ivas_CLDFB_RINGBUF_Open()
+ *
+ * Allocate a ring buffer for CLDFB data with the given capacity of CLDFB columns.
+ * Each column is expected to contain at most CLDFB_NO_CHANNELS_MAX frequency bands.
+ *
+ * May return IVAS_ERR_FAILED_ALLOC on failed allocation, or IVAS_ERR_OK otherwise.
+ *---------------------------------------------------------------------*/
+
+ivas_error ivas_CLDFB_RINGBUF_Open(
+ ISAR_CLDFB_RINGBUF_HANDLE *ph,
+ const int16_t capacity_columns )
{
- CLDFB_RINGBUF_HANDLE h;
+ ISAR_CLDFB_RINGBUF_HANDLE h;
int32_t capacity;
+
capacity = capacity_columns * CLDFB_NO_CHANNELS_MAX;
- if ( ( h = malloc( sizeof( struct CldfbRingBuf ) ) ) == NULL )
+ if ( ( h = malloc( sizeof( ISAR_CLDFB_RINGBUF ) ) ) == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to allocate memory for CLDFB ring buffer\n" );
}
@@ -81,9 +115,17 @@ ivas_error CLDFB_RINGBUF_Open( CLDFB_RINGBUF_HANDLE *ph, int16_t capacity_column
return IVAS_ERR_OK;
}
-void CLDFB_RINGBUF_Close( CLDFB_RINGBUF_HANDLE *ph )
+
+/*---------------------------------------------------------------------*
+ * ivas_CLDFB_RINGBUF_Close()
+ *
+ * Dellocate CLDFB ring buffer. The given handle will be set to NULL.
+ *---------------------------------------------------------------------*/
+
+void ivas_CLDFB_RINGBUF_Close(
+ ISAR_CLDFB_RINGBUF_HANDLE *ph )
{
- CLDFB_RINGBUF_HANDLE h;
+ ISAR_CLDFB_RINGBUF_HANDLE h;
if ( ph == NULL )
{
@@ -111,13 +153,24 @@ void CLDFB_RINGBUF_Close( CLDFB_RINGBUF_HANDLE *ph )
return;
}
-void CLDFB_RINGBUF_Push( CLDFB_RINGBUF_HANDLE h, const float *real, const float *imag, uint16_t num_bands )
+
+/*---------------------------------------------------------------------*
+ * ivas_CLDFB_RINGBUF_Push()
+ *
+ * Push a single column onto the back of the CLDFB ring buffer from real and imag arrays.
+ *---------------------------------------------------------------------*/
+
+void ivas_CLDFB_RINGBUF_Push(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ const float *real,
+ const float *imag,
+ const int16_t num_bands )
{
assert( num_bands <= CLDFB_NO_CHANNELS_MAX );
- assert( !CLDFB_RINGBUF_IsFull( h ) );
+ assert( !ivas_cldfb_ringbuf_IsFull( h ) );
- mvr2r( real, &h->real[h->write_pos], (int16_t) num_bands );
- mvr2r( imag, &h->imag[h->write_pos], (int16_t) num_bands );
+ mvr2r( real, &h->real[h->write_pos], num_bands );
+ mvr2r( imag, &h->imag[h->write_pos], num_bands );
h->write_pos += CLDFB_NO_CHANNELS_MAX;
if ( h->write_pos == h->capacity )
@@ -133,18 +186,29 @@ void CLDFB_RINGBUF_Push( CLDFB_RINGBUF_HANDLE h, const float *real, const float
return;
}
-void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16_t num_bands )
+
+/*---------------------------------------------------------------------*
+ * ivas_CLDFB_RINGBUF_Pop()
+ *
+ * Pop a single column from the front of the CLDFB ring buffer into real and imag arrays.
+ *---------------------------------------------------------------------*/
+
+void ivas_CLDFB_RINGBUF_Pop(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ float *real,
+ float *imag,
+ const int16_t num_bands )
{
assert( num_bands <= CLDFB_NO_CHANNELS_MAX );
- assert( !CLDFB_RINGBUF_IsEmpty( h ) );
+ assert( !ivas_cldfb_ringbuf_IsEmpty( h ) );
if ( real != NULL )
{
- mvr2r( &h->real[h->read_pos], real, (int16_t) num_bands );
+ mvr2r( &h->real[h->read_pos], real, num_bands );
}
if ( imag != NULL )
{
- mvr2r( &h->imag[h->read_pos], imag, (int16_t) num_bands );
+ mvr2r( &h->imag[h->read_pos], imag, num_bands );
}
h->read_pos += CLDFB_NO_CHANNELS_MAX;
@@ -158,10 +222,17 @@ void CLDFB_RINGBUF_Pop( CLDFB_RINGBUF_HANDLE h, float *real, float *imag, uint16
return;
}
-/* Returns total number of buffered samples (including number of channels) */
-static uint32_t total_size( CLDFB_RINGBUF_HANDLE h )
+
+/*---------------------------------------------------------------------*
+ * ivas_cldfb_ringbuf_total_size()
+ *
+ * Returns total number of buffered samples (including number of channels)
+ *---------------------------------------------------------------------*/
+
+static uint32_t ivas_cldfb_ringbuf_total_size(
+ ISAR_CLDFB_RINGBUF_HANDLE h )
{
- if ( CLDFB_RINGBUF_IsFull( h ) )
+ if ( ivas_cldfb_ringbuf_IsFull( h ) )
{
return h->capacity;
}
@@ -170,14 +241,31 @@ static uint32_t total_size( CLDFB_RINGBUF_HANDLE h )
{
return h->write_pos - h->read_pos;
}
+
/* else wrap around */
return h->write_pos + h->capacity - h->read_pos;
}
-void CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_imag, int16_t col_idx )
+
+/*---------------------------------------------------------------------*
+ * ivas_CLDFB_RINGBUF_GetByIdx()
+ *
+ * Get pointers into a specific column in the CLDFB ring buffer based on given index.
+ * Non-negative indices access from the front of the ring buffer, negative indexes access
+ * from the back, similar to Python arrays. For example:
+ *
+ * - index 0 accesses the front of the buffer, i.e. the oldest CLDFB column in the queue.
+ * - index -1 accesses the back of the buffer, i.e. the newest (last pushed) CLDFB column in the queue.
+ *---------------------------------------------------------------------*/
+
+void ivas_CLDFB_RINGBUF_GetByIdx(
+ ISAR_CLDFB_RINGBUF_HANDLE h,
+ float **p_real,
+ float **p_imag,
+ const int16_t col_idx )
{
int32_t idx = col_idx * CLDFB_NO_CHANNELS_MAX;
- int32_t num_floats = (int32_t) total_size( h );
+ int32_t num_floats = (int32_t) ivas_cldfb_ringbuf_total_size( h );
uint32_t offset, uidx;
assert( -num_floats <= idx && idx <= num_floats );
@@ -205,21 +293,7 @@ void CLDFB_RINGBUF_GetByIdx( CLDFB_RINGBUF_HANDLE h, float **p_real, float **p_i
*p_real = &h->real[offset];
*p_imag = &h->imag[offset];
-}
-
-int16_t CLDFB_RINGBUF_IsEmpty( CLDFB_RINGBUF_HANDLE h )
-{
- return (int16_t) ( h->read_pos == h->write_pos && !h->is_full );
-}
-int16_t CLDFB_RINGBUF_IsFull( CLDFB_RINGBUF_HANDLE h )
-{
- return h->is_full;
-}
-
-uint16_t CLDFB_RINGBUF_Size( CLDFB_RINGBUF_HANDLE h )
-{
- return (uint16_t) ( total_size( h ) / CLDFB_NO_CHANNELS_MAX );
+ return;
}
-
#endif
diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c
index 7b2630fd67db94fb27706a55dc7d38ed53c15ab6..9e40f63ee8b32f711694044e410d35102ba9f8b4 100644
--- a/lib_rend/ivas_dirac_dec_binaural_functions.c
+++ b/lib_rend/ivas_dirac_dec_binaural_functions.c
@@ -796,11 +796,7 @@ static void ivas_dirac_dec_binaural_internal(
for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ )
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_Push(
- st_ivas->hSplitBinRend->hMultiBinCldfbData[ch],
- tmp_Cldfb_out_re[ch][i],
- tmp_Cldfb_out_im[ch][i],
- CLDFB_NO_CHANNELS_MAX );
+ ivas_CLDFB_RINGBUF_Push( st_ivas->hSplitBinRend->hMultiBinCldfbData[ch], tmp_Cldfb_out_re[ch][i], tmp_Cldfb_out_im[ch][i], CLDFB_NO_CHANNELS_MAX );
#else
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
@@ -869,7 +865,6 @@ static void ivas_dirac_dec_binaural_internal(
#endif
nchanSeparateChannels, st_ivas->hMasaIsmData );
-
/* re-use reverb and decorr from main direction for the sides */
ivas_dirac_dec_binaural_process_output( hDiracDecBin, hSpatParamRendCom, st_ivas->cldfbSynDec, output_f, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in,
max_band_decorr, numInChannels, config_data.processReverb, subframe, tmp_Cldfb_out_re, tmp_Cldfb_out_im,
@@ -881,11 +876,7 @@ static void ivas_dirac_dec_binaural_internal(
for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe]; i++ )
{
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- CLDFB_RINGBUF_Push(
- st_ivas->hSplitBinRend->hMultiBinCldfbData[pos_idx * BINAURAL_CHANNELS + ch],
- tmp_Cldfb_out_re[ch][i],
- tmp_Cldfb_out_im[ch][i],
- CLDFB_NO_CHANNELS_MAX );
+ ivas_CLDFB_RINGBUF_Push( st_ivas->hSplitBinRend->hMultiBinCldfbData[pos_idx * BINAURAL_CHANNELS + ch], tmp_Cldfb_out_re[ch][i], tmp_Cldfb_out_im[ch][i], CLDFB_NO_CHANNELS_MAX );
#else
mvr2r( tmp_Cldfb_out_re[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
mvr2r( tmp_Cldfb_out_im[ch][i], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[pos_idx * BINAURAL_CHANNELS + ch][hSpatParamRendCom->slots_rendered + i], CLDFB_NO_CHANNELS_MAX );
diff --git a/lib_rend/ivas_td_ring_buffer.c b/lib_rend/ivas_td_ring_buffer.c
index 6381a00e90b9e10cfb80ed9736b79394f999c821..f1fdab3af8143b15aaa1583ea998bca7d1c72a18 100644
--- a/lib_rend/ivas_td_ring_buffer.c
+++ b/lib_rend/ivas_td_ring_buffer.c
@@ -66,6 +66,7 @@ static int16_t ivas_td_ringbuf_has_space_for_num_samples(
return (int16_t) ( ivas_td_ringbuf_total_size( h ) + num_samples <= h->capacity );
}
+
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
static void ivas_td_ringbuf_push_interleaved(
TD_RINGBUF_HANDLE h, /* i/o: Ring buffer handle */
@@ -101,6 +102,7 @@ static void ivas_td_ringbuf_push_interleaved(
}
#endif
+
/*-----------------------------------------------------------------------*
* Global function definitions
*-----------------------------------------------------------------------*/
@@ -192,9 +194,9 @@ void ivas_TD_RINGBUF_Close(
*---------------------------------------------------------------------*/
void ivas_TD_RINGBUF_PushInterleaved(
- TD_RINGBUF_HANDLE h, /* i/o: Ring buffer handle */
- const float *data, /* i : Input audio in interleaved channels layout */
- const uint32_t num_samples_per_channel /* i : Number of samples per channel to push */
+ TD_RINGBUF_HANDLE h, /* i/o: Ring buffer handle */
+ const float *data, /* i : Input audio in interleaved channels layout */
+ const uint32_t num_samples_per_channel /* i : Number of samples per channel to push */
)
{
ivas_td_ringbuf_push_interleaved( h, data, num_samples_per_channel, 1 );
@@ -202,6 +204,7 @@ void ivas_TD_RINGBUF_PushInterleaved(
return;
}
+
/*---------------------------------------------------------------------*
* ivas_TD_RINGBUF_PushChannels()
*
diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c
index f12216a376bfe46f2a947e8f69acf250e0f12341..ef5324e64e6d4ba253dafb2bdb1e63b1dff34396 100644
--- a/lib_rend/lib_rend.c
+++ b/lib_rend/lib_rend.c
@@ -1483,7 +1483,7 @@ static ivas_error alignInputDelay(
int32_t numSamplesToPush, numSamplesToPop;
uint32_t ringBufferSize, preDelay;
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
- int32_t i;
+ int16_t i;
const float *p_read_channels[MAX_INPUT_CHANNELS];
float *p_write_channels[MAX_INPUT_CHANNELS];
#endif
@@ -7837,7 +7837,6 @@ static ivas_error getSamplesInternal(
return IVAS_ERR_OK;
}
-
/*-------------------------------------------------------------------*
* IVAS_REND_GetSamples()
*
@@ -7896,11 +7895,10 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream(
IVAS_REND_AudioBufferConfig *pSplitEncBufConfig;
ISAR_SPLIT_REND_CONFIG_HANDLE pSplitRendConfig;
ISAR_SPLIT_REND_BITS_DATA bits;
-
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
float *p_Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX];
float *p_Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX];
- int32_t j;
+ int16_t j;
for ( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
{