Commit de26f332 authored by multrus's avatar multrus
Browse files

[cleanup] accept TD5_FIX_INVALID_MEMORY_ACCESS TD5

parent 2f1c8b42
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -444,17 +444,9 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef TD5
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL )
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
#endif
        {
#ifdef TD5
            fprintf( stderr, "\nExternal Renderer Config is supported only for BINAURAL and BINAURAL_ROOM. Exiting. \n\n" );
#else
            fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n\n" );
#endif
            goto cleanup;
        }

@@ -1453,9 +1445,7 @@ static ivas_error decodeG192(
    ivas_error error = IVAS_ERR_UNKNOWN;
    uint16_t numObj = 0;
    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
#ifdef TD5
    IVAS_POSITION Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
#endif

    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -1545,11 +1535,7 @@ static ivas_error decodeG192(
        if ( arg.enableReferenceRotation )
        {
            IVAS_QUATERNION quaternion;
#ifdef TD5
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
#else
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
@@ -1568,22 +1554,14 @@ static ivas_error decodeG192(

            for ( i = 0; i < IVAS_MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
            {
#ifdef TD5
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
#else
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i] ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) );
                    goto cleanup;
                }
            }

#ifdef TD5
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions, Pos ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
+0 −15
Original line number Diff line number Diff line
@@ -126,9 +126,7 @@ typedef struct
#endif
#endif
    bool pca;
#ifdef TD5
    bool ism_extended_metadata;
#endif

} EncArguments;

@@ -381,11 +379,7 @@ int main(
            }
            break;
        case IVAS_ENC_INPUT_ISM:
