diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 92a0b8f88bc5cbac8a181136619c7808593131d5..1b05d93106cd90498cc0dee349ec1c59e97c9200 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -235,12 +235,18 @@ stages: - cd $SCRIPTS_DIR - sed -i '/fetch/d' .git/config # Remove all fetch lines to clean out dead links - git remote set-branches --add origin "$BASOP_CI_BRANCH_PC_REPO" # Add currently used branch + - git remote set-branches --add origin main # Add main to be able to load new format HRTFs - git fetch - git restore --staged . # Needed if HRTF model files were updated. - git restore . # Just as a precaution - git checkout "$BASOP_CI_BRANCH_PC_REPO" - git reset --hard origin/"$BASOP_CI_BRANCH_PC_REPO" - git pull + +# Restore new format of HRTF binary + - git fetch origin main + - git checkout 78154d0b3f1b2c6c8ff8a234f3f7cf865d467d35 -- scripts/binauralRenderer_interface/binaural_renderers_hrtf_data + - cd - - cp -r $SCRIPTS_DIR/ci . - cp -r $SCRIPTS_DIR/scripts . @@ -2031,7 +2037,7 @@ ivas-pytest-on-merge-request: ### prepare pytest # create references - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --update_ref 1 -k "not model" ### Run test using branch scripts and input - if [ $ref_using_target == 1 ]; then git checkout $source_branch_commit_sha; fi @@ -2039,7 +2045,7 @@ ivas-pytest-on-merge-request: ### run pytest - exit_code=0 - testcase_timeout=60 - - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout || exit_code=$? + - python3 -m pytest $TESTS_DIR_CODEC_BE_ON_MR -v --html=report.html --self-contained-html --junit-xml=report-junit.xml --testcase_timeout=$testcase_timeout -k "not model" || exit_code=$? - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true - *merge-request-comparison-check diff --git a/apps/decoder.c b/apps/decoder.c index db9c49695b98f5571467a09636d5e582ff33ce01..70a3b5f9ab135256469d11b78f45731f80e8715c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -735,7 +735,6 @@ int main( } #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) @@ -744,7 +743,6 @@ int main( goto cleanup; } } -#endif #endif if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ) ) != IVAS_ERR_OK ) @@ -832,7 +830,6 @@ int main( #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -851,12 +848,14 @@ int main( } } #else - if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) + if ( ( hHrtfTD != NULL ) && ( *hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK ) { - fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); - goto cleanup; + if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) + { + fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName ); + goto cleanup; + } } -#endif #endif } diff --git a/apps/renderer.c b/apps/renderer.c index d65a7b68e41b13778afbf71af56abb8d72749123..58b6fdbba6af3ad8ef38e989ed7d0cf4b8198400 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -933,7 +933,6 @@ int main( } #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( ( hHrtfTD != NULL ) && ( error = load_reverb_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK ) { if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA ) @@ -942,7 +941,6 @@ int main( goto cleanup; } } -#endif #endif if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hSetOfHRTF ) ) != IVAS_ERR_OK ) @@ -1026,7 +1024,6 @@ int main( } #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( ( error = IVAS_REND_GetHrtfStatisticsHandle( hIvasRend, &hHrtfStatistics ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_GetHrtfStatisticsHandle failed\n\n" ); @@ -1044,7 +1041,6 @@ int main( destroy_hrtf_statistics( hHrtfStatistics ); } } -#endif #endif } diff --git a/lib_com/options.h b/lib_com/options.h index c0e2cf8f7c7f5c22243e2c21f059952e97bec2e7..4cd497a76fce06cddb18aaf958d13b2a8020fd6e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -183,24 +183,15 @@ #define FIX_993_REMOVE_SBA_GET_ORDER /* VA: issue 993: remove unused function ivas_sba_get_order() */ #define FIX_960_SYN_OUTPUT /* VA: issue 960: unused function syn_output() is removed */ -//#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ +#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */ #ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT -#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ -#ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES -#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format */ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES -#define NONBE_FIX_AVG_IAC_CLDFB_REVERB -#endif -#endif -#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format*/ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES -#define NONBE_FIX_AVG_IAC_CLDFB_REVERB -#endif #define FIX_OLD_BINARY_FORMAT /* Orange: trick to make tests succesful when changing hrtf binary format between ref and new branch*/ -#define FIX_OLD_BINARY_FILE /* Orange: current hrtf binary file in ref branch contains wrong values for fastconv value. This switch can be activated to compre running codec with and without hrtf file*/ +//#define NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /* Philips: Use pre-computed HRTF average L/R energies and IAC in all renderers */ +#endif +//#define FIX_638_ENERGIE_IAC_ROM_TABLES /* Orange: Missing left/right and coherence late reverb tables in binary format */ #define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ #define FIX_INV_DIFFUSE_WEIGHT /* Orange : Fix error in energy compensation in late binaural */ -#endif + #define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions */ //#define FIX_777_COMBI_RENDER_CONFIG_FILE /* Philips: Fix for combined renderer config file support */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a9ec15a79c5cc0f7ba5c96a359c1b3849f2d50e8..e5551c374a5f66044c7cc7c1e0fc48f5f5cdd239 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1956,7 +1956,8 @@ ivas_error ivas_init_decoder( } #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index eac4c045723233f3b6c5b79c61c3003d1b65c9d3..0f138fd945100990ad7a0503de334a29ebd17588 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -215,7 +215,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Open Crend Binaural renderer */ #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 12b1fc71173e7f13a91af162efd0ead1c3cc7518..1f5ab85ddbb4efc89caf0cc812a9106e53b4bb1a 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1246,7 +1246,7 @@ static ivas_error ivas_mc_dec_reconfig( else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES - if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index a4168fc9f1b4a79a85c13f0bd390384f1e512927..4bb146e5adfda490d1b17b9946371d8951a1364c 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -38,7 +38,11 @@ #include "wmc_auto.h" #include "ivas_prot.h" #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES +#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES #include "ivas_rom_binaural_crend_head.h" +#else +#include "ivas_rom_rend.h" +#endif #endif /*-----------------------------------------------------------------------* diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 1a0f1eaa06c1d8c61a7280fc467a71ac040c7bde..80af6cfd8c471592a68805048cc916cf89c5a7ba 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -38,6 +38,8 @@ #include "ivas_prot.h" #ifdef FIX_638_ENERGIE_IAC_ROM_TABLES #include "ivas_rom_binaural_crend_head.h" +#else +#include "ivas_rom_rend.h" #endif /*---------------------------------------------------------------------* @@ -191,7 +193,7 @@ static ivas_error check_hrtf_binary_header( { /* Check the renderer type */ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT 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 ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) && @@ -445,7 +447,7 @@ static ivas_error LoadBSplineBinary( LoadBSplineBinaryITD( &HrFiltSet_p->ModelParamsITD, f_hrtf ); } -#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifndef USE_NEW_HRTF_BINARY_FILE_FORMAT /* left/right energy and interaural coherence for late reverb */ for ( i = 0; i < 3; i++ ) { @@ -462,7 +464,6 @@ static ivas_error LoadBSplineBinary( return IVAS_ERR_OK; } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES #ifndef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES /*-------------------------------------------------------------------* * set_default_reverb_iac_energy() @@ -501,12 +502,10 @@ static ivas_error set_default_reverb_iac_energy( #else HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) ); #endif -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } -#endif } switch ( HrFiltSet_p->SampleRate ) { @@ -559,8 +558,6 @@ static ivas_error set_default_reverb_iac_energy( } #endif -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES - /*-------------------------------------------------------------------* * load_reverb_from_binary() * @@ -587,9 +584,7 @@ static ivas_error load_reverb_from_binary( ivas_hrtfs_header_t hrtf_header; int32_t hrtf_data_size_max; char *hrtf_data; -#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB int16_t lr_iac_len; - #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( hHrtfStatistics == NULL ) #else @@ -600,6 +595,7 @@ static ivas_error load_reverb_from_binary( } lr_iac_len = LR_IAC_LENGTH_NR_FC; +#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB #ifdef NONBE_FIX_922_PRECOMPUTED_HRTF_PROPERTIES if ( sampleRate == 16000 ) #else @@ -647,7 +643,11 @@ static ivas_error load_reverb_from_binary( return header_check_result; } +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT + is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); +#else is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); +#endif if ( !is_reverb ) { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) @@ -682,27 +682,13 @@ static ivas_error load_reverb_from_binary( /* left/right energy and interaural coherence for late reverb */ for ( i = 0; i < 3; i++ ) { -#ifdef NONBE_FIX_AVG_IAC_CLDFB_REVERB HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( lr_iac_len * sizeof( float ) ); -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); } -#endif fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), lr_iac_len, f_hrtf ); HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i]; -#else - HrFiltSet_p->lr_energy_and_iac_dyn[i] = (float *) malloc( LR_IAC_LENGTH_NR_FC * sizeof( float ) ); -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES - if ( HrFiltSet_p->lr_energy_and_iac_dyn[i] == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" ); - } -#endif - fread( HrFiltSet_p->lr_energy_and_iac_dyn[i], sizeof( const float ), LR_IAC_LENGTH_NR_FC, f_hrtf ); - HrFiltSet_p->lr_energy_and_iac[i] = (const float *) HrFiltSet_p->lr_energy_and_iac_dyn[i]; -#endif } #endif } @@ -720,7 +706,6 @@ static ivas_error load_reverb_from_binary( return IVAS_ERR_OK; } -#endif /*---------------------------------------------------------------------* * load_reverb_binary() @@ -746,7 +731,6 @@ ivas_error load_reverb_binary( return load_reverb_from_binary( hHrtf, hrtfReader->file ); #endif } -#endif /*-------------------------------------------------------------------* * TDREND_MIX_LoadHRTF() @@ -822,7 +806,7 @@ static ivas_error TDREND_MIX_LoadHRTF( return header_check_result; } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT is_tdrend = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD ); #else is_tdrend = ( hrtf_header.rend_type == RENDERER_BINAURAL_OBJECTS_TD ); @@ -1129,7 +1113,7 @@ static ivas_error create_HRTF_from_rawdata( ( *hHRTF )->index_frequency_max_diffuse = *( (uint16_t *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( uint16_t ); - +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT #ifdef FIX_INV_DIFFUSE_WEIGHT for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) { @@ -1141,6 +1125,23 @@ static ivas_error create_HRTF_from_rawdata( ( *hHRTF )->inv_diffuse_weight[1][i] = *( (float *) ( hrtf_data_rptr ) ); hrtf_data_rptr += sizeof( float ); } +#else + for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) + { + ( *hHRTF )->inv_diffuse_weight[i] = *( (float *) ( hrtf_data_rptr ) ); + hrtf_data_rptr += sizeof( float ); + } + hrtf_data_rptr += sizeof( float ) * ( *hHRTF )->max_num_ir; +#endif +#else +#ifdef FIX_INV_DIFFUSE_WEIGHT + /* inv_diffuse_weight */ + for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) + { + ( *hHRTF )->inv_diffuse_weight[0][i] = *( (float *) ( hrtf_data_rptr ) ); + ( *hHRTF )->inv_diffuse_weight[1][i] = ( *hHRTF )->inv_diffuse_weight[0][i]; + hrtf_data_rptr += sizeof( float ); + } #else /* inv_diffuse_weight */ for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ ) @@ -1149,6 +1150,7 @@ static ivas_error create_HRTF_from_rawdata( hrtf_data_rptr += sizeof( float ); } #endif +#endif #ifdef FIX_OLD_BINARY_FORMAT #ifdef FIX_INV_DIFFUSE_WEIGHT @@ -1270,7 +1272,7 @@ static ivas_error create_HRTF_from_rawdata( static ivas_error create_fastconv_HRTF_from_rawdata( HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */ char *hrtf_data, /* i : pointer to binary file */ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT HRTF_READER_RENDERER_TYPE rend_type, /* i : Renderer type */ #else RENDERER_TYPE rend_type, /* i : Renderer type */ @@ -1280,13 +1282,13 @@ static ivas_error create_fastconv_HRTF_from_rawdata( { int16_t i, j; char *hrtf_data_rptr; -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT ivas_error error; #endif ( *hHRTF )->allocate_init_flag = 0; -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) { if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK ) @@ -1321,7 +1323,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( #endif /* HRIR */ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) #else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) @@ -1383,7 +1385,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) #else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) @@ -1445,7 +1447,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) #else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) @@ -1508,7 +1510,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) #else else if ( rend_type == RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) @@ -1573,7 +1575,7 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } } /* BRIR */ -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) #else else if ( rend_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) @@ -1642,18 +1644,10 @@ static ivas_error create_fastconv_HRTF_from_rawdata( } hrtf_data_rptr += sizeof( uint16_t ); -#ifdef FIX_OLD_BINARY_FILE // old binary file contains wrong value use default one instead - extern const Word32 fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX]; - memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); - hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); - memcpy( ( *hHRTF )->fastconvReverberationTimes, fastconvReverberationTimes, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); - hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); -#else memcpy( ( *hHRTF )->fastconvReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) ); hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float ); -#endif } return IVAS_ERR_OK; @@ -1710,7 +1704,7 @@ ivas_error load_fastconv_HRTF_from_binary( free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" ); } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) ) #else if ( ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV ) || ( hrtf_header.rend_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) @@ -1872,7 +1866,7 @@ ivas_error load_parambin_HRTF_from_binary( } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ #else if ( hrtf_header.rend_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */ @@ -1966,7 +1960,7 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = NULL; if ( hrtf_header.frequency == output_Fs ) { -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) #else if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV ) @@ -1989,7 +1983,7 @@ ivas_error create_SetOfHRTF_from_binary( hHRTF = &( ( *hSetOfHRTF ).hHRTF_hrir_foa ); } } -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES +#ifdef USE_NEW_HRTF_BINARY_FILE_FORMAT else if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) #else else if ( hrtf_header.rend_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h index 673ce38b309938e3f067fc1257b2a76da7b64c92..1ab193a34b3cd638ccb5463ea22886b377733178 100644 --- a/lib_util/hrtf_file_reader.h +++ b/lib_util/hrtf_file_reader.h @@ -46,8 +46,6 @@ typedef struct ivas_hrtfs_header_t uint32_t data_size; } ivas_hrtfs_header_t; - -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES typedef enum { HRTF_READER_RENDERER_BINAURAL_INVALID, @@ -60,7 +58,6 @@ typedef enum HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM, HRTF_READER_RENDERER_BINAURAL_REVERB_ALL } HRTF_READER_RENDERER_TYPE; -#endif /*---------------------------------------------------------------------* * hrtfFileReader_open() @@ -94,7 +91,6 @@ ivas_error load_HRTF_binary( const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES /*---------------------------------------------------------------------* * load_reverb_binary() * @@ -110,7 +106,6 @@ ivas_error load_reverb_binary( #endif const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */ ); -#endif /*---------------------------------------------------------------------* * create_SetOfHRTF_from_binary()