diff --git a/lib_com/options.h b/lib_com/options.h index 1a7b596d5309b846680d83f511711c50f1bc7674..79b51a0572ba05320040640b300360a88cd4ca83 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -85,7 +85,7 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ - +#define FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND /* OR : Fix issue basop 2201 hrtf_file_reader crend differs between basop ivas-main and ivas-float-update */ /* #################### End BE switches ################################## */ @@ -97,7 +97,6 @@ #define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */ #define NONBE_FIX_1967_SBA_DECODER_MONO_OUT_BIG_DIFFERENCES /* Dolby: Fix basop issue 1967 */ - /* ##################### End NON-BE switches ########################### */ /* ################## End MAINTENANCE switches ######################### */ diff --git a/lib_rend/ivas_crend_fx.c b/lib_rend/ivas_crend_fx.c index bb1c5519aaea764c817870d44136d01b92f756a9..b16e740fb13f20bcd891a5f55429396e7919d7ef 100644 --- a/lib_rend/ivas_crend_fx.c +++ b/lib_rend/ivas_crend_fx.c @@ -94,6 +94,11 @@ ivas_error ivas_Crend_hrtf_init_fx( hHrtf->pIndex_frequency_max[i][j] = NULL; hHrtf->pOut_to_bin_re_fx[i][j] = NULL; hHrtf->pOut_to_bin_im_fx[i][j] = NULL; +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + hHrtf->pOut_to_bin_re_dyn_fx[i][j] = NULL; + hHrtf->pOut_to_bin_im_dyn_fx[i][j] = NULL; + hHrtf->pIndex_frequency_max_dyn_fx[i][j] = NULL; +#endif } } @@ -102,9 +107,12 @@ ivas_error ivas_Crend_hrtf_init_fx( hHrtf->num_iterations_diffuse[j] = 0; move16(); hHrtf->pIndex_frequency_max_diffuse[j] = NULL; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = NULL; hHrtf->pOut_to_bin_diffuse_im_fx[j] = NULL; +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + hHrtf->pOut_to_bin_diffuse_re_dyn_fx[j] = NULL; + hHrtf->pOut_to_bin_diffuse_im_dyn_fx[j] = NULL; +#endif } hHrtf->init_from_rom = 1; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index db7d42d7c264e78ba1414281cd8416e0428a67ec..d274a0ccfab4c45b9d048aac5047aa9c4c23ad3b 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -179,8 +179,13 @@ static ivas_error read_and_check_hrtf_binary_file_header( static ivas_error check_hrtf_binary_header( ivas_hrtfs_header_t *hrtf_header ) { +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + if ( hrtf_header == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } +#endif /* Check the renderer type */ - if ( ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) && @@ -787,7 +792,11 @@ static ivas_error load_reverb_from_binary( if ( hrtf_header.frequency != sampleRate ) { free( hrtf_data ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; +#else return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF invalid sampling rate" ); +#endif } } } @@ -954,7 +963,11 @@ static ivas_error TDREND_MIX_LoadHRTF( if ( hrtf_header.frequency != sampleRate ) { free( hrtf_data ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; +#else return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF invalid sampling rate" ); +#endif } } } @@ -1723,7 +1736,11 @@ ivas_error load_fastconv_HRTF_from_binary( if ( hrtf_header.frequency != 48000 ) /* note: Parametric renderer data are always stored at 48 kHz */ { free( hrtf_data ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; +#else return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF invalid sampling rate" ); +#endif } if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -1823,7 +1840,11 @@ ivas_error load_parambin_HRTF_from_binary( if ( hrtf_header.frequency != 48000 ) /* note: Parametric renderer data are always stored at 48 kHz */ { free( hrtf_data ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; +#else return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF invalid sampling rate" ); +#endif } if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -1943,7 +1964,11 @@ ivas_error load_Crend_HRTF_from_binary( if ( hrtf_header.frequency != sampleRate ) { free( hrtf_data ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + return IVAS_ERR_INVALID_HRTF_SAMPLING_RATE; +#else return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF invalid sampling rate" ); +#endif } if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -2035,6 +2060,7 @@ void destroy_crend_hrtf( } +#ifndef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND /*---------------------------------------------------------------------* * destroy_hrtf_statistics() * @@ -2065,6 +2091,7 @@ void destroy_hrtf_statistics( return; } +#endif /*---------------------------------------------------------------------* * destroy_fastconv_hrtf() @@ -2100,3 +2127,36 @@ void destroy_parambin_hrtf( return; } + +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND +/*---------------------------------------------------------------------* + * destroy_hrtf_statistics() + * + * Destroy the HRTF statistics set. + *---------------------------------------------------------------------*/ + +void destroy_hrtf_statistics( + IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ +) +{ + if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) ) + { + if ( ( *hHrtfStatistics )->average_energy_l_dyn != NULL ) + { + free( ( *hHrtfStatistics )->average_energy_l_dyn ); + } + if ( ( *hHrtfStatistics )->average_energy_r_dyn != NULL ) + { + free( ( *hHrtfStatistics )->average_energy_r_dyn ); + } + if ( ( *hHrtfStatistics )->inter_aural_coherence_dyn != NULL ) + { + free( ( *hHrtfStatistics )->inter_aural_coherence_dyn ); + } + } + + ivas_HRTF_statistics_close_fx( hHrtfStatistics ); + + return; +} +#endif diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index 105ee0ace97155bbff8e9e8273cc41e25bbb29c2..f949308d72d9dc8392d106fcd78f05ea22c2f0d2 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -56,7 +56,7 @@ typedef enum { BINAURAL_INPUT_AUDIO_CONFIG_INVALID, BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */ - BINAURAL_INPUT_AUDIO_CONFIG_HOA3, /* HOA3 */ + BINAURAL_INPUT_AUDIO_CONFIG_HOA3, /* HOA3 */ BINAURAL_INPUT_AUDIO_CONFIG_HOA2, /* HOA2 */ BINAURAL_INPUT_AUDIO_CONFIG_FOA, /* FOA */ BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED /* Not used */ @@ -118,13 +118,17 @@ ivas_error load_reverb_binary( ); /*---------------------------------------------------------------------* - * create_SetOfHRTF_from_binary() + * load_Crend_HRTF_from_binary() * - * Create the HRTF data set from the binary file + * Create the Crend HRTF data set from the binary file *---------------------------------------------------------------------*/ ivas_error load_Crend_HRTF_from_binary( - IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: Set of HRTF CRend handle */ +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + IVAS_DEC_HRTF_CREND_HANDLE hHrtfCrend, /* i/o: HRTF CRend handle */ +#else + IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF, /* i/o: Set of HRTF CRend handle */ +#endif const hrtfFileReader *hrtfReader, /* i : pointer to hrtfFileReader handle */ const IVAS_AUDIO_CONFIG OutputConfig, /* i : output audio configuration */ const IVAS_AUDIO_CONFIG hrtf_set_audio_cfg, /* i : HRTF set audio config. */ @@ -134,11 +138,15 @@ ivas_error load_Crend_HRTF_from_binary( /*---------------------------------------------------------------------* * destroy_crend_hrtf() * - * Destroy the HRTF data set. + * Destroy the Crend HRTF data set *---------------------------------------------------------------------*/ void destroy_crend_hrtf( +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND + IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend /* i/o: Crend HRTF handle */ +#else IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */ +#endif ); /*---------------------------------------------------------------------* @@ -174,7 +182,7 @@ ivas_error load_parambin_HRTF_from_binary( IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin, /* i/o: Parambin HRTF handle */ const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */ ); - +#ifndef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND /*---------------------------------------------------------------------* * destroy_hrtf_statistics() * @@ -184,7 +192,7 @@ ivas_error load_parambin_HRTF_from_binary( void destroy_hrtf_statistics( IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ ); - +#endif /*---------------------------------------------------------------------* * destroy_parambin_hrtf() * @@ -205,4 +213,16 @@ void destroy_td_hrtf( IVAS_DEC_HRTF_TD_HANDLE *hHRTF /* i/o: TD rend. HRTF handle */ ); +#ifdef FIX_BASOP_2201_HARMONIZE_HRTF_FILE_READER_CREND +/*---------------------------------------------------------------------* + * destroy_hrtf_statistics() + * + * free memory allocated for HRTF statistics binary data + *---------------------------------------------------------------------*/ + +void destroy_hrtf_statistics( + IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics /* i/o: HRTF statistics handle */ +); +#endif + #endif /* IVAS_HRTF_FILE_READER_H */