From b87975d8448a44fa4583d8b5e2429c435d4fc3db Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 17 Jan 2025 14:06:11 +0100 Subject: [PATCH] Fix for renderer tests with PEAQ comparison --- tests/renderer/utils.py | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index caf21b23c5..3f37729133 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -315,6 +315,47 @@ def run_renderer( # CUT creation mode will run a comparison with REF out_file_ref = str(OUTPUT_PATH_REF.joinpath(out_file_stem)) + # Check if we need to render to mono, stereo or binaural for PEAQ comparison + odg_input = None + odg_test = None + odg_ref = None + if get_odg: + odg_input = out_file_ref[0:-4] + ".INPUT.BINAURAL.wav" + odg_test = str(out_file)[0:-4] + ".BINAURAL.wav" + odg_ref = out_file_ref[0:-4] + ".BINAURAL.wav" + + if out_fmt not in PEAQ_SUPPORTED_FMT: + # Render test to BINAURAL + cmd2 = RENDERER_CMD[:] + cmd2[2] = str(out_file) # in_file + cmd2[4] = str(out_fmt) # in_fmt + cmd2[6] = odg_test # out_file + cmd2[8] = "BINAURAL" # out_fmt + cmd2[10] = str(sr) + cmd2[0] += BIN_SUFFIX_MERGETARGET # Use IVAS_rend_ref for re-rendering + cmd2[0] += binary_suffix + run_cmd(cmd2, env) + + # Render ref to BINAURAL with same settings as test + cmd2[2] = str(out_file_ref) # in_file + cmd2[6] = odg_ref # out_file + run_cmd(cmd2, env) + out_fmt_bin = "BINAURAL" + else: + out_fmt_bin = out_fmt + odg_test = out_file + odg_ref = out_file_ref + + if out_fmt_bin != in_fmt: + # Render input to match out_fmt_bin using same config as input, but with IVAS_rend_ref + cmd[0] += BIN_SUFFIX_MERGETARGET + cmd[0] += binary_suffix + cmd[6] = odg_input # out_file + cmd[8] = out_fmt_bin # out_fmt + run_cmd(cmd, env) + else: + odg_input = in_file + # see constants.py ref_fs = int(cmd[10]) * 1000 output_differs, reason = cmp_pcm( @@ -326,7 +367,10 @@ def run_renderer( mld_lim=get_mld_lim, abs_tol=abs_tol, get_ssnr=get_ssnr, - get_odg=get_ssnr, + get_odg=get_odg, + odg_input=odg_input, + odg_test=odg_test, + odg_ref=odg_ref, ) props = parse_properties(reason, output_differs, props_to_record) -- GitLab