Commit c328e08f authored by Devansh Kandpal's avatar Devansh Kandpal
Browse files

First changes - porting socket connection features (needs debugging)

parent 440c2cb0
Loading
Loading
Loading
Loading
+275 −3
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

#include "lib_dec.h"
#include <string.h>
#include <stdbool.h>
#include "cmdl_tools.h"
#include "audio_file_writer.h"
#include "bitstream_reader.h"
@@ -43,11 +44,17 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#include "common_api_types.h"
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
#include "socket_comm.h"
#include "ivas_error_utils.h"
#endif
#include "split_render_file_read_write.h"
#include "vector3_pair_file_reader.h"
#include "wmc_auto.h"
#include "options.h"
#include "stl.h"
#include "cnst.h"


#define WMC_TOOL_SKIP
@@ -102,6 +109,10 @@ typedef struct
    bool voipMode;
    bool enableHeadRotation;
    char *headrotTrajFileName;
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    bool enableHeadrotTrajSocket;
    uint16_t socketPort;
#endif
    bool enableReferenceRotation;
    char *refrotTrajFileName;
    bool enableReferenceVectorTracking;
@@ -135,16 +146,22 @@ typedef struct

} DecArguments;


/*------------------------------------------------------------------------------------------*
 * Local functions prototypes
 *------------------------------------------------------------------------------------------*/

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
static ivas_error parseQuaternionData( char *rxBuffer, IVAS_QUATERNION *pQuaternion );
#endif 
static void usage_dec( void );
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, unsigned int hSocket, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, unsigned int hSocket, IVAS_DEC_HANDLE hIvasDec );
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );

#endif

/*------------------------------------------------------------------------------------------*
 * main()
@@ -177,6 +194,13 @@ int main(
    IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    uint32_t hSocket = (uint32_t) NULL;
#endif

    //hHrtfBinary.hHrtfTD = NULL;         /* just to avoid compilation warning */
    //hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */


#ifdef WMOPS
    reset_wmops();
