Commit 945a5036 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'main' to '196-refactor-renderer-output-configuration'

parents 15e8c00c 64f3259c
Loading
Loading
Loading
Loading
Loading
+1 −63
Original line number Diff line number Diff line
@@ -83,9 +83,7 @@ static
#ifdef VARIABLE_SPEED_DECODING
#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20
#endif
#ifdef JBM_TSM_ON_TCS
#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20
#endif

typedef struct
{
@@ -137,12 +135,10 @@ typedef struct
    char *tsmScaleFileName;
    uint16_t tsmScale;
#endif
#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
    uint16_t frontendFetchSizeMs;
#endif
#endif
#endif

} DecArguments;

@@ -219,11 +215,7 @@ int main(
     * Open decoder handle
     *------------------------------------------------------------------------------------------*/

#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -407,26 +399,13 @@ int main(
    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/
#ifdef FIX_356_ISM_METADATA_SYNC
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#endif
#endif

    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

#ifdef JBM_TSM_ON_TCS
    /*------------------------------------------------------------------------------------------*
     * Configure VoIP mode
     *------------------------------------------------------------------------------------------*/
@@ -451,7 +430,6 @@ int main(
    }
#endif
#endif
#endif

#ifdef DEBUGGING
    /*-----------------------------------------------------------------*
@@ -687,17 +665,6 @@ int main(

    if ( arg.voipMode )
    {
#ifndef JBM_TSM_ON_TCS
#ifdef VARIABLE_SPEED_DECODING
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
#endif
        error = decodeVoIP( arg, hBsReader, hIvasDec );
    }
#ifdef VARIABLE_SPEED_DECODING
@@ -965,11 +932,9 @@ static bool parseCmdlIVAS_dec(
    arg->tsmScaleFileEnabled = false;
    arg->tsmScaleFileName = NULL;
#endif
#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
    arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS;
#endif
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    arg->noBadFrameDelay = false;
#endif
@@ -1138,7 +1103,6 @@ static bool parseCmdlIVAS_dec(
            }
        }
#endif
#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
        else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 )
        {
@@ -1159,7 +1123,6 @@ static bool parseCmdlIVAS_dec(
            }
        }
#endif
#endif
#endif /* #ifdef DEBUGGING */

        else if ( strcmp( argv_to_upper, "-MIME" ) == 0 )
@@ -1452,11 +1415,9 @@ static void usage_dec( void )
    fprintf( stdout, "-VS fac             : Variable Speed mode: change speed of playout fac as integer in percent.\n" );
    fprintf( stdout, "                      50 <= fac <= 150; fac<100 faster, fac>100 slower\n" );
#endif
#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
    fprintf( stdout, "-VOIP_framesize     : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" );
#endif
#endif
#endif
    fprintf( stdout, "-fec_cfg_file       : Optimal channel aware configuration computed by the JBM   \n" );
    fprintf( stdout, "                      as described in Section 6.3.1 of TS26.448. The output is \n" );
@@ -2141,10 +2102,8 @@ static ivas_error decodeVoIP(

    uint32_t nextPacketRcvTime_ms = 0;
    uint32_t systemTime_ms = 0;
#ifdef JBM_TSM_ON_TCS
    uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS;
    int32_t nFramesWritten = 0;
#endif
    int32_t nFramesFed = 0;


@@ -2280,26 +2239,18 @@ static ivas_error decodeVoIP(
     * Main receiving/decoding loop
     *------------------------------------------------------------------------------------------*/

#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
    systemTimeInc_ms = arg.frontendFetchSizeMs;
#endif
#endif

    while ( 1 )
    {
        int16_t nOutSamples = 0;
#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING )
        uint16_t nSamplesAvailableNext = 0;
#endif
#ifdef JBM_TSM_ON_TCS
#ifdef DEBUG_JBM_CMD_OPTION
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs );
#else
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS );
#endif
#else
        nOutSamples = (int16_t) ( arg.output_Fs / 50 );
#endif
        /* read all packets with a receive time smaller than the system time */
        while ( nextPacketRcvTime_ms <= systemTime_ms )
@@ -2344,23 +2295,16 @@ static ivas_error decodeVoIP(

        /* we are finished when all packets have been received and jitter buffer is empty */
        /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */
#ifdef JBM_TSM_ON_TCS
        /* last clause should make sure that for BE tests we end up with the same number of samples...*/
        if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) )
#else
        if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec ) || nFramesFed < 2 ) )
#endif
        {
            break;
        }


        /* decode and get samples */
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms
#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING )
                                                 ,
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms,
                                                 &nSamplesAvailableNext
#endif
#ifdef SUPPORT_JBM_TRACEFILE
                                                 ,
                                                 writeJbmTraceFileFrameWrapper,
@@ -2450,7 +2394,6 @@ static ivas_error decodeVoIP(
                delayNumSamples -= nOutSamples;
            }

#ifdef JBM_TSM_ON_TCS
            /* Write ISM metadata to external file(s) */
            if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT )
            {
@@ -2497,7 +2440,6 @@ static ivas_error decodeVoIP(
                    }
                }
            }
#endif
        }

        if ( !arg.quietModeEnabled )
@@ -2506,12 +2448,8 @@ static ivas_error decodeVoIP(
        }

        frame++;
#ifdef JBM_TSM_ON_TCS
        systemTime_ms += systemTimeInc_ms;
        nFramesWritten++;
#else
        systemTime_ms += 20;
#endif

#ifdef WMOPS
        update_mem();
