From 22a5cecabab31037800d1d4dc4d21635ae187deb Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 17 Dec 2024 11:33:38 +0100 Subject: [PATCH 1/3] Add disclaimer for external renderer + Add info about IVAS reference version (FLP issue 1225); under FIX_DISCLAIMER --- apps/renderer.c | 48 ++++++++++++++ lib_com/disclaimer.c | 4 ++ lib_com/options.h | 1 + lib_dec/lib_dec_fx.c | 9 ++- lib_rend/ivas_output_init_fx.c | 116 +++++++++++++++++++++++++++++++++ lib_rend/ivas_prot_rend.h | 7 ++ lib_rend/lib_rend.c | 95 +++++++++++++++++++++++++++ lib_rend/lib_rend.h | 16 +++++ 8 files changed, 294 insertions(+), 2 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 44ed320ad..c4c772cf4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -655,6 +655,10 @@ int main( lfeRoutingConfigs[i] = NULL; } +#ifdef FIX_DISCLAIMER + IVAS_REND_PrintDisclaimer(); + +#endif CmdlnArgs args = parseCmdlnArgs( argc, argv ); if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) || @@ -816,6 +820,50 @@ int main( exit( -1 ); } +#ifdef FIX_DISCLAIMER + fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); + fprintf( stdout, "Output audio file: %s\n\n", args.outputFilePath ); + + if ( args.inConfig.numAudioObjects > 0 ) + { + if ( args.inConfig.numAudioObjects == 1 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM1 ); + } + else if ( args.inConfig.numAudioObjects == 2 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM2 ); + } + else if ( args.inConfig.numAudioObjects == 3 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM3 ); + } + else if ( args.inConfig.numAudioObjects == 4 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM4 ); + } + } + for ( i = 0; i < args.inConfig.numMultiChannelBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.multiChannelBuses[i].audioConfig ); + } + for ( i = 0; i < args.inConfig.numMasaBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.masaBuses[i].audioConfig ); + } + for ( i = 0; i < args.inConfig.numAmbisonicsBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.ambisonicsBuses[i].audioConfig ); + } + + if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) ); + //goto cleanup; + exit( -1 ); + } + +#endif /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index 58452de24..86222c17a 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -44,7 +44,11 @@ int16_t print_disclaimer( FILE *fPtr ) { fprintf( fPtr, "\n==================================================================================================\n" ); +#ifdef FIX_DISCLAIMER + fprintf( fPtr, " \n IVAS Codec Version IVAS-FL-1.0\n" ); +#else fprintf( fPtr, " IVAS Codec Baseline\n" ); +#endif fprintf( fPtr, " \n" ); fprintf( fPtr, " Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,\n" ); fprintf( fPtr, " Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0\n" ); diff --git a/lib_com/options.h b/lib_com/options.h index 9ae9b3a40..8a40a130d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -100,4 +100,5 @@ #define FIX_1009_OPT_PARAMMC_RENDER /* FhG: Optimize ivas_param_mc_dec_render_fx() */ #define FIX_1109_OPTIM_MCT_STEREO_IGF_DEC /* FhG: optimize mctStereoIGF_dec_fx() */ #define FIX_1110_OPTIM_DIRAC_DECORR_PROC /* FhG: optimize ivas_dirac_dec_decorr_process() */ +#define FIX_DISCLAIMER /* VA: Add disclaimer for external renderer + Add info about IVAS reference version (FLP issue 1225) */ #endif diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index b63668b38..7e2e69ec4 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -44,6 +44,11 @@ #include "jbm_jb4sb.h" #include "jbm_pcmdsp_apa.h" #include "jbm_pcmdsp_fifo.h" +#include +#include +#ifndef FIX_DISCLAIMER +#include +#endif #include "wmc_auto.h" #define INV_1000_Q31 2147484 /*1/1000 IN Q31*/ @@ -3058,7 +3063,7 @@ const char *IVAS_DEC_GetErrorMessage( return ivas_error_to_string( error ); } - +#ifndef FIX_DISCLAIMER /*---------------------------------------------------------------------* * get_channel_config() * @@ -3136,7 +3141,7 @@ static ivas_error get_channel_config( return IVAS_ERR_OK; } - +#endif /*---------------------------------------------------------------------* * printConfigInfo_dec( ) diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 77cfa9c55..0300c55c2 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -2,6 +2,10 @@ #include "ivas_prot_fx.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" +#ifdef FIX_DISCLAIMER +#include +#endif + Word16 ivas_get_nchan_buffers_dec_ivas_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word16 sba_analysis_order, /* i : SBA order evaluated in SBA decoder */ @@ -157,3 +161,115 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( return nchan_out_buff; } + +#ifdef FIX_DISCLAIMER +/*---------------------------------------------------------------------* + * get_channel_config() + * + * Gets a str related to input config + *---------------------------------------------------------------------*/ + +ivas_error get_channel_config( + AUDIO_CONFIG config, + Word8 *str ) +{ + IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MONO ) ) + { + strcpy( (char *) str, "Mono" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_STEREO ) ) + { + strcpy( (char *) str, "Stereo" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_ISM1 ) ) + { + strcpy( (char *) str, "Object-based audio (1 object)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_ISM2 ) ) + { + strcpy( (char *) str, "Object-based audio (2 objects)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_ISM3 ) ) + { + strcpy( (char *) str, "Object-based audio (3 objects)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_ISM4 ) ) + { + strcpy( (char *) str, "Object-based audio (4 objects)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1 ) ) + { + strcpy( (char *) str, "Multichannel 5.1 (CICP6)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1 ) ) + { + strcpy( (char *) str, "Multichannel 7.1 (CICP12)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_2 ) ) + { + strcpy( (char *) str, "Multichannel 5.1+2 (CICP14)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_5_1_4 ) ) + { + strcpy( (char *) str, "Multichannel 5.1+4 (CICP16)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_7_1_4 ) ) + { + strcpy( (char *) str, "Multichannel 7.1+4 (CICP19)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + strcpy( (char *) str, "Multichannel (custom loudspeaker layout)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MASA1 ) ) + { + strcpy( (char *) str, "Metadata-Assisted Spatial Audio mono (MASA1)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MASA2 ) ) + { + strcpy( (char *) str, "Metadata-Assisted Spatial Audio stereo (MASA2)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_FOA ) ) + { + strcpy( (char *) str, "Ambisonics: First Order (FOA)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA2 ) ) + { + strcpy( (char *) str, "Ambisonics: Second Order (HOA2)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_HOA3 ) ) + { + strcpy( (char *) str, "Ambisonics: Third Order (HOA3)" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL ) ) + { + strcpy( (char *) str, "Binaural: no room" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) + { + strcpy( (char *) str, "Binaural: room with impulse responses" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + strcpy( (char *) str, "Binaural: room with reverb" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) + { + strcpy( (char *) str, "BINAURAL_SPLIT_CODED" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + strcpy( (char *) str, "Binaural_Split_PCM" ); + } + ELSE IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) + { + strcpy( (char *) str, "External renderer" ); + } + ELSE + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" ); + } + + return IVAS_ERR_OK; +} +#endif diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 396b1163a..c86cada8c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -81,6 +81,13 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( const Word32 ivas_total_brate /* i : total IVAS bitrate */ ); +#ifdef FIX_DISCLAIMER +ivas_error get_channel_config( + const AUDIO_CONFIG config, + char *str +); +#endif + /*----------------------------------------------------------------------------------* * Limiter prototypes *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 14bb3b957..b73a5eb88 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8457,3 +8457,98 @@ static void intermidiate_ext_dirac_render( } } } + +#ifdef FIX_DISCLAIMER +static ivas_error printConfigInfo_rend( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +) +{ + ivas_error error; + char config_str[50]; + + /*-----------------------------------------------------------------* + * Print output audio configuration + *-----------------------------------------------------------------*/ + + IF( NE_32( ( error = get_channel_config( hIvasRend->outputConfig, &config_str[0] ) ), IVAS_ERR_OK ) ) + { + return error; + } + + fprintf( stdout, "Output configuration: %s\n", config_str ); + + /*-----------------------------------------------------------------* + * Print renderer configurations + *-----------------------------------------------------------------*/ + + fprintf( stdout, "Output sampling rate: %d Hz\n", hIvasRend->sampleRateOut ); + + if ( hIvasRend->headRotData.headRotEnabled ) + { + fprintf( stdout, "Head-tracking: ON\n" ); + } + + IF( EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || + EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || + EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || + EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || + EQ_16( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + fprintf( stdout, "Render framesize: %dms\n", mult( hIvasRend->num_subframes, 5 ) ); + } + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintInputConfig() + * + * + *---------------------------------------------------------------------*/ + +void IVAS_REND_PrintInputConfig( + const IVAS_AUDIO_CONFIG inputConfig /* i : input audio configuration */ +) +{ + char config_str[50]; + + get_channel_config( inputConfig, &config_str[0] ); + fprintf( stdout, "Input configuration: %s\n", config_str ); + + return; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintConfig() + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_PrintConfig( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +) +{ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return printConfigInfo_rend( hIvasRend ); +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintDisclaimer() + * + * Print IVAS disclaimer to console + *---------------------------------------------------------------------*/ + +void IVAS_REND_PrintDisclaimer( void ) +{ + print_disclaimer( stderr ); + + return; +} +#endif diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index f3726a05b..74e6070b5 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -324,6 +324,22 @@ void IVAS_REND_Close( ); +#ifdef FIX_DISCLAIMER +/* Disclaimer and info printing */ + +void IVAS_REND_PrintInputConfig( + const IVAS_AUDIO_CONFIG inputConfig /* i : input audio configuration */ +); + +ivas_error IVAS_REND_PrintConfig( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +); + +void IVAS_REND_PrintDisclaimer( + void +); +#endif + /* clang-format on */ #endif -- GitLab From 04eca59b9c456a3a35e6e717fd0b222613695194 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 17 Dec 2024 11:57:18 +0100 Subject: [PATCH 2/3] correction of version --- lib_com/disclaimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index 86222c17a..44fc3627a 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -45,7 +45,7 @@ int16_t print_disclaimer( FILE *fPtr ) fprintf( fPtr, "\n==================================================================================================\n" ); #ifdef FIX_DISCLAIMER - fprintf( fPtr, " \n IVAS Codec Version IVAS-FL-1.0\n" ); + fprintf( fPtr, " IVAS Codec BASOP Baseline\n" ); #else fprintf( fPtr, " IVAS Codec Baseline\n" ); #endif -- GitLab From a16345d1bdede80e01be965ecf8916d104f4debd Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 17 Dec 2024 14:56:05 +0100 Subject: [PATCH 3/3] fix --- apps/renderer.c | 2 +- lib_rend/ivas_output_init_fx.c | 7 ++++--- lib_rend/ivas_prot_rend.h | 5 +++-- lib_rend/lib_rend.c | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index c4c772cf4..f5c0a8847 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -859,7 +859,7 @@ int main( if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) ); - //goto cleanup; + // goto cleanup; exit( -1 ); } diff --git a/lib_rend/ivas_output_init_fx.c b/lib_rend/ivas_output_init_fx.c index 0300c55c2..bbe6ae4b5 100644 --- a/lib_rend/ivas_output_init_fx.c +++ b/lib_rend/ivas_output_init_fx.c @@ -166,12 +166,13 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( /*---------------------------------------------------------------------* * get_channel_config() * - * Gets a str related to input config + * Gets a str related to audio configuration *---------------------------------------------------------------------*/ ivas_error get_channel_config( - AUDIO_CONFIG config, - Word8 *str ) + const AUDIO_CONFIG config, /* i : audio configuration */ + Word8 *str /* o : string with the configuration name */ +) { IF( EQ_16( (Word16) config, IVAS_AUDIO_CONFIG_MONO ) ) { diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index c86cada8c..4afd38886 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -83,11 +83,12 @@ Word16 ivas_get_nchan_buffers_dec_ivas_fx( #ifdef FIX_DISCLAIMER ivas_error get_channel_config( - const AUDIO_CONFIG config, - char *str + const AUDIO_CONFIG config, /* i : audio configuration */ + Word8 *str /* o : string with the configuration name */ ); #endif + /*----------------------------------------------------------------------------------* * Limiter prototypes *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index b73a5eb88..f230cca25 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8464,7 +8464,7 @@ static ivas_error printConfigInfo_rend( ) { ivas_error error; - char config_str[50]; + Word8 config_str[50]; /*-----------------------------------------------------------------* * Print output audio configuration @@ -8511,7 +8511,7 @@ void IVAS_REND_PrintInputConfig( const IVAS_AUDIO_CONFIG inputConfig /* i : input audio configuration */ ) { - char config_str[50]; + Word8 config_str[50]; get_channel_config( inputConfig, &config_str[0] ); fprintf( stdout, "Input configuration: %s\n", config_str ); -- GitLab