Commit ba61e9a7 authored by vaclav's avatar vaclav
Browse files

framework-related and formal improvements

parent fec95298
Loading
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@
    <ClCompile Include="..\lib_dec\ari_hm_dec.c" />
    <ClCompile Include="..\lib_dec\avq_dec.c" />
    <ClCompile Include="..\lib_dec\bass_psfilter.c" />
    <ClCompile Include="..\lib_dec\cldfb_ring_buffer.c" />
    <ClCompile Include="..\lib_dec\cng_dec.c" />
    <ClCompile Include="..\lib_dec\core_dec_init.c" />
    <ClCompile Include="..\lib_dec\core_dec_reconf.c" />
@@ -207,6 +206,7 @@
    <ClCompile Include="..\lib_dec\inov_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_agc_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_binRenderer_internal.c" />
    <ClCompile Include="..\lib_dec\ivas_cldfb_ring_buffer.c" />
    <ClCompile Include="..\lib_dec\ivas_corecoder_dec_reconfig.c" />
    <ClCompile Include="..\lib_dec\ivas_core_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_cpe_dec.c" />
@@ -313,7 +313,6 @@
    <ClCompile Include="..\lib_dec\ivas_sns_dec.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\cldfb_ring_buffer.h" />
    <ClInclude Include="..\lib_dec\ivas_rom_dec.h" />
    <ClInclude Include="..\lib_dec\ivas_stat_dec.h" />
    <ClInclude Include="..\lib_dec\jbm_jb4sb.h" />
+4 −7
Original line number Diff line number Diff line
@@ -277,9 +277,6 @@
    <ClCompile Include="..\lib_dec\bass_psfilter.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\cldfb_ring_buffer.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\cng_dec.c">
      <Filter>decoder_all_c</Filter>
    </ClCompile>
@@ -518,11 +515,11 @@
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\lib_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_cldfb_ring_buffer.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\cldfb_ring_buffer.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\ivas_stat_dec.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
+19 −26
Original line number Diff line number Diff line
@@ -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
    {
@@ -1906,7 +1905,6 @@ static ivas_error initOnFirstGoodFrame(
        else
#endif
        {

            if ( *pRemainingDelayNumSamples < *numOutSamples )
            {
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
@@ -2115,7 +2113,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
@@ -2455,11 +2453,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;
                }
@@ -3380,15 +3378,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, nOutSamples, (void *) pcmBuf, splitRendBits, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
                if ( ( error = IVAS_DEC_VoIP_GetSplitBinauralBitstream( hIvasDec, (void *) pcmBuf, splitRendBits, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
                                                                        &bitstreamReadDone,
                                                                        &nSamplesRendered,
                                                                        &parametersAvailableForEditing,
                                                                        systemTime_ms ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSplitBinauralBitstream: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
@@ -3398,7 +3392,7 @@ static ivas_error decodeVoIP(
            {
#endif
#ifdef SUPPORT_JBM_TRACEFILE
                if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
                if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, &nSamplesRendered, &parameterAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
@@ -3490,15 +3484,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 ) );
@@ -3523,6 +3515,7 @@ static ivas_error decodeVoIP(
                    goto cleanup;
                }
            }

            if ( !isSplitCoded )
            {
#endif
+37 −0
Original line number Diff line number Diff line
@@ -5195,6 +5195,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

lib_dec/cldfb_ring_buffer.h

deleted100644 → 0
+0 −108
Original line number Diff line number Diff line
/******************************************************************************************************

   (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 <stdint.h>

#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
Loading