From 55144c75edbe772f8aa0be68e385656e41b9376e Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 17 Aug 2023 18:26:36 +0200 Subject: [PATCH 01/12] issue 708: sanity checks for '-dpid' command-line; under FIX_708_DPID_COMMAND_LINE --- apps/decoder.c | 47 +++++++++++++++++++++++++++++++++++++++++ lib_com/ivas_error.h | 7 ++++++ lib_com/options.h | 2 ++ lib_dec/ivas_init_dec.c | 15 +++++++++++++ lib_dec/ivas_stat_dec.h | 3 +++ lib_dec/lib_dec.c | 18 +++++++++++++++- lib_dec/lib_dec.h | 3 +++ 7 files changed, 94 insertions(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index a3e9fb000a..2c7d946fab 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -144,6 +144,9 @@ typedef struct #endif #endif uint16_t acousticEnvironmentId; +#ifdef FIX_708_DPID_COMMAND_LINE + int16_t Opt_dpid_on; +#endif uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; bool framing_5ms; } DecArguments; @@ -451,7 +454,11 @@ int main( * Configure the decoder *------------------------------------------------------------------------------------------*/ +#ifdef FIX_708_DPID_COMMAND_LINE + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -996,6 +1003,9 @@ static bool parseCmdlIVAS_dec( arg->renderConfigEnabled = false; arg->renderConfigFilename = NULL; +#ifdef FIX_708_DPID_COMMAND_LINE + arg->Opt_dpid_on = 0; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT arg->outputMdFilename = NULL; @@ -1398,14 +1408,46 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { +#ifdef FIX_708_DPID_COMMAND_LINE + arg->Opt_dpid_on = 1; +#endif ++i; int16_t tmp; tmp = 0; while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS ) { arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] ); + +#ifdef FIX_708_DPID_COMMAND_LINE + if ( arg->directivityPatternId[tmp] < 0 || arg->directivityPatternId[tmp] > 4 ) + { + fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] ); + usage_dec(); + return false; + } +#endif ++tmp; } + +#ifdef FIX_708_DPID_COMMAND_LINE + if ( tmp == 0 ) + { + if ( argc - i <= 4 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Directivity pattern ID not specified!\n\n" ); + usage_dec(); + return false; + } + + if ( !is_number( argv[i + tmp] ) ) + { + fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] ); + usage_dec(); + return false; + } + } +#endif + i += tmp; } @@ -1589,7 +1631,12 @@ static void usage_dec( void ) fprintf( stdout, "-force R : Force specific binaural rendering mode, R = (TDREND, CLDFBREND),\n" ); #endif fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); +#ifdef FIX_708_DPID_COMMAND_LINE + fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = (1,2,3,4) (space-separated list of up\n" ); + fprintf( stdout, " to 4 numbers can be specified) for binaural output configuration\n" ); +#else fprintf( stdout, "-dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" ); +#endif fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index e9c8692bde..a60eb83358 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -76,6 +76,9 @@ typedef enum IVAS_ERR_INVALID_OUTPUT_FORMAT, IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED, IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED, +#ifdef FIX_708_DPID_COMMAND_LINE + IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, +#endif IVAS_ERR_INVALID_HRTF, IVAS_ERR_INVALID_INPUT_FORMAT, IVAS_ERR_INVALID_INDEX, /* ToDo: should be merged with IVAS_ERR_INDEX_OUT_OF_BOUNDS */ @@ -249,6 +252,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) #endif case IVAS_ERR_EXT_ORIENTATION_NOT_SUPPORTED: return "External orientation not supported"; +#ifdef FIX_708_DPID_COMMAND_LINE + case IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED: + return "Directivity not supported"; +#endif case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; case IVAS_ERR_INVALID_INPUT_FORMAT: diff --git a/lib_com/options.h b/lib_com/options.h index 71dc84b955..183f54f2af 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,8 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ +#define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ + /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 779c3d390e..85882333f0 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3017,6 +3017,21 @@ static ivas_error doSanityChecks_IVAS( } } +#ifdef FIX_708_DPID_COMMAND_LINE + if ( st_ivas->hDecoderConfig->Opt_dpid_on ) + { + if ( st_ivas->hHrtfTD == NULL ) + { + return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is supported in the TD renderer only." ); + } + + if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is not supported in this output configuration." ); + } + } +#endif + if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && output_config == AUDIO_CONFIG_EXTERNAL ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index d6167f5708..4fb5caf664 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -903,6 +903,9 @@ typedef struct decoder_config_structure float non_diegetic_pan_gain; /* non diegetic panning gain*/ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ int16_t Opt_ExternalOrientation; /* indiates whether external orientations are used */ +#ifdef FIX_708_DPID_COMMAND_LINE + int16_t Opt_dpid_on; /* indicates whether Directivity pattern option is used */ +#endif /* temp. development parameters */ #ifdef DEBUGGING diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index f790be3f0b..a6c3597b6d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -240,6 +240,9 @@ static void init_decoder_config( hDecoderConfig->Opt_delay_comp = 0; hDecoderConfig->Opt_ExternalOrientation = 0; +#ifdef FIX_708_DPID_COMMAND_LINE + hDecoderConfig->Opt_dpid_on = 0; +#endif return; } @@ -335,7 +338,10 @@ ivas_error IVAS_DEC_Configure( const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ - const int16_t delayCompensationEnabled /* i : enable delay compensation */ +#ifdef FIX_708_DPID_COMMAND_LINE + const int16_t Opt_dpid_on, /* i : enable directivity pattern option */ +#endif + const int16_t delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -391,6 +397,9 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation; +#ifdef FIX_708_DPID_COMMAND_LINE + hDecoderConfig->Opt_dpid_on = Opt_dpid_on; +#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) @@ -2611,6 +2620,13 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "Non-diegetic panning: %.2f\n", st_ivas->hDecoderConfig->non_diegetic_pan_gain * 90.f ); } + +#ifdef FIX_708_DPID_COMMAND_LINE + if ( st_ivas->hDecoderConfig->Opt_dpid_on ) + { + fprintf( stdout, "Directivity pattern: ON\n" ); + } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 623603b6c3..1a74ee82ca 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -130,6 +130,9 @@ ivas_error IVAS_DEC_Configure( const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ +#ifdef FIX_708_DPID_COMMAND_LINE + const int16_t Opt_dpid_on, /* i : enable directivity pattern option */ +#endif const int16_t delayCompensationEnabled /* i : enable delay compensation */ ); -- GitLab From 377de0889ad35febae6b69759b3deba60b7f820a Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 17 Aug 2023 18:56:21 +0200 Subject: [PATCH 02/12] correction within FIX_708_DPID_COMMAND_LINE --- apps/decoder.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 2c7d946fab..5e1b621024 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1409,6 +1409,8 @@ static bool parseCmdlIVAS_dec( else if ( strcmp( argv_to_upper, "-DPID" ) == 0 ) { #ifdef FIX_708_DPID_COMMAND_LINE + int16_t id; + arg->Opt_dpid_on = 1; #endif ++i; @@ -1416,15 +1418,19 @@ static bool parseCmdlIVAS_dec( tmp = 0; while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS ) { - arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] ); - #ifdef FIX_708_DPID_COMMAND_LINE - if ( arg->directivityPatternId[tmp] < 0 || arg->directivityPatternId[tmp] > 4 ) + id = (int16_t) atoi( argv[i + tmp] ); + + if ( !is_digits_only( argv[i + tmp] ) || id < 0 || id > 4 ) { fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] ); usage_dec(); return false; } + + arg->directivityPatternId[tmp] = id; +#else + arg->directivityPatternId[tmp] = (int16_t) atoi( argv[i + tmp] ); #endif ++tmp; } -- GitLab From d3f6f5abd890c5607b782d07edb7fab5fdae4f5e Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 21 Aug 2023 13:03:43 +0200 Subject: [PATCH 03/12] DPID, remove check for TD renderer, id < 0 - Renderer technology is based also on information from the bitstream, e.g bitrate. TD renderer struct is set once bitstream is read. - DPID values are space seperated list with at most 4 values where each value (id) is a number>0. --- apps/decoder.c | 2 +- lib_dec/ivas_init_dec.c | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 9ce04cbd79..9606677a93 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1521,7 +1521,7 @@ static bool parseCmdlIVAS_dec( #ifdef FIX_708_DPID_COMMAND_LINE id = (int16_t) atoi( argv[i + tmp] ); - if ( !is_digits_only( argv[i + tmp] ) || id < 0 || id > 4 ) + if ( !is_digits_only( argv[i + tmp] ) || id < 0 ) { fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] ); usage_dec(); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 069b9a7f4f..1edd992c27 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3112,11 +3112,6 @@ static ivas_error doSanityChecks_IVAS( #ifdef FIX_708_DPID_COMMAND_LINE if ( st_ivas->hDecoderConfig->Opt_dpid_on ) { - if ( st_ivas->hHrtfTD == NULL ) - { - return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is supported in the TD renderer only." ); - } - if ( !( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { return IVAS_ERROR( IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED, "Wrong set-up: Directivity is not supported in this output configuration." ); -- GitLab From a5a68bcd5f6bd249fdb40582622f7fa0380e98e1 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 21 Aug 2023 13:21:43 +0200 Subject: [PATCH 04/12] DPID, remove check for TD renderer, id > 4 correct typo in prevous commit message (d3f6f5ab) -- GitLab From 1f66104f114358bce936d51ef084ca311ac96625 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 21 Aug 2023 14:57:36 +0200 Subject: [PATCH 05/12] store DPIDs from file in correct struct index - Directivity Pattern ids read from file are now stored in the correct index instead of overritting index 0. - print informative error message when Directivity Pattern ID (DPID(s)) specified is/are not found. - Repeat last DPID value for remaining objects if not all objects' DPID are specified when -DPID commandline flag is used. e.g if -DPID 0 1 is equivalent to -DPID 0 1 1 1 . --- apps/decoder.c | 8 ++++++++ apps/renderer.c | 4 ++++ lib_com/options.h | 1 + lib_util/render_config_reader.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/apps/decoder.c b/apps/decoder.c index 9606677a93..58bcf70d26 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -719,7 +719,11 @@ int main( if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); +#else fprintf( stderr, "Failed to get directivity for objects: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); +#endif goto cleanup; } @@ -1125,7 +1129,11 @@ static bool parseCmdlIVAS_dec( arg->acousticEnvironmentId = 0; for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + arg->directivityPatternId[i] = 65535; +#else arg->directivityPatternId[i] = 0; +#endif } /*-----------------------------------------------------------------* * Initialization diff --git a/apps/renderer.c b/apps/renderer.c index 858a9d4150..9279db05d2 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2689,7 +2689,11 @@ static CmdlnArgs defaultArgs( for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) { +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + args.directivityPatternId[i] = 65535; +#else args.directivityPatternId[i] = 0; +#endif } args.acousticEnvironmentId = 0; diff --git a/lib_com/options.h b/lib_com/options.h index f66f854132..185317b2a0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ #define FIX_708_DPID_COMMAND_LINE /* issue 708: sanity checks for '-dpid' command-line */ +#define FIX_730_DPID_NOT_SET_CORRECTLY /* Eri: issue 730: write dpid read from file in correct index, print informative error message when DPID specified is not found. */ diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index bdbfe3ec2b..c2f3a2ff16 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2620,7 +2620,9 @@ ivas_error RenderConfigReader_read( return IVAS_ERR_INVALID_RENDER_CONFIG; } idx = strtol( strtok( NULL, ":" ), NULL, 0 ); +#ifndef FIX_730_DPID_NOT_SET_CORRECTLY pRenderConfigReader->pDP->id = idx; +#endif params_idx = 0; pValue = (char *) calloc( strlen( pParams ), sizeof( char ) ); @@ -2628,13 +2630,20 @@ ivas_error RenderConfigReader_read( { params_idx += (int32_t) ( strlen( item ) + strlen( pValue ) + 2 ); #ifdef DEBUGGING +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + fprintf( stderr, " PARAM: %s -> %s, DIRECTIVITYPATTERN -> %u\n", item, pValue, idx ); +#else fprintf( stderr, " PARAM: %s -> %s\n", item, pValue ); +#endif #endif /* Allocate memory for directivity arrays*/ if ( ( pRenderConfigReader->pDP[accDPIdx].pDirectivity = (float *) malloc( 3 * sizeof( float ) ) ) == NULL ) { return IVAS_ERR_FAILED_ALLOC; } +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + pRenderConfigReader->pDP[accDPIdx].id = idx; +#endif if ( strcmp( item, "DIRECTIVITY" ) == 0 ) { if ( read_txt_vector( pValue, 3, pRenderConfigReader->pDP[accDPIdx].pDirectivity ) ) @@ -2829,6 +2838,9 @@ ivas_error RenderConfigReader_getDirectivity( ) { uint16_t n, m; +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + uint16_t last_specified_id; +#endif bool idExists; @@ -2847,6 +2859,23 @@ ivas_error RenderConfigReader_getDirectivity( } else { +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + last_specified_id = id[0]; + + /* set unpspecified Directivity Patterns ID to last specified ID */ + for (n = MAX_NUM_OBJECTS-1; n > 0; n--) + { + if ( id[n] != 65535 ) + { + last_specified_id = id[n]; + break; + } + } + for ( ; n < MAX_NUM_OBJECTS; n++ ) + { + id[n] = last_specified_id; + } +#endif for ( n = 0; n < MAX_NUM_OBJECTS; n++ ) { idExists = false; -- GitLab From 0c6968e46eeef64785b14e62ee4c36b591845e75 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 22 Aug 2023 15:12:44 +0200 Subject: [PATCH 06/12] fix case when -dpid is not specified --- lib_util/render_config_reader.c | 12 +++++++++++- scripts/testv/config_directivity.cfg | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index c2f3a2ff16..7b56db4986 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2863,7 +2863,7 @@ ivas_error RenderConfigReader_getDirectivity( last_specified_id = id[0]; /* set unpspecified Directivity Patterns ID to last specified ID */ - for (n = MAX_NUM_OBJECTS-1; n > 0; n--) + for ( n = MAX_NUM_OBJECTS - 1; n > 0; n-- ) { if ( id[n] != 65535 ) { @@ -2871,6 +2871,12 @@ ivas_error RenderConfigReader_getDirectivity( break; } } + /* case when -dpid is not specified, select first directivity pattern from config file */ + if ( n == 0 ) + { + last_specified_id = pRenderConfigReader->pDP[0].id; + } + for ( ; n < MAX_NUM_OBJECTS; n++ ) { id[n] = last_specified_id; @@ -2884,7 +2890,11 @@ ivas_error RenderConfigReader_getDirectivity( if ( id[n] == pRenderConfigReader->pDP[m].id ) { idExists = true; +#ifdef FIX_730_DPID_NOT_SET_CORRECTLY + mvr2r( pRenderConfigReader->pDP[m].pDirectivity, directivity + ( n * 3 ), 3 ); +#else mvr2r( pRenderConfigReader->pDP[id[n]].pDirectivity, directivity + ( n * 3 ), 3 ); +#endif break; } } diff --git a/scripts/testv/config_directivity.cfg b/scripts/testv/config_directivity.cfg index d284c5c6a7..4835341434 100644 --- a/scripts/testv/config_directivity.cfg +++ b/scripts/testv/config_directivity.cfg @@ -1,8 +1,17 @@ [directivitySetting] -directivityCount = 1; +directivityCount = 5; -[directivityPattern:0] +[directivityPattern:10] directivity = [0.0, 360.0, 0.2512] -[general] -binaryConfig = config_directivity.dat; +[directivityPattern:11] +directivity = [0.1, 180.0, 0.1137] + +[directivityPattern:12] +directivity = [0.2, 100.0, 0.1237] + +[directivityPattern:13] +directivity = [0.3, 180.0, 0.1337] + +[directivityPattern:14] +directivity = [0.4, 70.0, 0.1437] \ No newline at end of file -- GitLab From e2a34101440e6200abf73ceaf6a2b87b606bf95c Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 22 Aug 2023 15:56:04 +0200 Subject: [PATCH 07/12] resolve type conversion warning on windows cast uint32_t to uint16_t for pRenderConfigReader->pDP[0].id --- lib_util/render_config_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 7b56db4986..1738d530bf 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2874,7 +2874,7 @@ ivas_error RenderConfigReader_getDirectivity( /* case when -dpid is not specified, select first directivity pattern from config file */ if ( n == 0 ) { - last_specified_id = pRenderConfigReader->pDP[0].id; + last_specified_id = ( uint16_t ) pRenderConfigReader->pDP[0].id; } for ( ; n < MAX_NUM_OBJECTS; n++ ) -- GitLab From 355009fbaa1e91a24e1b21ea5a6fffebb2e3183b Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 22 Aug 2023 17:19:15 +0200 Subject: [PATCH 08/12] clang-formart --- lib_util/render_config_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index 1738d530bf..0955db8971 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -2874,7 +2874,7 @@ ivas_error RenderConfigReader_getDirectivity( /* case when -dpid is not specified, select first directivity pattern from config file */ if ( n == 0 ) { - last_specified_id = ( uint16_t ) pRenderConfigReader->pDP[0].id; + last_specified_id = (uint16_t) pRenderConfigReader->pDP[0].id; } for ( ; n < MAX_NUM_OBJECTS; n++ ) -- GitLab From f909808e02d65b3ae672a9ccedf77fe54de4ad65 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Wed, 23 Aug 2023 14:16:46 +0200 Subject: [PATCH 09/12] undo changes in config file - scripts/testv/config_directivity.cfg --- scripts/testv/config_directivity.cfg | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/scripts/testv/config_directivity.cfg b/scripts/testv/config_directivity.cfg index 4835341434..ae287adb27 100644 --- a/scripts/testv/config_directivity.cfg +++ b/scripts/testv/config_directivity.cfg @@ -1,17 +1,8 @@ [directivitySetting] -directivityCount = 5; +directivityCount = 1; -[directivityPattern:10] +[directivityPattern:0] directivity = [0.0, 360.0, 0.2512] -[directivityPattern:11] -directivity = [0.1, 180.0, 0.1137] - -[directivityPattern:12] -directivity = [0.2, 100.0, 0.1237] - -[directivityPattern:13] -directivity = [0.3, 180.0, 0.1337] - -[directivityPattern:14] -directivity = [0.4, 70.0, 0.1437] \ No newline at end of file +[general] +binaryConfig = config_directivity.dat; \ No newline at end of file -- GitLab From dc09213e0580a3e1c7b5866ad835e2c21d7dd829 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Wed, 23 Aug 2023 16:47:04 +0200 Subject: [PATCH 10/12] Add several directivity patterns to config file - config_directivity_txt.cfg now contains 5 directivity patterns --- scripts/testv/config_directivity.cfg | 2 +- scripts/testv/config_directivity_txt.cfg | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/testv/config_directivity.cfg b/scripts/testv/config_directivity.cfg index ae287adb27..d284c5c6a7 100644 --- a/scripts/testv/config_directivity.cfg +++ b/scripts/testv/config_directivity.cfg @@ -5,4 +5,4 @@ directivityCount = 1; directivity = [0.0, 360.0, 0.2512] [general] -binaryConfig = config_directivity.dat; \ No newline at end of file +binaryConfig = config_directivity.dat; diff --git a/scripts/testv/config_directivity_txt.cfg b/scripts/testv/config_directivity_txt.cfg index ae91929310..f040d5708d 100644 --- a/scripts/testv/config_directivity_txt.cfg +++ b/scripts/testv/config_directivity_txt.cfg @@ -1,5 +1,17 @@ [directivitySetting] -directivityCount = 1; +directivityCount = 5; [directivityPattern:0] directivity = [0.0, 360.0, 0.2512] + +[directivityPattern:1] +directivity = [0.01, 180.0, 0.2512] + +[directivityPattern:2] +directivity = [0.02, 180.0, 0.2512] + +[directivityPattern:3] +directivity = [0.0, 90.0, 0.2512] + +[directivityPattern:4] +directivity = [0.0, 350.0, 0.2512] -- GitLab From 342deeb22142b57ecba73fabb753e52abdf700a2 Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Mon, 28 Aug 2023 17:44:02 +0200 Subject: [PATCH 11/12] improve description of -dpid option --- apps/decoder.c | 7 +++++-- apps/renderer.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 58bcf70d26..842a93463d 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1753,8 +1753,11 @@ static void usage_dec( void ) #endif fprintf( stdout, "-exof File : External orientation File for external orientation trajectory\n" ); #ifdef FIX_708_DPID_COMMAND_LINE - fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = (1,2,3,4) (space-separated list of up\n" ); - fprintf( stdout, " to 4 numbers can be specified) for binaural output configuration\n" ); + fprintf( stdout, "-dpid ID : Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up\n" ); + fprintf( stdout, " to 4 numbers (unsigned integers) can be specified for BINAURAL output configuration.\n" ); + fprintf( stdout, " ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for ISMs 1,2,3 and 4 respectively.\n" ); + fprintf( stdout, " This options needs to be accompanied by a render_config file, otherwise a default\n" ); + fprintf( stdout, " directivity pattern is used.\n" ); #else fprintf( stdout, "-dpid ID : Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration\n" ); #endif diff --git a/apps/renderer.c b/apps/renderer.c index 9279db05d2..7ac1bc30f4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -383,7 +383,11 @@ static const CmdLnParser_Option cliOptions[] = { .id = CmdLnOptionId_directivityPatternId, .match = "ism_directivity_pattern_id", .matchShort = "dpid", +#ifdef FIX_708_DPID_COMMAND_LINE + .description = "Directivity pattern ID(s) = [ID1, ID2, ID3, ID4]. Space-separated list of up to 4 numbers (unsigned integers) can be specified for BINAURAL output configuration.\nID1, ID2, ID3, ID4 specify the directivity pattern IDs used for ISMs 1,2,3 and 4 respectively.\nThis options needs to be accompanied by a render_config file, otherwise a default directivity pattern is used.", +#else .description = "Directivity pattern ID(s) (space-separated list of up to 4 numbers can be specified) for binaural output configuration", +#endif }, { .id = CmdLnOptionId_acousticEnvironmentId, -- GitLab From b536701fb4127bd4418ba077389ee0e0db087fbd Mon Sep 17 00:00:00 2001 From: Charles Kinuthia Date: Tue, 29 Aug 2023 14:21:46 +0200 Subject: [PATCH 12/12] replace is_number() with is_digit_only() to capture negative and decimal ID numbers --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index 842a93463d..98778655f1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1553,7 +1553,7 @@ static bool parseCmdlIVAS_dec( return false; } - if ( !is_number( argv[i + tmp] ) ) + if ( !is_digits_only( argv[i + tmp] ) ) { fprintf( stdout, "Error: Invalid directivity pattern ID specified: %s\n\n", argv[i + tmp] ); usage_dec(); -- GitLab