Loading scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +24 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ #include "ivas_stat_dec.h" #include "hrtf_file_reader.h" #include "ivas_rom_rend.h" #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT #include <math.h> #endif Loading @@ -60,7 +60,7 @@ #define DEFAULT_BIN_FILE_EXT ".bin" #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT #define DEFAULT_BIN_FILE_FX_FLAG 0x1000 #endif Loading Loading @@ -145,7 +145,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ ); int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int32_t compute_crend_hrtf_data_size_fx( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims ); #endif /*---------------------------------------------------------------------* Loading Loading @@ -622,7 +622,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { int32_t mixerconv_hrtf_header_size, mixerconv_hrtf_data_size; char *mixerconv_hrtf = NULL, *mixerconv_hrtf_wptr; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif Loading Loading @@ -652,7 +652,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { configuration_name = "HOA3_HRIR"; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_mixerconv_bin_hrir_file_name, "_fx" ) ) { input_mixerconv_bin_hrir_file_name[strlen( input_mixerconv_bin_hrir_file_name ) - 3] = '\0'; Loading Loading @@ -701,7 +701,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { return NULL; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_mixerconv_bin_brir_file_name, "_fx" ) ) { input_mixerconv_bin_brir_file_name[strlen( input_mixerconv_bin_brir_file_name ) - 3] = '\0'; Loading Loading @@ -765,7 +765,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { rend_type = rend_type + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -930,12 +930,12 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size ) FILE *input_reverb_file = NULL; int32_t reverb_header_size, reverb_data_size; char *reverb = NULL, *reverb_wptr, *full_in_reverb_path = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif *hrtf_size = 0; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_reverb_file_name, "_fx" ) ) { input_reverb_file_name[strlen( input_reverb_file_name ) - 3] = '\0'; Loading Loading @@ -1015,7 +1015,7 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size ) // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { *( (int32_t *) ( reverb_wptr ) ) = HRTF_READER_RENDERER_BINAURAL_REVERB_ALL + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -1083,7 +1083,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ int32_t hrtf_total_file_size = 0, hrtf_data_size = 0; int16_t nbHrft = 0, ind; ivas_hrtfs_header_t hrtf_header; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif Loading Loading @@ -1138,7 +1138,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ // Get the HRTF raw data #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_fastconv_bin_file_name, "_fx" ) ) { is_fx = 1; Loading Loading @@ -1276,7 +1276,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { rend_type = rend_type + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -1336,7 +1336,7 @@ char *create_hrtf_parametric( int32_t *hrtf_size ) int16_t i, j; FILE *input_param_bin_file = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT char hrtf_identifier[8] = ""; int16_t is_fx = 0; if ( strstr( input_param_bin_file_name, "_fx" ) ) Loading Loading @@ -1369,7 +1369,7 @@ char *create_hrtf_parametric( int32_t *hrtf_size ) hrtf_data_size = 0; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT input_param_bin_file = fopen( full_in_param_bin_path, "rb" ); Loading Loading @@ -2044,7 +2044,7 @@ int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INP return result; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * compute_crend_hrtf_data_size_fx() * Loading Loading @@ -2330,7 +2330,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( rend_type & DEFAULT_BIN_FILE_FX_FLAG ) hrtf_data_size = compute_crend_hrtf_data_size_fx( &tabs_ptrs, &tabs_dims ); else Loading @@ -2349,7 +2349,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD hrtf_data_in_rptr = hrtf_data_in; // latency_s #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( ( *( tabs_ptrs.latency_s ) - ( *( (Word32 *) ( hrtf_data_in_rptr ) ) ) * powf( 2.f, -31.f ) ) > 1e-9f ) #else if ( ( *( tabs_ptrs.latency_s ) - *( (float *) ( hrtf_data_in_rptr ) ) ) > 1e-9f ) Loading @@ -2358,7 +2358,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD fprintf( stderr, "check_hrtf_data of binary file failed: bad latency_s!\n\n" ); return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT hrtf_data_in_rptr += sizeof( Word32 ); #else hrtf_data_in_rptr += sizeof( float ); Loading Loading @@ -2447,7 +2447,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD hrtf_data_in_rptr += sizeof( uint16_t ); // inv_diffuse_weight #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( Word16 ); #else ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( float ); Loading Loading @@ -2483,7 +2483,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_re + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration; for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float ); Loading Loading @@ -2516,7 +2516,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_im + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration; for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float ); Loading Loading @@ -2556,7 +2556,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_diffuse_re + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff; for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float ); Loading Loading @@ -2585,7 +2585,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_diffuse_im + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff; for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float ); Loading scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +14 −14 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ void usage_gen_crend_tables( void ); void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct ); int generate_crend_ivas_tables_from_sofa( const char *sofa_file_path, ConfigReader *cfgReader ); void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, Word16 *pEner_l_fx, Word16 *pEner_r_fx, Word16 *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len ); #else Loading @@ -150,14 +150,14 @@ extern Word16 float2Word16( float, Word16 ); void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ ); uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT uint32_t compute_binary_size_fx( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims ); ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, Word16 *factorQ ); #endif ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ); ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ivas_error write_binary_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float *pCoherence, Word16 factorQ, const int32_t samplerate ); #endif Loading Loading @@ -1298,7 +1298,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c latency_48k_optim = hrtf_data.latency_s; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t factorQ[3]; make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ); #endif Loading Loading @@ -1348,7 +1348,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c if ( lib_rend_path != NULL ) { update_h_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ); #else update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len ); Loading @@ -1367,7 +1367,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ivas_hrtf_close( &hrtf_data ); return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( write_binary_file_fx( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ) != IVAS_ERR_OK ) { mxDestroyArray( sofa ); Loading Loading @@ -1880,7 +1880,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) nr_fc_fft_filter = ( frame_len >> 1 ) + 1; float *p_avg_lr = NULL; float *pCoherence = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT Word16 *p_avg_lr_fx = NULL; Word16 *pCoherence_fx = NULL; #endif Loading Loading @@ -1936,7 +1936,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) ivas_reverb_get_hrtf_set_properties( pHrtf_set_l_re, pHrtf_set_l_im, pHrtf_set_r_re, pHrtf_set_r_im, IVAS_AUDIO_CONFIG_5_1, sofa_M, nr_fc_fft_filter, nr_fc_fft_filter, p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ ); #ifdef IVAS_FLOAT_FIXED for ( i = 0; i < nr_fc_fft_filter; i++ ) Loading @@ -1948,7 +1948,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) #endif #endif update_h_file_with_reverb( sample_rates[indSR] ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, p_avg_lr_fx, &p_avg_lr_fx[nr_fc_fft_filter], pCoherence_fx, factorQ, sample_rates[indSR], nr_fc_fft_filter ); #else update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], nr_fc_fft_filter ); Loading @@ -1959,7 +1959,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) { goto cleanup; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( write_reverb_to_binary_file_fx( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, factorQ, sample_rates[indSR] ) != IVAS_ERR_OK ) { goto cleanup; Loading Loading @@ -2241,7 +2241,7 @@ void write_array_word16_to_file( FILE *fp, Word16 *vec, int32_t size_vec, int32_ /*---------------------------------------------------------------------* *update_c_file_with_reverb(); *---------------------------------------------------------------------*/ #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, Word16 *pEner_l_fx, Word16 *pEner_r_fx, Word16 *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len ) #else void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len ) Loading Loading @@ -2319,7 +2319,7 @@ void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherenc /*---------------------------------------------------------------------* *update_c_file(); *---------------------------------------------------------------------*/ #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ) #else void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len) ) Loading Loading @@ -2972,7 +2972,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr return hrtf_data_size; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * compute_binary_size_fx(); Loading Loading @@ -3933,7 +3933,7 @@ ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, return IVAS_ERR_OK; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * write_binary_file_fx(); *---------------------------------------------------------------------*/ Loading Loading
scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +24 −24 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ #include "ivas_stat_dec.h" #include "hrtf_file_reader.h" #include "ivas_rom_rend.h" #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT #include <math.h> #endif Loading @@ -60,7 +60,7 @@ #define DEFAULT_BIN_FILE_EXT ".bin" #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT #define DEFAULT_BIN_FILE_FX_FLAG 0x1000 #endif Loading Loading @@ -145,7 +145,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, crend_hrtf_tables_pointers *hrtf_table_ptrs /*OUT*/, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ ); int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int32_t compute_crend_hrtf_data_size_fx( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims ); #endif /*---------------------------------------------------------------------* Loading Loading @@ -622,7 +622,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { int32_t mixerconv_hrtf_header_size, mixerconv_hrtf_data_size; char *mixerconv_hrtf = NULL, *mixerconv_hrtf_wptr; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif Loading Loading @@ -652,7 +652,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { configuration_name = "HOA3_HRIR"; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_mixerconv_bin_hrir_file_name, "_fx" ) ) { input_mixerconv_bin_hrir_file_name[strlen( input_mixerconv_bin_hrir_file_name ) - 3] = '\0'; Loading Loading @@ -701,7 +701,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD { return NULL; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_mixerconv_bin_brir_file_name, "_fx" ) ) { input_mixerconv_bin_brir_file_name[strlen( input_mixerconv_bin_brir_file_name ) - 3] = '\0'; Loading Loading @@ -765,7 +765,7 @@ char *create_hrtf_crend( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { rend_type = rend_type + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -930,12 +930,12 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size ) FILE *input_reverb_file = NULL; int32_t reverb_header_size, reverb_data_size; char *reverb = NULL, *reverb_wptr, *full_in_reverb_path = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif *hrtf_size = 0; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_reverb_file_name, "_fx" ) ) { input_reverb_file_name[strlen( input_reverb_file_name ) - 3] = '\0'; Loading Loading @@ -1015,7 +1015,7 @@ char *create_reverb( int32_t frequency, int32_t *hrtf_size ) // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { *( (int32_t *) ( reverb_wptr ) ) = HRTF_READER_RENDERER_BINAURAL_REVERB_ALL + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -1083,7 +1083,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ int32_t hrtf_total_file_size = 0, hrtf_data_size = 0; int16_t nbHrft = 0, ind; ivas_hrtfs_header_t hrtf_header; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t is_fx = 0; #endif Loading Loading @@ -1138,7 +1138,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ // Get the HRTF raw data #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( strstr( input_fastconv_bin_file_name, "_fx" ) ) { is_fx = 1; Loading Loading @@ -1276,7 +1276,7 @@ char *create_hrtf_fastconv( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_ // Get the HRTF header // Renderer type #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( is_fx == 1 ) { rend_type = rend_type + DEFAULT_BIN_FILE_FX_FLAG; Loading Loading @@ -1336,7 +1336,7 @@ char *create_hrtf_parametric( int32_t *hrtf_size ) int16_t i, j; FILE *input_param_bin_file = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT char hrtf_identifier[8] = ""; int16_t is_fx = 0; if ( strstr( input_param_bin_file_name, "_fx" ) ) Loading Loading @@ -1369,7 +1369,7 @@ char *create_hrtf_parametric( int32_t *hrtf_size ) hrtf_data_size = 0; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT input_param_bin_file = fopen( full_in_param_bin_path, "rb" ); Loading Loading @@ -2044,7 +2044,7 @@ int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INP return result; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * compute_crend_hrtf_data_size_fx() * Loading Loading @@ -2330,7 +2330,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( rend_type & DEFAULT_BIN_FILE_FX_FLAG ) hrtf_data_size = compute_crend_hrtf_data_size_fx( &tabs_ptrs, &tabs_dims ); else Loading @@ -2349,7 +2349,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD hrtf_data_in_rptr = hrtf_data_in; // latency_s #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( ( *( tabs_ptrs.latency_s ) - ( *( (Word32 *) ( hrtf_data_in_rptr ) ) ) * powf( 2.f, -31.f ) ) > 1e-9f ) #else if ( ( *( tabs_ptrs.latency_s ) - *( (float *) ( hrtf_data_in_rptr ) ) ) > 1e-9f ) Loading @@ -2358,7 +2358,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD fprintf( stderr, "check_hrtf_data of binary file failed: bad latency_s!\n\n" ); return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT hrtf_data_in_rptr += sizeof( Word32 ); #else hrtf_data_in_rptr += sizeof( float ); Loading Loading @@ -2447,7 +2447,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD hrtf_data_in_rptr += sizeof( uint16_t ); // inv_diffuse_weight #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( Word16 ); #else ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( float ); Loading Loading @@ -2483,7 +2483,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_re + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration; for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float ); Loading Loading @@ -2516,7 +2516,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_im + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration; for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float ); Loading Loading @@ -2556,7 +2556,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_diffuse_re + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff; for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float ); Loading Loading @@ -2585,7 +2585,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD coeff_rptr = tabs_ptrs.coeff_diffuse_im + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff; for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ ) { #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( Word32 ); #else ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float ); Loading
scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +14 −14 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ void usage_gen_crend_tables( void ); void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct ); int generate_crend_ivas_tables_from_sofa( const char *sofa_file_path, ConfigReader *cfgReader ); void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, Word16 *pEner_l_fx, Word16 *pEner_r_fx, Word16 *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len ); #else Loading @@ -150,14 +150,14 @@ extern Word16 float2Word16( float, Word16 ); void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ ); uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT uint32_t compute_binary_size_fx( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims ); ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, Word16 *factorQ ); #endif ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len ); ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT ivas_error write_binary_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ); ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float *pCoherence, Word16 factorQ, const int32_t samplerate ); #endif Loading Loading @@ -1298,7 +1298,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c latency_48k_optim = hrtf_data.latency_s; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT int16_t factorQ[3]; make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ); #endif Loading Loading @@ -1348,7 +1348,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c if ( lib_rend_path != NULL ) { update_h_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ); #else update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len ); Loading @@ -1367,7 +1367,7 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c ivas_hrtf_close( &hrtf_data ); return -1; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( write_binary_file_fx( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ) != IVAS_ERR_OK ) { mxDestroyArray( sofa ); Loading Loading @@ -1880,7 +1880,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) nr_fc_fft_filter = ( frame_len >> 1 ) + 1; float *p_avg_lr = NULL; float *pCoherence = NULL; #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT Word16 *p_avg_lr_fx = NULL; Word16 *pCoherence_fx = NULL; #endif Loading Loading @@ -1936,7 +1936,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) ivas_reverb_get_hrtf_set_properties( pHrtf_set_l_re, pHrtf_set_l_im, pHrtf_set_r_re, pHrtf_set_r_im, IVAS_AUDIO_CONFIG_5_1, sofa_M, nr_fc_fft_filter, nr_fc_fft_filter, p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ ); #ifdef IVAS_FLOAT_FIXED for ( i = 0; i < nr_fc_fft_filter; i++ ) Loading @@ -1948,7 +1948,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) #endif #endif update_h_file_with_reverb( sample_rates[indSR] ); #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, p_avg_lr_fx, &p_avg_lr_fx[nr_fc_fft_filter], pCoherence_fx, factorQ, sample_rates[indSR], nr_fc_fft_filter ); #else update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], nr_fc_fft_filter ); Loading @@ -1959,7 +1959,7 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) { goto cleanup; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT if ( write_reverb_to_binary_file_fx( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, factorQ, sample_rates[indSR] ) != IVAS_ERR_OK ) { goto cleanup; Loading Loading @@ -2241,7 +2241,7 @@ void write_array_word16_to_file( FILE *fp, Word16 *vec, int32_t size_vec, int32_ /*---------------------------------------------------------------------* *update_c_file_with_reverb(); *---------------------------------------------------------------------*/ #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, Word16 *pEner_l_fx, Word16 *pEner_r_fx, Word16 *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len ) #else void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len ) Loading Loading @@ -2319,7 +2319,7 @@ void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherenc /*---------------------------------------------------------------------* *update_c_file(); *---------------------------------------------------------------------*/ #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] ) #else void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len) ) Loading Loading @@ -2972,7 +2972,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr return hrtf_data_size; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * compute_binary_size_fx(); Loading Loading @@ -3933,7 +3933,7 @@ ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, return IVAS_ERR_OK; } #ifdef FIX_FIX_POINT_HRTF_FILE_FORMAT #ifdef FIX_CREND_CHANGES_AND_HRTF_FILE_FORMAT /*---------------------------------------------------------------------* * write_binary_file_fx(); *---------------------------------------------------------------------*/ Loading