From aee6cf7c2aacd4325ad7b2e76cb72f4eb50459fb Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Jun 2024 10:50:19 +0200 Subject: [PATCH] [fix] BRIR memory allocation being skipped due to function return when loading from file if HRIR memory is already allocated --- lib_com/options.h | 1 + lib_dec/ivas_binRenderer_internal.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index ea4a4576ec..c069cc8e92 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,6 +168,7 @@ //#define FIX_CREND_SIMPLIFY_CODE /* Ora : simplify line code in crend */ #define FLOAT_FIX_POINT_HRTF_FILE_FORMAT /* allows reading floation or fix point hrtf binary file format */ #define FIX_1082_INSTRUM_FAILED_LC3PLUS /* VoiceAge: issue 1082: fix ambiguous syntax in LC3Plus code leading to fails of instrumented builds */ +#define FIX_1115_FASTCONV_HRTF_FILE_LOAD /* FhG: issue 1115: fix crash when loading FastConv-only binary HRTF file */ #define FIX_1099_JBM_MD_HANDLE_ALLOC /* VA: issue 1099: Limit the allocation of `hJbmMetadata` handle to MASA and OMASA only */ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 6eed547360..9e7ed8b6e1 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -685,11 +685,15 @@ ivas_error ivas_allocate_binaural_hrtf( if ( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { +#ifndef FIX_1115_FASTCONV_HRTF_FILE_LOAD if ( ( HrtfFastConv->leftHRIRReal != NULL ) && ( HrtfFastConv->leftHRIRImag != NULL ) && ( HrtfFastConv->rightHRIRReal != NULL ) && ( HrtfFastConv->rightHRIRImag != NULL ) ) { return IVAS_ERR_OK; } else +#else + if ( ( HrtfFastConv->leftHRIRReal == NULL ) && ( HrtfFastConv->leftHRIRImag == NULL ) && ( HrtfFastConv->rightHRIRReal == NULL ) && ( HrtfFastConv->rightHRIRImag == NULL ) ) +#endif { if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) ) @@ -713,11 +717,15 @@ ivas_error ivas_allocate_binaural_hrtf( if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { +#ifndef FIX_1115_FASTCONV_HRTF_FILE_LOAD if ( ( HrtfFastConv->leftBRIRReal != NULL ) && ( HrtfFastConv->leftBRIRImag != NULL ) && ( HrtfFastConv->rightBRIRReal != NULL ) && ( HrtfFastConv->rightBRIRImag != NULL ) ) { return IVAS_ERR_OK; } else +#else + if ( ( HrtfFastConv->leftBRIRReal == NULL ) && ( HrtfFastConv->leftBRIRImag == NULL ) && ( HrtfFastConv->rightBRIRReal == NULL ) && ( HrtfFastConv->rightBRIRImag == NULL ) ) +#endif { if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) ) { -- GitLab