Commit 2d4c92c4 authored by vaclav's avatar vaclav
Browse files

Merge branch 'main' into 237-external-renderer-function-declarations-2

parents 06bbc81a 75b78040
Loading
Loading
Loading
Loading
+73 −12
Original line number Diff line number Diff line
@@ -94,10 +94,8 @@ typedef struct
    float FER;
    bool hrtfReaderEnabled;
    char *hrtfFileName;
#ifdef HRTF_BINARY_FILE
    bool hrtfCRendReaderEnabled;
    char *hrtfCRendFileName;
#endif
    IVAS_DEC_INPUT_FORMAT inputFormat;
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
@@ -446,7 +444,6 @@ int main(
            goto cleanup;
        }

#ifdef HRTF_BINARY_FILE

        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
@@ -472,7 +469,6 @@ int main(
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfCRendFileName );
        }
#endif
    }

    /*-----------------------------------------------------------------*
@@ -539,12 +535,10 @@ cleanup:
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
#ifdef HRTF_BINARY_FILE
#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
#endif
#endif
    }
    IVAS_DEC_Close( &hIvasDec );
@@ -594,6 +588,9 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config(
    char argv_to_upper[FILENAME_MAX];

    strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
    argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
    to_upper( argv_to_upper );

    if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */
@@ -672,7 +669,9 @@ static bool parseCmdlIVAS_dec(
    char argv_to_upper[FILENAME_MAX];
#ifdef DEBUGGING
    float ftmp;
#ifndef FIX_343_TO_UPPER
    char stmp[FILENAME_MAX];
#endif

    arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED;
    arg->forceSubframeBinauralization = false;
@@ -702,10 +701,8 @@ static bool parseCmdlIVAS_dec(
    arg->hrtfReaderEnabled = false;
    arg->hrtfFileName = NULL;

#ifdef HRTF_BINARY_FILE
    arg->hrtfCRendReaderEnabled = false;
    arg->hrtfCRendFileName = NULL;
#endif

    arg->customLsOutputEnabled = false;
    arg->customLsSetupFilename = NULL;
@@ -736,6 +733,9 @@ static bool parseCmdlIVAS_dec(
    while ( argv[i][0] == '-' )
    {
        strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
        argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
        to_upper( argv_to_upper );

        if ( strcmp( argv_to_upper, "-VOIP" ) == 0 )
@@ -743,13 +743,21 @@ static bool parseCmdlIVAS_dec(
            arg->voipMode = 1;
            i++;
        }
#ifdef FIX_343_TO_UPPER
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 )
#else
        else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 )
#endif
        {
            arg->voipMode = 1;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP;
            i++;
        }
#ifdef FIX_343_TO_UPPER
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 )
#else
        else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 )
#endif
        {
            arg->voipMode = 1;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF;
@@ -822,8 +830,14 @@ static bool parseCmdlIVAS_dec(
            i++;
            if ( i < argc - 3 )
            {
#ifdef FIX_343_TO_UPPER
                strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
                argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
                arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper );
#else
                strncpy( stmp, argv[i], sizeof( stmp ) );
                arg->forcedRendMode = parseForcedRendModeDec( stmp );
#endif
                i++;
            }
        }
@@ -875,8 +889,30 @@ static bool parseCmdlIVAS_dec(
                usage_dec();
                return false;
            }

