From 895b3b62ba55b0782bb4b569a09322bbc5809e76 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Mon, 10 Nov 2025 14:08:14 +0100 Subject: [PATCH] Port MR2105 from ivas-codec/main --- apps/decoder.c | 62 +++++++++++- apps/renderer.c | 76 ++++++++++++++ lib_com/common_api_types.h | 10 ++ lib_com/ivas_cnst.h | 16 +++ lib_com/options.h | 1 + lib_dec/ivas_init_dec.c | 56 +++++++++++ lib_dec/ivas_stat_dec.h | 21 ++-- lib_dec/lib_dec.c | 21 ++-- lib_dec/lib_dec.h | 3 + lib_rend/ivas_prot_rend.h | 7 ++ lib_rend/ivas_render_config.c | 87 ++++++++++++++++ lib_rend/ivas_rom_rend.c | 87 +++++++++++++++- lib_rend/ivas_rom_rend.h | 15 +++ lib_rend/lib_rend.c | 180 ++++++++++++++++++++++++++++++++++ lib_rend/lib_rend.h | 12 +++ 15 files changed, 634 insertions(+), 20 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 52db79616..022ccaee8 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -147,6 +147,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; @@ -443,12 +446,21 @@ int main( uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; - 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 ) + +#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; } + if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg.renderFramesize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -1019,6 +1031,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 *-----------------------------------------------------------------*/ @@ -1551,7 +1567,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 @@ -1790,6 +1844,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/apps/renderer.c b/apps/renderer.c index c49b79305..3840a61bb 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -195,6 +195,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 @@ -225,7 +228,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[] = { @@ -395,6 +403,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 }; @@ -1160,6 +1176,18 @@ int main( fprintf( stderr, "\nError in IVAS_REND_SetOrientationTrackingMode(): %s\n", ivas_error_to_string( error ) ); 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 ) @@ -2628,6 +2656,40 @@ 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( CmdlnArgs args ) @@ -2749,6 +2811,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; } @@ -2930,6 +2996,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 0a4c9e780..d68144a14 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/ivas_cnst.h b/lib_com/ivas_cnst.h index 71aa5abd4..690b02e0b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1611,11 +1611,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 eb37cf314..3b4f219d0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -211,6 +211,7 @@ #define FIX_1372_OSBA_OBJECT_EDITING /* VA: issue 1372: Fix OSBA object-editing in BINAURAL_ROOM_IR */ #define NONBE_FIX_1172_OBJ_EDIT_JBM /* VA: issue 1172: fix OMASA object editing in JBM */ #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES /* Nokia: Fix for issues 1399: obj edit broken with MC/SBA output in VOIP, and 1400: negative energy estimate used for gaining. */ +#define FIX_1318_ROOM_SIZE_CMD_LINE /* Philips/Nokia: Default room sizes support */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index e208f6a85..4cdddd428 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1403,16 +1403,72 @@ ivas_error ivas_init_decoder( } } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + /*--------------------------------------------------------------------------* + * Allocate and initialize HRTF Statistics handle, get default reverb values + *--------------------------------------------------------------------------*/ +#else /*--------------------------------------------------------------------* * Allocate and initialize HRTF Statistics handle *--------------------------------------------------------------------*/ +#endif if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { + /* Init HRTF statistics */ if ( ( error = ivas_HRTF_statistics_init( &st_ivas->hHrtfStatistics, output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + /* Get default reverb values based on format, if custom values were not given */ + if ( 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; + 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; + } + if ( ( error = ivas_render_config_change_defaults( st_ivas->hRenderConfig, defaultReverbSize ) ) != IVAS_ERR_OK ) + { + return error; + } + } +#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index abdec1414..8022bf3ee 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1014,15 +1014,18 @@ typedef struct jbm_metadata_structure typedef struct decoder_config_structure { - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - 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 */ + int32_t ivas_total_brate; /* IVAS total bitrate in bps */ + int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ + int32_t output_Fs; /* output signal sampling frequency in Hz */ + int16_t nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + 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 f20929fb8..f2bdfbeac 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -319,6 +319,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; @@ -461,12 +464,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 float non_diegetic_pan_gain, /* i : non diegetic panning gain */ - const bool dpidEnabled, /* i : enable directivity pattern option */ - const uint16_t 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 float non_diegetic_pan_gain, /* i : non diegetic panning gain */ + const bool dpidEnabled, /* i : enable directivity pattern option */ + const uint16_t acousticEnvironmentId, /* i : Acoustic environment ID */ + const bool objEditEnabled, /* i : enable object editing */ + const bool delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -530,6 +536,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 22805c7a4..633d25cd9 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 float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const bool dpidEnabled, /* i : enable directivity pattern option */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a92070391..32f24c131 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -1341,6 +1341,13 @@ ivas_error ivas_render_config_init_from_rom( 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.c b/lib_rend/ivas_render_config.c index 0cb6062fd..d02ba73ae 100644 --- a/lib_rend/ivas_render_config.c +++ b/lib_rend/ivas_render_config.c @@ -46,8 +46,19 @@ * Local constants *-----------------------------------------------------------------------*/ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +#define IVAS_REVERB_DEFAULT_L_PRE_DELAY 0.016f +#define IVAS_REVERB_DEFAULT_L_INPUT_DELAY 0.1f + +#define IVAS_REVERB_DEFAULT_S_PRE_DELAY 0.0125f +#define IVAS_REVERB_DEFAULT_S_INPUT_DELAY 0.0f + +#define IVAS_REVERB_DEFAULT_M_PRE_DELAY 0.0125f +#define IVAS_REVERB_DEFAULT_M_INPUT_DELAY 0.0f +#else #define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f #define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f +#endif #define IVAS_REVERB_DEFAULT_USE_ER 0 @@ -105,24 +116,38 @@ ivas_error ivas_render_config_init_from_rom( ) { int16_t i; + if ( hRenderConfig == NULL || *hRenderConfig == NULL ) { return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" ); } + #ifdef DEBUGGING ( *hRenderConfig )->renderer_type_override = IVAS_RENDER_TYPE_OVERRIDE_NONE; #endif +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; + ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_L_PRE_DELAY; + ( *hRenderConfig )->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_L_INPUT_DELAY; +#else ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS; ( *hRenderConfig )->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_PRE_DELAY; ( *hRenderConfig )->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_INPUT_DELAY; +#endif ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; set_zero( &( *hRenderConfig )->roomAcoustics.pFc_input[0], CLDFB_NO_CHANNELS_MAX ); set_zero( &( *hRenderConfig )->roomAcoustics.pAcoustic_rt60[0], CLDFB_NO_CHANNELS_MAX ); set_zero( &( *hRenderConfig )->roomAcoustics.pAcoustic_dsr[0], CLDFB_NO_CHANNELS_MAX ); +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + mvr2r( ivas_reverb_default_large_fc, ( *hRenderConfig )->roomAcoustics.pFc_input, IVAS_REVERB_DEFAULT_L_N_BANDS ); + mvr2r( ivas_reverb_default_large_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_L_N_BANDS ); + mvr2r( ivas_reverb_default_large_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_L_N_BANDS ); +#else mvr2r( ivas_reverb_default_fc, ( *hRenderConfig )->roomAcoustics.pFc_input, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_RT60, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_N_BANDS ); mvr2r( ivas_reverb_default_DSR, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_N_BANDS ); +#endif for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { @@ -146,3 +171,65 @@ ivas_error ivas_render_config_init_from_rom( 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; + hRenderConfig->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_S_PRE_DELAY; + hRenderConfig->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_S_INPUT_DELAY; + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + set_zero( &hRenderConfig->roomAcoustics.pFc_input[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_rt60[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_dsr[0], CLDFB_NO_CHANNELS_MAX ); + + mvr2r( ivas_reverb_default_small_fc, hRenderConfig->roomAcoustics.pFc_input, IVAS_REVERB_DEFAULT_S_N_BANDS ); + mvr2r( ivas_reverb_default_small_RT60, hRenderConfig->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_S_N_BANDS ); + mvr2r( ivas_reverb_default_small_DSR, hRenderConfig->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_S_N_BANDS ); + break; + case DEFAULT_REVERB_MEDIUM: + hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_M_N_BANDS; + hRenderConfig->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_M_PRE_DELAY; + hRenderConfig->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_M_INPUT_DELAY; + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + set_zero( &hRenderConfig->roomAcoustics.pFc_input[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_rt60[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_dsr[0], CLDFB_NO_CHANNELS_MAX ); + + mvr2r( ivas_reverb_default_medium_fc, hRenderConfig->roomAcoustics.pFc_input, IVAS_REVERB_DEFAULT_M_N_BANDS ); + mvr2r( ivas_reverb_default_medium_RT60, hRenderConfig->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_M_N_BANDS ); + mvr2r( ivas_reverb_default_medium_DSR, hRenderConfig->roomAcoustics.pAcoustic_dsr, IVAS_REVERB_DEFAULT_M_N_BANDS ); + break; + case DEFAULT_REVERB_LARGE: + hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS; + hRenderConfig->roomAcoustics.acousticPreDelay = IVAS_REVERB_DEFAULT_L_PRE_DELAY; + hRenderConfig->roomAcoustics.inputPreDelay = IVAS_REVERB_DEFAULT_L_INPUT_DELAY; + hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER; + set_zero( &hRenderConfig->roomAcoustics.pFc_input[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_rt60[0], CLDFB_NO_CHANNELS_MAX ); + set_zero( &hRenderConfig->roomAcoustics.pAcoustic_dsr[0], CLDFB_NO_CHANNELS_MAX ); + + mvr2r( ivas_reverb_default_large_fc, hRenderConfig->roomAcoustics.pFc_input, IVAS_REVERB_DEFAULT_L_N_BANDS ); + mvr2r( ivas_reverb_default_large_RT60, hRenderConfig->roomAcoustics.pAcoustic_rt60, IVAS_REVERB_DEFAULT_L_N_BANDS ); + mvr2r( ivas_reverb_default_large_DSR, hRenderConfig->roomAcoustics.pAcoustic_dsr, 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.c b/lib_rend/ivas_rom_rend.c index fc477be61..b7df27a8c 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -350,7 +350,79 @@ const float t_design_11_elevation[70] = * Reverberator ROM tables *-----------------------------------------------------------------------*/ -const float ivas_reverb_default_fc[IVAS_REVERB_DEFAULT_N_BANDS] = +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const float ivas_reverb_default_small_fc[IVAS_REVERB_DEFAULT_S_N_BANDS] = +{ + 200.0f, 600.0f, 1000.0f, 1400.0f, 1800.0f, 2200.0f, 2600.0f, 3000.0f, 3400.0f, 3800.0f, + 4200.0f, 4600.0f, 5000.0f, 5400.0f, 5800.0f, 6200.0f, 6600.0f, 7000.0f, 7400.0f, 7800.0f, + 8200.0f, 8600.0f, 9000.0f, 9400.0f, 9800.0f, 10200.0f, 10600.0f, 11000.0f, 11400.0f, 11800.0f, + 12200.0f, 12600.0f, 13000.0f, 13400.0f, 13800.0f, 14200.0f, 14600.0f, 15000.0f, 15400.0f, 15800.0f, + 16200.0f, 16600.0f, 17000.0f, 17400.0f, 17800.0f, 18200.0f, 18600.0f, 19000.0f, 19400.0f, 19800.0f, + 20200.0f, 20600.0f, 21000.0f, 21400.0f, 21800.0f, 22200.0f, 22600.0f, 23000.0f, 23400.0f, 23800.0f +}; + +const float ivas_reverb_default_small_RT60[IVAS_REVERB_DEFAULT_S_N_BANDS] = +{ + 0.300000f, 0.273750f, 0.265941f, 0.263784f, 0.265572f, 0.261790f, 0.252988f, 0.245801f, 0.237429f, 0.228169f, + 0.219536f, 0.211116f, 0.203262f, 0.196144f, 0.189161f, 0.182436f, 0.176237f, 0.170114f, 0.164250f, 0.158791f, + 0.153349f, 0.148312f, 0.143266f, 0.138398f, 0.133929f, 0.129493f, 0.125309f, 0.121833f, 0.118321f, 0.115130f, + 0.112655f, 0.109958f, 0.107465f, 0.105311f, 0.103006f, 0.100783f, 0.098629f, 0.096469f, 0.094335f, 0.092217f, + 0.090115f, 0.088057f, 0.086034f, 0.084061f, 0.082327f, 0.080552f, 0.078876f, 0.077614f, 0.076203f, 0.074918f, + 0.074102f, 0.073068f, 0.072153f, 0.071659f, 0.070969f, 0.070686f, 0.070224f, 0.069878f, 0.069936f, 0.069820f +}; + +const float ivas_reverb_default_small_DSR[IVAS_REVERB_DEFAULT_S_N_BANDS] = +{ + 1.562141e-05f, 7.104127e-06f, 4.699859e-06f, 4.302786e-06f, 5.277136e-06f, 6.382504e-06f, 7.237492e-06f, 9.198124e-06f, 1.073813e-05f, 1.148954e-05f, + 1.063691e-05f, 9.580873e-06f, 8.187593e-06f, 7.045559e-06f, 5.871790e-06f, 4.857175e-06f, 4.194530e-06f, 3.594923e-06f, 3.377501e-06f, 4.063327e-06f, + 4.885563e-06f, 6.276646e-06f, 7.591577e-06f, 8.950862e-06f, 9.394771e-06f, 9.701081e-06f, 9.456415e-06f, 8.555601e-06f, 8.035221e-06f, 7.461511e-06f, + 6.976915e-06f, 6.454842e-06f, 5.885498e-06f, 5.657134e-06f, 5.205549e-06f, 4.791783e-06f, 4.635302e-06f, 4.326645e-06f, 4.245139e-06f, 4.107671e-06f, + 4.033808e-06f, 3.961318e-06f, 3.862554e-06f, 3.742024e-06f, 3.559007e-06f, 3.379882e-06f, 3.192690e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, + 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f, 3.129763e-06f +}; + +const float ivas_reverb_default_medium_fc[IVAS_REVERB_DEFAULT_M_N_BANDS] = +{ + 20.0f, 25.0f, 31.5f, 40.0f, + 50.0f, 63.0f, 80.0f, 100.0f, + 125.0f, 160.0f, 200.0f, 250.0f, + 315.0f, 400.0f, 500.0f, 630.0f, + 800.0f, 1000.0f, 1250.0f, 1600.0f, + 2000.0f, 2500.0f, 3150.0f, 4000.0f, + 5000.0f, 6300.0f, 8000.0f, 10000.0f, + 12500.0f, 16000.0f, 20000.0f +}; + +const float ivas_reverb_default_medium_RT60[IVAS_REVERB_DEFAULT_M_N_BANDS] = +{ + 0.22000000f, 0.22500000f, 0.23150000f, 0.24000000f, + 0.25000000f, 0.26300000f, 0.28000000f, 0.30000000f, + 0.32500000f, 0.36000000f, 0.40000000f, 0.39625000f, + 0.39137500f, 0.38500000f, 0.37750000f, 0.36933070f, + 0.36553800f, 0.36107600f, 0.35953475f, 0.35963200f, + 0.35849250f, 0.34878675f, 0.33447100f, 0.31297400f, + 0.28944200f, 0.26387000f, 0.23550800f, 0.20767000f, + 0.18357975f, 0.16133300f, 0.14229700f +}; + +const float ivas_reverb_default_medium_DSR[IVAS_REVERB_DEFAULT_M_N_BANDS] = +{ + 1.488034e-05f, 1.521853e-05f, 1.565818e-05f, 1.623310e-05f, + 1.690948e-05f, 1.778877e-05f, 1.893862e-05f, 2.029138e-05f, + 2.198233e-05f, 2.434965e-05f, 2.705517e-05f, 2.518051e-05f, + 2.274345e-05f, 1.955652e-05f, 1.580720e-05f, 1.174766e-05f, + 9.989742e-06f, 7.921604e-06f, 7.494128e-06f, 8.064566e-06f, + 9.803470e-06f, 1.171147e-05f, 1.607462e-05f, 1.776450e-05f, + 1.271521e-05f, 6.951610e-06f, 6.154952e-06f, 1.181682e-05f, + 7.084896e-06f, 3.571991e-06f, 2.210372e-06f +}; +#endif + +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const float ivas_reverb_default_large_fc[IVAS_REVERB_DEFAULT_L_N_BANDS] = +#else +const float ivas_reverb_default_fc[IVAS_REVERB_DEFAULT_N_BANDS] = +#endif { 20.0f, 25.0f, 31.5f, 40.0f, 50.0f, 63.0f, 80.0f, 100.0f, @@ -362,7 +434,11 @@ const float ivas_reverb_default_fc[IVAS_REVERB_DEFAULT_N_BANDS] = 12500.0f, 16000.0f, 20000.0f }; -const float ivas_reverb_default_RT60[IVAS_REVERB_DEFAULT_N_BANDS] = +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const float ivas_reverb_default_large_RT60[IVAS_REVERB_DEFAULT_L_N_BANDS] = +#else +const float ivas_reverb_default_RT60[IVAS_REVERB_DEFAULT_N_BANDS] = +#endif { 1.3622f, 1.4486f, 1.3168f, 1.5787f, 1.4766f, 1.3954f, 1.2889f, 1.3462f, @@ -374,7 +450,11 @@ const float ivas_reverb_default_RT60[IVAS_REVERB_DEFAULT_N_BANDS] = 0.71945f, 0.61682f, 0.60031f }; -const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +const float ivas_reverb_default_large_DSR[IVAS_REVERB_DEFAULT_L_N_BANDS] = +#else +const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = +#endif { 1.8811e-08f, 2.1428e-08f, 1.3972e-08f, 1.51e-08f, 1.287e-08f, 1.8747e-08f, 2.413e-08f, 3.9927e-08f, @@ -386,6 +466,7 @@ const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = 6.2001e-08f, 2.8483e-08f, 2.6267e-08f }; + /*----------------------------------------------------------------------------------* * Renderer SBA & MC enc/dec matrices *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_rom_rend.h b/lib_rend/ivas_rom_rend.h index 927287ecd..9d14bf325 100644 --- a/lib_rend/ivas_rom_rend.h +++ b/lib_rend/ivas_rom_rend.h @@ -113,9 +113,24 @@ extern const float t_design_11_elevation[70]; * Reverberator ROM tables *-----------------------------------------------------------------------*/ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE +extern const float ivas_reverb_default_small_fc[]; +extern const float ivas_reverb_default_small_RT60[]; +extern const float ivas_reverb_default_small_DSR[]; + +extern const float ivas_reverb_default_medium_fc[]; +extern const float ivas_reverb_default_medium_RT60[]; +extern const float ivas_reverb_default_medium_DSR[]; + +extern const float ivas_reverb_default_large_fc[]; +extern const float ivas_reverb_default_large_RT60[]; +extern const float ivas_reverb_default_large_DSR[]; +#else extern const float ivas_reverb_default_fc[]; extern const float ivas_reverb_default_RT60[]; extern const float ivas_reverb_default_DSR[]; +#endif + /*----------------------------------------------------------------------------------* * Renderer SBA & MC enc/dec matrices diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d0be488f8..ddf6e53f3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -91,6 +91,9 @@ typedef struct const int16_t *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 */ @@ -224,6 +227,9 @@ struct IVAS_REND int8_t rendererConfigEnabled; RENDER_CONFIG_DATA *hRendererConfig; /* Renderer config pointer */ +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + IVAS_DefaultReverbSize selectedRoomReverbSize; +#endif int16_t num_subframes; hrtf_handles hHrtfs; @@ -1238,6 +1244,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; } @@ -3133,6 +3142,9 @@ ivas_error IVAS_REND_Open( hIvasRend->hLimiter = NULL; hIvasRend->efapOutWrapper.hEfap = NULL; hIvasRend->efapOutWrapper.pCustomLsSetup = NULL; +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; +#endif #ifdef DEBUGGING hIvasRend->numClipping = 0; #endif @@ -3829,6 +3841,85 @@ 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; + int16_t i; + int16_t nActiveInputsIsm, nActiveInputsMasa, nActiveInputsSba, nActiveInputsMc; + IVAS_ROOM_SIZE_T selectedReverb; + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + + combinedFormat = false; + nActiveInputsIsm = 0; + nActiveInputsMasa = 0; + nActiveInputsMc = 0; + nActiveInputsSba = 0; + + for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) + { + if ( ismInputs[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + nActiveInputsIsm++; + } + } + for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) + { + if ( masaInputs[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + nActiveInputsMasa++; + } + } + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; i++ ) + { + if ( mcInputs[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + nActiveInputsMc++; + } + } + for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; i++ ) + { + if ( sbaInputs[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + nActiveInputsSba++; + } + } + + /* ISM present with MASA/SBA inputs; treat as combined format */ + if ( nActiveInputsIsm && ( nActiveInputsMasa || nActiveInputsSba ) ) + { + combinedFormat = true; + } + + if ( combinedFormat ) + { + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + } + else + { + /* Only set large if ISM is present alone */ + if ( nActiveInputsIsm && !nActiveInputsMc ) + { + selectedReverb = IVAS_ROOM_SIZE_LARGE; + } + /* if only MC is present, set medium; Will not be overridden by the subsequent block */ + else if ( nActiveInputsMc ) + { + selectedReverb = IVAS_ROOM_SIZE_MEDIUM; + } + else if ( nActiveInputsMasa || nActiveInputsSba ) + { + selectedReverb = IVAS_ROOM_SIZE_SMALL; + } + } + + return selectedReverb; +} +#endif /*-------------------------------------------------------------------* @@ -3957,6 +4048,18 @@ ivas_error IVAS_REND_AddInput( /* 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 ( hIvasRend->selectedRoomReverbSize == DEFAULT_REVERB_UNSET ) + { + IVAS_REND_SetReverbRoomSize( hIvasRend, + getDefaultReverbSize( hIvasRend->inputsIsm, + hIvasRend->inputsMasa, + hIvasRend->inputsMc, + hIvasRend->inputsSba ) ); + } +#endif return IVAS_ERR_OK; } @@ -5191,6 +5294,83 @@ ivas_error IVAS_REND_GetCombinedOrientation( return IVAS_ERR_OK; } +#ifdef FIX_1318_ROOM_SIZE_CMD_LINE + +/*---------------------------------------------------------------------* + * IVAS_REND_GetCombinedOrientation() + * + * + *---------------------------------------------------------------------*/ +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; + break; + case DEFAULT_REVERB_MEDIUM: + *reverbRoomSize = IVAS_ROOM_SIZE_MEDIUM; + break; + case DEFAULT_REVERB_LARGE: + *reverbRoomSize = IVAS_ROOM_SIZE_LARGE; + break; + case DEFAULT_REVERB_UNSET: + default: + *reverbRoomSize = IVAS_ROOM_SIZE_AUTO; + break; + } + + return IVAS_ERR_OK; +} + +/*---------------------------------------------------------------------* + * IVAS_REND_GetCombinedOrientation() + * + * + *---------------------------------------------------------------------*/ +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; + break; + case IVAS_ROOM_SIZE_MEDIUM: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_MEDIUM; + break; + case IVAS_ROOM_SIZE_LARGE: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_LARGE; + break; + case IVAS_ROOM_SIZE_AUTO: + default: + hIvasRend->selectedRoomReverbSize = DEFAULT_REVERB_UNSET; + break; /* will be setup in IVAS_REND_AddInput() */ + } + + if ( hIvasRend->hRendererConfig != NULL ) + { + if ( ( 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 /*-------------------------------------------------------------------* diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 4b6e7340f..0e73f7d82 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -263,6 +263,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 */ -- GitLab