Commit 458de603 authored by sbsarac's avatar sbsarac
Browse files

Combine decoder and renderer work

parent cde72ad2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@
    <ClCompile Include="..\lib_util\evs_rtp_payload.c" />
    <ClCompile Include="..\lib_util\g192.c" />
    <ClCompile Include="..\lib_util\quaternion_file_writer.c" />
    <ClCompile Include="..\lib_util\rotation_file_writer.c" />
    <ClCompile Include="..\lib_util\vector3_pair_file_reader.c" />
    <ClCompile Include="..\lib_util\hrtf_file_reader.c" />
    <ClCompile Include="..\lib_util\ism_file_reader.c" />
@@ -139,7 +138,6 @@
    <ClInclude Include="..\lib_util\evs_rtp_payload.h" />
    <ClInclude Include="..\lib_util\g192.h" />
    <ClInclude Include="..\lib_util\quaternion_file_writer.h" />
    <ClInclude Include="..\lib_util\rotation_file_writer.h" />
    <ClInclude Include="..\lib_util\vector3_pair_file_reader.h" />
    <ClInclude Include="..\lib_util\hrtf_file_reader.h" />
    <ClInclude Include="..\lib_util\ism_file_reader.h" />
+25 −25
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
#include "quaternion_file_writer.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -119,7 +119,7 @@ typedef struct
    bool voipMode;
    bool enableHeadRotation;
    char *headrotTrajFileName;
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    bool mainOrientationWriterEnabled;
    char *mainOrientationFilename;
    bool trackedRotationWriterEnabled;
@@ -183,7 +183,7 @@ typedef struct

static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, QuaternionFileWriter *mainOrientWriter, QuaternionFileWriter *trackRotWriter, QuaternionFileWriter *combOrientWriter, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#else
@@ -231,7 +231,7 @@ int main(
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    RotFileReader *refRotReader = NULL;
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter *mainOrientWriter = NULL;
    QuaternionFileWriter *trackRotWriter = NULL;
    QuaternionFileWriter *combOrientWriter = NULL;
@@ -371,7 +371,7 @@ int main(
        }
    }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    /*------------------------------------------------------------------------------------------*
     * Open main orientation output file for writing
     *------------------------------------------------------------------------------------------*/