#ifdef FIX_343_TO_UPPER
            strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            to_upper( argv_to_upper );

            if ( strcmp( argv_to_upper, "REF" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF;
            }
            else if ( strcmp( argv_to_upper, "AVG" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG;
            }
            else
            {
                fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", argv[i + 1] );
                usage_dec();
                return false;
            }
#else
            char tmp[4];
            strcpy( tmp, argv[i + 1] );

            if ( strcmp( to_upper( tmp ), "REF" ) == 0 )
            {
                arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF;
@@ -891,6 +927,7 @@ static bool parseCmdlIVAS_dec(
                usage_dec();
                return false;
            }
#endif
            i += 2;
        }
        else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 )
@@ -917,6 +954,33 @@ static bool parseCmdlIVAS_dec(
                return false;
            }

#ifdef FIX_343_TO_UPPER
            strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) )
            {
                arg->no_diegetic_pan = 0.f;
            }
            else if ( ( strcmp( argv_to_upper, "LEFT" ) == 0 ) || ( strchr( argv_to_upper, 'L' ) != NULL ) )
            {
                arg->no_diegetic_pan = -1.f;
            }
            else if ( ( strcmp( argv_to_upper, "RIGHT" ) == 0 ) || ( strchr( argv_to_upper, 'R' ) != NULL ) )
            {
                arg->no_diegetic_pan = 1.f;
            }
            else
            {
                arg->no_diegetic_pan = (float) atof( argv_to_upper );

                if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f )
                {
                    fprintf( stderr, "Error: Incorrect value for panning option argument specified: %s\n\n", argv[i] );
                    usage_dec();
                    return false;
                }
            }
#else
            char *param = to_upper( argv[i] );
            if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) )
            {
@@ -941,6 +1005,7 @@ static bool parseCmdlIVAS_dec(
                    return false;
                }
            }
#endif
            i++;
        }

@@ -1075,11 +1140,7 @@ static void usage_dec( void )
    fprintf( stdout, "                      which of the two supported formats is in use.\n" );
    fprintf( stdout, "                      default bitstream file format is G.192\n" );
    fprintf( stdout, "-T File             : Head rotation specified by external trajectory File\n" );
#ifdef HRTF_BINARY_FILE
    fprintf( stdout, "-hrtf File          : HRTF filter File used in BINAURAL output configuration\n" );
#else
    fprintf( stdout, "-hrtf File          : HRTF filter File used in ISm format and BINAURAL output configuration\n" );
#endif
#ifdef DEBUGGING
    fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" );
    fprintf( stdout, "                      output time resolution is larger.\n" );
