Commit 0e508bf3 authored by Jan Kiene's avatar Jan Kiene
Browse files

Accept FIX_2500_RENDCONF_REFACTOR

parent 63d803d8
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -498,13 +498,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 )
@@ -584,27 +582,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.
@@ -2126,13 +2108,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 )
@@ -2295,27 +2275,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
@@ -1246,13 +1246,11 @@ int main(
            fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            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_fx ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] );
@@ -1266,27 +1264,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, "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.
@@ -1731,27 +1713,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, "Invalid acoustic environment configuration parameters\n\n" );
                        goto cleanup;
                    }
                }
                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 ) );
+0 −1
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@
/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt. TS 26.251 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, adding clamping of distance att input and listener position */
#define FIX_BASOP_2023_TDREND_DISTATT_PRECISION_BUGFIX  /* Eri: Bug discovered in cleanup of basop issue 2023 */
#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 */
+0 −124
Original line number Diff line number Diff line
@@ -1284,7 +1284,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           */
)
@@ -1432,93 +1431,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;

    /* 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 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_fx[band_idx] <= pRoom_acoustics->pFc_input_fx[band_idx - 1] )
            {
                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_fx[band_idx] == 0 )
        {
            pRoom_acoustics->pAcoustic_dsr_fx[band_idx] = ACOUSTIC_DSR_EPSILON_FX;
        }
    }

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


    if ( pRoom_acoustics->use_er == 1 )
    {
        /* Room dimensions */
        if ( pRoom_acoustics->dimensions.x_fx < ER_MIN_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.x_fx = ER_MIN_ROOM_DIMENSION_FX;
        }
        if ( pRoom_acoustics->dimensions.x_fx > ER_MAX_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.x_fx = ER_MAX_ROOM_DIMENSION_FX;
        }
        if ( pRoom_acoustics->dimensions.y_fx < ER_MIN_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.y_fx = ER_MIN_ROOM_DIMENSION_FX;
        }
        if ( pRoom_acoustics->dimensions.y_fx > ER_MAX_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.y_fx = ER_MAX_ROOM_DIMENSION_FX;
        }
        if ( pRoom_acoustics->dimensions.z_fx < ER_MIN_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.z_fx = ER_MIN_ROOM_DIMENSION_FX;
        }
        if ( pRoom_acoustics->dimensions.z_fx > ER_MAX_ROOM_DIMENSION_FX )
        {
            pRoom_acoustics->dimensions.z_fx = ER_MAX_ROOM_DIMENSION_FX;
        }

        /* Abs Coeff */
        for ( wall_idx = 0; wall_idx < IVAS_ROOM_ABS_COEFF; wall_idx++ )
        {
            if ( pRoom_acoustics->AbsCoeff_fx[wall_idx] < ER_MIN_ABS_COEFF_FX )
            {
                pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MIN_ABS_COEFF_FX;
            }
            if ( pRoom_acoustics->AbsCoeff_fx[wall_idx] > ER_MAX_ABS_COEFF_FX )
            {
                pRoom_acoustics->AbsCoeff_fx[wall_idx] = ER_MAX_ABS_COEFF_FX;
            }
        }
    }


    return IVAS_ERR_OK;
}
#endif

/*------------------------------------------------------------------------------------------*
 * RenderConfigReader_open()
@@ -3127,26 +3039,8 @@ ivas_error RenderConfigReader_getAcousticEnvironment(
#endif
            pAcEnv->nBands = (int16_t) pRenderConfigReader->pAE[n].pFG->nrBands;
            pAcEnv->inputPreDelay_fx = (Word32) ( pRenderConfigReader->pAE[n].preDelay * ONE_IN_Q27 );
#ifndef FIX_2500_RENDCONF_REFACTOR
            if ( pRenderConfigReader->pAE[n].preDelay > INPUTPREDELAY_MAX ||
                 pRenderConfigReader->pAE[n].preDelay < INPUTPREDELAY_MIN )
            {
                return IVAS_ERR_INVALID_RENDER_CONFIG;
            }
#endif
            for ( m = 0; m < pAcEnv->nBands; m++ )
            {
#ifndef FIX_2500_RENDCONF_REFACTOR
                if ( pRenderConfigReader->pAE[n].pFG->pFc[m] > FC_INPUT_MAX ||
                     pRenderConfigReader->pAE[n].pFG->pFc[m] < FC_INPUT_MIN ||
                     pRenderConfigReader->pAE[n].pRT60[m] > ACOUSTIC_RT60_MAX ||
                     pRenderConfigReader->pAE[n].pRT60[m] < ACOUSTIC_RT60_MIN ||
                     pRenderConfigReader->pAE[n].pDSR[m] > ACOUSTIC_DSR_MAX ||
                     pRenderConfigReader->pAE[n].pDSR[m] < ACOUSTIC_DSR_MIN )
                {
                    return IVAS_ERR_INVALID_RENDER_CONFIG;
                }
#endif

                pAcEnv->pFc_input_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pFG->pFc[m] * ONE_IN_Q16 );
                pAcEnv->pAcoustic_rt60_fx[m] = (Word32) ( pRenderConfigReader->pAE[n].pRT60[m] * ONE_IN_Q26 );
@@ -3282,15 +3176,6 @@ ivas_error RenderConfigReader_getDirectivity(
    /* Convert to Word16 */
    FOR( n = 0; n < 4; n++ )
    {
#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] ) );
        directivity[n * 3 + 1] = max( 0.0f, min( 360.0f, directivity[n * 3 + 1] ) );
        directivity[n * 3 + 2] = max( 0.0f, min( 1.0f, directivity[n * 3 + 2] ) );
#endif
#endif

        directivity_fx[n * 3] = (Word16) ( directivity[n * 3] * ( 1u << 6 ) );
        directivity_fx[n * 3 + 1] = (Word16) ( directivity[n * 3 + 1] * ( 1u << 6 ) );
@@ -3330,15 +3215,6 @@ ivas_error RenderConfigReader_getDistanceAttenuation(

    /* Convert to Word32 */
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#ifndef FIX_2500_RENDCONF_REFACTOR
    /* Range needs to be checked before converting to fixed point -- different from float */
    /* 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           */
    distAtt[1] = min( max( 0, distAtt[1] ), DIST_ATT_MAX_REFDIST );
    distAtt[0] = min( max( distAtt[1], distAtt[0] ), DIST_ATT_MAX_MAXDIST );
    distAtt[2] = min( max( 0.0f, distAtt[2] ), DIST_ATT_MAX_ROLLOFF );
#endif
    distAtt_fx[0] = (Word32) ( distAtt[0] * ( 1u << 25 ) );
    distAtt_fx[1] = (Word32) ( distAtt[1] * ( 1u << 28 ) );
    distAtt_fx[2] = (Word32) ( distAtt[2] * ( 1u << 28 ) );
+0 −4
Original line number Diff line number Diff line
@@ -79,11 +79,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                                                                    */