Unverified Commit 9baff5a3 authored by norvell's avatar norvell
Browse files

Cleanup under FIX_2500_RENDCONF_REFACTOR

parent 100ed848
Loading
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ int main(
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
@@ -708,21 +708,27 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Invalid reverberation configuration parameters\n\n" );
                    goto cleanup;
                }
#endif
            }
            else
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -2364,7 +2370,7 @@ static ivas_error decodeG192(
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
@@ -2567,21 +2573,27 @@ static ivas_error decodeG192(
                            arg.aeSequence.selected = 0;
                        }
                        arg.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#else
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                        {
#ifndef FIX_2500_RENDCONF_REFACTOR
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" );
                                goto cleanup;
                            }
#endif
                        }
                        else
                        {
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#endif
                        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+17 −5
Original line number Diff line number Diff line
@@ -1176,7 +1176,7 @@ int main(
#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nInvalid render configuration parameters\n\n" );
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
@@ -1196,21 +1196,27 @@ int main(
        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" );
                    goto cleanup;
                }
#endif
            }
            else
            {
                fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -1617,21 +1623,27 @@ int main(
                    args.aeSequence.selected = 0;
                }
                args.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#else
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                {
#ifndef FIX_2500_RENDCONF_REFACTOR
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nInvalid acoustic environment configuration parameters\n\n" );
                        goto cleanup;
                    }
#endif
                }
                else
                {
                    fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#endif
                if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) );
+26 −17
Original line number Diff line number Diff line
@@ -1232,20 +1232,26 @@ static int32_t errorHandler(

#ifdef FIX_2500_RENDCONF_REFACTOR
ivas_error RenderConfigReader_checkValues(
    RenderConfigReader *pRenderConfigReader /* i/o : RenderConfigReader handle              */
    RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader           */
)
{
    int16_t band_idx, tab_value_err_count;
    int16_t tab_value_err_count;
    int16_t wall_idx;
    uint32_t n, i;
    uint32_t i;
    uint32_t nBands;
    uint32_t band_idx; 
    uint32_t n;
    AcousticEnv *pAE;
    FrequencyGrid *pFG;

    tab_value_err_count = 0;

    /* Verify all acoustic environments */
    /* Check range for all Acoustic Environment IDs */
    for ( n = 0; n < pRenderConfigReader->nAE; n++ )
    {
        AcousticEnv *pAE = &pRenderConfigReader->pAE[n];
        int16_t nBands = (int16_t) pAE->pFG->nrBands;
        pAE = &pRenderConfigReader->pAE[n];
        pFG = pAE->pFG;
        nBands = pFG->nrBands;

        /* Verify the number of frequency bands in the config input data */
        if ( ( nBands > N_BANDS_MAX ) || ( nBands < N_BANDS_MIN ) )
@@ -1265,14 +1271,14 @@ ivas_error RenderConfigReader_checkValues(
            /* Verify if the frequencies are in the ascending order (required for interpolation) */
            if ( band_idx != 0 )
            {
                if ( pAE->pFG->pFc[band_idx] <= pAE->pFG->pFc[band_idx - 1] )
                if ( pFG->pFc[band_idx] <= pFG->pFc[band_idx - 1] )
                {
                    tab_value_err_count++;
                }
            }

            /* Check the input frequencies */
            if ( ( pAE->pFG->pFc[band_idx] > FC_INPUT_MAX ) || ( pAE->pFG->pFc[band_idx] < FC_INPUT_MIN ) )
            if ( ( pFG->pFc[band_idx] > FC_INPUT_MAX ) || ( pFG->pFc[band_idx] < FC_INPUT_MIN ) )
            {
                tab_value_err_count++;
            }
@@ -1301,7 +1307,6 @@ ivas_error RenderConfigReader_checkValues(
            return IVAS_ERR_WRONG_PARAMS;
        }

        /* Early reflections parameter clamping */
        if ( pAE->pEarlyReflections != NULL && pAE->pEarlyReflections->use_er == 1 )
        {
            /* Room dimensions */
@@ -1345,20 +1350,23 @@ ivas_error RenderConfigReader_checkValues(
        }
    }

    /* Apply default distance attenuation if not specified in config */
    /* Distance attenuation range check */
    if ( pRenderConfigReader->distAtt[0] == -1 )
    {
        /* Default values */
        pRenderConfigReader->distAtt[0] = 15.75f;
        pRenderConfigReader->distAtt[1] = 1.0f;
        pRenderConfigReader->distAtt[2] = 1.0f;
    }

    else
    {
        /* Verify range of distance attenuation parameters: refDist:       0.0 <= distAtt[1] <= 6.3         */
        /*                                                  maxDist:       distAtt[1] <= distAtt[0] <= 63.0 */
        /*                                                  rollOffFactor: 0 <= distAtt[2] <= 4.0           */
        pRenderConfigReader->distAtt[1] = min( max( 0, pRenderConfigReader->distAtt[1] ), DIST_ATT_MAX_REFDIST );
        pRenderConfigReader->distAtt[0] = min( max( pRenderConfigReader->distAtt[1], pRenderConfigReader->distAtt[0] ), DIST_ATT_MAX_MAXDIST );
        pRenderConfigReader->distAtt[2] = min( max( 0.0f, pRenderConfigReader->distAtt[2] ), DIST_ATT_MAX_ROLLOFF );
    }

    /* Verify range of directivity patterns */
    for ( i = 0; i < pRenderConfigReader->nDP; i++ )
@@ -1369,6 +1377,7 @@ ivas_error RenderConfigReader_checkValues(
    }

    return IVAS_ERR_OK;

}
#else
ivas_error RenderConfigReader_checkValues(
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ ivas_error RenderConfigReader_getDistanceAttenuation(
/* Verifies configuration parameters                                                        */
ivas_error RenderConfigReader_checkValues(
#ifdef FIX_2500_RENDCONF_REFACTOR
    RenderConfigReader *pRenderConfigReader /* i/o : RenderConfigReader handle             */
    RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader           */
#else
    IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o  : Renderer configuration handle           */
#endif