diff --git a/apps/encoder.c b/apps/encoder.c index 1dc0aead517c33f79a1a282ca6d40b4745143074..10fd12a94baa165231f82866b2a8aa893976112b 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -1225,16 +1225,6 @@ static bool parseCmdlIVAS_enc( * IVAS Formats *-----------------------------------------------------------------*/ -#ifdef BINAURAL_AUDIO_CMDLINE - else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) - { - i++; - if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) - { - arg->is_binaural = true; - } - } -#endif else if ( strcmp( argv_to_upper, "-STEREO" ) == 0 ) { i++; @@ -1312,6 +1302,13 @@ static bool parseCmdlIVAS_enc( } #endif /* DEBUGGING */ } +#ifdef BINAURAL_AUDIO_CMDLINE + else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 ) + { + arg->is_binaural = true; + i++; + } +#endif else if ( strcmp( argv_to_upper, "-ISM" ) == 0 ) { arg->inputFormat = IVAS_ENC_INPUT_ISM; @@ -1703,9 +1700,6 @@ static void usage_enc( void ) fprintf( stdout, "Options:\n" ); fprintf( stdout, "--------\n" ); fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" ); -#ifdef BINAURAL_AUDIO_CMDLINE - fprintf( stdout, "-binaural : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" ); -#endif fprintf( stdout, "-stereo : Stereo format \n" ); fprintf( stdout, "-ism (+)Ch Files : ISM format \n" ); fprintf( stdout, " where Ch specifies the number of ISMs (1-4)\n" ); @@ -1737,6 +1731,9 @@ static void usage_enc( void ) fprintf( stdout, " alternatively, B can be a text file where each line contains \"nb_frames B\"\n" ); fprintf( stdout, "-no_delay_cmp : Turn off delay compensation\n" ); fprintf( stdout, "-stereo_dmx_evs : Activate stereo downmix function for EVS.\n" ); +#ifdef BINAURAL_AUDIO_CMDLINE + fprintf( stdout, "-binaural : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" ); +#endif fprintf( stdout, "-mime : Mime output bitstream file format\n" ); fprintf( stdout, " The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" ); fprintf( stdout, " default output bitstream file format is G.192\n" ); diff --git a/lib_com/options.h b/lib_com/options.h index 4328602f5a105a9733328433e16ba0d3cba3fd38..223c6a640446f125452eb4bc201974ff0a46b8bd 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ #define FIX_TODO_FD_CNG_SBA_CLEANUP /* FhG: BE, address TODO comment in fd_cng_enc */ #define ENHANCED_STEREO_DMX /* Orange : Contribution 48 - Enhanced stereo downmix. */ -#define BINAURAL_AUDIO_CMDLINE +#define BINAURAL_AUDIO_CMDLINE /* issue 491: Implement Commandline-Option for Binaural Audio */ #define FIX_570_TCX_LPC_WRITE /* FhG: fix issue 570: LPC bitstream writer in TCX */ #define FIX_506 /* FhG: Compiler warnings */ #define FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH /* Nokia: Issue 511, significant optimization of parametric binauralizer gain fetching. */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 4f2f375af7094af2561f6b387a47f98565b070ef..23d0acbe93c9568becd8bc8bd647d4fa31d69e73 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1084,7 +1084,7 @@ typedef struct encoder_config_structure int16_t max_bwidth; /* maximum encoded bandwidth */ IVAS_FORMAT ivas_format; /* IVAS format */ #ifdef BINAURAL_AUDIO_CMDLINE - bool is_binaural; /* flag indicating if input is binaural audio */ + int16_t is_binaural; /* flag indicating if input is binaural audio */ #endif int16_t element_mode_init; /* element mode used at initialization */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 472497bea5b8912fc4feb34ce842168599bdde5a..2668eed044eb284d8ee4217e09fefd7e7eaad35c 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -283,7 +283,7 @@ ivas_error IVAS_ENC_ConfigureForMono( hIvasEnc->st_ivas->hEncoderConfig->ivas_format = MONO_FORMAT; #ifdef BINAURAL_AUDIO_CMDLINE - hIvasEnc->st_ivas->hEncoderConfig->is_binaural = is_binaural; + hIvasEnc->st_ivas->hEncoderConfig->is_binaural = (int16_t) is_binaural; #endif if ( downmixFromStereo ) @@ -337,7 +337,7 @@ ivas_error IVAS_ENC_ConfigureForStereo( hEncoderConfig->nchan_inp = 2; hEncoderConfig->ivas_format = STEREO_FORMAT; #ifdef BINAURAL_AUDIO_CMDLINE - hEncoderConfig->is_binaural = is_binaural; + hEncoderConfig->is_binaural = (int16_t) is_binaural; #endif #ifdef DEBUGGING @@ -933,6 +933,13 @@ static ivas_error configureEncoder( return error; } +#ifdef BINAURAL_AUDIO_CMDLINE + if ( hEncoderConfig->is_binaural && !( ( hEncoderConfig->ivas_format == MONO_FORMAT && hEncoderConfig->stereo_dmx_evs ) || hEncoderConfig->ivas_format == STEREO_FORMAT ) ) + { + return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "'-binaural' option is supported only with '-stereo' or '-stereo_dmx_evs'" ); + } +#endif + /*-----------------------------------------------------------------* * Finalize initialization *-----------------------------------------------------------------*/ @@ -1540,12 +1547,6 @@ static ivas_error printConfigInfo_enc( if ( hEncoderConfig->stereo_dmx_evs ) { fprintf( stdout, "IVAS format: stereo downmix to bit-exact EVS mono\n" ); -#ifdef BINAURAL_AUDIO_CMDLINE - if ( hEncoderConfig->is_binaural ) - { - fprintf( stdout, "Optional indication: binaural audio\n" ); - } -#endif } else { @@ -1580,12 +1581,6 @@ static ivas_error printConfigInfo_enc( { fprintf( stdout, "IVAS format: stereo - MDCT stereo\n" ); } -#endif -#ifdef BINAURAL_AUDIO_CMDLINE - if ( hEncoderConfig->is_binaural ) - { - fprintf( stdout, "Optional indication: binaural audio\n" ); - } #endif } else if ( hEncoderConfig->ivas_format == ISM_FORMAT ) @@ -1654,6 +1649,13 @@ static ivas_error printConfigInfo_enc( } } +#ifdef BINAURAL_AUDIO_CMDLINE + if ( hEncoderConfig->is_binaural ) + { + fprintf( stdout, "Optional indication: binaural audio\n" ); + } +#endif + /*-----------------------------------------------------------------* * Print CNG update interval, if DTX is activated *-----------------------------------------------------------------*/ @@ -2323,6 +2325,9 @@ static void init_encoder_config( hEncoderConfig->nchan_inp = 1; hEncoderConfig->element_mode_init = EVS_MONO; hEncoderConfig->ivas_format = UNDEFINED_FORMAT; +#ifdef BINAURAL_AUDIO_CMDLINE + hEncoderConfig->is_binaural = 0; +#endif hEncoderConfig->Opt_SC_VBR = 0; hEncoderConfig->last_Opt_SC_VBR = 0; hEncoderConfig->Opt_AMR_WB = 0;