diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj index c887ffaa96ec38106a0b0669d27b9c274c42e003..79e5545f3fee266b8433f1b74a1926d40b570aa5 100644 --- a/Workspace_msvc/lib_util.vcxproj +++ b/Workspace_msvc/lib_util.vcxproj @@ -100,6 +100,7 @@ + @@ -126,6 +127,7 @@ + diff --git a/apps/decoder.c b/apps/decoder.c index 9d38acb1da54002fbe27e144bd60d4eba4b0f140..736e6130ffd953212dfa44acf2fbd555653767af 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -43,6 +43,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" #endif @@ -1543,65 +1546,25 @@ static bool parseCmdlIVAS_dec( if ( !is_digits_only( argv[i] ) ) { #ifdef FIX_1053_REVERB_RECONFIGURATION - uint16_t k; - char *s = argv[i]; - char *token = argv[i]; + aeidFileReader *aeidReader = NULL; - for ( k = 0; s[k]; ) + if ( aeidFileReader_open( argv[i], &aeidReader ) != IVAS_ERR_OK ) { - s[k] == ',' ? k++ : *s++; - } - k++; - - if ( k == 0 ) - { - fprintf( stdout, "Error: Invalid acoustic environment sequence specified: %s\n\n", argv[i] ); + fprintf( stderr, "\nError: Can't open aeid file %s \n", argv[i] ); usage_dec(); return false; } - if ( NULL == ( arg->aeSequence.pID = malloc( sizeof( uint16_t ) * k ) ) || - NULL == ( arg->aeSequence.pValidity = malloc( sizeof( uint16_t ) * k ) ) ) + if ( aeidFileReading( aeidReader, &arg->aeSequence.count, &arg->aeSequence.pID, &arg->aeSequence.pValidity ) != IVAS_ERR_OK ) { - fprintf( stdout, "Error: Unable to allocate memory for acoustic environment sequence: %s\n\n", argv[i] ); + fprintf( stderr, "\nError while reading aeid from %s\n", argv[i] ); usage_dec(); return false; } - arg->aeSequence.count = k; - - k = 0; - token = strtok( argv[i++], ":" ); - - while ( token != NULL ) - { - if ( !is_number( token ) ) - { - fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); - usage_dec(); - return false; - } - arg->aeSequence.pID[k] = (uint16_t) atoi( token ); + aeidFileReader_close( &aeidReader ); - token = strtok( NULL, "," ); - if ( !is_number( token ) ) - { - fprintf( stdout, "Error: Invalid token %s found in acoustic environment sequence: %s\n\n", token, argv[i] ); - usage_dec(); - return false; - } - arg->aeSequence.pValidity[k] = (uint16_t) atoi( token ); - - token = strtok( NULL, ":" ); - k++; - } - - if ( k != arg->aeSequence.count ) - { - fprintf( stdout, "Error while parsing acoustic environment sequence: %s\n\n", argv[i] ); - usage_dec(); - return false; - } + i++; #else fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] ); usage_dec(); @@ -1872,10 +1835,8 @@ static void usage_dec( void ) fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" ); fprintf( stdout, " otherwise a default directivity pattern is used.\n" ); #ifdef FIX_1053_REVERB_RECONFIGURATION - fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" ); - fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" ); - fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" ); - fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" ); + fprintf( stdout, "-aeid ID | File : Acoustic environment ID (number > 0)\n" ); + fprintf( stdout, " alternatively, it can be a text file where each line contains \"ID duration\"\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" ); #else fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index f8c53320d1ca65ed22823cf907f90b58445c0642..6a9f1048f31b6172043654890b20b5255f35c4bd 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -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) alternatively, it can be a text file where each line contains \"ID duration\" for BINAURAL_ROOM_REVERB output configuration.", #else .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration", #endif @@ -737,6 +740,7 @@ int main( int32_t delayTimeScale = 0; int16_t i, numChannels; #ifdef FIX_1053_REVERB_RECONFIGURATION + IVAS_RENDER_CONFIG_DATA renderConfig; uint16_t aeID; #endif ivas_error error = IVAS_ERR_OK; @@ -1051,7 +1055,9 @@ int main( if ( args.renderConfigFilePath[0] != '\0' ) { +#ifndef FIX_1053_REVERB_RECONFIGURATION IVAS_RENDER_CONFIG_DATA renderConfig; +#endif /* sanity check */ #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -1563,8 +1569,10 @@ int main( { if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] ) { +#ifndef FIX_1053_REVERB_RECONFIGURATION IVAS_RENDER_CONFIG_DATA renderConfig; +#endif if ( ++args.aeSequence.selected >= args.aeSequence.count ) { args.aeSequence.selected = 0; @@ -1574,7 +1582,7 @@ int main( { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) { - fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" ); + fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" ); goto cleanup; } } @@ -2569,69 +2577,27 @@ static bool parseAcousticEnvironmentIds( const char *value, AcousticEnvironmentSequence *aeSequence ) { - uint16_t k; char config_string[RENDERER_MAX_METADATA_LINE_LENGTH]; - char *s; - char *token; strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH ); - s = config_string; - token = config_string; 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 { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b99bf9a93ad001bcbf97920ddb4c0a904b762ce6..087c86118eb79a42c641ef313e3447fefa27dfcc 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -4393,6 +4393,10 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er; hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity; +#ifdef FIX_1053_REVERB_RECONFIGURATION + mvr2r( hRCin->distAtt, hRCout->distAtt, 3 ); +#endif + return IVAS_ERR_OK; } @@ -4439,6 +4443,9 @@ int16_t IVAS_REND_FeedRenderConfig( mvr2r( renderConfig.roomAcoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.roomAcoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX ); mvr2r( renderConfig.directivity, hRenderConfig->directivity, 3 * MAX_NUM_OBJECTS ); +#ifdef FIX_1053_REVERB_RECONFIGURATION + mvr2r( renderConfig.distAtt, hRenderConfig->distAtt, 3 ); +#endif hRenderConfig->roomAcoustics.use_er = 0; if ( renderConfig.roomAcoustics.use_er == 1 ) @@ -4468,16 +4475,13 @@ int16_t IVAS_REND_FeedRenderConfig( return error; } } - #ifdef SPLIT_REND_WITH_HEAD_ROT if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend[0] != NULL ) -#else - if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) -#endif { -#ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend[0]->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #else + if ( pIsmInput->crendWrapper != NULL && pIsmInput->crendWrapper->hCrend != NULL ) + { if ( ( error = ivas_reverb_open( &pIsmInput->crendWrapper->hCrend->hReverb, hIvasRend->hHrtfs.hHrtfStatistics, hRenderConfig, *pIsmInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { diff --git a/lib_util/aeid_file_reader.c b/lib_util/aeid_file_reader.c new file mode 100644 index 0000000000000000000000000000000000000000..737c71f0c8934c3cc27d62f98818ce6465855d6d --- /dev/null +++ b/lib_util/aeid_file_reader.c @@ -0,0 +1,187 @@ +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#include "aeid_file_reader.h" +#ifdef FIX_1053_REVERB_RECONFIGURATION +#include "ivas_error_utils.h" +#include +#include + +struct aeidFileReader +{ + FILE *aeidFile; + char *file_path; +}; + + +/*-----------------------------------------------------------------------* + * aeidFileReader_open() + * + * Allocate and initialize rotation handle + *-----------------------------------------------------------------------*/ + +ivas_error aeidFileReader_open( + char *aeidFilePath, /* i : aeid file name */ + aeidFileReader **aeidReader /* o : aeidFileReader handle */ +) +{ + aeidFileReader *self; + FILE *aeidFile; + + /* Open trajectory file */ + if ( strlen( aeidFilePath ) < 1 ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + aeidFile = fopen( aeidFilePath, "r" ); + + if ( !aeidFile ) + { + return IVAS_ERR_FAILED_FILE_OPEN; + } + + self = calloc( sizeof( aeidFileReader ), 1 ); + self->aeidFile = aeidFile; + self->file_path = calloc( sizeof( char ), strlen( aeidFilePath ) + 1 ); + strcpy( self->file_path, aeidFilePath ); + + *aeidReader = self; + + return IVAS_ERR_OK; +} + + +/*-----------------------------------------------------------------------* + * aeidFileReading() + * + * Read values from the aeid file + *-----------------------------------------------------------------------*/ + +ivas_error aeidFileReading( + aeidFileReader *aeidReader, /* i : aeidFileReader handle */ + uint16_t *count, /* o : number of sequences */ + uint16_t **pID, /* o : acoustic environment ID data */ + uint16_t **pValidity /* o : duration data */ +) +{ + int32_t id; + int32_t duration; + uint16_t k = 0; + + while ( !feof( aeidReader->aeidFile ) ) + { + if ( fscanf( aeidReader->aeidFile, "%d %d", &id, &duration ) == 2 ) + { + k++; + } + else + { + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_PARSE, "Error while parsing acoustic environment sequence" ); + } + } + + if ( k == 0 ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_PARSE, "No acoustic environment" ); + } + + if ( NULL == ( *pID = malloc( sizeof( uint16_t ) * k ) ) || + NULL == ( *pValidity = malloc( sizeof( uint16_t ) * k ) ) ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Unable to allocate memory for acoustic environment sequence" ); + } + + *count = k; + + k = 0; + + fseek( aeidReader->aeidFile, 0, SEEK_SET ); + + while ( !feof( aeidReader->aeidFile ) ) + { + if ( fscanf( aeidReader->aeidFile, "%d %d", &id, &duration ) == 2 ) + { + ( *pID )[k] = (uint16_t) id; + ( *pValidity )[k] = (uint16_t) duration; + k++; + } + else + { + return IVAS_ERROR( IVAS_ERR_FAILED_FILE_PARSE, "Error while parsing acoustic environment sequence" ); + } + } + + return IVAS_ERR_OK; +} + +/*-----------------------------------------------------------------------* + * aeidFileReader_close() + * + * Deallocates memory for the aeid handle + *-----------------------------------------------------------------------*/ + +void aeidFileReader_close( + aeidFileReader **aeidReader /* i/o: aeidFileReader handle */ +) +{ + if ( aeidReader == NULL || *aeidReader == NULL ) + { + return; + } + + fclose( ( *aeidReader )->aeidFile ); + free( ( *aeidReader )->file_path ); + free( *aeidReader ); + *aeidReader = NULL; + + return; +} + +/*-----------------------------------------------------------------------* + * aeidFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *aeidFileReader_getFilePath( + aeidFileReader *aeidReader /* i : aeidFileReader handle */ +) +{ + if ( aeidReader == NULL ) + { + return NULL; + } + + return aeidReader->file_path; +} +#endif diff --git a/lib_util/aeid_file_reader.h b/lib_util/aeid_file_reader.h new file mode 100644 index 0000000000000000000000000000000000000000..2e7c3209447f85bc13ae7db77f335c9efd6eebc0 --- /dev/null +++ b/lib_util/aeid_file_reader.h @@ -0,0 +1,89 @@ +/****************************************************************************************************** + + (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository. All Rights Reserved. + + This software is protected by copyright law and by international treaties. + The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, + Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., + Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, + Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other + contributors to this repository retain full ownership rights in their respective contributions in + the software. This notice grants no license of any kind, including but not limited to patent + license, nor is any license granted by implication, estoppel or otherwise. + + Contributors are required to enter into the IVAS codec Public Collaboration agreement before making + contributions. + + This software is provided "AS IS", without any express or implied warranties. The software is in the + development stage. It is intended exclusively for experts who have experience with such software and + solely for the purpose of inspection. All implied warranties of non-infringement, merchantability + and fitness for a particular purpose are hereby disclaimed and excluded. + + Any dispute, controversy or claim arising under or in relation to providing this software shall be + submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in + accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and + the United Nations Convention on Contracts on the International Sales of Goods. + +*******************************************************************************************************/ + +#ifndef IVAS_AEID_FILE_READER_H +#define IVAS_AEID_FILE_READER_H + +#include "common_api_types.h" + +#ifdef FIX_1053_REVERB_RECONFIGURATION + +struct aeidFileReader; +typedef struct aeidFileReader aeidFileReader; + +/*-----------------------------------------------------------------------* + * aeidFileReader_open() + * + * Allocate and initialize rotation handle + *-----------------------------------------------------------------------*/ + +ivas_error aeidFileReader_open( + char *aeidFilePath, /* i : aeid file name */ + struct aeidFileReader **aeidReader /* o : aeidFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * aeidFileReading() + * + * Read values from the aeid file + *-----------------------------------------------------------------------*/ + +ivas_error aeidFileReading( + aeidFileReader *aeidReader, /* i : aeidFileReader handle */ + uint16_t *count, /* o : number of sequences */ + uint16_t **pID, /* o : acoustic environment ID data */ + uint16_t **pValidity /* o : duration data */ +); + +/*-----------------------------------------------------------------------* + * aeidFileReader_close() + * + * Deallocates memory for the aeid handle + *-----------------------------------------------------------------------*/ + +void aeidFileReader_close( + aeidFileReader **aeidReader /* i/o: aeidFileReader handle */ +); + +/*-----------------------------------------------------------------------* + * aeidFileReader_getFilePath() + * + * + *-----------------------------------------------------------------------*/ + +const char *aeidFileReader_getFilePath( + aeidFileReader *aeidReader /* i : aeidFileReader handle */ +); + +#endif + +#endif /* IVAS_AEID_FILE_READER_H */ diff --git a/readme.txt b/readme.txt index e7e5d432f5b79d58fa6f15574326f3b3f03d95fc..cd5a01d4bed7837f7f29b9856d32858aba6d152b 100644 --- a/readme.txt +++ b/readme.txt @@ -286,7 +286,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) for BINAURAL_ROOM_REVERB output config. +-aeid ID | File : Acoustic environment ID (number > 0) or + alternatively, it can be a text file where each line contains "ID duration" + for BINAURAL_ROOM_REVERB output configuration. -level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. -om File : Coded metadata File for BINAURAL_SPLIT_PCM OutputConf Currently, all values default to level 3 (full functionality). @@ -319,11 +321,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 - for BINAURAL_ROOM_REVERB output configuration. +-aeid ID | File : Acoustic environment ID (number > 0) + alternatively, it can be a text file where each line contains "ID duration" + 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. If specified, overrides the default behavior which attempts to map input to output LFE channel(s) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index caede15c01cab82739000bc773292a60154fa4c8..301a80dfe3552ad54c91785737b5b3fa436f5fca 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1308,18 +1308,6 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/stv51MC48c.wav_MC51_512000_48-16_MC_Config_renderer.tst -// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) -//../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:200,0:100,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst - -// Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) -//../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:100,0:300 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst - -// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) -//../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:100,2:500,1:200 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst - // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_Config_hospital_patientroom.tst diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index f8888c56c11edc3af003b2072e38b2929c408f49..2a66699563e2f906fbe186b5b19d8bd95d9d1b03 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1307,18 +1307,6 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 ../IVAS_cod -mc 5_1 512000 48 testv/ltv48_MC51.wav bit ../IVAS_dec -render_config testv/rend_config_renderer.cfg BINAURAL_ROOM_REVERB 16 bit testv/ltv48_MC51.wav_MC51_512000_48-16_MC_Config_renderer.tst -// Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) -//../IVAS_cod -mc 5_1 512000 48 testv/ltv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst - -// Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) -//../IVAS_cod -mc 5_1 64000 48 testv/ltv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst - -// Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) -//../IVAS_cod -mc 5_1 32000 48 testv/ltv51MC48c.wav bit -//../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst - // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit ../IVAS_dec -render_config testv/rend_config_hospital_patientroom.cfg BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_80000_48-48_MC_Config_hospital_patientroom.tst diff --git a/tests/renderer/test_renderer.py b/tests/renderer/test_renderer.py index ca71224aea36a0f266b91d4226e1eed3be302fdb..3c9b95dbaf66170a9bd4204fc0c25bfc53e83e1a 100644 --- a/tests/renderer/test_renderer.py +++ b/tests/renderer/test_renderer.py @@ -127,6 +127,31 @@ def test_ambisonics_binaural_headrotation( ) +@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) +@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 +): + rend_config_path = TEST_VECTOR_DIR.joinpath(f"rend_config_combined.cfg") + rend_config_path.with_stem(f"rend_config") + + 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 """ diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 9717af0b81fb83eed279793470977f6a3b10c7ec..9bd2b8f4b77f04a89ef89ca8416de2c840815c5d 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -164,6 +164,7 @@ def run_renderer( get_mld=False, mld_lim=0, get_mld_lim=0, + aeid: Optional[str] = None, ) -> str: # prepare arguments and filepaths if trj_file is not None: @@ -196,6 +197,11 @@ def run_renderer( else: framing_name = "" + if aeid is not None: + aeid_name = f"_{aeid}" + else: + aeid_name = "" + if not isinstance(out_fmt, str): out_name = f"{out_fmt.stem}" else: @@ -227,7 +233,7 @@ def run_renderer( in_file = FORMAT_TO_FILE[in_fmt] in_name = in_fmt - out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}.wav" + out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}.wav" out_file = str(output_path_base.joinpath(out_file_stem)) @@ -270,6 +276,9 @@ def run_renderer( if frame_size: cmd.extend(["-fr", str(frame_size.replace("ms", ""))]) + if aeid is not None: + cmd.extend(["-aeid", str(aeid)]) + # Set env variables for UBSAN env = os.environ.copy() if test_info.node.name and "UBSAN_OPTIONS" in env.keys():