Loading scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +152 −29 Original line number Diff line number Diff line Loading @@ -168,8 +168,10 @@ void usage_tables_format_converter( void ) fprintf( stdout, "-input_param_file_name : Name of input param file with extension.\n" ); #endif #ifdef MIXER_CONV_BINARY_FILE_311 fprintf( stdout, "-input_mixerconv_file_path : Path of binary files for mixer_conv renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_name : Common name of input mixer_conv files .\n" ); fprintf( stdout, "-input_mixerconv_file_hrir_path : Path of binary files for mixer_conv hrir renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_hrir_name : Common name of input mixer_conv hrir files .\n" ); fprintf( stdout, "-input_mixerconv_file_brir_path : Path of binary files for mixer_conv brir renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_brir_name : Common name of input mixer_conv brir files .\n" ); #endif fprintf( stdout, "\n" ); fprintf( stdout, "For example :\n" Loading @@ -195,7 +197,8 @@ char *input_fastconv_bin_path = NULL; char *input_fastconv_bin_file_name = NULL; #endif #ifdef MIXER_CONV_BINARY_FILE_311 char *input_mixerconv_bin_path = NULL; char *input_mixerconv_bin_hrir_path = NULL; char *input_mixerconv_bin_brir_path = NULL; char *input_mixerconv_bin_hrir_file_name = NULL; char *input_mixerconv_bin_brir_file_name = NULL; #endif Loading Loading @@ -235,6 +238,7 @@ int main( int argc, char *argv[] ) return -1; } nbHRTFMax = 0; if ( input_mixerconv_bin_hrir_file_name != NULL ) { nbHRTFMax = IVAS_NB_AUDIO_CONFIG * IVAS_NB_SAMPLERATE; // mixerconv HRIR Loading Loading @@ -330,7 +334,7 @@ int main( int argc, char *argv[] ) break; case RENDERER_BINAURAL_MIXER_CONV: #ifdef MIXER_CONV_BINARY_FILE_311 if ( ( input_mixerconv_bin_path != NULL ) && ( input_mixerconv_bin_hrir_file_name != NULL ) ) if ( ( input_mixerconv_bin_hrir_path != NULL ) && ( input_mixerconv_bin_hrir_file_name != NULL ) ) #endif // MIXER_CONV_BINARY_FILE_311 { for ( j = 0; j < IVAS_NB_AUDIO_CONFIG; j++ ) Loading Loading @@ -365,7 +369,7 @@ int main( int argc, char *argv[] ) break; case RENDERER_BINAURAL_MIXER_CONV_ROOM: #ifdef MIXER_CONV_BINARY_FILE_311 if ( ( input_mixerconv_bin_path != NULL ) && ( input_mixerconv_bin_brir_file_name != NULL ) ) if ( ( input_mixerconv_bin_brir_path != NULL ) && ( input_mixerconv_bin_brir_file_name != NULL ) ) #endif // MIXER_CONV_BINARY_FILE_311 { for ( k = 0; k < nb_freq; k++ ) Loading @@ -373,7 +377,7 @@ int main( int argc, char *argv[] ) setOfHRTF[nbHRTF] = create_hrtf_crend( rend_types[i], BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, freq_ptr[k], &hrtf_size ); if ( hrtf_size == -1 ) { fprintf( stderr, "Creation of HRTF (%d, %d, %d) failed!\n\n", rend_types[i], input_cfgs[j], freq_ptr[k] ); fprintf( stderr, "Creation of HRTF (%d, %d, %d) failed!\n\n", rend_types[i], BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, freq_ptr[k] ); for ( l = 0; l < nbHRTF; l++ ) { free( setOfHRTF[l] ); Loading Loading @@ -465,7 +469,7 @@ int main( int argc, char *argv[] ) memcpy( file_header_wptr, &( nbHRTF ), sizeof( int16_t ) ); file_header_wptr += sizeof( int16_t ); hrtf_size_max -= 4 * sizeof( int32_t ); // ???? demander à Arnaud // hrtf_size_max -= 4 * sizeof( int32_t ); // ???? demander à Arnaud memcpy( file_header_wptr, &( hrtf_size_max ), sizeof( int32_t ) ); file_header_wptr += sizeof( int32_t ); Loading Loading @@ -537,32 +541,30 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in if ( rend_type == RENDERER_BINAURAL_MIXER_CONV ) { sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_path, input_mixerconv_bin_hrir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { configuration_name = "Combined"; configuration_name = "Combined_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { configuration_name = "FOA"; configuration_name = "FOA_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { configuration_name = "HOA2"; configuration_name = "HOA2_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { configuration_name = "HOA3"; configuration_name = "HOA3_HRIR"; } full_in_mixerconv_path = malloc( strlen( input_mixerconv_bin_hrir_path ) + strlen( input_mixerconv_bin_hrir_file_name ) + 1 + strlen( configuration_name ) + 1 + 8 + strlen( DEFAULT_BIN_FILE_EXT ) + 1 ); sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_hrir_path, input_mixerconv_bin_hrir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); } else if ( rend_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_path, input_mixerconv_bin_brir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { configuration_name = "Combined"; configuration_name = "Combined_BRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { Loading @@ -576,6 +578,8 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in { return NULL; } full_in_mixerconv_path = malloc( strlen( input_mixerconv_bin_brir_path ) + strlen( input_mixerconv_bin_brir_file_name ) + 1 + strlen( configuration_name ) + 1 + 8 + strlen( DEFAULT_BIN_FILE_EXT ) + 1 ); sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_brir_path, input_mixerconv_bin_brir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); } input_mixerconv_bin_file = fopen( full_in_mixerconv_path, "rb" ); Loading Loading @@ -638,6 +642,8 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in fclose( input_mixerconv_bin_file ); input_mixerconv_bin_file = NULL; free( full_in_mixerconv_path ); full_in_mixerconv_path = NULL; } else { Loading Loading @@ -923,6 +929,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) fprintf( stderr, "Memory allocation for the block failed!\n\n" ); fclose( input_td_bin_file ); *hrtf_size = -1; free( full_in_td_path ); full_in_td_path = NULL; return NULL; } Loading Loading @@ -955,6 +963,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) fprintf( stderr, "Reading of the td hrtf failed!\n\n" ); fclose( input_td_bin_file ); free( td_hrtf ); free( full_in_td_path ); full_in_td_path = NULL; *hrtf_size = -1; return NULL; } Loading Loading @@ -1001,6 +1011,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) return NULL; } free( full_in_td_path ); full_in_td_path = NULL; return td_hrtf; } Loading @@ -1010,8 +1022,9 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) *---------------------------------------------------------------------*/ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size ) { char *hrtf = NULL, *hrtf_wptr; uint32_t hrtf_data_size; char *fastconv_hrtf = NULL, *fastconv_hrtf_wptr; uint32_t fastconv_hrtf_data_size; #ifndef MIXER_CONV_BINARY_FILE_311 uint32_t data_size_tmp; int16_t i, j; Loading @@ -1020,8 +1033,8 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG uint16_t num_taps; uint16_t cldfb_nchan_max; float latency_s; hrtf_data_size = 0; #endif fastconv_hrtf_data_size = 0; /* Binary file - block description : Loading Loading @@ -1060,6 +1073,87 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG fastConvReverberationEneCorrection => float[CLDFB_NO_CHANNELS_MAX] */ #ifdef MIXER_CONV_BINARY_FILE_311 char *full_in_fastconv_path = NULL; FILE *input_fastconv_bin_file = NULL; // Get the HRTF raw data sprintf( full_in_fastconv_path, "%s%s", input_fastconv_bin_path, input_fastconv_bin_file_name ); input_fastconv_bin_file = fopen( full_in_fastconv_path, "rb" ); if ( input_fastconv_bin_file != NULL ) { fseek( input_fastconv_bin_file, 0, SEEK_END ); fastconv_hrtf_data_size = ftell( input_fastconv_bin_file ); fseek( input_fastconv_bin_file, 0, SEEK_SET ); // Header [Declaration of the HRTF] // Renderer type (4 bytes) : See "RENDERER_TYPE" // Decoder output format (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG" // Sampling Frequency (4 bytes) // Raw data size (4 bytes) fastconv_hrtf_data_size = sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( uint32_t ); *hrtf_size = fastconv_hrtf_data_size + fastconv_hrtf_data_size; fastconv_hrtf = (char *) malloc( *hrtf_size ); if ( fastconv_hrtf == NULL ) { fprintf( stderr, "Memory allocation for the block failed!\n\n" ); fclose( input_fastconv_bin_file ); *hrtf_size = -1; return NULL; } memset( fastconv_hrtf, 0x00, *hrtf_size ); fastconv_hrtf_wptr = fastconv_hrtf; // Get the HRTF header // Renderer type memcpy( fastconv_hrtf_wptr, &( rend_type ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Decoder output format memcpy( fastconv_hrtf_wptr, &( input_cfg ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Sampling Frequency memcpy( fastconv_hrtf_wptr, &( frequency ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Raw data size memcpy( fastconv_hrtf_wptr, &( fastconv_hrtf_data_size ), sizeof( uint32_t ) ); fastconv_hrtf_wptr += sizeof( uint32_t ); // Get the HRTF raw data if ( fread( fastconv_hrtf_wptr, fastconv_hrtf_data_size, 1, input_fastconv_bin_file ) != 1 ) { fprintf( stderr, "Reading of the mixer_conv hrtf failed!\n\n" ); fclose( input_fastconv_bin_file ); free( fastconv_hrtf ); *hrtf_size = -1; return NULL; } fclose( input_fastconv_bin_file ); input_fastconv_bin_file = NULL; } else { fprintf( stderr, "Opening of file %s failed!\n\n", full_in_fastconv_path ); *hrtf_size = -1; return NULL; } #else // Set table sizes binaural_convbands = BINAURAL_CONVBANDS; Loading Loading @@ -1414,8 +1508,9 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG memcpy( hrtf_wptr, &( fastconvReverberationTimes ), data_size_tmp ); // fastconvReverberationTimes memcpy( hrtf_wptr, &( fastconvReverberationEneCorrections ), data_size_tmp ); // fastconvEneCorrections } #endif return hrtf; return fastconv_hrtf; } /*---------------------------------------------------------------------* Loading Loading @@ -2589,7 +2684,7 @@ int32_t read_hrtf_size( char *hrtf ) hrtf_rptr += sizeof( int32_t ); memcpy( &( hrtf_size ), hrtf_rptr, sizeof( uint32_t ) ); hrtf_size += sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ); // + hrtf header size // hrtf_size += sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ); // + hrtf header size // hrtf_rptr += sizeof(uint32_t); } Loading Loading @@ -2693,17 +2788,30 @@ int rom2bin_init( int argc, char *argv[] ) i++; } #ifdef MIXER_CONV_BINARY_FILE_311 else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_FILE_PATH" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_HRIR_FILE_PATH" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixer_conv file path: %s\n\n", argv[i] ); fprintf( stderr, "Wrong input mixer_conv hrir file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_path, argv[i] ); input_mixerconv_bin_hrir_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_hrir_path, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_BRIR_FILE_PATH" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixer_conv brir file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_brir_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_brir_path, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_TD_FILE_PATH" ) == 0 ) Loading Loading @@ -2760,7 +2868,7 @@ int rom2bin_init( int argc, char *argv[] ) i++; } #ifdef MIXER_CONV_BINARY_FILE_311 else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_FILE_NAME" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_HRIR_FILE_NAME" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) Loading @@ -2772,6 +2880,16 @@ int rom2bin_init( int argc, char *argv[] ) input_mixerconv_bin_hrir_file_name = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_hrir_file_name, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_BRIR_FILE_NAME" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixconf file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_brir_file_name = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_brir_file_name, argv[i] ); i++; Loading Loading @@ -2985,9 +3103,14 @@ void rom2bin_terminat( void ) #endif #ifdef MIXER_CONV_BINARY_FILE_311 if ( input_mixerconv_bin_path != NULL ) if ( input_mixerconv_bin_hrir_path != NULL ) { free( input_mixerconv_bin_hrir_path ); } if ( input_mixerconv_bin_brir_path != NULL ) { free( input_mixerconv_bin_path ); free( input_mixerconv_bin_brir_path ); } if ( input_mixerconv_bin_hrir_file_name != NULL ) Loading scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +88 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +152 −29 Original line number Diff line number Diff line Loading @@ -168,8 +168,10 @@ void usage_tables_format_converter( void ) fprintf( stdout, "-input_param_file_name : Name of input param file with extension.\n" ); #endif #ifdef MIXER_CONV_BINARY_FILE_311 fprintf( stdout, "-input_mixerconv_file_path : Path of binary files for mixer_conv renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_name : Common name of input mixer_conv files .\n" ); fprintf( stdout, "-input_mixerconv_file_hrir_path : Path of binary files for mixer_conv hrir renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_hrir_name : Common name of input mixer_conv hrir files .\n" ); fprintf( stdout, "-input_mixerconv_file_brir_path : Path of binary files for mixer_conv brir renderer (with separator, used as flag).\n" ); fprintf( stdout, "-input_mixerconv_file_brir_name : Common name of input mixer_conv brir files .\n" ); #endif fprintf( stdout, "\n" ); fprintf( stdout, "For example :\n" Loading @@ -195,7 +197,8 @@ char *input_fastconv_bin_path = NULL; char *input_fastconv_bin_file_name = NULL; #endif #ifdef MIXER_CONV_BINARY_FILE_311 char *input_mixerconv_bin_path = NULL; char *input_mixerconv_bin_hrir_path = NULL; char *input_mixerconv_bin_brir_path = NULL; char *input_mixerconv_bin_hrir_file_name = NULL; char *input_mixerconv_bin_brir_file_name = NULL; #endif Loading Loading @@ -235,6 +238,7 @@ int main( int argc, char *argv[] ) return -1; } nbHRTFMax = 0; if ( input_mixerconv_bin_hrir_file_name != NULL ) { nbHRTFMax = IVAS_NB_AUDIO_CONFIG * IVAS_NB_SAMPLERATE; // mixerconv HRIR Loading Loading @@ -330,7 +334,7 @@ int main( int argc, char *argv[] ) break; case RENDERER_BINAURAL_MIXER_CONV: #ifdef MIXER_CONV_BINARY_FILE_311 if ( ( input_mixerconv_bin_path != NULL ) && ( input_mixerconv_bin_hrir_file_name != NULL ) ) if ( ( input_mixerconv_bin_hrir_path != NULL ) && ( input_mixerconv_bin_hrir_file_name != NULL ) ) #endif // MIXER_CONV_BINARY_FILE_311 { for ( j = 0; j < IVAS_NB_AUDIO_CONFIG; j++ ) Loading Loading @@ -365,7 +369,7 @@ int main( int argc, char *argv[] ) break; case RENDERER_BINAURAL_MIXER_CONV_ROOM: #ifdef MIXER_CONV_BINARY_FILE_311 if ( ( input_mixerconv_bin_path != NULL ) && ( input_mixerconv_bin_brir_file_name != NULL ) ) if ( ( input_mixerconv_bin_brir_path != NULL ) && ( input_mixerconv_bin_brir_file_name != NULL ) ) #endif // MIXER_CONV_BINARY_FILE_311 { for ( k = 0; k < nb_freq; k++ ) Loading @@ -373,7 +377,7 @@ int main( int argc, char *argv[] ) setOfHRTF[nbHRTF] = create_hrtf_crend( rend_types[i], BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, freq_ptr[k], &hrtf_size ); if ( hrtf_size == -1 ) { fprintf( stderr, "Creation of HRTF (%d, %d, %d) failed!\n\n", rend_types[i], input_cfgs[j], freq_ptr[k] ); fprintf( stderr, "Creation of HRTF (%d, %d, %d) failed!\n\n", rend_types[i], BINAURAL_INPUT_AUDIO_CONFIG_COMBINED, freq_ptr[k] ); for ( l = 0; l < nbHRTF; l++ ) { free( setOfHRTF[l] ); Loading Loading @@ -465,7 +469,7 @@ int main( int argc, char *argv[] ) memcpy( file_header_wptr, &( nbHRTF ), sizeof( int16_t ) ); file_header_wptr += sizeof( int16_t ); hrtf_size_max -= 4 * sizeof( int32_t ); // ???? demander à Arnaud // hrtf_size_max -= 4 * sizeof( int32_t ); // ???? demander à Arnaud memcpy( file_header_wptr, &( hrtf_size_max ), sizeof( int32_t ) ); file_header_wptr += sizeof( int32_t ); Loading Loading @@ -537,32 +541,30 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in if ( rend_type == RENDERER_BINAURAL_MIXER_CONV ) { sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_path, input_mixerconv_bin_hrir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { configuration_name = "Combined"; configuration_name = "Combined_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { configuration_name = "FOA"; configuration_name = "FOA_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 ) { configuration_name = "HOA2"; configuration_name = "HOA2_HRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) { configuration_name = "HOA3"; configuration_name = "HOA3_HRIR"; } full_in_mixerconv_path = malloc( strlen( input_mixerconv_bin_hrir_path ) + strlen( input_mixerconv_bin_hrir_file_name ) + 1 + strlen( configuration_name ) + 1 + 8 + strlen( DEFAULT_BIN_FILE_EXT ) + 1 ); sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_hrir_path, input_mixerconv_bin_hrir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); } else if ( rend_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_path, input_mixerconv_bin_brir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) { configuration_name = "Combined"; configuration_name = "Combined_BRIR"; } else if ( input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA ) { Loading @@ -576,6 +578,8 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in { return NULL; } full_in_mixerconv_path = malloc( strlen( input_mixerconv_bin_brir_path ) + strlen( input_mixerconv_bin_brir_file_name ) + 1 + strlen( configuration_name ) + 1 + 8 + strlen( DEFAULT_BIN_FILE_EXT ) + 1 ); sprintf( full_in_mixerconv_path, "%s%s_%s_%dkHz%s", input_mixerconv_bin_brir_path, input_mixerconv_bin_brir_file_name, configuration_name, frequency / 1000, DEFAULT_BIN_FILE_EXT ); } input_mixerconv_bin_file = fopen( full_in_mixerconv_path, "rb" ); Loading Loading @@ -638,6 +642,8 @@ char *create_hrtf_crend( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG in fclose( input_mixerconv_bin_file ); input_mixerconv_bin_file = NULL; free( full_in_mixerconv_path ); full_in_mixerconv_path = NULL; } else { Loading Loading @@ -923,6 +929,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) fprintf( stderr, "Memory allocation for the block failed!\n\n" ); fclose( input_td_bin_file ); *hrtf_size = -1; free( full_in_td_path ); full_in_td_path = NULL; return NULL; } Loading Loading @@ -955,6 +963,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) fprintf( stderr, "Reading of the td hrtf failed!\n\n" ); fclose( input_td_bin_file ); free( td_hrtf ); free( full_in_td_path ); full_in_td_path = NULL; *hrtf_size = -1; return NULL; } Loading Loading @@ -1001,6 +1011,8 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) return NULL; } free( full_in_td_path ); full_in_td_path = NULL; return td_hrtf; } Loading @@ -1010,8 +1022,9 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) *---------------------------------------------------------------------*/ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG input_cfg, int32_t frequency, int32_t *hrtf_size ) { char *hrtf = NULL, *hrtf_wptr; uint32_t hrtf_data_size; char *fastconv_hrtf = NULL, *fastconv_hrtf_wptr; uint32_t fastconv_hrtf_data_size; #ifndef MIXER_CONV_BINARY_FILE_311 uint32_t data_size_tmp; int16_t i, j; Loading @@ -1020,8 +1033,8 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG uint16_t num_taps; uint16_t cldfb_nchan_max; float latency_s; hrtf_data_size = 0; #endif fastconv_hrtf_data_size = 0; /* Binary file - block description : Loading Loading @@ -1060,6 +1073,87 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG fastConvReverberationEneCorrection => float[CLDFB_NO_CHANNELS_MAX] */ #ifdef MIXER_CONV_BINARY_FILE_311 char *full_in_fastconv_path = NULL; FILE *input_fastconv_bin_file = NULL; // Get the HRTF raw data sprintf( full_in_fastconv_path, "%s%s", input_fastconv_bin_path, input_fastconv_bin_file_name ); input_fastconv_bin_file = fopen( full_in_fastconv_path, "rb" ); if ( input_fastconv_bin_file != NULL ) { fseek( input_fastconv_bin_file, 0, SEEK_END ); fastconv_hrtf_data_size = ftell( input_fastconv_bin_file ); fseek( input_fastconv_bin_file, 0, SEEK_SET ); // Header [Declaration of the HRTF] // Renderer type (4 bytes) : See "RENDERER_TYPE" // Decoder output format (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG" // Sampling Frequency (4 bytes) // Raw data size (4 bytes) fastconv_hrtf_data_size = sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( uint32_t ); *hrtf_size = fastconv_hrtf_data_size + fastconv_hrtf_data_size; fastconv_hrtf = (char *) malloc( *hrtf_size ); if ( fastconv_hrtf == NULL ) { fprintf( stderr, "Memory allocation for the block failed!\n\n" ); fclose( input_fastconv_bin_file ); *hrtf_size = -1; return NULL; } memset( fastconv_hrtf, 0x00, *hrtf_size ); fastconv_hrtf_wptr = fastconv_hrtf; // Get the HRTF header // Renderer type memcpy( fastconv_hrtf_wptr, &( rend_type ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Decoder output format memcpy( fastconv_hrtf_wptr, &( input_cfg ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Sampling Frequency memcpy( fastconv_hrtf_wptr, &( frequency ), sizeof( int32_t ) ); fastconv_hrtf_wptr += sizeof( int32_t ); // Raw data size memcpy( fastconv_hrtf_wptr, &( fastconv_hrtf_data_size ), sizeof( uint32_t ) ); fastconv_hrtf_wptr += sizeof( uint32_t ); // Get the HRTF raw data if ( fread( fastconv_hrtf_wptr, fastconv_hrtf_data_size, 1, input_fastconv_bin_file ) != 1 ) { fprintf( stderr, "Reading of the mixer_conv hrtf failed!\n\n" ); fclose( input_fastconv_bin_file ); free( fastconv_hrtf ); *hrtf_size = -1; return NULL; } fclose( input_fastconv_bin_file ); input_fastconv_bin_file = NULL; } else { fprintf( stderr, "Opening of file %s failed!\n\n", full_in_fastconv_path ); *hrtf_size = -1; return NULL; } #else // Set table sizes binaural_convbands = BINAURAL_CONVBANDS; Loading Loading @@ -1414,8 +1508,9 @@ char *create_hrtf_fastconv( RENDERER_TYPE rend_type, BINAURAL_INPUT_AUDIO_CONFIG memcpy( hrtf_wptr, &( fastconvReverberationTimes ), data_size_tmp ); // fastconvReverberationTimes memcpy( hrtf_wptr, &( fastconvReverberationEneCorrections ), data_size_tmp ); // fastconvEneCorrections } #endif return hrtf; return fastconv_hrtf; } /*---------------------------------------------------------------------* Loading Loading @@ -2589,7 +2684,7 @@ int32_t read_hrtf_size( char *hrtf ) hrtf_rptr += sizeof( int32_t ); memcpy( &( hrtf_size ), hrtf_rptr, sizeof( uint32_t ) ); hrtf_size += sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ); // + hrtf header size // hrtf_size += sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ) + sizeof( int32_t ); // + hrtf header size // hrtf_rptr += sizeof(uint32_t); } Loading Loading @@ -2693,17 +2788,30 @@ int rom2bin_init( int argc, char *argv[] ) i++; } #ifdef MIXER_CONV_BINARY_FILE_311 else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_FILE_PATH" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_HRIR_FILE_PATH" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixer_conv file path: %s\n\n", argv[i] ); fprintf( stderr, "Wrong input mixer_conv hrir file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_path, argv[i] ); input_mixerconv_bin_hrir_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_hrir_path, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_BRIR_FILE_PATH" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixer_conv brir file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_brir_path = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_brir_path, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_TD_FILE_PATH" ) == 0 ) Loading Loading @@ -2760,7 +2868,7 @@ int rom2bin_init( int argc, char *argv[] ) i++; } #ifdef MIXER_CONV_BINARY_FILE_311 else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_FILE_NAME" ) == 0 ) else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_HRIR_FILE_NAME" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) Loading @@ -2772,6 +2880,16 @@ int rom2bin_init( int argc, char *argv[] ) input_mixerconv_bin_hrir_file_name = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_hrir_file_name, argv[i] ); i++; } else if ( strcmp( to_upper( argv[i] ), "-INPUT_MIXERCONV_BRIR_FILE_NAME" ) == 0 ) { i++; if ( strlen( argv[i] ) == 0 ) { fprintf( stderr, "Wrong input mixconf file path: %s\n\n", argv[i] ); usage_tables_format_converter(); return -1; } input_mixerconv_bin_brir_file_name = malloc( strlen( argv[i] ) + 1 ); strcpy( input_mixerconv_bin_brir_file_name, argv[i] ); i++; Loading Loading @@ -2985,9 +3103,14 @@ void rom2bin_terminat( void ) #endif #ifdef MIXER_CONV_BINARY_FILE_311 if ( input_mixerconv_bin_path != NULL ) if ( input_mixerconv_bin_hrir_path != NULL ) { free( input_mixerconv_bin_hrir_path ); } if ( input_mixerconv_bin_brir_path != NULL ) { free( input_mixerconv_bin_path ); free( input_mixerconv_bin_brir_path ); } if ( input_mixerconv_bin_hrir_file_name != NULL ) Loading
scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +88 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes