Commit 1f66104f authored by kinuthia's avatar kinuthia
Browse files

store DPIDs from file in correct struct index

- Directivity Pattern ids read from file are now stored in the correct index instead of overritting index 0.
- print informative error message when Directivity Pattern ID (DPID(s)) specified is/are not found.
- Repeat last DPID value for remaining objects if not all objects' DPID are specified when -DPID commandline flag is used. e.g if -DPID 0 1 is equivalent to -DPID 0 1 1 1 .
parent 38df9e18
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -719,7 +719,11 @@ int main(

        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#else
            fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
#endif
            goto cleanup;
        }

@@ -1125,7 +1129,11 @@ static bool parseCmdlIVAS_dec(
    arg->acousticEnvironmentId = 0;
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
        arg->directivityPatternId[i] = 65535;
#else
        arg->directivityPatternId[i] = 0;
#endif
    }
    /*-----------------------------------------------------------------*
     * Initialization
+4 −0
Original line number Diff line number Diff line
@@ -2689,7 +2689,11 @@ static CmdlnArgs defaultArgs(

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
        args.directivityPatternId[i] = 65535;
#else
        args.directivityPatternId[i] = 0;
#endif
    }

    args.acousticEnvironmentId = 0;
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@
#define FIX_718_JBM_MD_UDPATE                           /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */
#define FIX_719_CRASH_IN_CLEANUP                        /* VA: issue 719: fix Decoder crash after call to goto to cleanup */
#define FIX_708_DPID_COMMAND_LINE                       /* issue 708: sanity checks for '-dpid' command-line */
#define FIX_730_DPID_NOT_SET_CORRECTLY                  /* Eri: issue 730: write dpid read from file in correct index, print informative error message when DPID specified is not found. */



+29 −0
Original line number Diff line number Diff line
@@ -2620,7 +2620,9 @@ ivas_error RenderConfigReader_read(
                    return IVAS_ERR_INVALID_RENDER_CONFIG;
                }
                idx = strtol( strtok( NULL, ":" ), NULL, 0 );
#ifndef FIX_730_DPID_NOT_SET_CORRECTLY
                pRenderConfigReader->pDP->id = idx;
#endif

                params_idx = 0;
                pValue = (char *) calloc( strlen( pParams ), sizeof( char ) );
@@ -2628,13 +2630,20 @@ ivas_error RenderConfigReader_read(
                {
                    params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 );
#ifdef DEBUGGING
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
                    fprintf( stderr, "        PARAM: %s -> %s, DIRECTIVITYPATTERN -> %u\n", item, pValue, idx );
#else
                    fprintf( stderr, "        PARAM: %s -> %s\n", item, pValue );
#endif
#endif
                    /* Allocate memory for directivity arrays*/
                    if ( ( pRenderConfigReader->pDP[accDPIdx].pDirectivity = (float *) malloc( 3 * sizeof( float ) ) ) == NULL )
                    {
                        return IVAS_ERR_FAILED_ALLOC;
                    }
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
                    pRenderConfigReader->pDP[accDPIdx].id = idx;
#endif
                    if ( strcmp( item, "DIRECTIVITY" ) == 0 )
                    {
                        if ( read_txt_vector( pValue, 3, pRenderConfigReader->pDP[accDPIdx].pDirectivity ) )
@@ -2829,6 +2838,9 @@ ivas_error RenderConfigReader_getDirectivity(
)
{
    uint16_t n, m;
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
    uint16_t last_specified_id;
#endif
    bool idExists;


@@ -2847,6 +2859,23 @@ ivas_error RenderConfigReader_getDirectivity(
    }
    else
    {
#ifdef FIX_730_DPID_NOT_SET_CORRECTLY
        last_specified_id = id[0];

        /* set unpspecified Directivity Patterns ID to last specified ID */
        for (n = MAX_NUM_OBJECTS-1; n > 0; n--)
        {
            if ( id[n] != 65535 )
            {
                last_specified_id = id[n];
                break;
            }
        }
        for ( ; n < MAX_NUM_OBJECTS; n++ )
        {
            id[n] = last_specified_id;
        }
#endif
        for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
        {
            idExists = false;