Loading scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +1 −1 Original line number Diff line number Diff line Loading @@ -827,7 +827,7 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) int32_t td_hrtf_header_size, td_hrtf_data_size; char *td_hrtf = NULL, *td_hrtf_wptr, *full_in_td_path = NULL; #ifdef FIX_TDREND_HRTF_FILE_FORMAT int16_t is_fx; int16_t is_fx = 0; #endif // left/right and coherences for late reverb table sizes Loading scripts/binauralRenderer_interface/fastconv/write_fastconv_rom_table_BE.m 0 → 100644 +101 −0 Original line number Diff line number Diff line %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, % Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., % Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, % Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other % contributors to this repository. All Rights Reserved. % % This software is protected by copyright law and by international treaties. % The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, % Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., % Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, % Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other % contributors to this repository retain full ownership rights in their respective contributions in % the software. This notice grants no license of any kind, including but not limited to patent % license, nor is any license granted by implication, estoppel or otherwise. % % Contributors are required to enter into the IVAS codec Public Collaboration agreement before making % contributions. % % This software is provided "AS IS", without any express or implied warranties. The software is in the % development stage. It is intended exclusively for experts who have experience with such software and % solely for the purpose of inspection. All implied warranties of non-infringement, merchantability % and fitness for a particular purpose are hereby disclaimed and excluded. % % Any dispute, controversy or claim arising under or in relation to providing this software shall be % submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in % accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and % the United Nations Convention on Contracts on the International Sales of Goods. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function write_fastconv_rom_table(output_file, FastConv_SHD_IR_FOA, FastConv_SHD_IR_HOA2, FastConv_SHD_IR_HOA3, FastConv_SD_IR, FastConv_SD_BRIR) % TODO move this to common script that writes all tables? %% Open file and write header if ismac username = getenv('USER'); else username = getenv('username'); end fid = fopen(output_file, 'at'); fprintf(fid, '/*\n'); fprintf(fid, ' * Generated on %s with Matlab version %s by %s on %s\n', datetime("today"), version, username, computer); fprintf(fid, '*/\n\n\n'); %% HRIRs (SHD) % HOA3 fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_HOA3.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_HOA3.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA3.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',imag(squeeze(FastConv_SHD_IR_HOA3.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA3.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA3.IR(2,:,:,:)))); % HOA2 fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_HOA2.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_HOA2.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA2.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA2.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA2.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA2.IR(2,:,:,:)))); % FOA fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_FOA.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_FOA.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_FOA.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_FOA.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',real(squeeze(FastConv_SHD_IR_FOA.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',imag(squeeze(FastConv_SHD_IR_FOA.IR(2,:,:,:)))); %% HRIRs (SD) fprintf(fid, 'const float FASTCONV_HRIR_latency_s = %10.9ff;\n', FastConv_SD_IR.latency_s); writeData3L(fid, 'const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', real(squeeze(FastConv_SD_IR.IR(1,:,:,:)))); writeData3L(fid, 'const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', imag(squeeze(FastConv_SD_IR.IR(1,:,:,:)))); writeData3L(fid, 'const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]', '%+ff',real(squeeze(FastConv_SD_IR.IR(2,:,:,:)))); writeData3L(fid, 'const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', imag(squeeze(FastConv_SD_IR.IR(2,:,:,:)))); %% BRIRs (SD) fprintf(fid, '/* Binaural rendering data set based on BRIRs \n'); fprintf(fid, ' * Tables derived from Mozart IIS BRIRs.*/\n'); fprintf(fid, 'const float FASTCONV_BRIR_latency_s = %10.9ff;\n', FastConv_SD_BRIR.rev_param.latency_s); writeData3L(fid, 'const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]','%+ff', real(squeeze(FastConv_SD_BRIR.IR(1,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]', '%+ff',imag(squeeze(FastConv_SD_BRIR.IR(1,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]', '%+ff',real(squeeze(FastConv_SD_BRIR.IR(2,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]','%+ff', imag(squeeze(FastConv_SD_BRIR.IR(2,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); % RT60 fprintf(fid,'const float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX] = \n{'); fprintf(fid,'\n\t'); for bandIdx = 1:FastConv_SD_BRIR.rev_param.kAna fprintf(fid,'%f%s, ', FastConv_SD_BRIR.rev_param.rt60(bandIdx),'f'); end fprintf(fid,'\n};\n'); fprintf(fid,'\n\n'); % energyReverb fprintf(fid,'const float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX] = \n{'); fprintf(fid,'\n\t'); for bandIdx = 1:FastConv_SD_BRIR.rev_param.kAna fprintf(fid,'%f%s, ', FastConv_SD_BRIR.rev_param.nrgLr(bandIdx),'f'); end fprintf(fid,'\n};\n'); fprintf(fid,'\n\n'); fclose(fid); end No newline at end of file scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +6 −7 Original line number Diff line number Diff line Loading @@ -880,7 +880,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c double *sofa_delay_val = NULL; double *sofa_src_pos_val = NULL; double *sofa_src_pos_cart_val = NULL; int iIR, iChan, iIter, offset; long sofa_sample_rate = 0; double a[3] = { 0 }; Loading Loading @@ -3373,7 +3372,7 @@ ivas_error write_binary_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lsc return IVAS_ERR_FAILED_FILE_WRITE; } binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( lscfg.name ) + 1 + 5 + 3 + 4 + 3 ) ); binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( lscfg.name ) + 1 + 5 + 6 + 4 ) ); sprintf( binary_file_full_path, "%s_%s_%ikHz_fx.bin", binary_file_path, lscfg.name, samplerate / 1000 ); fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path ); Loading Loading @@ -3785,7 +3784,6 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float char tmpStr[64]; uint32_t hrtf_data_size; float maxDiff = 0, diff, tmp, tmp2; Word16 tmp16; char *hrtf_bin = NULL, *hrtf_bin_wptr; Loading @@ -3800,7 +3798,6 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float if ( pEner_l == NULL ) return IVAS_ERR_UNEXPECTED_NULL_POINTER; ; if ( pEner_r == NULL ) return IVAS_ERR_UNEXPECTED_NULL_POINTER; Loading Loading @@ -3865,9 +3862,10 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float return IVAS_ERR_FAILED_FILE_WRITE; } binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( "Reverb" ) + 1 + 5 + 3 + 4 ) ); binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( "Reverb" ) + 1 + 5 + 6 + 4 ) ); sprintf( binary_file_full_path, "%s_%s_%ikHz_fx.bin", binary_file_path, "Reverb", samplerate / 1000 ); fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path ); fprintf( stdout, "Write Binary file %s\n", binary_file_full_path ); output_binary_file = fopen( binary_file_full_path, "wb" ); if ( output_binary_file == NULL ) Loading @@ -3893,9 +3891,10 @@ ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *p FILE *output_binary_file; int16_t iTap; #ifndef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT char tmpStr[64]; #endif uint32_t hrtf_data_size; float maxVal; char *hrtf_bin = NULL, *hrtf_bin_wptr; Loading scripts/binauralRenderer_interface/generate_ivas_binauralizer_tables_from_sofa.m +1 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ if generateCustomBinaryFile command = [command ... ' -brir_optim_config_path' ... ' brir_low_complexity_optim.cfg ' ... ] ]; end command = [command ... ' -compute_reverb_rom ' ... Loading scripts/td_object_renderer/modeling_tool/Gen_Hrf_IVAS_Binary.m +16 −16 Original line number Diff line number Diff line Loading @@ -617,7 +617,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -657,7 +657,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -717,7 +717,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -740,7 +740,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -781,7 +781,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -804,7 +804,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -881,7 +881,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -904,7 +904,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading Loading @@ -945,7 +945,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -968,7 +968,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading Loading @@ -1082,7 +1082,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1105,7 +1105,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -1203,7 +1203,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1226,7 +1226,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -1298,7 +1298,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1321,7 +1321,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading
scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c +1 −1 Original line number Diff line number Diff line Loading @@ -827,7 +827,7 @@ char *create_hrtf_tdrend( int32_t frequency, int32_t *hrtf_size ) int32_t td_hrtf_header_size, td_hrtf_data_size; char *td_hrtf = NULL, *td_hrtf_wptr, *full_in_td_path = NULL; #ifdef FIX_TDREND_HRTF_FILE_FORMAT int16_t is_fx; int16_t is_fx = 0; #endif // left/right and coherences for late reverb table sizes Loading
scripts/binauralRenderer_interface/fastconv/write_fastconv_rom_table_BE.m 0 → 100644 +101 −0 Original line number Diff line number Diff line %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % (C) 2022-2024 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB, % Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., % Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, % Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other % contributors to this repository. All Rights Reserved. % % This software is protected by copyright law and by international treaties. % The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB, % Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD., % Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange, % Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other % contributors to this repository retain full ownership rights in their respective contributions in % the software. This notice grants no license of any kind, including but not limited to patent % license, nor is any license granted by implication, estoppel or otherwise. % % Contributors are required to enter into the IVAS codec Public Collaboration agreement before making % contributions. % % This software is provided "AS IS", without any express or implied warranties. The software is in the % development stage. It is intended exclusively for experts who have experience with such software and % solely for the purpose of inspection. All implied warranties of non-infringement, merchantability % and fitness for a particular purpose are hereby disclaimed and excluded. % % Any dispute, controversy or claim arising under or in relation to providing this software shall be % submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in % accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and % the United Nations Convention on Contracts on the International Sales of Goods. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function write_fastconv_rom_table(output_file, FastConv_SHD_IR_FOA, FastConv_SHD_IR_HOA2, FastConv_SHD_IR_HOA3, FastConv_SD_IR, FastConv_SD_BRIR) % TODO move this to common script that writes all tables? %% Open file and write header if ismac username = getenv('USER'); else username = getenv('username'); end fid = fopen(output_file, 'at'); fprintf(fid, '/*\n'); fprintf(fid, ' * Generated on %s with Matlab version %s by %s on %s\n', datetime("today"), version, username, computer); fprintf(fid, '*/\n\n\n'); %% HRIRs (SHD) % HOA3 fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_HOA3.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_HOA3.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA3.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',imag(squeeze(FastConv_SHD_IR_HOA3.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA3.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_HOA3.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA3.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA3.IR(2,:,:,:)))); % HOA2 fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_HOA2.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_HOA2.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA2.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA2.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_HOA2.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_HOA2.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_HOA2.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_HOA2.IR(2,:,:,:)))); % FOA fprintf(fid, ['const float FASTCONV_' FastConv_SHD_IR_FOA.order '_latency_s = %10.9ff;\n'], FastConv_SHD_IR_FOA.latency_s); writeData3L(fid, ['const float leftHRIRReal_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', real(squeeze(FastConv_SHD_IR_FOA.IR(1,:,:,:)))); writeData3L(fid, ['const float leftHRIRImag_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'],'%+ff', imag(squeeze(FastConv_SHD_IR_FOA.IR(1,:,:,:)))); writeData3L(fid, ['const float rightHRIRReal_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',real(squeeze(FastConv_SHD_IR_FOA.IR(2,:,:,:)))); writeData3L(fid, ['const float rightHRIRImag_' FastConv_SHD_IR_FOA.order '[BINAURAL_CONVBANDS][' FastConv_SHD_IR_FOA.order '_CHANNELS][BINAURAL_NTAPS_SBA]'], '%+ff',imag(squeeze(FastConv_SHD_IR_FOA.IR(2,:,:,:)))); %% HRIRs (SD) fprintf(fid, 'const float FASTCONV_HRIR_latency_s = %10.9ff;\n', FastConv_SD_IR.latency_s); writeData3L(fid, 'const float leftHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', real(squeeze(FastConv_SD_IR.IR(1,:,:,:)))); writeData3L(fid, 'const float leftHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', imag(squeeze(FastConv_SD_IR.IR(1,:,:,:)))); writeData3L(fid, 'const float rightHRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]', '%+ff',real(squeeze(FastConv_SD_IR.IR(2,:,:,:)))); writeData3L(fid, 'const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]','%+ff', imag(squeeze(FastConv_SD_IR.IR(2,:,:,:)))); %% BRIRs (SD) fprintf(fid, '/* Binaural rendering data set based on BRIRs \n'); fprintf(fid, ' * Tables derived from Mozart IIS BRIRs.*/\n'); fprintf(fid, 'const float FASTCONV_BRIR_latency_s = %10.9ff;\n', FastConv_SD_BRIR.rev_param.latency_s); writeData3L(fid, 'const float leftBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]','%+ff', real(squeeze(FastConv_SD_BRIR.IR(1,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float leftBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]', '%+ff',imag(squeeze(FastConv_SD_BRIR.IR(1,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float rightBRIRReal[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]', '%+ff',real(squeeze(FastConv_SD_BRIR.IR(2,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); writeData3L(fid, 'const float rightBRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS_MAX]','%+ff', imag(squeeze(FastConv_SD_BRIR.IR(2,:,:,1:FastConv_SD_BRIR.rev_param.NFilter)))); % RT60 fprintf(fid,'const float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX] = \n{'); fprintf(fid,'\n\t'); for bandIdx = 1:FastConv_SD_BRIR.rev_param.kAna fprintf(fid,'%f%s, ', FastConv_SD_BRIR.rev_param.rt60(bandIdx),'f'); end fprintf(fid,'\n};\n'); fprintf(fid,'\n\n'); % energyReverb fprintf(fid,'const float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX] = \n{'); fprintf(fid,'\n\t'); for bandIdx = 1:FastConv_SD_BRIR.rev_param.kAna fprintf(fid,'%f%s, ', FastConv_SD_BRIR.rev_param.nrgLr(bandIdx),'f'); end fprintf(fid,'\n};\n'); fprintf(fid,'\n\n'); fclose(fid); end No newline at end of file
scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c +6 −7 Original line number Diff line number Diff line Loading @@ -880,7 +880,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c double *sofa_delay_val = NULL; double *sofa_src_pos_val = NULL; double *sofa_src_pos_cart_val = NULL; int iIR, iChan, iIter, offset; long sofa_sample_rate = 0; double a[3] = { 0 }; Loading Loading @@ -3373,7 +3372,7 @@ ivas_error write_binary_file_fx( HRTFS_DATA *hrtf, struct ivas_layout_config lsc return IVAS_ERR_FAILED_FILE_WRITE; } binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( lscfg.name ) + 1 + 5 + 3 + 4 + 3 ) ); binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( lscfg.name ) + 1 + 5 + 6 + 4 ) ); sprintf( binary_file_full_path, "%s_%s_%ikHz_fx.bin", binary_file_path, lscfg.name, samplerate / 1000 ); fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path ); Loading Loading @@ -3785,7 +3784,6 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float char tmpStr[64]; uint32_t hrtf_data_size; float maxDiff = 0, diff, tmp, tmp2; Word16 tmp16; char *hrtf_bin = NULL, *hrtf_bin_wptr; Loading @@ -3800,7 +3798,6 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float if ( pEner_l == NULL ) return IVAS_ERR_UNEXPECTED_NULL_POINTER; ; if ( pEner_r == NULL ) return IVAS_ERR_UNEXPECTED_NULL_POINTER; Loading Loading @@ -3865,9 +3862,10 @@ ivas_error write_reverb_to_binary_file_fx( float *pEner_l, float *pEner_r, float return IVAS_ERR_FAILED_FILE_WRITE; } binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( "Reverb" ) + 1 + 5 + 3 + 4 ) ); binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + 1 + strlen( "Reverb" ) + 1 + 5 + 6 + 4 ) ); sprintf( binary_file_full_path, "%s_%s_%ikHz_fx.bin", binary_file_path, "Reverb", samplerate / 1000 ); fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path ); fprintf( stdout, "Write Binary file %s\n", binary_file_full_path ); output_binary_file = fopen( binary_file_full_path, "wb" ); if ( output_binary_file == NULL ) Loading @@ -3893,9 +3891,10 @@ ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *p FILE *output_binary_file; int16_t iTap; #ifndef FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT char tmpStr[64]; #endif uint32_t hrtf_data_size; float maxVal; char *hrtf_bin = NULL, *hrtf_bin_wptr; Loading
scripts/binauralRenderer_interface/generate_ivas_binauralizer_tables_from_sofa.m +1 −1 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ if generateCustomBinaryFile command = [command ... ' -brir_optim_config_path' ... ' brir_low_complexity_optim.cfg ' ... ] ]; end command = [command ... ' -compute_reverb_rom ' ... Loading
scripts/td_object_renderer/modeling_tool/Gen_Hrf_IVAS_Binary.m +16 −16 Original line number Diff line number Diff line Loading @@ -617,7 +617,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -657,7 +657,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -717,7 +717,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -740,7 +740,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -781,7 +781,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -804,7 +804,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -881,7 +881,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -904,7 +904,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading Loading @@ -945,7 +945,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -968,7 +968,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading Loading @@ -1082,7 +1082,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1105,7 +1105,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -1203,7 +1203,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1226,7 +1226,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading Loading @@ -1298,7 +1298,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f,"; Loading @@ -1321,7 +1321,7 @@ for fs = [48000 32000 16000] end end if dataSpec.float arr_str = num2str(v, "%.10f "); arr_str = num2str(v, '%.10f '); arr_str = regexprep(arr_str,'\s+',' '); arr_str = replace(arr_str, " ", "f, "); arr_str = arr_str + "f"; Loading