Loading lib_util/hrtf_file_reader.c +20 −10 Original line number Diff line number Diff line Loading @@ -500,10 +500,12 @@ 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 ) { Loading Loading @@ -555,6 +557,7 @@ static ivas_error set_default_reverb_iac_energy( return IVAS_ERR_OK; } #ifdef FIX_638_ENERGIE_IAC_ROM_TABLES /*-------------------------------------------------------------------* * load_reverb_from_binary() Loading @@ -569,7 +572,7 @@ static ivas_error load_reverb_from_binary( { int16_t i; bool is_reverb; ivas_error error; ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; int16_t hrtf_id; ivas_hrtfs_header_t hrtf_header; Loading @@ -590,9 +593,11 @@ static ivas_error load_reverb_from_binary( } #endif if ( ( error = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) header_check_result = IVAS_ERR_OK; if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) { return error; return header_check_result; } is_reverb = FALSE; Loading @@ -615,12 +620,14 @@ static ivas_error load_reverb_from_binary( { if ( read_hrtf_binary_header( &hrtf_header, f_hrtf ) != IVAS_ERR_OK ) { free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "HRTF binary file not compliant (number of HRTF)" ); } if ( ( error = check_hrtf_binary_header( &hrtf_header ) ) != IVAS_ERR_OK ) if ( ( header_check_result = check_hrtf_binary_header( &hrtf_header ) ) != IVAS_ERR_OK ) { return error; free( hrtf_data ); return header_check_result; } is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); Loading @@ -628,6 +635,7 @@ static ivas_error load_reverb_from_binary( { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } } Loading @@ -642,20 +650,22 @@ static ivas_error load_reverb_from_binary( { #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 Loading @@ -663,9 +673,9 @@ static ivas_error load_reverb_from_binary( } else { if ( ( error = set_default_reverb_iac_energy( HrFiltSet_p ) ) != IVAS_ERR_OK ) if ( ( header_check_result = set_default_reverb_iac_energy( HrFiltSet_p ) ) != IVAS_ERR_OK ) { return error; return header_check_result; } #ifdef NONBE_FIX_BINARY_BINAURAL_READING Loading @@ -677,7 +687,7 @@ static ivas_error load_reverb_from_binary( return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * load_reverb_binary() Loading scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +0 −73 Original line number Diff line number Diff line Loading @@ -1045,10 +1045,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c fprintf( stderr, "Database: %s\n", sofaDataBaseName ); fprintf( stderr, "Listener: %s\n", sofaListenerName ); if ( lscfg.isloudspeaker && ( lscfg.nb_channel > 11 ) ) { long nearest = 0; } /* get index to a position given in t (in spherical) */ int *index_pos = (int *) malloc( sizeof( int ) * lscfg.nb_channel ); uint32_t maxDel48kHz = 0; Loading Loading @@ -1146,37 +1142,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c data_IR_current = sofa_data_IR_val_48k; sofa_N = sofa_N_48k; if ( sample_rates[indSR] != DEFAULT_SAMPLERATE ) { char *file_path = (char *) malloc( sizeof( char ) * ( strlen( sofa_file_path ) + 1 ) ); strcpy( file_path, sofa_file_path ); char *fstr = strstr( file_path, "48000" ); if ( fstr ) { switch ( sample_rates[indSR] ) { case 32000: strncpy( fstr, "32000", 5 ); break; case 16000: strncpy( fstr, "16000", 5 ); break; default: break; } } else { strcpy( file_path, "" ); } FILE *fp = fopen( file_path, "rb" ); if ( fp ) { fclose( fp ); } else { switch ( sample_rates[indSR] ) { case 32000: Loading @@ -1192,10 +1157,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c sofa_N = sofa_N_48k; break; } } if ( file_path ) free( file_path ); } struct ivas_hrtf_t *ivas_hrtf = NULL; ivas_hrtf = malloc( sizeof( ivas_hrtf_t ) ); Loading Loading @@ -1793,36 +1754,6 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) data_IR_current = sofa_data_IR_val_48k; sofa_N = sofa_N_48k; if ( sample_rates[indSR] != DEFAULT_SAMPLERATE ) { char *file_path = (char *) malloc( sizeof( char ) * ( strlen( sofa_file_path ) + 1 ) ); strcpy( file_path, sofa_file_path ); char *fstr = strstr( file_path, "48000" ); if ( fstr ) { switch ( sample_rates[indSR] ) { case 32000: strncpy( fstr, "32000", 5 ); break; case 16000: strncpy( fstr, "16000", 5 ); break; default: break; } } else { strcpy( file_path, "" ); } FILE *fp = fopen( file_path, "rb" ); if ( fp ) { fclose( fp ); } else { switch ( sample_rates[indSR] ) { case 32000: Loading @@ -1838,10 +1769,6 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) sofa_N = sofa_N_48k; break; } } if ( file_path ) free( file_path ); } if ( frame_len < sofa_N ) { Loading Loading
lib_util/hrtf_file_reader.c +20 −10 Original line number Diff line number Diff line Loading @@ -500,10 +500,12 @@ 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 ) { Loading Loading @@ -555,6 +557,7 @@ static ivas_error set_default_reverb_iac_energy( return IVAS_ERR_OK; } #ifdef FIX_638_ENERGIE_IAC_ROM_TABLES /*-------------------------------------------------------------------* * load_reverb_from_binary() Loading @@ -569,7 +572,7 @@ static ivas_error load_reverb_from_binary( { int16_t i; bool is_reverb; ivas_error error; ivas_error header_check_result; ivas_hrtfs_file_header_t hrtfs_file_header; int16_t hrtf_id; ivas_hrtfs_header_t hrtf_header; Loading @@ -590,9 +593,11 @@ static ivas_error load_reverb_from_binary( } #endif if ( ( error = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) header_check_result = IVAS_ERR_OK; if ( ( header_check_result = read_and_check_hrtf_binary_file_header( &hrtfs_file_header, f_hrtf ) ) != IVAS_ERR_OK ) { return error; return header_check_result; } is_reverb = FALSE; Loading @@ -615,12 +620,14 @@ static ivas_error load_reverb_from_binary( { if ( read_hrtf_binary_header( &hrtf_header, f_hrtf ) != IVAS_ERR_OK ) { free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "HRTF binary file not compliant (number of HRTF)" ); } if ( ( error = check_hrtf_binary_header( &hrtf_header ) ) != IVAS_ERR_OK ) if ( ( header_check_result = check_hrtf_binary_header( &hrtf_header ) ) != IVAS_ERR_OK ) { return error; free( hrtf_data ); return header_check_result; } is_reverb = ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ); Loading @@ -628,6 +635,7 @@ static ivas_error load_reverb_from_binary( { if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size ) { free( hrtf_data ); return IVAS_ERROR( IVAS_ERR_FAILED_FILE_READ, "Error in HRTF file reading" ); } } Loading @@ -642,20 +650,22 @@ static ivas_error load_reverb_from_binary( { #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 Loading @@ -663,9 +673,9 @@ static ivas_error load_reverb_from_binary( } else { if ( ( error = set_default_reverb_iac_energy( HrFiltSet_p ) ) != IVAS_ERR_OK ) if ( ( header_check_result = set_default_reverb_iac_energy( HrFiltSet_p ) ) != IVAS_ERR_OK ) { return error; return header_check_result; } #ifdef NONBE_FIX_BINARY_BINAURAL_READING Loading @@ -677,7 +687,7 @@ static ivas_error load_reverb_from_binary( return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * load_reverb_binary() Loading
scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +0 −73 Original line number Diff line number Diff line Loading @@ -1045,10 +1045,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c fprintf( stderr, "Database: %s\n", sofaDataBaseName ); fprintf( stderr, "Listener: %s\n", sofaListenerName ); if ( lscfg.isloudspeaker && ( lscfg.nb_channel > 11 ) ) { long nearest = 0; } /* get index to a position given in t (in spherical) */ int *index_pos = (int *) malloc( sizeof( int ) * lscfg.nb_channel ); uint32_t maxDel48kHz = 0; Loading Loading @@ -1146,37 +1142,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c data_IR_current = sofa_data_IR_val_48k; sofa_N = sofa_N_48k; if ( sample_rates[indSR] != DEFAULT_SAMPLERATE ) { char *file_path = (char *) malloc( sizeof( char ) * ( strlen( sofa_file_path ) + 1 ) ); strcpy( file_path, sofa_file_path ); char *fstr = strstr( file_path, "48000" ); if ( fstr ) { switch ( sample_rates[indSR] ) { case 32000: strncpy( fstr, "32000", 5 ); break; case 16000: strncpy( fstr, "16000", 5 ); break; default: break; } } else { strcpy( file_path, "" ); } FILE *fp = fopen( file_path, "rb" ); if ( fp ) { fclose( fp ); } else { switch ( sample_rates[indSR] ) { case 32000: Loading @@ -1192,10 +1157,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c sofa_N = sofa_N_48k; break; } } if ( file_path ) free( file_path ); } struct ivas_hrtf_t *ivas_hrtf = NULL; ivas_hrtf = malloc( sizeof( ivas_hrtf_t ) ); Loading Loading @@ -1793,36 +1754,6 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) data_IR_current = sofa_data_IR_val_48k; sofa_N = sofa_N_48k; if ( sample_rates[indSR] != DEFAULT_SAMPLERATE ) { char *file_path = (char *) malloc( sizeof( char ) * ( strlen( sofa_file_path ) + 1 ) ); strcpy( file_path, sofa_file_path ); char *fstr = strstr( file_path, "48000" ); if ( fstr ) { switch ( sample_rates[indSR] ) { case 32000: strncpy( fstr, "32000", 5 ); break; case 16000: strncpy( fstr, "16000", 5 ); break; default: break; } } else { strcpy( file_path, "" ); } FILE *fp = fopen( file_path, "rb" ); if ( fp ) { fclose( fp ); } else { switch ( sample_rates[indSR] ) { case 32000: Loading @@ -1838,10 +1769,6 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path ) sofa_N = sofa_N_48k; break; } } if ( file_path ) free( file_path ); } if ( frame_len < sofa_N ) { Loading