Commit 486529f5 authored by norvell's avatar norvell
Browse files

Merge branch 'basop-2500-renderer-configuration-range-check-refactoring' into 'main'

Basop 2500 renderer configuration range check refactoring

See merge request !2987
parents 7e3f3315 db771234
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -507,6 +507,14 @@ 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 )
        {
@@ -585,6 +593,13 @@ 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 )
@@ -598,6 +613,7 @@ int main(
                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.
@@ -2114,6 +2130,14 @@ static ivas_error decodeG192(
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            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 )
@@ -2276,6 +2300,13 @@ 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 )
@@ -2289,6 +2320,7 @@ static ivas_error decodeG192(
                            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 ) );
+23 −0
Original line number Diff line number Diff line
@@ -1246,6 +1246,13 @@ 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] );
@@ -1259,6 +1266,13 @@ 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 )
@@ -1272,6 +1286,7 @@ int main(
                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.
@@ -1716,6 +1731,13 @@ 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 )
@@ -1729,6 +1751,7 @@ int main(
                    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 ) );
+5 −0
Original line number Diff line number Diff line
@@ -1588,6 +1588,11 @@ typedef enum
#define RESAMPLE_FACTOR_16_48_FX                ( 5461 )  // Q14
#define RESAMPLE_FACTOR_32_48_FX                ( 10922 ) // Q14

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
#define DIST_ATT_DEFAULT_MAXDIST_Q25 528482304 /* Q25 */                      /* Default maxDist based on maximum radius in encoded metadata (2^ISM_RADIUS_NBITS-1)*0.25 */ 
#define DIST_ATT_DEFAULT_REFDIST_Q28 ONE_IN_Q28 /* Q28 */                     /* Default refDist 1.0 in Q28 */                                      
#define DIST_ATT_DEFAULT_ROLLOFF_Q28 ONE_IN_Q28 /* Q28 */                     /* Default rolloffFactor 1.0 in Q28 */                                      
#endif

/* ----- Enums - TD Renderer ----- */

+1 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@
/* any switch which is non-be wrt. TS 26.251 V3.0 */

#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API            /* Expose Payload Type setting in RTP Header */
#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 USE_RTPDUMP                                     /* FhG: RTPDUMP format (rtptools standard) instead of custom format */
+12 −3
Original line number Diff line number Diff line
@@ -203,11 +203,11 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
            DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0
            move16();
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            DistAtten.MaxDist_fx = 528482304; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/
            DistAtten.MaxDist_fx = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/
            move32();
            DistAtten.RefDist_fx = ONE_IN_Q28; // Q28
            DistAtten.RefDist_fx = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28
            move32();
            DistAtten.RollOffFactor_fx = ONE_IN_Q28; // Q28
            DistAtten.RollOffFactor_fx = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28
            move32();
#else
            DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/
@@ -271,12 +271,21 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
            {
                DistAtten.DistAttenModel = TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED; // Q0
                move16();
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
                DistAtten.MaxDist_fx = DIST_ATT_DEFAULT_MAXDIST_Q25; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q25*/
                move32();
                DistAtten.RefDist_fx = DIST_ATT_DEFAULT_REFDIST_Q28; // Q28
                move32();
                DistAtten.RollOffFactor_fx = DIST_ATT_DEFAULT_ROLLOFF_Q28; // Q28
                move32();
#else
                DistAtten.MaxDist_fx = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/
                move32();
                DistAtten.RefDist_fx = ONE_IN_Q30; // Q30
                move32();
                DistAtten.RollOffFactor_fx = ONE_IN_Q30; // Q30
                move32();
#endif
            }
            ELSE
            {
Loading