@@ -254,17 +278,39 @@ int main(
        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
            fprintf( stderr, "\nError: Head-rotation cannot be used in this output configuration.\n\n" );
#else
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
#endif
            goto cleanup;
        }

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
        if ( arg.enableHeadrotTrajSocket )
        {
            if ( ( error = SocketComm_start( &hSocket, arg.socketPort ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError: Can't start socket communication \n\n" );
                goto cleanup;
            }
        }
        else
        {
            if ( ( error = RotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError: Can't open head-rotation file %s \n\n", arg.headrotTrajFileName );
                goto cleanup;
            }
        }
#else
        if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK )
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
@@ -681,11 +727,20 @@ int main(

    if ( arg.voipMode )
    {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hSocket, hIvasDec );
#else
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
#endif
    }
    else
    {

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hSocket, &splitRendBits, hIvasDec, pcmBuf );
#else
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
    }

    if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -752,6 +807,13 @@ cleanup:
    Vector3PairFileReader_close( &referenceVectorReader );
    RenderConfigReader_close( &renderConfigReader );

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    if ( arg.enableHeadrotTrajSocket )
    {
        SocketComm_close( hSocket );
    }
#endif

    if ( BS_Reader_Close( &hBsReader ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError while closing file: %s\nContinuing...\n\n", arg.inputBitstreamFilename );
@@ -885,9 +947,15 @@ static bool parseCmdlIVAS_dec(

    arg->enableHeadRotation = false;
    arg->headrotTrajFileName = NULL;
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    arg->enableHeadrotTrajSocket = false;
    arg->socketPort = 0;
#endif
    arg->orientation_tracking = ORIENT_TRK_NONE;
    arg->enableReferenceRotation = false;
#ifndef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    arg->headrotTrajFileName = NULL;
#endif
    arg->enableReferenceVectorTracking = false;
    arg->referenceVectorTrajFileName = NULL;
    arg->enableExternalOrientation = false;
@@ -1024,6 +1092,14 @@ static bool parseCmdlIVAS_dec(
        }
        else if ( strcmp( argv_to_upper, "-T" ) == 0 )
        {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
            if ( arg->enableHeadRotation )
            {
                fprintf( stderr, "Error: Head rotation file and socket communication cannot be used together!\n\n" );
                usage_dec();
                return false;
            }
#endif
            arg->enableHeadRotation = true;
            i++;

@@ -1037,6 +1113,38 @@ static bool parseCmdlIVAS_dec(
            arg->headrotTrajFileName = argv[i];
            i++;
        }

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
        else if ( strcmp( argv_to_upper, "-SOCKET" ) == 0 )
        {
            if ( arg->enableHeadRotation )
            {
                fprintf( stderr, "Error: Head rotation file and socket communication cannot be used together!\n\n" );
                usage_dec();
                return false;
            }

            arg->enableHeadRotation = true;
            arg->enableHeadrotTrajSocket = true;
            i++;

            if ( argc - i <= 4 || argv[i][0] == '-' )
            {
                fprintf( stderr, "Error: Socket port not specified!\n\n" );
                usage_dec();
                return false;
            }

            arg->socketPort = (int16_t) atoi( argv[i++] );

            if ( arg->socketPort < SOCKET_PORT_MIN || arg->socketPort > SOCKET_PORT_MAX )
            {
                fprintf( stderr, "Error: Only ports in the range of %d-%d can be used!\n\n", SOCKET_PORT_MIN, SOCKET_PORT_MAX );
                usage_dec();
                return false;
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-FR" ) == 0 )
        {
            int32_t tmp;
@@ -1479,6 +1587,46 @@ static bool parseCmdlIVAS_dec(
    return true;
}

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
/*-----------------------------------------------------------------------*
 * parseQuaternionData()
 *
 * Parse Quaternion Data
 *-----------------------------------------------------------------------*/

static ivas_error parseQuaternionData(
    char *rxBuffer,              /* i  : data buffer                     */
    IVAS_QUATERNION *pQuaternion /* o  : head-tracking data              */
)
{
    float w, x, y, z;
    size_t charsConsumed;
    const char *messageHeader = "IVAS buffer request";
    const int32_t read_values = sscanf( rxBuffer, "%*[^:]%n: %f, %f, %f, %f", &charsConsumed, &w, &x, &y, &z );

    if ( read_values == 4 && charsConsumed == strlen( messageHeader ) && strncmp( rxBuffer, messageHeader, charsConsumed ) == 0 )
    {
        {
            /* Recieved values can be seen in console */
            printf( "[rotation: w=%+.2f, x=%+.2f, y=%+.2f, z=%+.2f]\n", w, x, y, z );

            //Quaternion data is in float. Conver this to fixed point in Q22 format and set the Qformat of quaternion to 22.
            pQuaternion->w_fx = (Word32) w * ONE_IN_Q22;
            pQuaternion->x_fx = (Word32) x * ONE_IN_Q22;
            pQuaternion->y_fx = (Word32) y * ONE_IN_Q22;
            pQuaternion->z_fx = (Word32) z * ONE_IN_Q22;
            // Q-factor of IVAS quaternion?? canwe set it to Q0? set to 22 later
             pQuaternion->q_fact = 22;
        }
    }
    else
    {
        return IVAS_ERROR( IVAS_ERR_INTERNAL, "Quaternion Parser: parsing error." );
    }

    return IVAS_ERR_OK;
}
#endif

/*---------------------------------------------------------------------*
 * usage_dec()
@@ -1527,6 +1675,10 @@ static void usage_dec( void )
    fprintf( stdout, "                      default bitstream file format is G.192\n" );
    fprintf( stdout, "-hrtf File          : HRTF filter File used in BINAURAL output configuration\n" );
    fprintf( stdout, "-T File             : Head rotation specified by external trajectory File\n" );
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    fprintf( stdout, "-socket port        : Socket communication for pose input and audio output\n" );
    fprintf( stdout, "                      port = 49152-65535 (range of dynamic, private or ephemeral ports\n" );
#endif
    fprintf( stdout, "-otr tracking_type  : Head orientation tracking type: 'none', 'ref', 'avg', 'ref_vec' \n" );
    fprintf( stdout, "                      or 'ref_vec_lev' (only for binaural rendering)\n" );
    fprintf( stdout, "-rf File            : Reference rotation specified by external trajectory File\n" );
@@ -1864,6 +2016,9 @@ static ivas_error decodeG192(
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    uint32_t hSocket,
#endif
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )
@@ -1908,6 +2063,10 @@ static ivas_error decodeG192(
        return error;
    }

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    char rxBuffer[SOCKET_BUFFER_SIZE];
#endif

    if ( arg.renderConfigEnabled )
    {
        if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
@@ -2024,7 +2183,11 @@ static ivas_error decodeG192(
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
            if ( headRotReader == NULL && !arg.enableHeadrotTrajSocket )
#else
            if ( headRotReader == NULL )
#endif
            {
                for ( i = 0; i < num_subframes; i++ )
                {
@@ -2043,11 +2206,42 @@ static ivas_error decodeG192(
            {
                for ( i = 0; i < num_subframes; i++ )
                {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
                    if ( arg.enableHeadrotTrajSocket )
                    {
                        if ( i % num_subframes != 0 )
                        {
                            Quaternions[i] = Quaternions[0];
                            continue;
                        }

                        if ( ( error = SocketComm_recv( hSocket, rxBuffer ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while receiving head orientation\n", IVAS_DEC_GetErrorMessage( error ) );
                            goto cleanup;
                        }

                        if ( ( error = parseQuaternionData( rxBuffer, &Quaternions[i] ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while parsing head orientation\n", IVAS_DEC_GetErrorMessage( error ) );
                            goto cleanup;
                        }
                    }
                    else
                    {
                        if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                            goto cleanup;
                        }
                    }
#else
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                        goto cleanup;
                    }
#endif
                }
            }

@@ -2128,6 +2322,22 @@ static ivas_error decodeG192(
                {
                    if ( error == IVAS_ERR_END_OF_FILE )
                    {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
                        /* Rewind the input bitstream at the end of file in case of socket communication */
                        if ( arg.enableHeadrotTrajSocket )
                        {
                            if ( ( error = BS_Reader_Rewind( hBsReader ) ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "\nError: unable to rewind input bitstream file: %s \n\n", arg.inputBitstreamFilename );
                                goto cleanup;
                            }
                            if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename );
                                goto cleanup;
                            }
                        }
#endif
                        break;
                    }
                    fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename );
@@ -2220,6 +2430,16 @@ static ivas_error decodeG192(
            {
                if ( delayNumSamples < nOutSamples )
                {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
                    if ( arg.enableHeadrotTrajSocket )
                    {
                        if ( ( error = SocketComm_send( hSocket, (char *) &pcmBuf[delayNumSamples * nOutChannels], ( nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) * ( sizeof( *pcmBuf ) / sizeof( char ) ) ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while sending audio buffer\n", IVAS_DEC_GetErrorMessage( error ) );
                            goto cleanup;
                        }
                    }
#endif
                    if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nOutput audio file writer error\n" );
@@ -2539,6 +2759,9 @@ static ivas_error decodeVoIP(
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    uint32_t hSocket,
#endif
    IVAS_DEC_HANDLE hIvasDec )
{
    bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */
@@ -2585,6 +2808,9 @@ static ivas_error decodeVoIP(
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    char rxBuffer[SOCKET_BUFFER_SIZE];
#endif
    vec_pos_update = 0;
    if ( ( error = IVAS_DEC_GetRenderFramesizeMs( hIvasDec, &systemTimeInc_ms ) ) != IVAS_ERR_OK )
    {
@@ -2748,7 +2974,11 @@ static ivas_error decodeVoIP(
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
            if ( headRotReader == NULL && !arg.enableHeadrotTrajSocket )
#else
            if ( headRotReader == NULL )
#endif
            {
                for ( i = 0; i < num_subframes; i++ )
                {
@@ -2767,11 +2997,43 @@ static ivas_error decodeVoIP(
            {
                for ( i = 0; i < num_subframes; i++ )
                {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
                    if ( arg.enableHeadrotTrajSocket )
                    {
                        if ( i % num_subframes != 0 )
                        {
                            Quaternions[i] = Quaternions[0];
                            continue;
                        }

                        if ( ( error = SocketComm_recv( hSocket, rxBuffer ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while receiving head orientation\n", IVAS_DEC_GetErrorMessage( error ) );
                            goto cleanup;
                        }

                        if ( ( error = parseQuaternionData( rxBuffer, &Quaternions[i] ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while parsing head orientation\n", IVAS_DEC_GetErrorMessage( error ) );
                            goto cleanup;
                        }
                    }
                    else
                    {
                        if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                                     RotationFileReader_getFilePath( headRotReader ) );
                            goto cleanup;
                        }
                    }
#else
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                        goto cleanup;
                    }
#endif
                }
            }

@@ -2923,6 +3185,16 @@ static ivas_error decodeVoIP(
        {
            if ( delayNumSamples < nOutSamples )
            {
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
                if ( arg.enableHeadrotTrajSocket )
                {
                    if ( ( error = SocketComm_send( hSocket, (char *) &pcmBuf[delayNumSamples * nOutChannels], ( nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) * ( sizeof( *pcmBuf ) / sizeof( char ) ) ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while sending audio buffer\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }
                }
#endif
                if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nOutput audio file writer error\n" );
+11 −0
Original line number Diff line number Diff line
@@ -126,6 +126,17 @@ typedef enum
    IVAS_ERR_NO_FILE_OPEN,
    IVAS_ERR_SAMPLING_RATE_UNKNOWN,

    
#ifdef SOCKET_INTERFACE_FOR_POSE_AND_AUDIO
    /*----------------------------------------*
     *    socket errors (lib_util only)     *
     *----------------------------------------*/
    IVAS_ERR_SOCKET_RECEIVE_FAILED,
    IVAS_ERR_SOCKET_SEND_FAILED,
    IVAS_ERR_SOCKET_TIMEOUT,
#endif


    /*----------------------------------------*
     *    renderer (lib_rend only)            *
     *----------------------------------------*/
+5 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@

/* ################### Start DEBUGGING switches ######################## */

/*#define DEBUGGING*/                             /* Allows debugging message to be printed out during runtime */
#define DEBUGGING                             /* Allows debugging message to be printed out during runtime */
#ifdef DEBUGGING
/*#define DBG_BITSTREAM_ANALYSIS*/            /* Write bitstream with annotations to a text file */
#define DEBUG_MODE_INFO                       /* Define to output most important parameters to the subdirectory "res/" */
@@ -91,6 +91,10 @@
#define FIX_1990_SANITIZER_IN_REVERB_LOAD                    /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */
#define FIX_1995_REVERB_INIT                                 /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */

#ifdef _MSC_VER
#define SOCKET_INTERFACE_FOR_POSE_AND_AUDIO                  /* Philips: Socket interface for head rotation - Windows only*/
#endif

/* #################### Start BASOP porting switches ############################ */

#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
+16 −0
Original line number Diff line number Diff line
@@ -263,6 +263,22 @@ cleanup:
    return error;
}

#if defined( SOCKET_INTERFACE_FOR_POSE_AND_AUDIO ) || defined( DEBUGGING )
ivas_error BS_Reader_Rewind( BS_READER_HANDLE hBsReader )
{
    if ( hBsReader == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    if ( hBsReader->rewind == NULL )
    {
        return IVAS_ERR_NOT_IMPLEMENTED;
    }

    return hBsReader->rewind( hBsReader->hFormatReader );
}
#endif

ivas_error BS_Reader_ReadFrame_short( BS_READER_HANDLE hBsReader, uint16_t *serial, int16_t *num_bits, int16_t *bfi )
{
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ typedef struct BS_Reader *BS_READER_HANDLE;

ivas_error BS_Reader_Open_filename( BS_READER_HANDLE *phBsReader, const char *filename, BS_READER_FORMAT format );

#if defined( SOCKET_INTERFACE_FOR_POSE_AND_AUDIO ) || defined( DEBUGGING )
ivas_error BS_Reader_Rewind( BS_READER_HANDLE hBsReader );
#endif

ivas_error BS_Reader_ReadFrame_short( BS_READER_HANDLE hBsReader, uint16_t *serial, int16_t *num_bits, int16_t *bfi );