Commit 7d276345 authored by Jan Kiene's avatar Jan Kiene
Browse files

Accept FIX_2500_RENDCONF_REFACTOR

parent d57c3d2e
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -531,13 +531,11 @@ int main(
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif

        aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader );
        if ( aeCount > 0 )
@@ -618,27 +616,11 @@ 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 )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Invalid reverberation configuration parameters\n\n" );
                    goto cleanup;
                }
            }
            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.
@@ -2362,13 +2344,11 @@ static ivas_error decodeG192(
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
    }

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -2568,27 +2548,11 @@ 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 )
                        {
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" );
                                goto cleanup;
                            }
                        }
                        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 ) );
+0 −34
Original line number Diff line number Diff line
@@ -1173,13 +1173,11 @@ int main(
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
@@ -1196,27 +1194,11 @@ 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 )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nInvalid room acoustics configuration parameters\n\n" );
                    goto cleanup;
                }
            }
            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.
@@ -1623,27 +1605,11 @@ 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 )
                {
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nInvalid acoustic environment configuration parameters\n\n" );
                        goto cleanup;
                    }
                }
                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 ) );
+0 −1
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@
/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt. TS 26.258 V3.0 */

#define FIX_2500_RENDCONF_REFACTOR                      /* Eri: Basop issue #2500: Renderer configuration range check before conversion to fixed point. Harmonize between BASOP/float */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION         /* Eri: Basop issue 2023: Distance attenuation scaling, synch with BASOP updates and adding clamping of distance att input and listener position  */
#define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE  /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
+0 −137
Original line number Diff line number Diff line
@@ -1240,7 +1240,6 @@ static int32_t errorHandler(
 * Verifies if the configuration parameters lie within acceptable limits
 *------------------------------------------------------------------------------------------*/

#ifdef FIX_2500_RENDCONF_REFACTOR
ivas_error RenderConfigReader_checkValues(
    RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader           */
)
@@ -1388,142 +1387,6 @@ ivas_error RenderConfigReader_checkValues(

    return IVAS_ERR_OK;
}
#else
ivas_error RenderConfigReader_checkValues(
    IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o  : Renderer configuration handle          */
)
{
    int16_t band_idx, tab_value_err_count;
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoom_acoustics;
    pRoom_acoustics = &hRenderConfig->roomAcoustics;
    tab_value_err_count = 0;
    int16_t wall_idx;
    int16_t i;


    /* Verify the number of frequency bands in the config input data */
    if ( ( pRoom_acoustics->nBands > N_BANDS_MAX ) || ( pRoom_acoustics->nBands < N_BANDS_MIN ) )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    /* Verify input pre-delay value */
    if ( ( pRoom_acoustics->inputPreDelay > INPUTPREDELAY_MAX ) || ( pRoom_acoustics->inputPreDelay < INPUTPREDELAY_MIN ) )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    /* Verify data per band in the acoustic properties table */
    for ( band_idx = 0; band_idx < pRoom_acoustics->nBands; band_idx++ )
    {
        /* Verify if the frequencies are in the ascending order (required for interpolation) */
        if ( band_idx != 0 )
        {
            if ( pRoom_acoustics->pFc_input[band_idx] <= pRoom_acoustics->pFc_input[band_idx - 1] )
            {
                tab_value_err_count++;
            }
        }

        /* Check the input frequencies */
        if ( ( pRoom_acoustics->pFc_input[band_idx] > FC_INPUT_MAX ) || ( pRoom_acoustics->pFc_input[band_idx] < FC_INPUT_MIN ) )
        {
            tab_value_err_count++;
        }

        /* Check the input RT60 values */
        if ( ( pRoom_acoustics->pAcoustic_rt60[band_idx] > ACOUSTIC_RT60_MAX ) || ( pRoom_acoustics->pAcoustic_rt60[band_idx] < ACOUSTIC_RT60_MIN ) )
        {
            tab_value_err_count++;
        }

        /* Check the input DSR values */
        if ( ( pRoom_acoustics->pAcoustic_dsr[band_idx] > ACOUSTIC_DSR_MAX ) || ( pRoom_acoustics->pAcoustic_dsr[band_idx] < ACOUSTIC_DSR_MIN ) )
        {
            tab_value_err_count++;
        }

        /* Replace zero DSR values with very small positive values, to avoid issues with coloration filter design */
        if ( pRoom_acoustics->pAcoustic_dsr[band_idx] <= 0.0f )
        {
            pRoom_acoustics->pAcoustic_dsr[band_idx] = ACOUSTIC_DSR_EPSILON;
        }
    }

    if ( tab_value_err_count != 0 )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    if ( pRoom_acoustics->use_er == 1 )
    {
        /* Room dimensions */
        if ( pRoom_acoustics->dimensions.x < ER_MIN_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.x = ER_MIN_ROOM_DIMENSION;
        }
        if ( pRoom_acoustics->dimensions.x > ER_MAX_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.x = ER_MAX_ROOM_DIMENSION;
        }
        if ( pRoom_acoustics->dimensions.y < ER_MIN_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.y = ER_MIN_ROOM_DIMENSION;
        }
        if ( pRoom_acoustics->dimensions.y > ER_MAX_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.y = ER_MAX_ROOM_DIMENSION;
        }
        if ( pRoom_acoustics->dimensions.z < ER_MIN_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.z = ER_MIN_ROOM_DIMENSION;
        }
        if ( pRoom_acoustics->dimensions.z > ER_MAX_ROOM_DIMENSION )
        {
            pRoom_acoustics->dimensions.z = ER_MAX_ROOM_DIMENSION;
        }

        /* Abs Coeff */
        for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ )
        {
            if ( pRoom_acoustics->AbsCoeff[wall_idx] < ER_MIN_ABS_COEFF )
            {
                pRoom_acoustics->AbsCoeff[wall_idx] = ER_MIN_ABS_COEFF;
            }
            if ( pRoom_acoustics->AbsCoeff[wall_idx] > ER_MAX_ABS_COEFF )
            {
                pRoom_acoustics->AbsCoeff[wall_idx] = ER_MAX_ABS_COEFF;
            }
        }

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        /* 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           */
        hRenderConfig->distAtt[1] = min( max( 0, hRenderConfig->distAtt[1] ), DIST_ATT_MAX_REFDIST );
        hRenderConfig->distAtt[0] = min( max( hRenderConfig->distAtt[1], hRenderConfig->distAtt[0] ), DIST_ATT_MAX_MAXDIST );
        hRenderConfig->distAtt[2] = min( max( 0.0f, hRenderConfig->distAtt[2] ), DIST_ATT_MAX_ROLLOFF );
#else
        /* Verify range of distance attenuation parameters: 0.1 <= distAtt[0] <= distAtt[1] */
        /*                                                  0.0 <= distAtt[2] <= 10.0       */
        hRenderConfig->distAtt[0] = max( 0.1f, hRenderConfig->distAtt[0] );
        hRenderConfig->distAtt[1] = max( hRenderConfig->distAtt[0], hRenderConfig->distAtt[1] );
        hRenderConfig->distAtt[2] = max( 0.0f, min( 10.0f, hRenderConfig->distAtt[2] ) );
#endif

        /* Verify range of directivity patterns */
        for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
        {
            hRenderConfig->directivity[i * 3] = max( 0.0f, min( 360.0f, hRenderConfig->directivity[i * 3] ) );
            hRenderConfig->directivity[i * 3 + 1] = max( 0.0f, min( 360.0f, hRenderConfig->directivity[i * 3 + 1] ) );
            hRenderConfig->directivity[i * 3 + 2] = max( 0.0f, min( 1.0f, hRenderConfig->directivity[i * 3 + 2] ) );
        }
    }


    return IVAS_ERR_OK;
}
#endif


/*------------------------------------------------------------------------------------------*
+0 −4
Original line number Diff line number Diff line
@@ -80,11 +80,7 @@ ivas_error RenderConfigReader_getDistanceAttenuation(
);
/* Verifies configuration parameters                                                        */
ivas_error RenderConfigReader_checkValues(
#ifdef FIX_2500_RENDCONF_REFACTOR
    RenderConfigReader *pRenderConfigReader /* i/o: Renderer configuration reader           */
#else
    IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* o  : Renderer configuration handle           */
#endif
);

/* Reads a configuration                                                                    */