Skip to content
"""
Generate command lines for split rendering with LC3plus
"""
import itertools
import os
# Paths
ENC_PATH = "./IVAS_cod"
DEC_PATH = "./IVAS_dec"
REND_PATH = "./IVAS_rend"
TEMP_DIR = "tmp"
# Config values to iterate over
ISM_CONFIGS_NUM_OBJECTS = [1, 2, 3, 4]
IVAS_BITRATES = [128000]
PRE_HEAD_ROT_FILES = [
"Workspace_msvc/trajectories/pre-renderer_pose_files/pre_yaw-20static.csv"
]
POST_HEAD_ROT_FILES = [
"Workspace_msvc/trajectories/post-renderer_pose_files/post_0static.csv"
]
RENDER_CONFIG_FILES = [
#######################################################
# Alternative 2 - LC3plus with CLDFB pose correction
"Workspace_msvc/renderer_configs/split_renderer_config_768_1dof.txt",
"Workspace_msvc/renderer_configs/split_renderer_config_512_2dof.txt",
None, # Alternative 2 is the default when no rendering config file is given on command line
#######################################################
# Alternative 3 - LC3plus with multi-stream (TD) pose correction
"Workspace_msvc/renderer_configs/split_renderer_config_768_1dof_tdposecorr.txt",
"Workspace_msvc/renderer_configs/split_renderer_config_1536_2dof_tdposecorr.txt",
]
def audio_for_ism(num_objects):
return f"scripts/testv/stv{num_objects}ISM48s.wav"
def metadata_for_ism(num_objects):
return f"scripts/testv/stvISM{num_objects}.csv"
def basename(file_path):
basename_w_ext = os.path.basename(file_path)
return os.path.splitext(basename_w_ext)[0]
# Full chain: IVAS_cod -> IVAS_dec -> IVAS_rend(post)
def full_chain(
num_objects, ivas_bitrate, pre_head_rot_file, render_config_file, post_head_rot_file
):
bs_name = f"{TEMP_DIR}/ism{num_objects}_b{ivas_bitrate}_full_chain.g192"
cod = [
ENC_PATH,
"-ism",
str(num_objects),
*[metadata_for_ism(i + 1) for i in range(num_objects)],
str(ivas_bitrate),
"48",
audio_for_ism(num_objects),
bs_name,
]
render_config_infix = (
f"##{basename(render_config_file)}" if render_config_file else ""
)
split_bs_name = bs_name.replace(
".g192", f"##{basename(pre_head_rot_file)}{render_config_infix}##split.bs"
)
render_config_args = (
["-render_config", render_config_file] if render_config_file else []
)
dec = [
DEC_PATH,
"-T",
pre_head_rot_file,
*render_config_args,
"SPLIT_BINAURAL",
"48",
bs_name,
split_bs_name,
]
binaural_output_name = split_bs_name.replace(
".bs", f"##{basename(post_head_rot_file)}##binaural.wav"
)
rend = [
REND_PATH,
"-i",
split_bs_name,
"-if",
"BINAURAL_SPLIT_CODED",
"-of",
"BINAURAL",
"-fs",
"48",
"-tf",
post_head_rot_file,
"-o",
binaural_output_name,
]
return [cod, dec, rend]
# Renderer chain: IVAS_rend(pre) -> IVAS_rend(post)
def rend_chain(num_objects, pre_head_rot_file, render_config_file, post_head_rot_file):
render_config_infix = (
f"##{basename(render_config_file)}" if render_config_file else ""
)
split_bs_name = f"{TEMP_DIR}/ism{num_objects}_rend_chain##{basename(pre_head_rot_file)}{render_config_infix}##split.bs"
render_config_args = (
["-render_config", render_config_file] if render_config_file else []
)
pre = [
REND_PATH,
"-i",
audio_for_ism(num_objects),
"-if",
f"ISM{num_objects}",
"-im",
*[metadata_for_ism(i + 1) for i in range(num_objects)],
"-of",
"BINAURAL_SPLIT_CODED",
"-fs",
"48",
*render_config_args,
"-tf",
pre_head_rot_file,
"-o",
split_bs_name,
]
binaural_output_name = split_bs_name.replace(
".bs", f"##{basename(post_head_rot_file)}##binaural.wav"
)
post = [
REND_PATH,
"-i",
split_bs_name,
"-if",
"BINAURAL_SPLIT_CODED",
"-of",
"BINAURAL",
"-fs",
"48",
"-tf",
post_head_rot_file,
"-o",
binaural_output_name,
]
return [pre, post]
def print_command_list(list_of_lists):
for lst in list_of_lists:
print(" ".join(lst))
print("") # newline
def main():
print("\n##########################################")
print("# Full chain: enc -> dec -> rend(post)")
print("##########################################\n")
for args_full_chain in itertools.product(
# Ordering here must match argument order in function call below!
ISM_CONFIGS_NUM_OBJECTS,
IVAS_BITRATES,
PRE_HEAD_ROT_FILES,
RENDER_CONFIG_FILES,
POST_HEAD_ROT_FILES,
):
print_command_list(full_chain(*args_full_chain))
print("\n##########################################")
print("# Renderer chain: rend(pre) -> rend(post)")
print("##########################################\n")
for args_rend_chain in itertools.product(
# Ordering here must match argument order in function call below!
ISM_CONFIGS_NUM_OBJECTS,
PRE_HEAD_ROT_FILES,
RENDER_CONFIG_FILES,
POST_HEAD_ROT_FILES,
):
print_command_list(rend_chain(*args_rend_chain))
if __name__ == "__main__":
main()
......@@ -111,7 +111,7 @@ if dataSpec.genRomFile
' *------------------------------------------------------------------------*/'
'/* TD renderer default HRIR model */'
'extern const float defaultHRIR_rom_latency_s;'
['extern const int16_t defaultHRIR_rom_azimDim2[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
['extern const int16_t defaultHRIR_rom_model_configuration[6];']
['extern const int16_t defaultHRIR_rom_azimDim3[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
['extern const int16_t defaultHRIR_rom_azim_start_idx[' int2str(size(mod_hrf_org.elevBf{1}, 3)) '];']
'extern const int16_t defaultHRIR_rom_azimSegSamples[1];'
......@@ -372,20 +372,14 @@ for fs = [48000 32000 16000]
fwrite(fileID, fs_khz, 'short');
% General - model-specific parts
fwrite(fileID, size(mod_hrf.elevBf{1}, 1), 'short'); % N = 4 i.e. coefficients for cubic including zeroth order
fwrite(fileID, size(mod_hrf.WR{1}, 2), 'short'); % K, filter length
% Elevation model structure
elevDim2 = size(mod_hrf.elevBf{1}, 2);
elevDim3 = size(mod_hrf.elevBf{1}, 3);
fwrite(fileID, elevDim2, 'short'); % elevDim2
fwrite(fileID, elevDim3, 'short'); % elevDim3 = P
fwrite(fileID, mod_hrf.elevKSeq{1}, 'float'); % length = elevDim3-2
% Azimuth model structure
azim_start_idx = 0;
c_file_content_dim2 = {
['const int16_t defaultHRIR_rom_azimDim2[' num2str(elevDim3) '] = {']
};
c_file_content_dim3 = {
['const int16_t defaultHRIR_rom_azimDim3[' num2str(elevDim3) '] = {']
};
......@@ -399,8 +393,6 @@ for fs = [48000 32000 16000]
for i = 1:elevDim3
azimDim2 = size(mod_hrf.azimBf{i}, 2);
azimDim3 = size(mod_hrf.azimBf{i}, 3);
fwrite(fileID, azimDim2, 'short'); % azimDim2
content_dim2 = [content_dim2 int2str(azimDim2) ', '];
fwrite(fileID, azimDim3, 'short'); % azimDim3 = Q
content_dim3 = [content_dim3 int2str(azimDim3) ', '];
fwrite(fileID, azim_start_idx, 'short'); % start azim index per elevation
......@@ -410,9 +402,6 @@ for fs = [48000 32000 16000]
end
if fs == fs_orig && dataSpec.genRomFile
fileID_c = fopen(c_file_name,'at');
c_file_content_dim2{size(c_file_content_dim2,2)+1} = content_dim2;
c_file_content_dim2{size(c_file_content_dim2,2)+1} = '};';
c_file_content_dim2{size(c_file_content_dim2,2)+1} = '';
c_file_content_dim3{size(c_file_content_dim3,2)+1} = content_dim3;
c_file_content_dim3{size(c_file_content_dim3,2)+1} = '};';
c_file_content_dim3{size(c_file_content_dim3,2)+1} = '';
......@@ -420,14 +409,64 @@ for fs = [48000 32000 16000]
c_file_content_start_idx{size(c_file_content_start_idx,2)+1} = '};';
c_file_content_start_idx{size(c_file_content_start_idx,2)+1} = '';
c_file_content = string(join(c_file_content_dim2,newline));
c_file_content = ...
['const int16_t defaultHRIR_rom_model_configuration[6] = {' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(useITD) ', /* UseItdModel */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(elevDim3) ', /* elevDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(size(mod_hrf_org.WL{1}, 1)) ', /* AlphaN */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(num_unique_splines) ', /* num_unique_azim_splines */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(e_num_points) ', /* elevSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(size(mod_hrf_org.WL{1}, 2)) ', /* K_48k */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['};' newline ];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_e))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_elevBsLen[' num2str(length(len_e)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_e))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_elevBsStart[' num2str(length(start_e)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = string(join(c_file_content_dim3,newline));
fprintf(fileID_c,'%s', c_file_content);
c_file_content = string(join(c_file_content_start_idx,newline));
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['const int16_t defaultHRIR_rom_azimSegSamples[1] = {' newline num2str(mod_hrf_org.azimKmSeq{1,2}(2)) ',' newline '};' newline];
arr_str = join(mat2str((single(a_num_points(1:num_unique_splines)))));
if(num_unique_splines>1)
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
else
arr_str(end+1) = ',';
end
c_file_content = ['const int16_t defaultHRIR_rom_azimSegSamples[' num2str(num_unique_splines) '] = {' newline arr_str newline '};' newline];
fprintf(fileID_c,'%s', c_file_content);
arr_str = mat2str(azimShapeIdx);
......@@ -662,20 +701,15 @@ for fs = [48000 32000 16000]
% If ITD model is used, parameters are stored in 2nd part of the same file
if useITD
% General
fwrite(fileID, size(mod_itd.elevBf, 1), 'short'); % N = 4 i.e. coefficients for cubic including zeroth order
%fwrite(fileID, size(mod_itd.W, 2), 'short'); % K = 1 always for ITD, so do not need to write.
% Elevation model structure
elevDim2 = size(mod_itd.elevBf, 2);
elevDim3 = size(mod_itd.elevBf, 3);
fwrite(fileID, elevDim2, 'short'); % elevDim2
fwrite(fileID, elevDim3, 'short'); % elevDim3 = P
fwrite(fileID, mod_itd.elevKSeq, 'float'); % length = elevDim3-2
% Azimuth model structure
azimDim2 = size(mod_itd.azimBf{2}, 2);
azimDim3 = size(mod_itd.azimBf{2}, 3);
fwrite(fileID, azimDim2, 'short'); % azimDim2
fwrite(fileID, azimDim3, 'short'); % azimDim3 = Q
fwrite(fileID, mod_itd.azimKSeq{2}, 'float'); % length = azimDim3+1
......@@ -725,6 +759,68 @@ for fs = [48000 32000 16000]
c_file_content = [ arr_str newline '};' newline];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_model_configuration[4] = {' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(elevDim3) ', /* elevDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(azimDim3) ', /* azimDim3 */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(e_num_points_ITD) ', /* elevSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = [ num2str(a_num_points_ITD) ', /* azimSegSamples */' newline ];
fprintf(fileID_c,'%s', c_file_content);
c_file_content = ['};' newline ];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_e_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_elevBsLen[' num2str(length(len_e_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_e_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_elevBsStart[' num2str(length(start_e_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(len_a_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_azimBsLen[' num2str(length(len_a_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str = join(mat2str((single(start_a_ITD))));
arr_str = arr_str(2:end);
arr_str(end) = ';';
arr_str = replace(arr_str, ";",',');
arr_str = replace(arr_str, " ",', ');
c_file_content = ...
['const int16_t defaultHRIR_rom_ITD_azimBsStart[' num2str(length(start_a_ITD)) '] = {' newline ...
arr_str ...
newline '};' newline ...
];
fprintf(fileID_c,'%s', c_file_content);
arr_str_all = num2hex(single(azimSplineShapeITD_all));
numCol = 25;
numIter = floor(length(azimSplineShapeITD_all)/numCol);
......@@ -809,6 +905,8 @@ end % fs loop
if dataSpec.genRomFile
h_file_content = string(join({''
['extern const int16_t defaultHRIR_rom_elevBsLen[' int2str(length(len_e)) '];']
['extern const int16_t defaultHRIR_rom_elevBsStart[' int2str(length(start_e)) '];']
['extern const uint32_t defaultHRIR_rom_elevBsShape[' int2str(length(elevSplineShape_all)) '];']
['extern const uint32_t defaultHRIR_rom_azimBsShape[' int2str(length(azimSplineShape{1})) '];']
['extern const uint32_t defaultHRIR_rom_ITD_W[' int2str(mod_itd.angleBfNum) '];']
......@@ -816,6 +914,11 @@ if dataSpec.genRomFile
['extern const float defaultHRIR_rom_ITD_azimKSeq[19];']
['extern const uint32_t defaultHRIR_rom_ITD_elevBsShape[' int2str(length(elevSplineShapeITD_all)) '];']
['extern const float defaultHRIR_rom_ITD_elevKSeq[16];']
['extern const int16_t defaultHRIR_rom_ITD_model_configuration[4];']
['extern const int16_t defaultHRIR_rom_ITD_elevBsLen[' int2str(length(len_e_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_elevBsStart[' int2str(length(start_e_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_azimBsLen[' int2str(length(len_a_ITD)) '];']
['extern const int16_t defaultHRIR_rom_ITD_azimBsStart[' int2str(length(start_a_ITD)) '];']
'#endif'
''
}, newline));
......
......@@ -54,6 +54,13 @@ def pytest_addoption(parser):
type=pathlib.Path,
default='./bin/IVAS_rend',
)
parser.addoption(
"--isar_post_renderer_path",
action="store",
help="path to renderer binary ISAR_post_rend(.exe)",
type=pathlib.Path,
default='./bin/ISAR_post_rend',
)
@pytest.fixture(scope="session")
......@@ -69,3 +76,8 @@ def decoder_path(request) -> str:
@pytest.fixture(scope="session")
def renderer_path(request) -> str:
return str(request.config.option.renderer_path.absolute())
@pytest.fixture(scope="session")
def isar_post_renderer_path(request) -> str:
return str(request.config.option.isar_post_renderer_path.absolute())
......@@ -59,7 +59,7 @@ def replace_paths(instr, testv_path, ref_path, cut_path):
test_dict = {}
TEST_DIR = "."
scripts=["Readme_IVAS_enc.txt", "Readme_IVAS_dec.txt", "Readme_IVAS_rend.txt", "Readme_IVAS_JBM_dec.txt"]
scripts=["Readme_IVAS_enc.txt", "Readme_IVAS_dec.txt", "Readme_IVAS_rend.txt", "Readme_IVAS_JBM_dec.txt", "Readme_IVAS_ISAR_dec.txt", "Readme_IVAS_ISAR_post_rend.txt"]
for s in scripts:
with open(os.path.join(TEST_DIR, s), "r", encoding="UTF-8") as fp:
......@@ -68,6 +68,7 @@ for s in scripts:
dec_opts = ""
diff_opts = ""
rend_opts = ""
isar_post_rend_opts = ""
testv_path = ""
ref_path = ""
cut_path = ""
......@@ -87,17 +88,20 @@ for s in scripts:
dec_opts = line
if line.startswith("$CUT_REND_BIN"):
rend_opts = line
if line.startswith("$CUT_ISAR_POST_REND_BIN"):
isar_post_rend_opts = line
if line.startswith("$DIFF_BIN"):
diff_opts = line
tag = s + "--" + diff_opts.split()[2].split('/')[-1]
if tag in test_dict:
print("non-unique tag found - ignoring new entry")
continue
test_dict[tag] = (enc_opts, dec_opts, rend_opts, diff_opts, testv_path, ref_path, cut_path)
test_dict[tag] = (enc_opts, dec_opts, rend_opts, isar_post_rend_opts, diff_opts, testv_path, ref_path, cut_path)
tag = ""
enc_opts = ""
dec_opts = ""
rend_opts = ""
isar_post_rend_opts = ""
diff_opts = ""
for proc in preproc:
proc = replace_paths(proc, testv_path, ref_path, cut_path)
......@@ -106,9 +110,9 @@ for s in scripts:
Path(path_arg).mkdir(parents=True, exist_ok=True)
@pytest.mark.parametrize("test_tag", list(test_dict.keys()))
def test_26252(test_tag, encoder_path, decoder_path, renderer_path):
def test_26252(test_tag, encoder_path, decoder_path, renderer_path, isar_post_renderer_path):
enc_opts, dec_opts, rend_opts, diff_opts, testv_path, ref_path, cut_path = test_dict[test_tag]
enc_opts, dec_opts, rend_opts, isar_post_rend_opts, diff_opts, testv_path, ref_path, cut_path = test_dict[test_tag]
if enc_opts:
enc_opts = replace_paths(enc_opts, testv_path, ref_path, cut_path)
......@@ -119,6 +123,9 @@ def test_26252(test_tag, encoder_path, decoder_path, renderer_path):
if rend_opts:
rend_opts = replace_paths(rend_opts, testv_path, ref_path, cut_path)
subprocess.run([renderer_path] + rend_opts.split()[1:], check = True)
if isar_post_rend_opts:
isar_post_rend_opts = replace_paths(isar_post_rend_opts, testv_path, ref_path, cut_path)
subprocess.run([isar_post_renderer_path] + isar_post_rend_opts.split()[1:], check = True)
diff_opts = replace_paths(diff_opts, testv_path, ref_path, cut_path)
result = True
......
......@@ -62,6 +62,41 @@ def run_cmd(cmd, env=None):
f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
)
def run_isar_ext_rend_cmd(cmd, env=None):
logging.info(f"\nRunning ISAR EXT REND command\n{' '.join(cmd)}\n")
try:
sp.run(cmd, check=True, capture_output=True, text=True, env=env)
except sp.CalledProcessError as e:
raise SystemError(
f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
)
def run_ivas_isar_enc_cmd(cmd, env=None):
logging.info(f"\nRunning IVAS ISAR encoder command\n{' '.join(cmd)}\n")
try:
sp.run(cmd, check=True, capture_output=True, text=True, env=env)
except sp.CalledProcessError as e:
raise SystemError(
f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
)
def run_ivas_isar_dec_cmd(cmd, env=None):
logging.info(f"\nDUT decoder command:\n\t{' '.join(cmd)}\n")
try:
sp.run(cmd, check=True, capture_output=True, text=True, env=env)
except sp.CalledProcessError as e:
raise SystemError(
f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
)
def run_isar_post_rend_cmd(cmd, env=None):
logging.info(f"\nRunning ISAR post renderer command\n{' '.join(cmd)}\n")
try:
sp.run(cmd, check=True, capture_output=True, text=True, env=env)
except sp.CalledProcessError as e:
raise SystemError(
f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
)
def check_BE(
test_info,
......
......@@ -31,6 +31,7 @@
"""
from pathlib import Path
import platform
from tests.renderer.constants import (
BIN_SUFFIX_MERGETARGET,
......@@ -41,6 +42,13 @@ from tests.renderer.constants import (
METADATA_SCENES_TO_TEST,
)
if platform.system() == "Windows":
EXE_SUFFIX = ".exe"
elif platform.system() in ["Linux", "Darwin"]:
EXE_SUFFIX = ""
else:
assert False, f"Unsupported platform {platform.system()}"
""" Set up paths """
TESTS_DIR = Path(__file__).parent
RENDER_CFG_DIR = TESTS_DIR.joinpath("renderer_configs").resolve()
......
......@@ -38,6 +38,7 @@ from tests.split_rendering.utils import *
""" Ambisonics """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_AMBI)
......@@ -53,11 +54,13 @@ def test_ambisonics_full_chain_split(
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_AMBI)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI_SPLIT_REND)
......@@ -77,6 +80,7 @@ def test_ambisonics_external_split(test_info, in_fmt, render_config, trajectory)
""" Multichannel """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MC)
......@@ -92,11 +96,13 @@ def test_multichannel_full_chain_split(
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MC)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC_SPLIT_REND)
......@@ -116,6 +122,7 @@ def test_multichannel_external_split(test_info, in_fmt, render_config, trajector
""" ISM """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_ISM)
......@@ -129,11 +136,13 @@ def test_ism_full_chain_split(test_info, in_fmt, bitrate, render_config, traject
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_ISM)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM_SPLIT_REND)
......@@ -153,6 +162,7 @@ def test_ism_external_split(test_info, in_fmt, render_config, trajectory):
""" MASA """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_MASA)
......@@ -166,11 +176,13 @@ def test_masa_full_chain_split(test_info, in_fmt, bitrate, render_config, trajec
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_MASA)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MASA_SPLIT_REND)
......@@ -190,6 +202,7 @@ def test_masa_external_split(test_info, in_fmt, render_config, trajectory):
""" OMASA """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_OMASA)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_OMASA)
......@@ -203,6 +216,7 @@ def test_omasa_full_chain_split(test_info, in_fmt, bitrate, render_config, traje
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
......@@ -211,6 +225,7 @@ def test_omasa_full_chain_split(test_info, in_fmt, bitrate, render_config, traje
""" OSBA """
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_OSBA)
@pytest.mark.parametrize("bitrate", IVAS_BITRATES_OSBA)
......@@ -224,6 +239,7 @@ def test_osba_full_chain_split(test_info, in_fmt, bitrate, render_config, trajec
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
)
......@@ -232,6 +248,7 @@ def test_osba_full_chain_split(test_info, in_fmt, bitrate, render_config, trajec
""" PLC """
@pytest.mark.create_ref
@pytest.mark.parametrize("error_pattern", PLC_ERROR_PATTERNS)
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_TO_TEST_PLC)
......@@ -262,6 +279,7 @@ full_chain_split_pcm_params = [
]
@pytest.mark.create_ref
@pytest.mark.parametrize("in_fmt,bitrate,render_config", full_chain_split_pcm_params)
def test_full_chain_split_pcm(test_info, in_fmt, bitrate, render_config):
trajectory = SPLIT_REND_HR_TRAJECTORIES_TO_TEST[0]
......@@ -273,6 +291,7 @@ def test_full_chain_split_pcm(test_info, in_fmt, bitrate, render_config):
in_fmt=in_fmt,
bitrate=bitrate,
render_config=RENDER_CFG_DIR.joinpath(f"{render_config}.txt"),
binary_suffix=EXE_SUFFIX,
pre_trajectory=pre_trajectory,
post_trajectory=post_trajectory,
renderer_fmt="BINAURAL_SPLIT_PCM",
......@@ -286,6 +305,7 @@ external_split_pcm_params = [
]
@pytest.mark.create_ref
@pytest.mark.parametrize("in_fmt,render_config", external_split_pcm_params)
def test_external_split_pcm(test_info, in_fmt, render_config):
trajectory = SPLIT_REND_HR_TRAJECTORIES_TO_TEST[0]
......@@ -301,6 +321,7 @@ def test_external_split_pcm(test_info, in_fmt, render_config):
renderer_fmt="BINAURAL_SPLIT_PCM",
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_FRAMING)
@pytest.mark.parametrize("in_fmt", ["5_1"])
......@@ -319,6 +340,7 @@ def test_framing_combinations_external_split(test_info, in_fmt, render_config, t
post_rend_fr=post_rend_fr,
pre_rend_fr=pre_rend_fr,
)
@pytest.mark.create_ref
@pytest.mark.parametrize("trajectory", SPLIT_REND_HR_TRAJECTORIES_TO_TEST)
@pytest.mark.parametrize("render_config", RENDERER_CONFIGS_FRAMING)
@pytest.mark.parametrize("in_fmt", ["5_1"])
......@@ -337,6 +359,7 @@ def test_framing_combinations_full_chain_split(
pre_trajectory=pre_trajectory,
bitrate="256000",
post_trajectory=post_trajectory,
binary_suffix=EXE_SUFFIX,
post_rend_fr=post_rend_fr,
pre_rend_fr=pre_rend_fr,
)
......@@ -39,7 +39,7 @@ from typing import Tuple
import numpy as np
import pytest
from tests.renderer.utils import check_BE, run_cmd, test_info
from tests.renderer.utils import check_BE, run_cmd, test_info, run_ivas_isar_enc_cmd, run_ivas_isar_dec_cmd, run_isar_post_rend_cmd, run_isar_ext_rend_cmd
from tests.split_rendering.constants import *
sys.path.append(SCRIPTS_DIR)
......@@ -172,18 +172,26 @@ def run_full_chain_split_rendering(
with TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir)
cut_in_file = tmp_dir.joinpath("cut_input.wav")
ivas_bitstream = tmp_dir.joinpath("ivas.192")
split_bitstream = tmp_dir.joinpath("split.bit")
#ivas_bitstream = tmp_dir.joinpath("ivas.192")
ivas_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_ivas.192"
#split_bitstream = tmp_dir.joinpath("split.bit")
split_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split.bit"
if renderer_fmt == "BINAURAL_SPLIT_PCM":
split_md_file = tmp_dir.joinpath("split_md.bin")
out_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_{pre_trajectory.stem}_split_full_{post_trajectory.stem}_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_.wav"
#split_md_file = tmp_dir.joinpath("split_md.bin")
split_md_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split_md.bit"
out_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_.wav"
if test_info.config.option.create_ref:
output_path_base = OUTPUT_PATH_REF
else:
output_path_base = OUTPUT_PATH_CUT
ivas_bitstream = output_path_base.joinpath(ivas_bitstream_stem)
split_bitstream = output_path_base.joinpath(split_bitstream_stem)
out_file = output_path_base.joinpath(out_file_stem)
if renderer_fmt == "BINAURAL_SPLIT_PCM":
split_md_file = output_path_base.joinpath(split_md_file_stem)
# check for metadata files
if in_fmt.upper().startswith("OSBA"):
......@@ -216,7 +224,7 @@ def run_full_chain_split_rendering(
cmd[1:1] = FORMAT_TO_IVAS_COD_FORMAT[in_fmt]
run_cmd(cmd)
run_ivas_isar_enc_cmd(cmd)
# decode to split-rendering bitstream
cmd = SPLIT_PRE_DEC_CMD[:]
......@@ -234,7 +242,7 @@ def run_full_chain_split_rendering(
if renderer_fmt == "BINAURAL_SPLIT_PCM":
cmd[5:5] = ["-om", str(split_md_file)]
run_cmd(cmd)
run_ivas_isar_dec_cmd(cmd)
# run split renderer
cmd = SPLIT_POST_REND_CMD[:]
......@@ -251,7 +259,7 @@ def run_full_chain_split_rendering(
if renderer_fmt == "BINAURAL_SPLIT_PCM":
cmd[7:7] = ["-im", str(split_md_file)]
run_cmd(cmd)
run_isar_post_rend_cmd(cmd)
if test_info.config.option.create_cut:
# CUT creation mode will run a comparison with REF
......@@ -297,7 +305,7 @@ def run_external_split_rendering(
split_bitstream = tmp_dir.joinpath("split.bit")
if renderer_fmt == "BINAURAL_SPLIT_PCM":
split_md_file = tmp_dir.joinpath("split_md.bin")
out_file_stem = f"{in_fmt}_{renderer_fmt}_{pre_trajectory.stem}_split_ext_{post_trajectory.stem}_config_{render_config.stem}_postrfr_{pre_rend_fr}_prerfr_{post_rend_fr}.wav"
out_file_stem = f"{in_fmt}_{renderer_fmt}_split_ext_config_{render_config.stem}_postrfr_{pre_rend_fr}_prerfr_{post_rend_fr}.wav"
if test_info.config.option.create_ref:
output_path_base = OUTPUT_PATH_REF
......@@ -343,7 +351,7 @@ def run_external_split_rendering(
if in_meta_files:
cmd[9:9] = ["-im", *in_meta_files]
run_cmd(cmd)
run_isar_ext_rend_cmd(cmd)
# run split renderer
cmd = SPLIT_POST_REND_CMD[:]
......@@ -363,7 +371,7 @@ def run_external_split_rendering(
if plc_error_pattern:
cmd[1:1] = ["-prbfi", str(plc_error_pattern)]
run_cmd(cmd)
run_isar_ext_rend_cmd(cmd)
if test_info.config.option.create_cut:
# CUT creation mode will run a comparison with REF
......