diff --git a/apps/decoder.c b/apps/decoder.c index 94bfab14d8ac1d80b3970bde8b0a5a2873d93dff..7a000f9c57d4d1bccc9853f5d314d03732d5e1ec 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -129,6 +129,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; @@ -410,9 +413,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; @@ -886,6 +895,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 *-----------------------------------------------------------------*/ @@ -1360,6 +1373,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 @@ -1565,6 +1617,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/lib_com/common_api_types.h b/lib_com/common_api_types.h index 6259b5f8d25c933dcee512814d7bdbf0c5cd528f..be4f532ab8003e20af4fe3402ed574770fd36685 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 c445d0299fa3acf3d7256648074877f853ad9c96..7901398826e7e1d6132dc9cd391b7cbf93898a63 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1648,11 +1648,26 @@ 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_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 f658a0ace707fbb02819fb9b308a65709bf53dd1..18e33393e1c7564806933ebeb29d42bab82e56be 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,6 +142,7 @@ #define NONBE_MDCT_ST_DTX_FIX_SUBOPT_SPATIAL_CNG /* FhG: Fix MDCT-Stereo comfort noise for certain noise types */ #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 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: 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 dff92f4e4b92fbaa66580d5f1a546857e70a8303..f9eb53b82aff5e1fa3e2c7d764f29960b230e6a6 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1665,17 +1665,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 e911a5fca55eddc30366d708ed6168467813b2ee..2bf376d65287c9155074566d512c317f7bd62c00 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 ae2027e1093cc08edf740f5cce3a4bae4e0150c2..b6db446078eed0e599838b53f4817c30a23d9352 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -359,6 +359,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 @@ -517,12 +520,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; @@ -585,6 +591,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 f3f034c4da5bec02aa566575979e8cc8309a7f87..4c7f0c3d6f0b558463f8796f3fb8c20edf53e64c 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,