diff --git a/apps/decoder.c b/apps/decoder.c index 6f7b929cd2eccb2451bb5b6146cfcd531a8a14ba..6e3c6e5fbe00cec30b2951223f02a2563be0b777 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -155,6 +155,9 @@ typedef struct uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS]; bool objEditEnabled; char *objEditFileName; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_ROOM_SIZE_T roomSize; +#endif } DecArguments; @@ -455,9 +458,15 @@ int main( #ifdef IVAS_RTPDUMP arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, + arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.roomSize, arg.non_diegetic_pan_enabled, + arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -1036,6 +1045,10 @@ static bool parseCmdlIVAS_dec( arg->objEditEnabled = false; arg->objEditFileName = NULL; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + arg->roomSize = IVAS_ROOM_SIZE_AUTO; +#endif + /*-----------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -1524,6 +1537,45 @@ static bool parseCmdlIVAS_dec( } i++; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + else if ( strcmp( argv_to_upper, "-ROOM_SIZE" ) == 0 ) + { + i++; + if ( argc - i <= 3 || argv[i][0] == '-' ) + { + fprintf( stderr, "Error: Room size selector not specified!\n\n" ); + usage_dec(); + return false; + } + + if ( strlen( argv[i] ) != 1 ) + { + fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", argv[i] ); + usage_dec(); + return false; + } + switch ( argv[i][0] ) + { + case 'S': + case 's': + arg->roomSize = IVAS_ROOM_SIZE_SMALL; + break; + case 'M': + case 'm': + arg->roomSize = IVAS_ROOM_SIZE_MEDIUM; + break; + case 'L': + case 'l': + arg->roomSize = IVAS_ROOM_SIZE_LARGE; + break; + default: + fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", argv[i] ); + usage_dec(); + return false; + } + i++; + } +#endif /*-----------------------------------------------------------------* * Option not recognized @@ -1752,6 +1804,10 @@ static void usage_dec( void ) fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\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" ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); + fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); +#endif fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 80c90d6b3152a5ace3ef0f0f205ac0c61784a356..b8b3c93e3dc92d09d77ffd9adbd2c6440f60068b 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -173,6 +173,16 @@ typedef enum } IVAS_RENDER_FRAMESIZE; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +typedef enum +{ + IVAS_ROOM_SIZE_AUTO = -1, + IVAS_ROOM_SIZE_SMALL, + IVAS_ROOM_SIZE_MEDIUM, + IVAS_ROOM_SIZE_LARGE +} IVAS_ROOM_SIZE_T; +#endif + typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index a98f995caace1d62781b56c3f8ece92d70c7bb24..f58d88a81cfe152989a7797b4b092d14778b82f2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,7 +171,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define FIX_1413_IGF_INIT_PRINTOUT /* FhG: use correct variable for IGF initiliazation */ #define RENDERER_MD_SYNC_DELAY_TO_INTEGER /* FhG: change data type of metadata sync delay in ext renderer to int16_t for better BASOP portability (and nicer code) */ - +#define FIX_1318_ROOM_SIZE_CMD_LINE /* Philips/Nokia: Default room sizes support */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 284aae854d58e6e3b64f4b78a2f7151c0158ede8..57d21c5e84562d5e4f33208ef1d470386cb6071d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1397,7 +1397,46 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->Opt_RendConfigCustom == 0 ) { IVAS_DefaultReverbSize defaultReverbSize; - +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + switch ( st_ivas->hDecoderConfig->Opt_RoomSize ) + { + case IVAS_ROOM_SIZE_AUTO: + switch ( st_ivas->ivas_format ) + { + case ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + break; + case SBA_FORMAT: + defaultReverbSize = DEFAULT_REVERB_SMALL; + break; + case MASA_FORMAT: + defaultReverbSize = DEFAULT_REVERB_SMALL; + break; + case MC_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + break; + case MASA_ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + break; + case SBA_ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + break; + default: + defaultReverbSize = DEFAULT_REVERB_LARGE; + } + break; + case IVAS_ROOM_SIZE_SMALL: + defaultReverbSize = DEFAULT_REVERB_SMALL; + break; + case IVAS_ROOM_SIZE_MEDIUM: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + break; + case IVAS_ROOM_SIZE_LARGE: + default: + defaultReverbSize = DEFAULT_REVERB_LARGE; + break; + } +#else switch ( st_ivas->ivas_format ) { case ISM_FORMAT: @@ -1421,7 +1460,7 @@ ivas_error ivas_init_decoder( default: defaultReverbSize = DEFAULT_REVERB_LARGE; } - +#endif if ( ( error = ivas_render_config_change_defaults( st_ivas->hRenderConfig, defaultReverbSize ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index f1efb32a1019670330be0bc7f647dbadc404a0d3..777082e63504b17d29e5e9be285ca8dad37ccaa9 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1016,6 +1016,9 @@ typedef struct decoder_config_structure int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_ROOM_SIZE_T Opt_RoomSize; /* Selected room size */ +#endif IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ float non_diegetic_pan_gain; /* non diegetic panning gain*/ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index d8a602beb091edc727cf3211d122c4be7c22f721..9863143c9585fa5d7256f2bc0e5c4260c73a335a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -310,6 +310,9 @@ static void init_decoder_config( hDecoderConfig->Opt_HRTF_binary = 0; hDecoderConfig->Opt_Headrotation = 0; hDecoderConfig->Opt_RendConfigCustom = 0; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + hDecoderConfig->Opt_RoomSize = IVAS_ROOM_SIZE_AUTO; +#endif hDecoderConfig->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; @@ -452,6 +455,9 @@ ivas_error IVAS_DEC_Configure( const bool enableExternalOrientation, /* i : enable external orientations */ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + const IVAS_ROOM_SIZE_T roomSize, /* i : room size selector for reverb */ +#endif const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */ @@ -508,6 +514,9 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->orientation_tracking = orientation_tracking; hDecoderConfig->Opt_HRTF_binary = (int16_t) hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = (int16_t) renderConfigEnabled; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + hDecoderConfig->Opt_RoomSize = roomSize; +#endif hDecoderConfig->Opt_non_diegetic_pan = (int16_t) non_diegetic_pan_enabled; hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; hDecoderConfig->Opt_delay_comp = (int16_t) delayCompensationEnabled; diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index d0d2b501d847425d71c701665cda87ba15f71d36..5aef9034ed73edb5963fc02aafed6b1fbca24870 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -119,6 +119,9 @@ ivas_error IVAS_DEC_Configure( const bool enableExternalOrientation, /* i : enable external orientations */ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + const IVAS_ROOM_SIZE_T roomSize, /* i : room size selector for reverb */ +#endif const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */