diff --git a/apps/decoder.c b/apps/decoder.c index f40e1ae5ece56f80f8f10d24f22b9d0248ec4e7c..5d7ce4c54528c8f855542537d04a7f08d577b07a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -132,6 +132,9 @@ typedef struct #ifdef FIX_1419_MONO_STEREO_UMX bool evsMode; #endif +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_ROOM_SIZE_T roomSize; +#endif } DecArguments; @@ -413,9 +416,15 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; +#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_fx, 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_fx, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -892,6 +901,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 *-----------------------------------------------------------------*/ @@ -1374,6 +1387,45 @@ static bool parseCmdlIVAS_dec( i++; } #endif +#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 @@ -1594,6 +1646,10 @@ static void usage_dec( void ) 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" ); fprintf( stdout, "\n" ); diff --git a/apps/renderer.c b/apps/renderer.c index 9394fb655efaaa8015ce8648dc3761664a35ceae..6f5bebe8ae14dead48e8e3cf3e8369c6cd9c070a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -200,6 +200,9 @@ typedef struct IVAS_RENDER_FRAMESIZE render_framesize; uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS]; AcousticEnvironmentSequence aeSequence; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_ROOM_SIZE_T reverbRoomSize; +#endif } CmdlnArgs; typedef enum @@ -230,7 +233,12 @@ typedef enum CmdLnOptionId_framing, CmdLnOptionId_syncMdDelay, CmdLnOptionId_directivityPatternId, +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + CmdLnOptionId_acousticEnvironmentId, + CmdLnOptionId_roomSize, +#else CmdLnOptionId_acousticEnvironmentId +#endif } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { @@ -400,6 +408,14 @@ static const CmdLnParser_Option cliOptions[] = { .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.", #endif }, +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + { + .id = CmdLnOptionId_roomSize, + .match = "room_size", + .matchShort = "rsz", + .description = "Selects default reverb based on a room size (S - small | M - medium | L - large)", + } +#endif }; @@ -1252,6 +1268,19 @@ int main( goto cleanup; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + + /* Set reverb room size if specified */ + if ( args.reverbRoomSize != IVAS_ROOM_SIZE_AUTO ) + { + if ( ( IVAS_REND_SetReverbRoomSize( hIvasRend, args.reverbRoomSize ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError setting reverb room size\n" ); + goto cleanup; + } + } +#endif + /* Set up output custom layout configuration */ if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { @@ -2760,6 +2789,39 @@ static bool parseAcousticEnvironmentIds( return true; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + + +static bool parseReverbRoomSize( + char *value, + IVAS_ROOM_SIZE_T *reverbRoomSize ) +{ + if ( strlen( value ) != 1 ) + { + fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", value ); + return false; + } + + to_upper( value ); + switch ( value[0] ) + { + case 'S': + *reverbRoomSize = IVAS_ROOM_SIZE_SMALL; + break; + case 'M': + *reverbRoomSize = IVAS_ROOM_SIZE_MEDIUM; + break; + case 'L': + *reverbRoomSize = IVAS_ROOM_SIZE_LARGE; + break; + default: + fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", value ); + return false; + } + + return true; +} +#endif static bool checkRequiredArgs( @@ -2881,6 +2943,10 @@ static CmdlnArgs defaultArgs( args.aeSequence.pValidity = NULL; args.aeSequence.selected = 0; args.aeSequence.frameCounter = 0; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + + args.reverbRoomSize = IVAS_ROOM_SIZE_AUTO; +#endif return args; } @@ -3062,6 +3128,16 @@ static void parseOption( /* Metadata Delay to sync with audio delay in ms */ args->syncMdDelay = (int16_t) strtol( optionValues[0], NULL, 10 ); break; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + case CmdLnOptionId_roomSize: + assert( numOptionValues == 1 ); + if ( !parseReverbRoomSize( optionValues[0], &args->reverbRoomSize ) ) + { + fprintf( stderr, "Error: Unsupported room size selector %s!\n\n", optionValues[0] ); + exit( -1 ); + } + break; +#endif default: assert( 0 && "This should be unreachable - all command line options should be explicitly handled." ); break; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 4f144044bbaf3bf933ea5c423614fbd70184f7db..4a542eba2f8b05da55e4ecb5a3c295c9b6ab2f05 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -189,6 +189,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/ivas_cnst.h b/lib_com/ivas_cnst.h index 5822ba7e30ee7eb9c34707ae230b768e35b040e2..f3d33b1530f9629b600e498ee253228c50c09965 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1661,11 +1661,27 @@ typedef enum #define RV_LENGTH_NR_FC ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1 #define RV_LENGTH_NR_FC_16KHZ ( RV_FILTER_MAX_FFT_SIZE / 4 ) + 1 +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +#define IVAS_REVERB_DEFAULT_L_N_BANDS 31 +#define IVAS_REVERB_DEFAULT_M_N_BANDS 31 +#define IVAS_REVERB_DEFAULT_S_N_BANDS 60 +#else #define IVAS_REVERB_DEFAULT_N_BANDS 31 +#endif #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) #define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +typedef enum +{ + DEFAULT_REVERB_UNSET = -1, + DEFAULT_REVERB_SMALL, + DEFAULT_REVERB_MEDIUM, + DEFAULT_REVERB_LARGE +} IVAS_DefaultReverbSize; +#endif + /*----------------------------------------------------------------------------------* * FB mixer constants diff --git a/lib_com/options.h b/lib_com/options.h index 84169d48f4029a390729b81aaa36d8065844636e..48923dbb2377f7f92b03523028633f2c449a757e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,6 +147,7 @@ #define NONBE_1344_REND_MASA_LOW_FS /* Nokia: Issue 1344: Fix sanitizer errors when using IVAS_rend to render MASA with lower sampling rates */ #define FIX_1437_LC3PLUS_EXTREND_HIRES /* FhG: fix external renderer split bitstream header writing causing a crash for LC3plus High-res mode */ #define NONBE_1412_AVOID_ROUNDING_AZ_ELEV /* FhG: Avoid rounding when passing azimuth and elevation to efap_determine_gains() */ +#define FIX_1318_ROOM_SIZE_CMD_LINE /* Philips/Nokia/FhG: Default room sizes support */ // object-editing feature porting #define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions) diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 0cbbed6a1c482c34e88585fe8fd8e6640c13796d..09d35f3d991fb43c4de92b7fa876e96ef2241d85 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1682,17 +1682,91 @@ ivas_error ivas_init_decoder_fx( } } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + /*--------------------------------------------------------------------------* + * Allocate and initialize HRTF Statistics handle, get default reverb values + *--------------------------------------------------------------------------*/ + + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + /* Init HRTF statistics */ + IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + + /* Get default reverb values based on format, if custom values were not given */ + IF( EQ_16( st_ivas->hDecoderConfig->Opt_RendConfigCustom, 0 ) ) + { + IVAS_DefaultReverbSize defaultReverbSize; + SWITCH( st_ivas->hDecoderConfig->Opt_RoomSize ) + { + case IVAS_ROOM_SIZE_AUTO: + SWITCH( st_ivas->ivas_format ) + { + case ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_LARGE; + move32(); + BREAK; + case SBA_FORMAT: + defaultReverbSize = DEFAULT_REVERB_SMALL; + move32(); + BREAK; + case MASA_FORMAT: + defaultReverbSize = DEFAULT_REVERB_SMALL; + move32(); + BREAK; + case MC_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + move32(); + BREAK; + case MASA_ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + move32(); + BREAK; + case SBA_ISM_FORMAT: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + move32(); + BREAK; + default: + defaultReverbSize = DEFAULT_REVERB_LARGE; + move32(); + } + BREAK; + case IVAS_ROOM_SIZE_SMALL: + defaultReverbSize = DEFAULT_REVERB_SMALL; + move32(); + BREAK; + case IVAS_ROOM_SIZE_MEDIUM: + defaultReverbSize = DEFAULT_REVERB_MEDIUM; + move32(); + BREAK; + case IVAS_ROOM_SIZE_LARGE: + default: + defaultReverbSize = DEFAULT_REVERB_LARGE; + move32(); + BREAK; + } + IF( NE_32( error = ivas_render_config_change_defaults( st_ivas->hRenderConfig, defaultReverbSize ), IVAS_ERR_OK ) ) + { + return error; + } + } + } +#else /*--------------------------------------------------------------------* * Allocate and initialize HRTF Statistics handle *--------------------------------------------------------------------*/ IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { + /* Init HRTF statistics */ IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } } +#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 4a464705d34a23d136a8b5b5c7573e95112b349a..a10d550945d56ac8687e9872ccca2d1438bb77c4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1077,15 +1077,18 @@ typedef struct jbm_metadata_structure typedef struct decoder_config_structure { - Word32 ivas_total_brate; /* IVAS total bitrate in bps */ - Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */ - Word32 output_Fs; /* output signal sampling frequency in Hz */ - Word16 nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - Word16 Opt_Headrotation; /* indicates whether head-rotation is used */ - Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ + Word32 ivas_total_brate; /* IVAS total bitrate in bps */ + Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */ + Word32 output_Fs; /* output signal sampling frequency in Hz */ + Word16 nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + Word16 Opt_Headrotation; /* indicates whether head-rotation is used */ + Word16 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 */ Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */ Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain, Q15 */ diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index f58d8a819535953dc2cec452b350e1730e2dc0ee..f1d67916f6fb71d2a80c9f8cdf3f686e89930e4e 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -118,6 +118,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 Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */ diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 38c9c2fd18a75de65ccadb4b9f67704d13c6ff5c..417a9807c5f9c37f648c0845258ccf1da21b3087 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1,4 +1,4 @@ -/****************************************************************************************************** +/****************************************************************************************************** (C) 2022-2025 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., @@ -367,6 +367,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_fx = 0; // Q15 @@ -525,12 +528,15 @@ 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 */ - const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */ - const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */ - const bool dpidEnabled, /* i : enable directivity pattern option */ - const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ - const bool objEditEnabled, /* i : enable object editing */ - const bool delayCompensationEnabled /* i : enable delay compensation */ +#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 Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */ + const bool dpidEnabled, /* i : enable directivity pattern option */ + const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */ + const bool objEditEnabled, /* i : enable object editing */ + const bool delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -615,6 +621,9 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->orientation_tracking = orientation_tracking; hDecoderConfig->Opt_HRTF_binary = (Word16) hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = (Word16) renderConfigEnabled; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + hDecoderConfig->Opt_RoomSize = roomSize; +#endif hDecoderConfig->Opt_non_diegetic_pan = (Word16) non_diegetic_pan_enabled; hDecoderConfig->non_diegetic_pan_gain_fx = non_diegetic_pan_gain_fx; // Q15 hDecoderConfig->Opt_delay_comp = (Word16) delayCompensationEnabled; diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 86586520ea539a9b028d6f0873fa06af1d96e54c..9dce43a9751d6b8c12b41f8a5e7257a100a5cb04 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -1347,6 +1347,13 @@ ivas_error ivas_render_config_init_from_rom_fx( RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */ ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +ivas_error ivas_render_config_change_defaults( + RENDER_CONFIG_HANDLE hRenderConfig, /* i/o: Renderer config handle */ + IVAS_DefaultReverbSize reverbDefault /* i: Reverb default size */ +); + +#endif /*----------------------------------------------------------------------------------* * Quaternion operations diff --git a/lib_rend/ivas_render_config_fx.c b/lib_rend/ivas_render_config_fx.c index 3c43b59e1fa44312f199d2cd4af6d26c10e6229a..780908c712029d6117ffc605737477d17b24fed3 100644 --- a/lib_rend/ivas_render_config_fx.c +++ b/lib_rend/ivas_render_config_fx.c @@ -42,8 +42,19 @@ * Local constants *-----------------------------------------------------------------------*/ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +#define IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX 2147484 // 0.016 +#define IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX 13421773 // 0.1 + +#define IVAS_REVERB_DEFAULT_S_PRE_DELAY_FX 1677722 // 0.0125f +#define IVAS_REVERB_DEFAULT_S_INPUT_DELAY_FX 0 // 0.0f + +#define IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX 1677722 // 0.0125f +#define IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX 0 // 0.0f +#else #define IVAS_REVERB_DEFAULT_PRE_DELAY_FX 2147484 // 0.016 #define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773 // 0.1 +#endif #define IVAS_REVERB_DEFAULT_USE_ER 0 @@ -107,21 +118,36 @@ ivas_error ivas_render_config_init_from_rom_fx( { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; + move16(); + ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX; + move32(); + ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX; + move32(); +#else ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; move16(); ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_PRE_DELAY_FX; move32(); ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_INPUT_DELAY_FX; move32(); +#endif ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; move16(); set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_dsr_fx[0], 0, CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + Copy32( ivas_reverb_default_large_fc_fx, ( *hRenderConfig )->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); + Copy32( ivas_reverb_default_large_RT60_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); + Copy32( ivas_reverb_default_large_DSR_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); +#else Copy32( ivas_reverb_default_fc_fx, ( *hRenderConfig )->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_N_BANDS ); Copy32( ivas_reverb_default_RT60_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_N_BANDS ); Copy32( ivas_reverb_default_DSR_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_N_BANDS ); +#endif FOR( i = 0; i < MAX_NUM_OBJECTS; i++ ) { @@ -161,3 +187,77 @@ ivas_error ivas_render_config_init_from_rom_fx( return IVAS_ERR_OK; } + +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + +/*-------------------------------------------------------------------* + * ivas_render_config_change_defaults() + * + * Changes default values from ROM + *-------------------------------------------------------------------*/ + +ivas_error ivas_render_config_change_defaults( + RENDER_CONFIG_HANDLE hRenderConfig, /* i/o: Renderer config handle */ + IVAS_DefaultReverbSize defaultReverbSize /* i: Reverb default size */ +) +{ + SWITCH( defaultReverbSize ) + { + case DEFAULT_REVERB_SMALL: + hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_S_N_BANDS; + move16(); + hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_S_PRE_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_S_INPUT_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + move16(); + set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); + + Copy32( ivas_reverb_default_small_fc_fx, hRenderConfig->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_S_N_BANDS ); + Copy32( ivas_reverb_default_small_RT60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_S_N_BANDS ); + Copy32( ivas_reverb_default_small_DSR_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_S_N_BANDS ); + BREAK; + case DEFAULT_REVERB_MEDIUM: + hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_M_N_BANDS; + move16(); + hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + move16(); + set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); + + Copy32( ivas_reverb_default_medium_fc_fx, hRenderConfig->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_M_N_BANDS ); + Copy32( ivas_reverb_default_medium_RT60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_M_N_BANDS ); + Copy32( ivas_reverb_default_medium_DSR_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_M_N_BANDS ); + BREAK; + case DEFAULT_REVERB_LARGE: + hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; + move16(); + hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX; + move32(); + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + move16(); + set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX ); + set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX ); + + Copy32( ivas_reverb_default_large_fc_fx, hRenderConfig->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); + Copy32( ivas_reverb_default_large_RT60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); + Copy32( ivas_reverb_default_large_DSR_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_L_N_BANDS ); + BREAK; + default: + return IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING; + } + + return IVAS_ERR_OK; +} +#endif diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 5b0f33864b00d441ae9cf83f227b09556f1be6f4..121f019df2ca99b1e116f25e24250e49428a1769 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -107,9 +107,23 @@ extern const Word32 t_design_11_elevation_int[70]; /*Q-22*/ * Reverberator ROM tables *-----------------------------------------------------------------------*/ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +extern const Word32 ivas_reverb_default_small_fc_fx[]; /*Q-16*/ +extern const Word32 ivas_reverb_default_small_RT60_fx[]; /*Q-26*/ +extern const Word32 ivas_reverb_default_small_DSR_fx[]; /*Q-30*/ + +extern const Word32 ivas_reverb_default_medium_fc_fx[]; /*Q-16*/ +extern const Word32 ivas_reverb_default_medium_RT60_fx[]; /*Q-26*/ +extern const Word32 ivas_reverb_default_medium_DSR_fx[]; /*Q-30*/ + +extern const Word32 ivas_reverb_default_large_fc_fx[]; /*Q-16*/ +extern const Word32 ivas_reverb_default_large_RT60_fx[]; /*Q-26*/ +extern const Word32 ivas_reverb_default_large_DSR_fx[]; /*Q-30*/ +#else extern const Word32 ivas_reverb_default_fc_fx[]; /*Q-16*/ extern const Word32 ivas_reverb_default_RT60_fx[]; /*Q-26*/ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ +#endif /*----------------------------------------------------------------------------------* * EFAP ROM tables diff --git a/lib_rend/ivas_rom_rend_fx.c b/lib_rend/ivas_rom_rend_fx.c index ec49c39372a09ecd74e3db57172ff4b2a4e9824f..0579e68a4e712ac4be9ebf724325b6be41c604dd 100644 --- a/lib_rend/ivas_rom_rend_fx.c +++ b/lib_rend/ivas_rom_rend_fx.c @@ -252,20 +252,96 @@ const Word32 t_design_11_elevation_int[70] = //Q22 * Reverberator ROM tables *-----------------------------------------------------------------------*/ -const Word32 ivas_reverb_default_fc_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q16*/ = +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const Word32 ivas_reverb_default_small_fc_fx[IVAS_REVERB_DEFAULT_S_N_BANDS] = { - 1310720 , 1638400 , 2064384 , 2621440 , 3276800 , - 4128768 , 5242880 , 6553600 , 8192000 , - 10485760 , 13107200 , 16384000 , 20643840 , - 26214400 , 32768000 , 41287680 , 52428800 , - 65536000 , 81920000 , 104857600 , 131072000 , - 163840000 , 206438400 , 262144000 , 327680000 , - 412876800 , 524288000 , 655360000 , 819200000 , - 1048576000 , 1310720000 + 13107200, 39321600, 65536000, 91750400, 117964800, 144179200, 170393600, 196608000, 222822400, 249036800, + 275251200, 301465600, 327680000, 353894400, 380108800, 406323200, 432537600, 458752000, 484966400, 511180800, + 537395200, 563609600, 589824000, 616038400, 642252800, 668467200, 694681600, 720896000, 747110400, 773324800, + 799539200, 825753600, 851968000, 878182400, 904396800, 930611200, 956825600, 983040000, 1009254400, 1035468800, + 1061683200, 1087897600, 1114112000, 1140326400, 1166540800, 1192755200, 1218969600, 1245184000, 1271398400, 1297612800, + 1323827200, 1350041600, 1376256000, 1402470400, 1428684800, 1454899200, 1481113600, 1507328000, 1533542400, 1559756800 }; -const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q26*/ = +const Word32 ivas_reverb_default_small_RT60_fx[IVAS_REVERB_DEFAULT_S_N_BANDS] = +{ + 20132660, 18371052, 17846998, 17702244, 17822236, 17568430, 16977738, 16495426, 15933590, 15312162, + 14732812, 14167755, 13640682, 13163001, 12694380, 12243073, 11827065, 11416157, 11022631, 10656284, + 10291077, 9953050, 9614419, 9287733, 8987823, 8690128, 8409345, 8176074, 7940388, 7726244, + 7560149, 7379157, 7211854, 7067302, 6912616, 6763433, 6618880, 6473925, 6330715, 6188578, + 6047516, 5909405, 5773644, 5641238, 5524872, 5405753, 5293279, 5208588, 5113897, 5027662, + 4972901, 4903511, 4842106, 4808954, 4762649, 4743657, 4712653, 4689433, 4693326, 4685541 +}; + +const Word32 ivas_reverb_default_small_DSR_fx[IVAS_REVERB_DEFAULT_S_N_BANDS] = +{ + 16773, 7628, 5046, 4620, 5666, 6853, 7771, 9876, 11530, 12337, + 11421, 10287, 8791, 7565, 6305, 5215, 4504, 3860, 3627, 4363, + 5246, 6739, 8151, 9611, 10088, 10416, 10154, 9187, 8628, 8012, + 7491, 6931, 6320, 6074, 5589, 5145, 4977, 4646, 4558, 4411, + 4331, 4253, 4147, 4018, 3821, 3629, 3428, 3361, 3361, 3361, + 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361, 3361 +}; + +const Word32 ivas_reverb_default_medium_fc_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = +{ + 1310720, 1638400, 2064384, 2621440, 3276800, + 4128768, 5242880, 6553600, 8192000, + 10485760, 13107200, 16384000, 20643840, + 26214400, 32768000, 41287680, 52428800, + 65536000, 81920000, 104857600, 131072000, + 163840000, 206438400, 262144000, 327680000, + 412876800, 524288000, 655360000, 819200000, + 1048576000, 1310720000 +}; + +const Word32 ivas_reverb_default_medium_RT60_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = +{ + 14763950, 15099494, 15535702, 16106127, + 16777216, 17649632, 18790482, 20132660, + 21810380, 24159192, 26843546, 26591888, + 26264732, 25836912, 25333596, 24785364, + 24530840, 24231400, 24127968, 24134494, + 24058024, 23406682, 22445968, 21003330, + 19424124, 17708016, 15804674, 13936498, + 12319828, 10826874, 9549390 +}; + +const Word32 ivas_reverb_default_medium_DSR_fx[IVAS_REVERB_DEFAULT_M_N_BANDS] = { + 15978, 16341, 16813, 17430, + 18156, 19101, 20335, 21788, + 23603, 26145, 29050, 27037, + 24421, 20999, 16973, 12614, + 10726, 8506, 8047, 8659, + 10526, 12575, 17260, 19074, + 13653, 7464, 6609, 12688, + 7607, 3835, 2373 +}; +#endif + +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const Word32 ivas_reverb_default_large_fc_fx[IVAS_REVERB_DEFAULT_L_N_BANDS] /*Q16*/ = +#else +const Word32 ivas_reverb_default_fc_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q16*/ = +#endif +{ + 1310720, 1638400, 2064384, 2621440, 3276800, + 4128768, 5242880, 6553600, 8192000, + 10485760, 13107200, 16384000, 20643840, + 26214400, 32768000, 41287680, 52428800, + 65536000, 81920000, 104857600, 131072000, + 163840000, 206438400, 262144000, 327680000, + 412876800, 524288000, 655360000, 819200000, + 1048576000, 1310720000 +}; + +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const Word32 ivas_reverb_default_large_RT60_fx[IVAS_REVERB_DEFAULT_L_N_BANDS] /*Q26*/ = +#else +const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q26*/ = +#endif + { 91415696, 97213904, 88368952, 105944760, 99092952, 93643712, 86496616, 90341952, 72202424, 69799928, 73618424, 72813120, @@ -276,7 +352,11 @@ const Word32 ivas_reverb_default_RT60_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q26*/ = 48281472, 41394088, 40286124 }; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const Word32 ivas_reverb_default_large_DSR_fx[IVAS_REVERB_DEFAULT_L_N_BANDS] /*Q30*/ = +#else const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = +#endif { 20, 23, 15, 16, 13, 20, 25, 42, diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index ea2bc3981e7bbd2c6c2eb7d479d799981be268b4..4959a3a3ce4e3fefbaebe81f81a306caf6c54525 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -270,6 +270,18 @@ ivas_error IVAS_REND_FeedRenderConfig( IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + +ivas_error IVAS_REND_GetReverbRoomSize( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + IVAS_ROOM_SIZE_T *reverbRoomSize /* o : Reverb room size */ +); + +ivas_error IVAS_REND_SetReverbRoomSize( + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ + const IVAS_ROOM_SIZE_T reverbRoomSize /* i : Reverb room size */ +); +#endif ivas_error IVAS_REND_FeedSplitBinauralBitstream( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 97064e1e814d6f08e2b13d3e074476b447c863c0..7443521aa8453924a8c6edd3dc710207ff0cefc6 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -102,6 +102,9 @@ typedef struct const Word16 *pSplitRendBFI; const SPLIT_REND_WRAPPER *pSplitRendWrapper; const COMBINED_ORIENTATION_HANDLE *pCombinedOrientationData; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + const IVAS_DefaultReverbSize *pSelectedRoomReverbSize; +#endif } rendering_context; /* Common base for input structs */ @@ -232,6 +235,9 @@ struct IVAS_REND Word8 rendererConfigEnabled; RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_DefaultReverbSize selectedRoomReverbSize; +#endif #ifdef DEBUGGING Word32 numClipping; /* Counter of clipped output samples */ @@ -1374,6 +1380,9 @@ static rendering_context getRendCtx( ctx.pSplitRendBFI = &hIvasRend->splitRendBFI; ctx.pSplitRendWrapper = hIvasRend->splitRendWrapper; ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + ctx.pSelectedRoomReverbSize = &hIvasRend->selectedRoomReverbSize; +#endif return ctx; } @@ -3649,6 +3658,10 @@ ivas_error IVAS_REND_Open( move32(); hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; move32(); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; + move32(); +#endif hIvasRend->num_subframes = num_subframes; move16(); @@ -4427,7 +4440,99 @@ static ivas_error isar_pre_rend_init( return IVAS_ERR_OK; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +static IVAS_ROOM_SIZE_T getDefaultReverbSize( + input_ism *ismInputs, + input_masa *masaInputs, + input_mc *mcInputs, + input_sba *sbaInputs ) +{ + bool combinedFormat; + Word16 i; + Word16 nActiveInputsIsm, nActiveInputsMasa, nActiveInputsSba, nActiveInputsMc; + IVAS_ROOM_SIZE_T selectedReverb; + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + move32(); + + combinedFormat = false; + nActiveInputsIsm = 0; + nActiveInputsMasa = 0; + nActiveInputsMc = 0; + nActiveInputsSba = 0; + move16(); + move16(); + move16(); + move16(); + move16(); + + FOR( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + IF( NE_32( ismInputs[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + nActiveInputsIsm = add( nActiveInputsIsm, 1 ); + } + } + FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) + { + IF( NE_32( masaInputs[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + nActiveInputsMasa = add( nActiveInputsMasa, 1 ); + } + } + FOR( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + { + IF( NE_32( mcInputs[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + nActiveInputsMc = add( nActiveInputsMc, 1 ); + } + } + FOR( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + { + IF( NE_32( sbaInputs[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) + { + nActiveInputsSba = add( nActiveInputsSba, 1 ); + } + } + + /* ISM present with MASA/SBA inputs; treat as combined format */ + test(); + test(); + IF( nActiveInputsIsm && ( nActiveInputsMasa || nActiveInputsSba ) ) + { + combinedFormat = true; + move16(); + } + + IF( combinedFormat ) + { + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + move32(); + } + ELSE + { + /* Only set large if ISM is present alone */ + test(); + IF( nActiveInputsIsm && !nActiveInputsMc ) + { + selectedReverb = IVAS_ROOM_SIZE_LARGE; + move32(); + } + /* if only MC is present, set medium; Will not be overridden by the subsequent block */ + ELSE IF( nActiveInputsMc ) + { + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + move32(); + } + ELSE IF( nActiveInputsMasa || nActiveInputsSba ) + { + selectedReverb = IVAS_ROOM_SIZE_SMALL; + move32(); + } + } + return selectedReverb; +} +#endif /*-------------------------------------------------------------------* * IVAS_REND_AddInput() @@ -4567,6 +4672,18 @@ ivas_error IVAS_REND_AddInput_fx( /* set global maximum delay after adding an input */ setMaxGlobalDelayNs( hIvasRend ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + + /* select default reverb size after adding an input */ + IF( EQ_32( hIvasRend->selectedRoomReverbSize, DEFAULT_REVERB_UNSET ) ) + { + IVAS_REND_SetReverbRoomSize( hIvasRend, + getDefaultReverbSize( hIvasRend->inputsIsm, + hIvasRend->inputsMasa, + hIvasRend->inputsMc, + hIvasRend->inputsSba ) ); + } +#endif return IVAS_ERR_OK; } @@ -5790,6 +5907,91 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( * *---------------------------------------------------------------------*/ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + +/*---------------------------------------------------------------------* + * IVAS_REND_GetReverbRoomSize() + * + * + *---------------------------------------------------------------------*/ +ivas_error IVAS_REND_GetReverbRoomSize( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_ROOM_SIZE_T *reverbRoomSize /* o : Reverb room size */ +) +{ + SWITCH( hIvasRend->selectedRoomReverbSize ) + { + case DEFAULT_REVERB_SMALL: + *reverbRoomSize = IVAS_ROOM_SIZE_SMALL; + move32(); + BREAK; + case DEFAULT_REVERB_MEDIUM: + *reverbRoomSize = IVAS_ROOM_SIZE_MEDIUM; + move32(); + BREAK; + case DEFAULT_REVERB_LARGE: + *reverbRoomSize = IVAS_ROOM_SIZE_LARGE; + move32(); + BREAK; + case DEFAULT_REVERB_UNSET: + default: + *reverbRoomSize = IVAS_ROOM_SIZE_AUTO; + move32(); + BREAK; + } + + return IVAS_ERR_OK; +} + +/*---------------------------------------------------------------------* + * IVAS_REND_SetReverbRoomSize() + * + * + *---------------------------------------------------------------------*/ +ivas_error IVAS_REND_SetReverbRoomSize( + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + const IVAS_ROOM_SIZE_T reverbRoomSize /* i : Reverb room size */ +) +{ + ivas_error error; + + SWITCH( reverbRoomSize ) + { + case IVAS_ROOM_SIZE_SMALL: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_SMALL; + move32(); + BREAK; + case IVAS_ROOM_SIZE_MEDIUM: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_MEDIUM; + move32(); + BREAK; + case IVAS_ROOM_SIZE_LARGE: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_LARGE; + move32(); + BREAK; + case IVAS_ROOM_SIZE_AUTO: + default: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; + move32(); + BREAK; /* will be setup in IVAS_REND_AddInput() */ + } + + IF( hIvasRend->hRendererConfig != NULL ) + { + IF( EQ_32( error = ivas_render_config_change_defaults( hIvasRend->hRendererConfig, hIvasRend->selectedRoomReverbSize ), IVAS_ERR_OK ) ) + { + return error; + } + } + ELSE + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return IVAS_ERR_OK; +} +#endif + /*-------------------------------------------------------------------* * Local functions