+1 −42
Original line number Diff line number Diff line
@@ -144,11 +144,7 @@ typedef struct
    char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef FIX_439_OTR_PARAMS
    int8_t orientation_tracking;
#else
    int8_t orientationTracking;
#endif
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
    bool delayCompensationEnabled;
@@ -810,11 +806,7 @@ int main(
        }
    }

#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -1514,54 +1506,29 @@ static bool parseDiegeticPan(

static bool parseOrientationTracking(
    char *value,
#ifdef FIX_439_OTR_PARAMS
    int8_t *orientation_tracking
#else
    int8_t *tracking_type
#endif
)
    int8_t *orientation_tracking )
{
    to_upper( value );

    if ( strcmp( value, "NONE" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
        *tracking_type = IVAS_ORIENT_TRK_NONE;
#endif
    }
    else if ( strcmp( value, "REF" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF;
#endif
    }
    else if ( strcmp( value, "AVG" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_AVG;
#else
        *tracking_type = IVAS_ORIENT_TRK_AVG;
#endif
    }
    else if ( strcmp( value, "REF_VEC" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC;
#endif
    }
    else if ( strcmp( value, "REF_VEC_LEV" ) == 0 )
    {
#ifdef FIX_439_OTR_PARAMS
        *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV;
#else
        *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV;
#endif
    }
    else
    {
@@ -1804,11 +1771,7 @@ static CmdlnArgs defaultArgs(
    clearString( args.customHrtfFilePath );
    clearString( args.renderConfigFilePath );

#ifdef FIX_439_OTR_PARAMS
    args.orientation_tracking = HEAD_ORIENT_TRK_NONE;
#else
    args.orientationTracking = IVAS_ORIENT_TRK_NONE;
#endif
    args.nonDiegeticPan = 0;
    args.nonDiegeticPanGain = 0.f;

@@ -1916,11 +1879,7 @@ static void parseOption(
            break;
        case CmdLnOptionId_orientationTracking:
            assert( numOptionValues == 1 );
#ifdef FIX_439_OTR_PARAMS
            if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) )
#else
            if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) )
#endif
            {
                fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] );
                exit( -1 );
+0 −51
Original line number Diff line number Diff line
@@ -772,27 +772,15 @@ int16_t get_ivas_max_num_indices_metadata( /* o
        }
        else if ( ivas_total_brate <= IVAS_256k )
        {
#ifdef FIX_483b
            return 1050;
#else
            return 1000;
#endif
        }
        else if ( ivas_total_brate <= IVAS_384k )
        {
#ifdef FIX_509
            return 2000;
#else
            return 1500;
#endif
        }
        else
        {
#ifdef FIX_509
            return 2500;
#else
            return 2000;
#endif
        }
    }
    else if ( ivas_format == MASA_FORMAT )
@@ -803,59 +791,31 @@ int16_t get_ivas_max_num_indices_metadata( /* o
        }
        else if ( ivas_total_brate <= IVAS_32k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 125;
#else
            return 110;
#endif
        }
        else if ( ivas_total_brate <= IVAS_48k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 205;
#else
            return 180;
#endif
        }
        else if ( ivas_total_brate <= IVAS_96k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 240;
#else
            return 200;
#endif
        }
        else if ( ivas_total_brate <= IVAS_128k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 305;
#else
            return 250;
#endif
        }
        else if ( ivas_total_brate <= IVAS_160k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 425;
#else
            return 320;
#endif
        }
        else if ( ivas_total_brate <= IVAS_192k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 630;
#else
            return 430;
#endif
        }
        else if ( ivas_total_brate <= IVAS_256k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 850;
#else
            return 600;
#endif
        }
        else if ( ivas_total_brate <= IVAS_384k )
        {
@@ -863,11 +823,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o
        }
        else
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 1750;
#else
            return 1500;
#endif
        }
    }
    else if ( ivas_format == MC_FORMAT )
@@ -882,11 +838,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o
        }
        else if ( ivas_total_brate <= IVAS_64k )
        {
#ifdef FIX_502_IND_LIST_SIZE
            return 210;
#else
            return 200;
#endif
        }
        else if ( ivas_total_brate <= IVAS_96k )
        {
@@ -2942,9 +2894,6 @@ ivas_error preview_indices(
                if ( bit_stream[2] == 0 )
                {
                    st_ivas->ivas_format = SBA_FORMAT;
#ifndef SBA_MODE_CLEAN_UP
                    st_ivas->sba_mode = ivas_sba_mode_select();
#endif
                }
                else
                {
+0 −2
Original line number Diff line number Diff line
@@ -2240,13 +2240,11 @@ enum
    VOIP_RTPDUMP
};

#ifdef FIX_489_COV_SMOOTHING
typedef enum _COV_SMOOTHING_TYPE
{
    COV_SMOOTH_SPAR,
    COV_SMOOTH_MC
} COV_SMOOTHING_TYPE;
#endif

/* clang-format on */
#endif /* CNST_H */
+0 −2
Original line number Diff line number Diff line
@@ -94,7 +94,6 @@ typedef struct
    float x, y, z;
} IVAS_VECTOR3;

#ifdef FIX_439_OTR_PARAMS
typedef enum
{
    HEAD_ORIENT_TRK_NONE,
@@ -103,7 +102,6 @@ typedef enum
    HEAD_ORIENT_TRK_REF_VEC,
    HEAD_ORIENT_TRK_REF_VEC_LEV
} HEAD_ORIENT_TRK_T;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE;
Loading