Commit 14199a09 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Binary/text configuration reading handling

parent 96214cdc
Loading
Loading
Loading
Loading
Loading
+18 −13
Original line number Diff line number Diff line
@@ -1443,13 +1443,17 @@ static ivas_error RenderConfigReader_readBinary(
        {
            return IVAS_ERR_FAILED_ALLOC;
        }
    }

        for ( n = 0; n < nFG; n++ )
        {
            /* Initialize memory pointers to allow safe freeing ico errors */
            pRenderConfigReader->pFG[n].pFc = NULL;
        }
        pRenderConfigReader->nFG = nFG;
    }

    /* Loop through the frequency grids read from the binary stream */
    for ( n = 0; n < nFG; n++ )
    {
        /* Read the representation method */
        value = 0;
        if ( ( error = read_bin_bits( pRenderConfigReader, &value, 2 ) ) != IVAS_ERR_OK )
@@ -1629,13 +1633,11 @@ static ivas_error RenderConfigReader_readBinary(
            free( pRenderConfigReader->pAE );
        }

        pRenderConfigReader->nAE = nAE;
        if ( ( pRenderConfigReader->pAE = (AcousticEnv *) malloc( pRenderConfigReader->nAE * sizeof( AcousticEnv ) ) ) == NULL )
        {
            return IVAS_ERR_FAILED_ALLOC;
        }
    }

        pRenderConfigReader->nAE = nAE;
        /* Initialize memory pointers to allow safe freeing ico errors */
        for ( n = 0; n < nAE; n++ )
        {
@@ -1645,8 +1647,10 @@ static ivas_error RenderConfigReader_readBinary(
            pRenderConfigReader->pAE[n].pEarlyReflections = NULL;
#endif
        }
    }

    for ( n = 0; n < pRenderConfigReader->nAE; n++ )
    /* Loop through the acoustic environments from the binary stream */
    for ( n = 0; n < nAE; n++ )
    {
        /* Read the AE ID */
        if ( ( error = get_bin_id( pRenderConfigReader, &pRenderConfigReader->pAE[n].id ) ) != IVAS_ERR_OK )
@@ -1993,6 +1997,7 @@ ivas_error RenderConfigReader_read(
                                }
#endif
                            }
                            free( pRenderConfigReader->pAE );
                            pRenderConfigReader->nAE = nAE;
                        }
                        /* Allocate memory for the acoustic environments array */