Loading Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py 0 → 100644 +151 −0 Original line number Diff line number Diff line from scipy.io.wavfile import read, write from scipy import signal import subprocess import numpy as np import sys import os ## dimension of following 2 arrays should be same, that is for each file name there should be a tag file_names = [ '../scripts/testv/stv4ISM48s.wav' ]; ism_md_file_names = [ '../scripts/testv/stvISM1.csv', '../scripts/testv/stvISM2.csv', '../scripts/testv/stvISM3.csv', '../scripts/testv/stvISM4.csv' ]; file_tags = [ 'test_ISM' ]; ## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag pre_hr_file_names = [ 'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' ]; post_hr_file_names = [ 'trajectories/post-renderer_pose_files/post_0static.csv' ]; hr_file_tags = [ 'yaw20static' ]; renderers = [ ('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), ('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), ('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), ('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), ('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), ('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), ('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), ('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), ('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; split_md_file_name = 'split_md.bin'; split_rend_file_outs = ['recons_out_pos0.wav', 'recons_out_pos1.wav', 'recons_out_pos2.wav', 'rotated_ref_pos0.wav', 'rotated_ref_pos1.wav', 'rotated_ref_pos2.wav', 'rotated_ref_RefPos.wav', 'split_rend_MD_bitrate.txt'] def check_and_makedir(dir_path): if not os.path.exists(dir_path): try: os.makedirs(dir_path) except OSError as e: if e.errno != errno.EEXIST: raise # raises the error again def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): check_and_makedir(out_dir); for idx in range(0, len(file_tags)): for hr_idx in range(0, len(hr_file_tags)): for rend in range(0, len(renderers)): filename = file_names[idx]; file_in = os.path.join(file_dir, filename); rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); out_fmt = 'BINAURAL_SPLIT_CLDFB'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); out_fmt = 'BINAURAL_SPLIT_PCM'; md_out_arg = ['-om', split_md_file_name]; md_in_arg = ['-im', split_md_file_name]; file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); file_out = os.path.join(out_dir, file_out_name); print(file_in) print(bs_file_out) print(file_out) hr_pre_file_name = pre_hr_file_names[hr_idx]; hr_pre_file = os.path.join(file_dir, hr_pre_file_name); hr_post_file_name = post_hr_file_names[hr_idx]; hr_post_file = os.path.join(file_dir, hr_post_file_name); pre_rend_cmd = [ rend_exe, '-rc', renderers[rend][1], md_out_arg[0], md_out_arg[1], '-i', file_in, '-if', 'ISM4', '-im', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], '-o', bs_file_out, '-of', out_fmt, '-fs', '48', '-tf', hr_pre_file, ] print(pre_rend_cmd) test_status = subprocess.call(pre_rend_cmd, shell=False) post_rend_cmd = [ rend_exe, md_in_arg[0], md_in_arg[1], '-i', bs_file_out, '-if', out_fmt, '-o', file_out, '-of', 'BINAURAL', '-fs', '48', '-tf', hr_post_file, ] print(post_rend_cmd) test_status = subprocess.call(post_rend_cmd, shell=False) if os.path.exists(bs_file_out): os.remove(bs_file_out); if os.path.exists(split_md_file_name): os.remove(split_md_file_name); for fo in split_rend_file_outs: file_old = os.path.join(os. getcwd(), fo); file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); file_new = os.path.join(out_dir, file_out_name); if os.path.exists(file_old): os.rename(file_old, file_new); def main(argv): print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') if len(argv) < 3: return print(len(argv)) return generate_split_rend_lis_items(*argv[1:]) if __name__ == "__main__": sys.exit(main(sys.argv)) No newline at end of file apps/decoder.c +8 −0 Original line number Diff line number Diff line Loading @@ -1338,6 +1338,13 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } #ifdef SPLIT_REND_CLDFB_ISM if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) { pFullDelayNumSamples[0] = 0; } #endif if ( !arg.delayCompensationEnabled ) { Loading @@ -1345,6 +1352,7 @@ static ivas_error initOnFirstGoodFrame( } *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); Loading lib_dec/ivas_dec.c +6 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ #endif #include "wmc_auto.h" /*--------------------------------------------------------------------------* * ivas_dec() * Loading Loading @@ -245,7 +244,12 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef SPLIT_REND_LC3PLUS #ifdef SPLIT_REND_CLDFB_ISM if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) #endif { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } Loading Loading @@ -652,6 +656,7 @@ ivas_error ivas_dec( hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, Loading Loading
Workspace_msvc/sample_split_rend_script_ivas_rend_ism.py 0 → 100644 +151 −0 Original line number Diff line number Diff line from scipy.io.wavfile import read, write from scipy import signal import subprocess import numpy as np import sys import os ## dimension of following 2 arrays should be same, that is for each file name there should be a tag file_names = [ '../scripts/testv/stv4ISM48s.wav' ]; ism_md_file_names = [ '../scripts/testv/stvISM1.csv', '../scripts/testv/stvISM2.csv', '../scripts/testv/stvISM3.csv', '../scripts/testv/stvISM4.csv' ]; file_tags = [ 'test_ISM' ]; ## dimension of following 3 arrays should be same, that is for each pre file there should be a post file and a tag pre_hr_file_names = [ 'trajectories/pre-renderer_pose_files/pre_yaw20static.csv' ]; post_hr_file_names = [ 'trajectories/post-renderer_pose_files/post_0static.csv' ]; hr_file_tags = [ 'yaw20static' ]; renderers = [ ('crend_768_1dof', 'renderer_configs/split_renderer_config_768_1dof.txt', '0'), ('crend_pcm_1dof', 'renderer_configs/split_renderer_config_pcm_1dof.txt', '1'), ('crend_512_2dof', 'renderer_configs/split_renderer_config_512_2dof.txt', '0'), ('crend_pcm_2dof', 'renderer_configs/split_renderer_config_pcm_2dof.txt', '1'), ('crend_384_3dof', 'renderer_configs/split_renderer_config_384_3dof.txt', '0'), ('crend_pcm_3dof', 'renderer_configs/split_renderer_config_pcm_3dof.txt', '1'), ('crend_384_3dof_hq', 'renderer_configs/split_renderer_config_384_3dof_hq.txt', '0'), ('crend_pcm_3dof_hq', 'renderer_configs/split_renderer_config_pcm_3dof_hq.txt', '1'), ('crend_lc3plus_1dof', 'renderer_configs/split_renderer_config_768_1dof_hoa_lc3plus.txt', '0')]; split_md_file_name = 'split_md.bin'; split_rend_file_outs = ['recons_out_pos0.wav', 'recons_out_pos1.wav', 'recons_out_pos2.wav', 'rotated_ref_pos0.wav', 'rotated_ref_pos1.wav', 'rotated_ref_pos2.wav', 'rotated_ref_RefPos.wav', 'split_rend_MD_bitrate.txt'] def check_and_makedir(dir_path): if not os.path.exists(dir_path): try: os.makedirs(dir_path) except OSError as e: if e.errno != errno.EEXIST: raise # raises the error again def generate_split_rend_lis_items(file_dir, exe_dir, out_dir): check_and_makedir(out_dir); for idx in range(0, len(file_tags)): for hr_idx in range(0, len(hr_file_tags)): for rend in range(0, len(renderers)): filename = file_names[idx]; file_in = os.path.join(file_dir, filename); rend_exe = os.path.join(exe_dir, 'IVAS_rend.exe'); if renderers[rend][2] == '0': bs_file_out_name = '_'.join([file_tags[idx], 'out.pkt']); bs_file_out = os.path.join(out_dir, bs_file_out_name); out_fmt = 'BINAURAL_SPLIT_CLDFB'; else: bs_file_out_name = '_'.join([file_tags[idx], 'out.wav']); bs_file_out = os.path.join(out_dir, bs_file_out_name); out_fmt = 'BINAURAL_SPLIT_PCM'; md_out_arg = ['-om', split_md_file_name]; md_in_arg = ['-im', split_md_file_name]; file_out_name = '_'.join([file_tags[idx], renderers[rend][0], 'out.wav']); file_out = os.path.join(out_dir, file_out_name); print(file_in) print(bs_file_out) print(file_out) hr_pre_file_name = pre_hr_file_names[hr_idx]; hr_pre_file = os.path.join(file_dir, hr_pre_file_name); hr_post_file_name = post_hr_file_names[hr_idx]; hr_post_file = os.path.join(file_dir, hr_post_file_name); pre_rend_cmd = [ rend_exe, '-rc', renderers[rend][1], md_out_arg[0], md_out_arg[1], '-i', file_in, '-if', 'ISM4', '-im', ism_md_file_names[0], ism_md_file_names[1], ism_md_file_names[2], ism_md_file_names[3], '-o', bs_file_out, '-of', out_fmt, '-fs', '48', '-tf', hr_pre_file, ] print(pre_rend_cmd) test_status = subprocess.call(pre_rend_cmd, shell=False) post_rend_cmd = [ rend_exe, md_in_arg[0], md_in_arg[1], '-i', bs_file_out, '-if', out_fmt, '-o', file_out, '-of', 'BINAURAL', '-fs', '48', '-tf', hr_post_file, ] print(post_rend_cmd) test_status = subprocess.call(post_rend_cmd, shell=False) if os.path.exists(bs_file_out): os.remove(bs_file_out); if os.path.exists(split_md_file_name): os.remove(split_md_file_name); for fo in split_rend_file_outs: file_old = os.path.join(os. getcwd(), fo); file_out_name = '_'.join([file_tags[idx], hr_file_tags[hr_idx], renderers[rend][0], fo]); file_new = os.path.join(out_dir, file_out_name); if os.path.exists(file_old): os.rename(file_old, file_new); def main(argv): print('USAGE : python generate_split_rend_lis_items.py file_dir exe_dir out_dir') if len(argv) < 3: return print(len(argv)) return generate_split_rend_lis_items(*argv[1:]) if __name__ == "__main__": sys.exit(main(sys.argv)) No newline at end of file
apps/decoder.c +8 −0 Original line number Diff line number Diff line Loading @@ -1338,6 +1338,13 @@ static ivas_error initOnFirstGoodFrame( fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) ); return error; } #ifdef SPLIT_REND_CLDFB_ISM if ( ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) || ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CLDFB ) ) { pFullDelayNumSamples[0] = 0; } #endif if ( !arg.delayCompensationEnabled ) { Loading @@ -1345,6 +1352,7 @@ static ivas_error initOnFirstGoodFrame( } *pRemainingDelayNumSamples = pFullDelayNumSamples[0]; if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); Loading
lib_dec/ivas_dec.c +6 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ #endif #include "wmc_auto.h" /*--------------------------------------------------------------------------* * ivas_dec() * Loading Loading @@ -245,7 +244,12 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { #ifdef SPLIT_REND_LC3PLUS #ifdef SPLIT_REND_CLDFB_ISM if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) || ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else if ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CLDFB ) #endif { ObjRenderIvasFrame_splitBinaural( st_ivas, output, output_frame ); } Loading Loading @@ -652,6 +656,7 @@ ivas_error ivas_dec( hSplitBinRend = &st_ivas->splitBinRend; max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 ); pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0; ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend, st_ivas->hHeadTrackData->Quaternions, st_ivas->hRenderConfig->split_rend_config.splitRendBitRate, Loading