Loading scripts/td_object_renderer/modeling_tool/Gen_Hrf_IVAS_Binary.m +8 −13 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ for fs = [48000 32000 16000] numRemain = size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_AlphaL' num2str(fs/1000) '_Q_fx = ' num2str(Q_WL) ';' newline ... 'const Word16 defaultHRIR_rom_Alpha' num2str(fs/1000) '_Q_fx = ' num2str(Q_WL) ';' newline ... 'const Word16 defaultHRIR_rom_AlphaL' num2str(fs/1000) '_fx[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -769,7 +769,6 @@ for fs = [48000 32000 16000] numRemain = size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_AlphaR' num2str(fs/1000) '_Q_fx = ' num2str(Q_WR) ';' newline ... 'const Word16 defaultHRIR_rom_AlphaR' num2str(fs/1000) '_fx[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -882,7 +881,7 @@ for fs = [48000 32000 16000] numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_EL' num2str(fs/1000) '_Q_fx = ' num2str(Q_EL) ';' newline ... 'const Word16 defaultHRIR_rom_E' num2str(fs/1000) '_Q_fx = ' num2str(Q_EL) ';' newline ... 'const Word32 defaultHRIR_rom_EL' num2str(fs/1000) '_fx[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -939,7 +938,6 @@ for fs = [48000 32000 16000] numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_ER' num2str(fs/1000) '_Q_fx = ' num2str(Q_ER) ';' newline ... 'const Word32 defaultHRIR_rom_ER' num2str(fs/1000) '_fx[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -1014,7 +1012,6 @@ for fs = [48000 32000 16000] else arr_str_all = num2hex(single(mod_itd.W)); end arr_str_all_fx = reshape(integer_itd_W,[], 1); numCol = 25; numIter = floor(length(mod_itd.W)/numCol); numRemain = length(mod_itd.W) - numCol * numIter; Loading @@ -1038,6 +1035,7 @@ for fs = [48000 32000 16000] c_file_content = [ arr_str newline '};' newline]; fprintf(fileID_c,'%s', c_file_content); arr_str_all_fx = reshape(integer_itd_W,[], 1); numCol = 25; numIter = floor(length(mod_itd.W)/numCol); numRemain = length(mod_itd.W) - numCol * numIter; Loading @@ -1047,19 +1045,17 @@ for fs = [48000 32000 16000] 'const UWord32 defaultHRIR_rom_ITD_W_fx[' num2str(length(mod_itd.W)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter arr_str = join(mat2str(arr_str_all((ind-1) * numCol + 1 :ind * numCol, : ))); arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : ))); arr_str = arr_str(2:end); arr_str(end) = ';'; arr_str = replace(arr_str, "';",','); arr_str = replace(arr_str, "'",'0x'); arr_str = replace(arr_str, ";",','); c_file_content = [ arr_str newline]; fprintf(fileID_c,'%s', c_file_content); end arr_str = join(mat2str(arr_str_all(ind * numCol + 1 :ind * numCol + numRemain, : ))); arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : ))); arr_str = arr_str(2:end); arr_str(end) = ';'; arr_str = replace(arr_str, "';",','); arr_str = replace(arr_str, "'",'0x'); arr_str = replace(arr_str, ";",','); c_file_content = [ arr_str newline '};' newline ... '#endif // IVAS_FLOAT_FIXED' newline ... ]; Loading Loading @@ -1287,13 +1283,12 @@ for fs = [48000 32000 16000] ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_ITD_elevKSeq_Q_fx = ' num2str(Q_elevKSeq_itd) ';' newline ... 'const Word16 defaultHRIR_rom_ITD_elevKSeq_fx[' num2str(length(mod_itd.elevKSeq)) '] = {' newline ... arr_str ... arr_str_fx ... newline '};' newline ... '#endif // IVAS_FLOAT_FIXED' newline ... ]; fprintf(fileID_c,'%s', c_file_content); fclose(fileID_c); end Loading Loading
scripts/td_object_renderer/modeling_tool/Gen_Hrf_IVAS_Binary.m +8 −13 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ for fs = [48000 32000 16000] numRemain = size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_AlphaL' num2str(fs/1000) '_Q_fx = ' num2str(Q_WL) ';' newline ... 'const Word16 defaultHRIR_rom_Alpha' num2str(fs/1000) '_Q_fx = ' num2str(Q_WL) ';' newline ... 'const Word16 defaultHRIR_rom_AlphaL' num2str(fs/1000) '_fx[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -769,7 +769,6 @@ for fs = [48000 32000 16000] numRemain = size(mod_hrf.WL{1},1)*size(mod_hrf.WL{1},2) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_AlphaR' num2str(fs/1000) '_Q_fx = ' num2str(Q_WR) ';' newline ... 'const Word16 defaultHRIR_rom_AlphaR' num2str(fs/1000) '_fx[' int2str(size(mod_hrf.WR{1}, 1)) ' * ' int2str(size(mod_hrf.WR{1}, 2)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -882,7 +881,7 @@ for fs = [48000 32000 16000] numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_EL' num2str(fs/1000) '_Q_fx = ' num2str(Q_EL) ';' newline ... 'const Word16 defaultHRIR_rom_E' num2str(fs/1000) '_Q_fx = ' num2str(Q_EL) ';' newline ... 'const Word32 defaultHRIR_rom_EL' num2str(fs/1000) '_fx[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -939,7 +938,6 @@ for fs = [48000 32000 16000] numRemain = HRTF_MODEL_N_SECTIONS*size(mod_hrf.WL{1},1) - numCol * numIter; c_file_content = ... ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_ER' num2str(fs/1000) '_Q_fx = ' num2str(Q_ER) ';' newline ... 'const Word32 defaultHRIR_rom_ER' num2str(fs/1000) '_fx[HRTF_MODEL_N_SECTIONS * ' int2str(size(mod_hrf.WL{1}, 1)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter Loading Loading @@ -1014,7 +1012,6 @@ for fs = [48000 32000 16000] else arr_str_all = num2hex(single(mod_itd.W)); end arr_str_all_fx = reshape(integer_itd_W,[], 1); numCol = 25; numIter = floor(length(mod_itd.W)/numCol); numRemain = length(mod_itd.W) - numCol * numIter; Loading @@ -1038,6 +1035,7 @@ for fs = [48000 32000 16000] c_file_content = [ arr_str newline '};' newline]; fprintf(fileID_c,'%s', c_file_content); arr_str_all_fx = reshape(integer_itd_W,[], 1); numCol = 25; numIter = floor(length(mod_itd.W)/numCol); numRemain = length(mod_itd.W) - numCol * numIter; Loading @@ -1047,19 +1045,17 @@ for fs = [48000 32000 16000] 'const UWord32 defaultHRIR_rom_ITD_W_fx[' num2str(length(mod_itd.W)) '] = {' newline ]; fprintf(fileID_c,'%s', c_file_content); for ind = 1: numIter arr_str = join(mat2str(arr_str_all((ind-1) * numCol + 1 :ind * numCol, : ))); arr_str = join(mat2str(arr_str_all_fx((ind-1) * numCol + 1 :ind * numCol, : ))); arr_str = arr_str(2:end); arr_str(end) = ';'; arr_str = replace(arr_str, "';",','); arr_str = replace(arr_str, "'",'0x'); arr_str = replace(arr_str, ";",','); c_file_content = [ arr_str newline]; fprintf(fileID_c,'%s', c_file_content); end arr_str = join(mat2str(arr_str_all(ind * numCol + 1 :ind * numCol + numRemain, : ))); arr_str = join(mat2str(arr_str_all_fx(ind * numCol + 1 :ind * numCol + numRemain, : ))); arr_str = arr_str(2:end); arr_str(end) = ';'; arr_str = replace(arr_str, "';",','); arr_str = replace(arr_str, "'",'0x'); arr_str = replace(arr_str, ";",','); c_file_content = [ arr_str newline '};' newline ... '#endif // IVAS_FLOAT_FIXED' newline ... ]; Loading Loading @@ -1287,13 +1283,12 @@ for fs = [48000 32000 16000] ['#ifdef IVAS_FLOAT_FIXED' newline ... 'const Word16 defaultHRIR_rom_ITD_elevKSeq_Q_fx = ' num2str(Q_elevKSeq_itd) ';' newline ... 'const Word16 defaultHRIR_rom_ITD_elevKSeq_fx[' num2str(length(mod_itd.elevKSeq)) '] = {' newline ... arr_str ... arr_str_fx ... newline '};' newline ... '#endif // IVAS_FLOAT_FIXED' newline ... ]; fprintf(fileID_c,'%s', c_file_content); fclose(fileID_c); end Loading