+30 −1
Original line number Diff line number Diff line
@@ -884,7 +884,11 @@ static bool parseCmdlIVAS_enc(
    while ( i < argc - 4 )
    {
        strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
#ifdef FIX_343_TO_UPPER
        argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
#endif
        to_upper( argv_to_upper );

        /*-----------------------------------------------------------------*
         * Bandwidth limitation
         *-----------------------------------------------------------------*/
@@ -894,6 +898,9 @@ static bool parseCmdlIVAS_enc(
            arg->max_bwidth_user = true;

            strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 );
#ifdef FIX_343_TO_UPPER
            stmp[sizeof( stmp ) - 1] = '\0';
#endif
            to_upper( stmp );

            if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 )
@@ -1081,7 +1088,9 @@ static bool parseCmdlIVAS_enc(
            if ( i < argc - 4 )
            {
                strncpy( stmp, argv[i], sizeof( stmp ) );

#ifdef FIX_343_TO_UPPER
                stmp[sizeof( stmp ) - 1] = '\0';
#endif
                to_upper( argv[i] );
                if ( strcmp( argv[i], "LO" ) == 0 )
                {
@@ -1369,6 +1378,25 @@ static bool parseCmdlIVAS_enc(

            if ( i < argc - 4 )
            {
#ifdef FIX_343_TO_UPPER
                if ( strcmp( argv[i], "5_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1;
                }
                else if ( strcmp( argv[i], "7_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1;
                }
                else if ( strcmp( argv[i], "5_1_2" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2;
                }
                else if ( strcmp( argv[i], "5_1_4" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4;
                }
                else if ( strcmp( argv[i], "7_1_4" ) == 0 )
#else
                if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 )
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1;
@@ -1386,6 +1414,7 @@ static bool parseCmdlIVAS_enc(
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4;
                }
                else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 )
#endif
                {
                    arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4;
                }
+9 −0
Original line number Diff line number Diff line
@@ -460,6 +460,9 @@ static void setupWithSingleFormatInput(
            /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */
            char charBuf[FILENAME_MAX];
            strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 );
#ifdef FIX_343_TO_UPPER
            charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0';
#endif
            to_upper( charBuf );
            if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 )
            {
@@ -1080,6 +1083,9 @@ static bool parseInConfig(

    /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */
    strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 );
#ifdef FIX_343_TO_UPPER
    charBuf[sizeof( charBuf ) - 1] = '\0';
#endif
    to_upper( charBuf );
    if ( strcmp( charBuf, "META" ) == 0 )
    {
@@ -1265,6 +1271,9 @@ static IVAS_REND_AudioConfig parseAudioConfig(
    charBuf[13] = '\0';

    strncpy( charBuf, configString, sizeof( charBuf ) - 1 );
#ifdef FIX_343_TO_UPPER
    charBuf[sizeof( charBuf ) - 1] = '\0';
#endif
    to_upper( charBuf );

    if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) )
+0 −4
Original line number Diff line number Diff line
@@ -92,14 +92,10 @@ typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE;
typedef float IVAS_REND_LfePanMtx[IVAS_MAX_INPUT_LFE_CHANNELS][IVAS_MAX_OUTPUT_CHANNELS];

typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
#ifdef HRTF_BINARY_FILE
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
#endif
#ifdef HRTF_BINARY_FILE
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;

typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
#endif

#ifdef DEBUGGING
typedef enum
+0 −13
Original line number Diff line number Diff line
@@ -1363,16 +1363,12 @@ typedef enum

#define BINAURAL_MAXBANDS                       60                          /* Max number of bands */
#define BINAURAL_CONVBANDS                      50                          /* Bands upto which convolution is performed */
#ifdef HRTF_BINARY_FILE
#define BINAURAL_NTAPS                           7
#endif
#define BINAURAL_NTAPS_MAX                      96

#define HRTF_SH_ORDER                           3
#define HRTF_SH_CHANNELS                        16
#ifdef HRTF_BINARY_FILE
#define HRTF_LS_CHANNELS                        15
#endif
#define HRTF_NUM_BINS                           60
#define REVERB_PREDELAY_MAX                     20                          /* Max input delay for reverb module */
#define GAIN_LFE                                1.88364911f                 /* Gain applied to LFE during renderering */
@@ -1381,7 +1377,6 @@ typedef enum

#define BINAURAL_COHERENCE_DIFFERENCE_BINS      9                           /* Number of bins for direction-dependent diffuse-field binaural coherence */

#ifdef HRTF_BINARY_FILE
typedef enum 
{
    BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
@@ -1391,7 +1386,6 @@ typedef enum

} BINAURAL_INPUT_AUDIO_CONFIG;

#endif
#define HEADROT_ORDER                           3
#define HEADROT_SHMAT_DIM                       ( ( HEADROT_ORDER + 1 ) * ( HEADROT_ORDER + 1 ) )
#define HEADROT_SHMAT_DIM2                      ( HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM )
@@ -1414,16 +1408,9 @@ typedef enum
#define SFX_SPAT_BIN_NUM_SUBSAMPLES             64
#define ITD_MEM_LEN                             (MAX_ITD + SFX_SPAT_BIN_SINC_M)
#define L_SUBFRAME5MS_48k                       (L_FRAME48k/4)
#ifdef FIX_337_TDREND_INTP
#define MAX_ANGULAR_STEP                        (1.0f)
#else
#define MAX_ANGULAR_STEP                        (15.0f)
#endif
#define MAX_ANGULAR_STEP_INV                    ( 1.0f / MAX_ANGULAR_STEP )
#define MAX_INTERPOLATION_STEPS                 12
#ifndef FIX_310_TD_REND_DELAY
#define BINAURAL_TD_LATENCY_S                   0.0f                        /* ITD fix removes TD renderer delay -- should be cleaned out */
#endif

/* ----- Enums - TD Renderer ----- */

Loading