#ifdef TD5
            if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects, arg.ism_extended_metadata ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForObjects( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.ism.numObjects ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
@@ -883,9 +877,7 @@ static void initArgStruct( EncArguments *arg )
    arg->caConfig = IVAS_ENC_GetDefaultChannelAwareConfig();
    arg->ca_config_file = NULL;
    arg->mimeOutput = false;
#ifdef TD5
    arg->ism_extended_metadata = false;
#endif

#ifdef DEBUGGING
    arg->forcedMode = IVAS_ENC_FORCE_UNFORCED;
@@ -1273,13 +1265,11 @@ static bool parseCmdlIVAS_enc(

            if ( i < argc - 4 )
            {
#ifdef TD5
                if ( argv[i][0] == '+' )
                {
                    argv[i]++;
                    arg->ism_extended_metadata = true;
                }
#endif
                if ( !is_digits_only( argv[i] ) )
                {
                    fprintf( stderr, "Error: Number of ISM channels must be an integer number!\n\n" );
@@ -1660,14 +1650,9 @@ static void usage_enc( void )
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
    fprintf( stdout, "-stereo [Mode]      : Stereo format, default is unified stereo \n" );
    fprintf( stdout, "                      optional for Mode: 1: DFT Stereo, 2: TD Stereo, 3: MDCT Stereo\n" );
#ifdef TD5
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
    fprintf( stdout, "                      where positive (+) means extended metadata format is used (including orientation and radius) \n" );
#else
    fprintf( stdout, "-ism Channels Files : ISM format \n" );
    fprintf( stdout, "                      where Channels specifies the number of ISMs (1-4)\n" );
#endif
    fprintf( stdout, "                      and Files specify input files containing metadata, one file per object\n" );
    fprintf( stdout, "                      (use NULL for no input metadata)\n" );
    fprintf( stdout, "-sba +/-Order       : Scene Based Audio input format (Ambisonics ACN/SN3D),\n" );
+0 −65
Original line number Diff line number Diff line
@@ -550,9 +550,7 @@ int main(
    int32_t delayTimeScale = 0;
    int16_t i, numChannels;
    ivas_error error = IVAS_ERR_OK;
#ifdef TD5
    IVAS_POSITION Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];
#endif

#ifdef WMOPS
    reset_wmops();
@@ -693,11 +691,7 @@ int main(
    }

    /* === Configure === */
#ifdef TD5
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) || ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL ) ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_InitConfig( hIvasRend, strlen( args.renderConfigFilePath ) != 0 ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error in Renderer Config Init\n" );
        exit( -1 );
@@ -708,17 +702,9 @@ int main(
        IVAS_RENDER_CONFIG_DATA renderConfig;

        /* sanity check */
#ifdef TD5
        if ( ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL ) )
#else
        if ( args.outConfig.audioConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM )
#endif
        {
#ifdef TD5
            fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL or BINAURAL_ROOM is used as output. Exiting. \n" );
#else
            fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" );
#endif
            exit( -1 );
        }

@@ -965,11 +951,7 @@ int main(
        if ( referenceRotReader != NULL )
        {
            IVAS_QUATERNION quaternion;
#ifdef TD5
            if ( ( error = HeadRotationFileReading( referenceRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
#else
            if ( HeadRotationFileReading( referenceRotReader, &quaternion ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
@@ -989,21 +971,13 @@ int main(

            for ( i = 0; i < RENDERER_HEAD_POSITIONS_PER_FRAME; i++ )
            {
#ifdef TD5
                if ( ( error = HeadRotationFileReading( headRotReader, &quatBuffer[i], &Pos[i] ) ) != IVAS_ERR_OK )
#else
                if ( HeadRotationFileReading( headRotReader, &quatBuffer[i] ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                    exit( -1 );
                }
            }
#ifdef TD5
            if ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer, Pos ) ) != IVAS_ERR_OK )
#else
            if ( IVAS_REND_SetHeadRotation( hIvasRend, quatBuffer ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
@@ -1011,11 +985,7 @@ int main(
        }
        else
        {
#ifdef TD5
            if ( ( ( error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
#else
            if ( ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_OK ) && ( IVAS_REND_SetHeadRotation( hIvasRend, NULL ) != IVAS_ERR_INVALID_OUTPUT_FORMAT ) )
#endif
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
@@ -1877,11 +1847,9 @@ void getMetadataFromFileReader(

    objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth;
    objectMetadataBuffer->positions[objIdx].elevation = ismMetadata.elevation;
#ifdef TD5
    objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius;
    objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw;
    objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch;
#endif

    return;
}
@@ -1936,11 +1904,9 @@ static void IsmPositionProvider_getNextFrame(
        {
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
#ifdef TD5
            objectMetadataBuffer->positions[objIdx].radius = 1.0f;
            objectMetadataBuffer->positions[objIdx].yaw = 0.0f;
            objectMetadataBuffer->positions[objIdx].pitch = 0.0f;
#endif
        }

        /* Wrap azimuth to lie within (-180, 180] range */
@@ -1955,7 +1921,6 @@ static void IsmPositionProvider_getNextFrame(

        /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 );
#ifdef TD5
        /* Wrap yaw to lie within (-180, 180] range */
        while ( objectMetadataBuffer->positions[objIdx].yaw < 0.0f )
        {
@@ -1968,7 +1933,6 @@ static void IsmPositionProvider_getNextFrame(

        /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 );
#endif
    }

    ++positionProvider->frameCounter;
@@ -2203,7 +2167,6 @@ static void parseObjectPosition(
    uint16_t *positionDuration )
{
    char *endptr;
#ifdef TD5
    int16_t read_values;
    float meta_prm[7] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f };

@@ -2224,34 +2187,6 @@ static void parseObjectPosition(
    position->radius = meta_prm[2];
    position->yaw = meta_prm[5];
    position->pitch = meta_prm[6];
#else

    readNextMetadataChunk( line, "," );
    *positionDuration = (uint16_t) strtol( line, &endptr, 10 );

    if ( *endptr != '\0' )
    {
        fprintf( stderr, "Error reading metadata\n" );
        exit( -1 );
    }

    readNextMetadataChunk( line, "," );
    position->azimuth = strtof( line, &endptr );

    if ( *endptr != '\0' )
    {
        fprintf( stderr, "Error reading metadata\n" );
        exit( -1 );
    }

    readNextMetadataChunk( line, "\n" );
    position->elevation = strtof( line, &endptr );
    if ( *endptr != '\0' )
    {
        fprintf( stderr, "Error reading metadata\n" );
        exit( -1 );
    }
#endif
    return;
}

+0 −8
Original line number Diff line number Diff line
@@ -78,10 +78,8 @@ typedef struct _IVAS_ISM_METADATA
    float radius;
    float spread;
    float gainFactor;
#ifdef TD5
    float yaw;
    float pitch;
#endif
} IVAS_ISM_METADATA;

typedef struct
@@ -97,13 +95,11 @@ typedef struct
} IVAS_VECTOR3;
#endif /* OTR_REFERENCE_VECTOR_TRACKING */

#ifdef TD5
typedef struct
{
    float x, y, z;

} IVAS_POSITION;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
#ifdef FIX_350_MASA_DELAY_COMP
@@ -130,11 +126,9 @@ typedef struct
{
    float azimuth;
    float elevation;
#ifdef TD5
    float radius;
    float yaw;
    float pitch;
#endif
} IVAS_REND_AudioObjectPosition;

typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
@@ -156,9 +150,7 @@ typedef struct _IVAS_RENDER_CONFIG
    IVAS_RENDER_TYPE_OVERRIDE renderer_type_override;
#endif
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics;
#ifdef TD5
    float directivity[3];
#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;

typedef struct _IVAS_LS_CUSTOM_LAYOUT
+0 −8
Original line number Diff line number Diff line
@@ -320,13 +320,11 @@ typedef enum
#define ISM_Q_STEP                              2.5f
#define ISM_Q_STEP_BORDER                       5.0f

#ifdef TD5
#define ISM_RADIUS_NBITS                       6 
#define ISM_RADIUS_MIN                         0.0f
#define ISM_RADIUS_DELTA                       0.25f /* Max radius = (2^ISM_RADIUS_NBITS-1)*0.25 = 15.75 */
#define ISM_EXTENDED_METADATA_BRATE            IVAS_64k
#define ISM_EXTENDED_METADATA_BITS             1
#endif 

/* Parametric ISM */
#define MAX_PARAM_ISM_NBANDS                    11
@@ -374,12 +372,8 @@ typedef enum
enum
{
    IND_ISM_NUM_OBJECTS,
#ifdef TD5
    IND_ISM_EXTENDED_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
    IND_ISM_METADATA_FLAG = IND_ISM_EXTENDED_FLAG + MAX_NUM_OBJECTS, /* EN2VE: Is this not supposed to be in the loop part below, since it is one per ISM? */
#else
    IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
#endif
    IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
#ifdef DISCRETE_ISM_DTX_CNG
    IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
@@ -396,10 +390,8 @@ enum
    IND_ISM_AZIMUTH = TAG_ISM_LOOP_START,
    IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_ELEVATION = TAG_ISM_LOOP_START,
#ifdef TD5
    IND_ISM_RADIUS_DIFF_FLAG = TAG_ISM_LOOP_START,
    IND_ISM_RADIUS = TAG_ISM_LOOP_START,
#endif 
    TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */
    /* --------- end of loop for objects ----------- */

Loading