Commit 4bb4f161 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

mend

parent e949e07f
Loading
Loading
Loading
Loading
+43 −13
Original line number Diff line number Diff line
@@ -1374,6 +1374,7 @@ static ivas_error RenderConfigReader_readBinary(
    uint32_t signx, signy, k;
#endif
    uint32_t i, m, n;
    uint32_t nFG, nAE;
    ivas_error error;
    float freqHop;
    uint32_t gridLen;
@@ -1422,25 +1423,33 @@ static ivas_error RenderConfigReader_readBinary(
    /****************************/

    /* Number of frequency grids */
    if ( ( error = get_bin_count_or_index( pRenderConfigReader, &pRenderConfigReader->nFG ) ) != IVAS_ERR_OK )
    if ( ( error = get_bin_count_or_index( pRenderConfigReader, &nFG ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /* Allocate memory for the frequency grids */
    if ( nFG > 0 )
    {
        if ( pRenderConfigReader->nFG > 0 )
        {
            for ( n = 0; n < pRenderConfigReader->nFG; n++ )
            {
                free( pRenderConfigReader->pFG[n].pFc );
            }
            free( pRenderConfigReader->pFG );
        }
        if ( ( pRenderConfigReader->pFG = (FrequencyGrid *) malloc( pRenderConfigReader->nFG * sizeof( FrequencyGrid ) ) ) == NULL )
        {
            return IVAS_ERR_FAILED_ALLOC;
        }
    }

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

    for ( n = 0; n < pRenderConfigReader->nFG; n++ )
    {
        /* Read the representation method */
        value = 0;
        if ( ( error = read_bin_bits( pRenderConfigReader, &value, 2 ) ) != IVAS_ERR_OK )
@@ -1595,19 +1604,40 @@ static ivas_error RenderConfigReader_readBinary(
    /**********************************/

    /* Number of acoustic environments */
    if ( ( error = get_bin_count_or_index( pRenderConfigReader, &pRenderConfigReader->nAE ) ) != IVAS_ERR_OK )
    if ( ( error = get_bin_count_or_index( pRenderConfigReader, &nAE ) ) != IVAS_ERR_OK )
    {
        return IVAS_ERR_INVALID_RENDER_CONFIG;
    }

    /* Allocate memory for the acoustic environments array */
    if ( nAE > 0 )
    {
        if ( pRenderConfigReader->nAE > 0 )
        {
            for ( n = 0; n < pRenderConfigReader->nAE; n++ )
            {
                free( pRenderConfigReader->pAE[n].pRT60 );
                free( pRenderConfigReader->pAE[n].pDSR );
#ifdef CONTROL_METADATA_EARLY_REFLECTIONS
                if ( pRenderConfigReader->pAE[n].pEarlyReflections != NULL )
                {
                    free( pRenderConfigReader->pAE[n].pEarlyReflections->pListenerOrigin );
                    free( pRenderConfigReader->pAE[n].pEarlyReflections );
                }
#endif
            }
            free( pRenderConfigReader->pAE );
        }

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

    /* Initialize memory pointers to allow safe freeing ico errors */
    for ( n = 0; n < pRenderConfigReader->nAE; n++ )
    for ( n = 0; n < nAE; n++ )
    {
        pRenderConfigReader->pAE[n].pRT60 = NULL;
        pRenderConfigReader->pAE[n].pDSR = NULL;
+47 −0
Original line number Diff line number Diff line
[roomAcoustics]
frequencyGridCount = 3;
acousticEnvironmentCount = 1;

[frequencyGrid:0]
method = individualFrequencies;
nrBands = 31;
frequencies  = [20.0, 25.0, 31.5, 40.0,
                50.0, 63.0, 80.0, 100.0,
                125.0, 160.0, 200.0, 250.0,
                315.0, 400.0, 500.0, 630.0,
                800.0, 1000.0, 1250.0, 1600.0,
                2000.0, 2500.0, 3150.0, 4000.0,
                5000.0, 6300.0, 8000.0, 10000.0,
                12500.0, 16000.0, 20000.0];

[frequencyGrid:1]
method = defaultBanding;
defaultGrid = 2;

[frequencyGrid:2]
method = startHopAmount;
nrBands = 31;
startFrequency = 20;
frequencyHop = 1.259921050;

[acousticEnvironment:0]
frequencyGridIndex = 1;
predelay = 0.1;
rt60 = [1.3622, 1.4486, 1.3168, 1.5787,
        1.4766, 1.3954, 1.2889, 1.3462,
        1.0759, 1.0401, 1.0970, 1.0850,
        1.0910, 1.0404, 1.0499, 1.0699,
        1.1028, 1.1714, 1.1027, 1.0666,
        1.0550, 1.0553, 1.0521, 1.0569,
        1.0421, 0.97822, 0.80487, 0.75944,
        0.71945, 0.61682, 0.60031];

dsr  = [1.9952632e-08, 1.9952632e-08, 1.2589251e-08, 1.5848926e-08, 1.2589251e-08, 1.9952632e-08, 2.511887e-08, 3.9810708e-08, 1e-07, 1.9952633e-07,
        3.981071e-07, 6.3095763e-07, 7.943284e-07, 6.3095763e-07, 5.01187e-07, 5.01187e-07, 6.3095763e-07, 6.3095763e-07, 7.943284e-07, 6.3095763e-07,
        5.01187e-07, 6.3095763e-07, 6.3095763e-07, 6.3095763e-07, 5.01187e-07, 2.511887e-07, 1.2589251e-07, 1e-07, 6.309576e-08, 3.1622776e-08,
        2.511887e-08];

hasEarlyReflections = true;
earlyReflectionsSize = [4.0, 3.0, 2.5];
absorptionCoeffs = [0.2, 0.2, 0.2, 0.2, 0.3, 0.8];
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ acousticEnvironmentCount = 1;

[frequencyGrid:0]
method = individualFrequencies;
nBands = 31;
nrBands = 31;
frequencies  = [20.0, 25.0, 31.5, 40.0,
                50.0, 63.0, 80.0, 100.0,
                125.0, 160.0, 200.0, 250.0,
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ acousticEnvironmentCount = 1;

[frequencyGrid:0]
method = individualFrequencies;
nBands = 31;
nrBands = 31;
frequencies  = [20.0, 25.0, 31.5, 40.0,
                50.0, 63.0, 80.0, 100.0,
                125.0, 160.0, 200.0, 250.0,
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ acousticEnvironmentCount = 1;

[frequencyGrid:0]
method = individualFrequencies;
nBands = 31;
nrBands = 31;
frequencies  = [20.0, 25.0, 31.5, 40.0,
                50.0, 63.0, 80.0, 100.0,
                125.0, 160.0, 200.0, 250.0,