@@ -948,7 +948,7 @@ int main(

    if ( arg.voipMode )
    {
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, mainOrientWriter, trackRotWriter, combOrientWriter, referenceVectorReader, hIvasDec );
#else
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
@@ -956,7 +956,7 @@ int main(
    }
    else
    {
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
#ifdef SPLIT_REND_WITH_HEAD_ROT
        error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, mainOrientWriter, trackRotWriter, combOrientWriter, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
#else
@@ -1038,7 +1038,7 @@ cleanup:
    RotationFileReader_close( &headRotReader );
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &refRotReader );
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter_close( &mainOrientWriter );
    QuaternionFileWriter_close( &trackRotWriter );
    QuaternionFileWriter_close( &combOrientWriter );
@@ -1194,7 +1194,7 @@ static bool parseCmdlIVAS_dec(

    arg->enableHeadRotation = false;
    arg->headrotTrajFileName = NULL;
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    arg->mainOrientationWriterEnabled = false;
    arg->mainOrientationFilename = NULL;
    arg->trackedRotationWriterEnabled = false;
@@ -1436,8 +1436,8 @@ static bool parseCmdlIVAS_dec(
            arg->headrotTrajFileName = argv[i];
            i++;
        }
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
        else if ( strcmp( argv_to_upper, "-MORI" ) == 0 )
#ifdef FIX_1100_OUTPUT_ORIENT
        else if ( strcmp( argv_to_upper, "-MOOF" ) == 0 )
        {
            arg->mainOrientationWriterEnabled = true;
            i++;
@@ -1452,7 +1452,7 @@ static bool parseCmdlIVAS_dec(
            arg->mainOrientationFilename = argv[i];
            i++;
        }
        else if ( strcmp( argv_to_upper, "-TROT" ) == 0 )
        else if ( strcmp( argv_to_upper, "-TROF" ) == 0 )
        {
            arg->trackedRotationWriterEnabled = true;
            i++;
@@ -1467,7 +1467,7 @@ static bool parseCmdlIVAS_dec(
            arg->trackedRotationFilename = argv[i];
            i++;
        }
        else if ( strcmp( argv_to_upper, "-CORI" ) == 0 )
        else if ( strcmp( argv_to_upper, "-COOF" ) == 0 )
        {
            arg->combinedOrientationWriterEnabled = true;
            i++;
@@ -1946,10 +1946,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 NONBE_FIX_1100_OUTPUT_ORIENT
    fprintf( stdout, "-mori File          : Main orientation data output File\n" );
    fprintf( stdout, "-trot File          : Tracked rotation data output File\n" );
    fprintf( stdout, "-cori File          : Combined orientation data output File\n" );
#ifdef FIX_1100_OUTPUT_ORIENT
    fprintf( stdout, "-moof File          : Main orientation data output File\n" );
    fprintf( stdout, "-trof File          : Tracked rotation data output File\n" );
    fprintf( stdout, "-coof File          : Combined orientation data output File\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" );
@@ -2366,7 +2366,7 @@ static ivas_error decodeG192(
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter *mainOrientWriter,
    QuaternionFileWriter *trackRotWriter,
    QuaternionFileWriter *combOrientWriter,
@@ -2614,7 +2614,7 @@ static ivas_error decodeG192(
                }
            }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
            if ( arg.mainOrientationWriterEnabled )
            {
                IVAS_QUATERNION orientation;
@@ -2681,7 +2681,7 @@ static ivas_error decodeG192(
            }
        }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
        if ( arg.combinedOrientationWriterEnabled && ( arg.enableHeadRotation || arg.enableExternalOrientation ) )
        {
            IVAS_QUATERNION orientation;
@@ -3035,7 +3035,7 @@ static ivas_error decodeG192(
                goto cleanup;
            }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
            if ( arg.mainOrientationWriterEnabled )
            {
                IVAS_QUATERNION orientation;
@@ -3076,7 +3076,7 @@ static ivas_error decodeG192(
#endif
        }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
        if ( arg.combinedOrientationWriterEnabled && ( arg.enableHeadRotation || arg.enableExternalOrientation ) )
        {
            IVAS_QUATERNION orientation;
@@ -3388,7 +3388,7 @@ static ivas_error decodeVoIP(
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter *mainOrientWriter,
    QuaternionFileWriter *trackRotWriter,
    QuaternionFileWriter *combOrientWriter,
@@ -3647,7 +3647,7 @@ static ivas_error decodeVoIP(
                }
            }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
            if ( arg.mainOrientationWriterEnabled )
            {
                IVAS_QUATERNION orientation;
@@ -3716,7 +3716,7 @@ static ivas_error decodeVoIP(
            }
        }

#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
        if ( arg.combinedOrientationWriterEnabled && ( arg.enableHeadRotation || arg.enableExternalOrientation ) )
        {
            IVAS_QUATERNION orientation;
+31 −31
Original line number Diff line number Diff line
@@ -45,8 +45,8 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#include "rotation_file_writer.h"
#ifdef FIX_1100_OUTPUT_ORIENT
#include "quaternion_file_writer.h"
#endif
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
@@ -181,7 +181,7 @@ typedef struct
    char externalOrientationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    char mainOrientationOutputFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char trackedOrientationOutputFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char combinedOrientationOutputFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
@@ -237,7 +237,7 @@ typedef enum
#endif
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    CmdLnOptionId_mainOrientationOutputFile,
    CmdLnOptionId_trackedRotationOutputFile,
    CmdLnOptionId_combinedOrientationOutputFile,
@@ -393,24 +393,24 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "exof",
        .description = "External orientation trajectory file for simulation of external orientations",
    },
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    {
        .id = CmdLnOptionId_mainOrientationOutputFile,
        .match = "main_orientation_output_file",
        .matchShort = "moof",
        .description = "Main orientation output file",
        .description = "Main orientation data output File",
    },
    {
        .id = CmdLnOptionId_trackedRotationOutputFile,
        .match = "tracked_rotation_output_file",
        .matchShort = "trof",
        .description = "Tracked rotation output file",
        .description = "Tracked rotation data output File",
    },
    {
        .id = CmdLnOptionId_combinedOrientationOutputFile,
        .match = "combined_orientation_output_file",
        .matchShort = "coof",
        .description = "Combined orientation output file",
        .description = "Combined orientation data output File",
    },
#endif
    {
@@ -723,10 +723,10 @@ int main(
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    RotFileReader *referenceRotReader = NULL;
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
    RotFileWriter *mainOrientationFileWriter = NULL;
    RotFileWriter *trackedRotationFileWriter = NULL;
    RotFileWriter *combinedOrientationFileWriter = NULL;
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter *mainOrientationFileWriter = NULL;
    QuaternionFileWriter *trackedRotationFileWriter = NULL;
    QuaternionFileWriter *combinedOrientationFileWriter = NULL;
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS];
@@ -841,7 +841,7 @@ int main(
    convert_backslash( args.referenceRotationFilePath );
    convert_backslash( args.inLfePanningMatrixFile );
    convert_backslash( args.externalOrientationFilePath );
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    convert_backslash( args.mainOrientationOutputFilePath );
    convert_backslash( args.trackedOrientationOutputFilePath );
    convert_backslash( args.combinedOrientationOutputFilePath );
@@ -889,10 +889,10 @@ int main(
        }
    }

#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    if ( !isEmptyString( args.mainOrientationOutputFilePath ) )
    {
        if ( RotationFileWriter_open( args.mainOrientationOutputFilePath, &mainOrientationFileWriter ) != IVAS_ERR_OK )
        if ( QuaternionFileWriter_open( args.mainOrientationOutputFilePath, &mainOrientationFileWriter ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", args.mainOrientationOutputFilePath );
            exit( -1 );
@@ -901,7 +901,7 @@ int main(

    if ( !isEmptyString( args.trackedOrientationOutputFilePath ) )
    {
        if ( RotationFileWriter_open( args.trackedOrientationOutputFilePath, &trackedRotationFileWriter ) != IVAS_ERR_OK )
        if ( QuaternionFileWriter_open( args.trackedOrientationOutputFilePath, &trackedRotationFileWriter ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", args.trackedOrientationOutputFilePath );
            exit( -1 );
@@ -910,7 +910,7 @@ int main(

    if ( !isEmptyString( args.combinedOrientationOutputFilePath ) )
    {
        if ( RotationFileWriter_open( args.combinedOrientationOutputFilePath, &combinedOrientationFileWriter ) != IVAS_ERR_OK )
        if ( QuaternionFileWriter_open( args.combinedOrientationOutputFilePath, &combinedOrientationFileWriter ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error opening file: %s\n", args.combinedOrientationOutputFilePath );
            exit( -1 );
@@ -1794,8 +1794,8 @@ int main(
            }
        }

#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
        if ( mainOrientationFileWriter != NULL )
#ifdef FIX_1100_OUTPUT_ORIENT
        if ( mainOrientationFileWriter != NULL && headRotReader != NULL )
        {
            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            {
@@ -1806,7 +1806,7 @@ int main(
                    fprintf( stderr, "Error while getting main orientation: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
                if ( ( error = RotationFileWriter_write( mainOrientationFileWriter, &mainOrientation ) ) != IVAS_ERR_OK )
                if ( ( error = QuaternionFileWriter_writeFrame( mainOrientationFileWriter, mainOrientation ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error while writing main orientation data: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
@@ -1814,7 +1814,7 @@ int main(
            }
        }

        if ( trackedRotationFileWriter != NULL )
        if ( trackedRotationFileWriter != NULL && headRotReader != NULL )
        {
            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            {
@@ -1825,7 +1825,7 @@ int main(
                    fprintf( stderr, "Error while getting main orientation: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
                if ( ( error = RotationFileWriter_write( trackedRotationFileWriter, &trackedRotation ) ) != IVAS_ERR_OK )
                if ( ( error = QuaternionFileWriter_writeFrame( trackedRotationFileWriter, trackedRotation ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error while writing main orientation data: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
@@ -1833,7 +1833,7 @@ int main(
            }
        }

        if ( combinedOrientationFileWriter != NULL )
        if ( combinedOrientationFileWriter != NULL && ( headRotReader != NULL || externalOrientationFileReader != NULL ) )
        {
            for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
            {
@@ -1844,7 +1844,7 @@ int main(
                    fprintf( stderr, "Error while getting main orientation: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
                if ( ( error = RotationFileWriter_write( combinedOrientationFileWriter, &combinedOrientation ) ) != IVAS_ERR_OK )
                if ( ( error = QuaternionFileWriter_writeFrame( combinedOrientationFileWriter, combinedOrientation ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error while writing main orientation data: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
@@ -2260,10 +2260,10 @@ cleanup:
    RotationFileReader_close( &headRotReader );
    RotationFileReader_close( &externalOrientationFileReader );
    RotationFileReader_close( &referenceRotReader );
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
    RotationFileWriter_close( &mainOrientationFileWriter );
    RotationFileWriter_close( &trackedRotationFileWriter );
    RotationFileWriter_close( &combinedOrientationFileWriter );
#ifdef FIX_1100_OUTPUT_ORIENT
    QuaternionFileWriter_close( &mainOrientationFileWriter );
    QuaternionFileWriter_close( &trackedRotationFileWriter );
    QuaternionFileWriter_close( &combinedOrientationFileWriter );
#endif

    Vector3PairFileReader_close( &referenceVectorReader );
@@ -2838,7 +2838,7 @@ static CmdlnArgs defaultArgs(
    clearString( args.renderConfigFilePath );
    clearString( args.externalOrientationFilePath );

#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
    clearString( args.mainOrientationOutputFilePath );
    clearString( args.trackedOrientationOutputFilePath );
    clearString( args.combinedOrientationOutputFilePath );
@@ -2960,7 +2960,7 @@ static void parseOption(
            assert( numOptionValues == 1 );
            strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
#ifdef FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS
#ifdef FIX_1100_OUTPUT_ORIENT
        case CmdLnOptionId_mainOrientationOutputFile:
            assert( numOptionValues == 1 );
            strncpy( args->mainOrientationOutputFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
+1 −2
Original line number Diff line number Diff line
@@ -176,8 +176,7 @@

#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR          /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define FIX_1050_EFAP_ALLOC                             /* FhG: issue 1050: reduction of memory allocated to EFAP handle */
#define NONBE_FIX_1100_OUTPUT_ORIENT                    /* Philips: issue 1100: Output for main/tracked/combined orientation for the decoder application */
#define FIX_1066_ORIENTATION_OUTPUT_FUNCTIONS           /* Philips: issue 1066: orientation output functions support */
#define FIX_1100_OUTPUT_ORIENT                    /* Philips: issue 1100: Output for main/tracked/combined orientation for the decoder application */

/* #################### End BE switches ################################## */

+1 −1
Original line number Diff line number Diff line
@@ -2501,7 +2501,7 @@ static void bsCompactToSerial( const uint8_t *compact, uint16_t *serial, uint16_
}


#ifdef NONBE_FIX_1100_OUTPUT_ORIENT
#ifdef FIX_1100_OUTPUT_ORIENT
/*-------------------------------------------------------------------*
 * IVAS_DEC_GetMainOrientation()
 *
Loading