Unverified Commit ae128fa6 authored by norvell's avatar norvell
Browse files

Cleanup under FIX_2500_RENDCONF_REFACTOR

parent 8b7c8da3
Loading
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -510,7 +510,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
@@ -593,21 +593,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.
@@ -2128,7 +2134,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
@@ -2294,21 +2300,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
@@ -1249,7 +1249,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
@@ -1266,21 +1266,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, "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.
@@ -1725,21 +1731,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, "Invalid acoustic environment configuration parameters\n\n" );
                        goto cleanup;
                    }
#endif
                }
                else
                {
                    fprintf( stderr, "Failed 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 −18
Original line number Diff line number Diff line
@@ -1276,20 +1276,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 ) )
@@ -1309,14 +1315,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++;
            }
@@ -1345,7 +1351,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 */
@@ -1389,20 +1394,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++ )
@@ -3264,8 +3272,8 @@ ivas_error RenderConfigReader_getDirectivity(
    /* Convert to Word16 */
    FOR( n = 0; n < 4; n++ )
    {
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#ifndef FIX_2500_RENDCONF_REFACTOR
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        /* Verify range of directivity patterns */
        /* Range needs to be checked before converting to fixed point -- different from float */
        directivity[n * 3] = max( 0.0f, min( 360.0f, directivity[n * 3] ) );
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,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