Loading ci/ivas_voip_be_test.sh +5 −18 Original line number Diff line number Diff line Loading @@ -113,28 +113,15 @@ python_audiofile_script_path=$python_audio_module_path/pyaudio3dtools/audiofile. jbm_offset=60 output_dir_default_dec="$output_dir_default"/dec output_dir_jbm = ${ref/$output_dir_default/$output_dir_voip} all_be=1 pids="" num_diff=0 num_diff=$(python3 $python_audio_module_path/batch_comp_audio.py $output_dir_default_dec $output_dir_jbm -ds --tool pyaudio3dtools --test_offset_ms $jbm_offset) for ref in "$output_dir_default_dec"/*.wav; do cut=${ref/$output_dir_default/$output_dir_voip} cut=${cut/".dec."/"_jbm_dly_error_profile_0_dat.dec."} # Print paths of compared files, since the script doesn't do it printf "\nComparing %s and %s\n" "$ref" "$cut" | tee -a voip_be_test_output.txt python3 $python_audiofile_script_path compare "$ref" "$cut" "$jbm_offset" echo "$?t" # pids="$pids $!" done # for pid in $pids; do # wait $pid || let "all_be=0" # done if [ $all_be -eq 1 ]; then if [ $num_diff == 0 ]; then printf "\n\nAll tested conditions are bit-exact\n" | tee -a voip_be_test_output.txt else printf "\n\nBitexactness problems found!\n" | tee -a voip_be_test_output.txt =rintf "\n\nBitexactness problems found!\n" | tee -a voip_be_test_output.txt exit 1; fi scripts/batch_comp_audio.py +23 −6 Original line number Diff line number Diff line Loading @@ -49,16 +49,21 @@ SEG_SNR_EXPR = r"Seg. SNR\s+=(.+)dB" DIFF_EXPR = r"Max Diff\s+=\s+(\d+)" DIFF_STR = { "CompAudio": "{label} Max. diff (PCM) for file {f}: {diff}", "pyaudio3dtools": "{label} Max. diff (PCM) for file {f}: {diff}", "mld": "{label} MLD diff for file {f}: {diff}", } def main(args): tool = args.tool if shutil.which(tool) is None: if tool != "pyaudio3dtools" and shutil.which(tool) is None: print(f"{tool} not in PATH - abort.") sys.exit(-1) test_offset_ms = args.test_offset_ms if tool != "pyaudio3dtools": test_offset_ms = 0 num_files_diff = 0 with OutFileManager(args.out_file) as out_file: Loading @@ -77,7 +82,7 @@ def main(args): # if only one thread is passed, do everything in the main thread # to allow for meaningful debugging if needed for f in common_files: compare_files(f, fol1, fol2, outputs, tool) compare_files(f, fol1, fol2, outputs, tool, test_offset_ms) else: with concurrent.futures.ThreadPoolExecutor( max_workers=args.num_threads Loading @@ -89,6 +94,7 @@ def main(args): repeat(fol2), repeat(outputs), repeat(tool), repeat(test_offset_ms) ) if args.sort: Loading @@ -98,7 +104,7 @@ def main(args): # write csv header if out_file is not None: if tool == "CompAudio": if tool == "CompAudio" or tool == "pyaudio3dtools": out_file.write("filename,diff\n") elif tool == "mld": out_file.write("filename,mld\n") Loading @@ -106,7 +112,7 @@ def main(args): for f, tool_output in out.items(): if tool == "CompAudio": diff, snr, gain, seg_snr = tool_output elif tool == "mld": elif tool == "mld" or tool == "pyaudio3dtools": diff = tool_output if diff > 0: Loading Loading @@ -136,7 +142,7 @@ def main(args): return num_files_diff def compare_files(f, fol1, fol2, outputs_dict, tool): def compare_files(f, fol1, fol2, outputs_dict, tool, test_offset_ms): """ Compare file f in both folders fol1 and fol2 using the given tool and store the parsed difference in outputs_dict. Loading @@ -157,6 +163,11 @@ def compare_files(f, fol1, fol2, outputs_dict, tool): s2, fs2 = readfile(f2, outdtype="int16") cmp_result = compare(s1, s2, fs1, per_frame=False, get_mld=True) tool_output = cmp_result["MLD"] elif tool == "pyaudio3dtools": s1, fs1 = readfile(f1, outdtype="int16") s2, fs2 = readfile(f2, outdtype="int16") cmp_result = compare(s1, s2, fs1, per_frame=False, test_start_offset_ms=test_offset_ms) tool_output = cmp_result["max_abs_diff"] with threading.Lock(): outputs_dict.update({f: tool_output}) Loading Loading @@ -286,10 +297,16 @@ if __name__ == "__main__": ) parser.add_argument( "--tool", choices=["mld", "CompAudio"], choices=["mld", "CompAudio", "pyaudio3dtools"], default="CompAudio", help="Compare tool to run", ) parser.add_argument( "--test_offset_ms", type=int, default=0, help="Offset in miliseconds that is ignored at the start of the files in folder2 (only used if tool=pyaudio3dtools)" ) args = parser.parse_args() sys.exit(main(args)) Loading
ci/ivas_voip_be_test.sh +5 −18 Original line number Diff line number Diff line Loading @@ -113,28 +113,15 @@ python_audiofile_script_path=$python_audio_module_path/pyaudio3dtools/audiofile. jbm_offset=60 output_dir_default_dec="$output_dir_default"/dec output_dir_jbm = ${ref/$output_dir_default/$output_dir_voip} all_be=1 pids="" num_diff=0 num_diff=$(python3 $python_audio_module_path/batch_comp_audio.py $output_dir_default_dec $output_dir_jbm -ds --tool pyaudio3dtools --test_offset_ms $jbm_offset) for ref in "$output_dir_default_dec"/*.wav; do cut=${ref/$output_dir_default/$output_dir_voip} cut=${cut/".dec."/"_jbm_dly_error_profile_0_dat.dec."} # Print paths of compared files, since the script doesn't do it printf "\nComparing %s and %s\n" "$ref" "$cut" | tee -a voip_be_test_output.txt python3 $python_audiofile_script_path compare "$ref" "$cut" "$jbm_offset" echo "$?t" # pids="$pids $!" done # for pid in $pids; do # wait $pid || let "all_be=0" # done if [ $all_be -eq 1 ]; then if [ $num_diff == 0 ]; then printf "\n\nAll tested conditions are bit-exact\n" | tee -a voip_be_test_output.txt else printf "\n\nBitexactness problems found!\n" | tee -a voip_be_test_output.txt =rintf "\n\nBitexactness problems found!\n" | tee -a voip_be_test_output.txt exit 1; fi
scripts/batch_comp_audio.py +23 −6 Original line number Diff line number Diff line Loading @@ -49,16 +49,21 @@ SEG_SNR_EXPR = r"Seg. SNR\s+=(.+)dB" DIFF_EXPR = r"Max Diff\s+=\s+(\d+)" DIFF_STR = { "CompAudio": "{label} Max. diff (PCM) for file {f}: {diff}", "pyaudio3dtools": "{label} Max. diff (PCM) for file {f}: {diff}", "mld": "{label} MLD diff for file {f}: {diff}", } def main(args): tool = args.tool if shutil.which(tool) is None: if tool != "pyaudio3dtools" and shutil.which(tool) is None: print(f"{tool} not in PATH - abort.") sys.exit(-1) test_offset_ms = args.test_offset_ms if tool != "pyaudio3dtools": test_offset_ms = 0 num_files_diff = 0 with OutFileManager(args.out_file) as out_file: Loading @@ -77,7 +82,7 @@ def main(args): # if only one thread is passed, do everything in the main thread # to allow for meaningful debugging if needed for f in common_files: compare_files(f, fol1, fol2, outputs, tool) compare_files(f, fol1, fol2, outputs, tool, test_offset_ms) else: with concurrent.futures.ThreadPoolExecutor( max_workers=args.num_threads Loading @@ -89,6 +94,7 @@ def main(args): repeat(fol2), repeat(outputs), repeat(tool), repeat(test_offset_ms) ) if args.sort: Loading @@ -98,7 +104,7 @@ def main(args): # write csv header if out_file is not None: if tool == "CompAudio": if tool == "CompAudio" or tool == "pyaudio3dtools": out_file.write("filename,diff\n") elif tool == "mld": out_file.write("filename,mld\n") Loading @@ -106,7 +112,7 @@ def main(args): for f, tool_output in out.items(): if tool == "CompAudio": diff, snr, gain, seg_snr = tool_output elif tool == "mld": elif tool == "mld" or tool == "pyaudio3dtools": diff = tool_output if diff > 0: Loading Loading @@ -136,7 +142,7 @@ def main(args): return num_files_diff def compare_files(f, fol1, fol2, outputs_dict, tool): def compare_files(f, fol1, fol2, outputs_dict, tool, test_offset_ms): """ Compare file f in both folders fol1 and fol2 using the given tool and store the parsed difference in outputs_dict. Loading @@ -157,6 +163,11 @@ def compare_files(f, fol1, fol2, outputs_dict, tool): s2, fs2 = readfile(f2, outdtype="int16") cmp_result = compare(s1, s2, fs1, per_frame=False, get_mld=True) tool_output = cmp_result["MLD"] elif tool == "pyaudio3dtools": s1, fs1 = readfile(f1, outdtype="int16") s2, fs2 = readfile(f2, outdtype="int16") cmp_result = compare(s1, s2, fs1, per_frame=False, test_start_offset_ms=test_offset_ms) tool_output = cmp_result["max_abs_diff"] with threading.Lock(): outputs_dict.update({f: tool_output}) Loading Loading @@ -286,10 +297,16 @@ if __name__ == "__main__": ) parser.add_argument( "--tool", choices=["mld", "CompAudio"], choices=["mld", "CompAudio", "pyaudio3dtools"], default="CompAudio", help="Compare tool to run", ) parser.add_argument( "--test_offset_ms", type=int, default=0, help="Offset in miliseconds that is ignored at the start of the files in folder2 (only used if tool=pyaudio3dtools)" ) args = parser.parse_args() sys.exit(main(args))