Commit ecdb579b authored by sbsarac's avatar sbsarac
Browse files

Extend aeid file to renderer

parent 831cbdd3
Loading
Loading
Loading
Loading
Loading
+10 −44
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
#ifdef FIX_1053_REVERB_RECONFIGURATION
#include "aeid_file_reader.h"
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "split_render_file_read_write.h"
#include "split_rend_bfi_file_reader.h"
@@ -400,7 +403,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .match = "acoustic_environment_id",
        .matchShort = "aeid",
#ifdef FIX_1053_REVERB_RECONFIGURATION
        .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1-duration1,ID2-duration2...] without braces and spaces, with '-' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
        .description = "Acoustic environment ID (number > 0) or file contains lines for each ID and duration in the format [ID1:duration1] without braces and spaces, with ':' character separating ID from duration, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
#else
        .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
#endif
@@ -2585,58 +2588,21 @@ static bool parseAcousticEnvironmentIds(

    if ( !is_digits_only( config_string ) )
    {
        aeidFileReader *aeidReader = NULL;

        for ( k = 0; s[k]; )
        {
            s[k] == ',' ? k++ : *s++;
        }
        k++;

        if ( k == 0 )
        if ( aeidFileReader_open( config_string, &aeidReader ) != IVAS_ERR_OK )
        {
            fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", config_string );
            fprintf( stderr, "\nError: Can't open aeid file %s \n", config_string );
            return false;
        }

        if ( NULL == ( aeSequence->pID = malloc( sizeof( uint16_t ) * k ) ) ||
             NULL == ( aeSequence->pValidity = malloc( sizeof( uint16_t ) * k ) ) )
        if ( aeidFileReading( aeidReader, &aeSequence->count, &aeSequence->pID, &aeSequence->pValidity ) != IVAS_ERR_OK )
        {
            fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", config_string );
            fprintf( stderr, "\nError while reading aeid from %s\n", config_string );
            return false;
        }

        aeSequence->count = k;

        k = 0;

        token = strtok( config_string, "-" );

        while ( token != NULL )
        {
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pID[k] = (uint16_t) atoi( token );

            token = strtok( NULL, "," );
            if ( !is_number( token ) )
            {
                fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, config_string );
                return false;
            }
            aeSequence->pValidity[k] = (uint16_t) atoi( token );

            token = strtok( NULL, "-" );
            k++;
        }

        if ( k != aeSequence->count )
        {
            fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", config_string );
            return false;
        }
        aeidFileReader_close( &aeidReader );
    }
    else
    {
+8 −10
Original line number Diff line number Diff line
@@ -282,10 +282,9 @@ Options:
-exof File          : External orientation trajectory File for simulation of external orientations
-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be 
                      specified) for binaural output configuration
-aeid ID            : Acoustic environment ID (number >= 0) or
                      a sequence thereof in the format [ID1-duration1,ID2-duration2...]
                      without braces and spaces, with '-' character separating ID from duration and ',' separating
                      ID and duration pairs, where duration is specified in frames
-aeid ID | File     : Acoustic environment ID (number > 0) or
					  file contains lines for each ID and duration in the format [ID1:duration1] without braces and
					  spaces, with ':' character separating ID from duration, where duration is specified in frames
					  for BINAURAL_ROOM_REVERB output configuration.					 
-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation.
                      Currently, all values default to level 3 (full functionality).
@@ -318,10 +317,9 @@ Options:
-exof File          : External orientation trajectory File for simulation of external orientations
-dpid ID            : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be 
                      specified) for binaural output configuration
-aeid ID            : Acoustic environment ID (number > 0) or
                      a sequence thereof in the format [ID1-duration1,ID2-duration2...]
                      without braces and spaces, with '-' character separating ID from duration and ',' separating
                      ID and duration pairs, where duration is specified in frames
-aeid ID | File     : Acoustic environment ID (number > 0) or
					  file contains lines for each ID and duration in the format [ID1:duration1] without braces and
					  spaces, with ':' character separating ID from duration, where duration is specified in frames
					  for BINAURAL_ROOM_REVERB output configuration.
-lp Position        : Output LFE position. Comma-delimited triplet of [gain, azimuth, elevation] where gain is linear 
                      (like --gain, -g) and azimuth, elevation are in degrees.
+26 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ def test_ambisonics_binaural_headrotation(
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[2:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
@pytest.mark.parametrize("aeid", ["1", "0-1000,2-500,1-500"]) 
@pytest.mark.parametrize("aeid", ["1", "0"]) 
def test_dynamic_acoustic_environment(
    record_property, test_info, in_fmt, out_fmt, frame_size, get_mld, get_mld_lim, aeid
):
@@ -133,6 +133,31 @@ def test_dynamic_acoustic_environment(
        aeid=aeid,        
    )

@pytest.mark.create_ref
@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL[2:])
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
@pytest.mark.parametrize("frame_size", FRAMING_TO_TEST)
def test_dynamic_acoustic_environment_file(
    record_property, test_info, in_fmt, out_fmt, frame_size, get_mld, get_mld_lim, aeid
):
    rend_config_path = TESTV_DIR.joinpath(f"rend_config_combined.cfg")
    rend_config_path.with_stem(f"rend_config")

    aeid = TESTV_DIR.joinpath(f"aeid1.txt")
    
    run_renderer(
        record_property,
        test_info,
        in_fmt,
        out_fmt,
        binary_suffix=EXE_SUFFIX,
        frame_size=frame_size,
        get_mld=get_mld,
        mld_lim=get_mld_lim,
        config_file=rend_config_path,
        aeid=aeid,        
    )


""" Multichannel """