Loading .gitlab-ci.yml +26 −0 Original line number Diff line number Diff line Loading @@ -659,6 +659,32 @@ clang-format-check: name: "$ARTIFACT_BASE_NAME" expose_as: 'formatting patch' # check for crashes if first received frame on decoder side is an SID check-first-frame-is-sid: extends: - .test-job-linux-needs-testv-dir - .rules-merge-request tags: - ivas-linux stage: test needs: ["build-codec-linux-cmake"] script: - *print-common-info - *update-ltv-repo - cmake . - make -j # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA) - echo $modes - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 artifacts: paths: - out/logs when: on_failure name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" expose_as: "logs-sidstart" # --------------------------------------------------------------- # Test jobs for main branch # --------------------------------------------------------------- Loading scripts/config/ci_linux_sidstart_test.json 0 → 100644 +25 −0 Original line number Diff line number Diff line { "afspPath": "not_needed", "utilPath": "/tools", "inpaths": { "MONO": "/usr/local/testv/test_mono.wav", "STEREO": "/usr/local/testv/test_stereo.wav", "FOA": "/usr/local/ltv/ltv48_FOA.wav", "HOA2": "/usr/local/ltv/ltv48_HOA2.wav", "HOA3": "/usr/local/ltv/ltv48_HOA3.wav", "SBA": "/usr/local/ltv/ltv48_HOA3.wav", "MASA1TC1DIR": "/usr/local/testv/test_MASA_1dir1TC.wav", "MASA1TC2DIR": "/usr/local/testv/test_MASA_2dir1TC.wav", "MASA2TC1DIR": "/usr/local/testv/test_MASA_1dir2TC.wav", "MASA2TC2DIR": "/usr/local/testv/test_MASA_2dir2TC.wav", "5_1": "/usr/local/testv/test_MC51.wav", "5_1_2": "/usr/local/testv/test_MC51p2.wav", "5_1_4": "/usr/local/testv/test_MC51p4.wav", "7_1": "/usr/local/testv/test_MC71.wav", "7_1_4": "/usr/local/testv/test_MC71p4.wav", "ISM1": "/usr/local/testv/test_mono.wav", "ISM2": "/usr/local/testv/test_ISM_2obj.wav", "ISM3": "/usr/local/testv/test_ISM_3obj.wav", "ISM4": "/usr/local/testv/test_ISM_4obj.wav" } } scripts/cut_bs.py +38 −11 Original line number Diff line number Diff line Loading @@ -35,12 +35,32 @@ import argparse import os.path import sys #SID_BITS = {35, 48, 88, 100} SID_BITS = {35, 48, 104} SYNC_WORDS = {b"!k", b" k"} def cut_bs(fp, fp_out, start_frame = 0, start_with_sid = False): def cut_to_length(fp, fp_out, length): assert length > 0 fr_cnt = 0 for f in range(length): sync_word = fp.read(2) if sync_word == b"": return fr_cnt if sync_word not in SYNC_WORDS: raise ValueError("Bad Sync word!") n_bits_bs = fp.read(2) n_bits = struct.unpack("h", n_bits_bs)[0] fp_out.write(sync_word) fp_out.write(n_bits_bs) fp_out.write(fp.read(n_bits * 2)) fr_cnt += 1 return fr_cnt def cut_from_start(fp, fp_out, start_frame=0, start_with_sid=False): # cut until start frame fr_cnt = 0 cut_cnt = 0 Loading Loading @@ -92,14 +112,15 @@ def cut_bs(fp, fp_out, start_frame = 0, start_with_sid = False): if __name__ == "__main__": my_parser = argparse.ArgumentParser( description="Cut frames from the beginning of a G.192 bit stream file" description="Cut a G.192 bit stream file" ) my_parser.add_argument( "--sid", "-s", help="Cut until the first SID frame", action="store_true" "--sid", "-s", help="Cut away all frames before the first SID frame", action="store_true" ) my_parser.add_argument( "--frame", "-f", type=int, help="Number of frames to cut.", default=0 "--frame", "-f", type=int, help="Number of frames to cut from the start of the file.", default=0 ) my_parser.add_argument("--length", "-l", type=int, help="Cut bitstream to this length (in frames)", default=-1) my_parser.add_argument("bs_in", type=str, help="G.192 bit stream file name to cut") my_parser.add_argument("bs_out", type=str, help="Cut G.192 bit stream file name") my_args = my_parser.parse_args() Loading @@ -113,10 +134,16 @@ if __name__ == "__main__": with open(my_args.bs_in, "rb") as fp_in: with open(my_args.bs_out, "wb") as fp_out: fr_cnt, cut_cnt = cut_bs( if my_args.sid or my_args.frame: fr_cnt, cut_cnt = cut_from_start( fp_in, fp_out, start_frame=my_args.frame, start_with_sid=my_args.sid ) if my_args.sid and (fr_cnt == cut_cnt): print("Warning! No SID frame found in bitstream!") print(f"Cut {cut_cnt} of {fr_cnt} frames from {my_args.bs_in}") elif my_args.length: fr_cnt = cut_to_length(fp_in, fp_out, my_args.length) if fr_cnt != my_args.length: print(f"Warning! Could not cut to length {my_args.length} as bitstream only contained {fr_cnt} frames!") print(f"Cut {my_args.bs_in} to {fr_cnt} frames") scripts/pyivastest/IvasScriptsCommon.py +18 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,12 @@ class IvasScriptArgParser(argparse.ArgumentParser): help="Cut frames from the beginning of the encoded bit stream until the first SID frame", action="store_true", ) self.add_argument( "--bs_length", help="Cut bitstream to this (maximum) length. Is applied AFTER --sidstart processing, if this is given", type=int, default=-1, ) self.add_argument( "--info", help="Ouput debug info in subfolders of /res (use with caution, this can generate a huge amount of data)", Loading Loading @@ -613,6 +619,18 @@ def runner_setup(runner, args): ] add_to_proc_chain(bs_proc_chain, sidstart_cmd) if args["bs_length"] > 0: bs_len = args["bs_length"] bs_cut_cmd = [ os.path.join(constants.SCRIPTS_BASE_DIR, "cut_bs.py"), "--length", f"{bs_len}", "{in_file}", "{out_file}", f"{bs_len}frames", ] add_to_proc_chain(bs_proc_chain, bs_cut_cmd) if bs_proc_chain != {}: runner.global_bitstream_processing = bs_proc_chain Loading scripts/runIvasCodec.py +5 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,11 @@ class RunIvasCodec(IvasScriptsCommon.IvasScript): self.logger.console(" ") encs_failed = len(runner.failed_modes["enc"]) > 0 decs_failed = len(runner.failed_modes["dec"]) > 0 return encs_failed or decs_failed if __name__ == "__main__": script = RunIvasCodec() script.run() sys.exit(script.run()) Loading
.gitlab-ci.yml +26 −0 Original line number Diff line number Diff line Loading @@ -659,6 +659,32 @@ clang-format-check: name: "$ARTIFACT_BASE_NAME" expose_as: 'formatting patch' # check for crashes if first received frame on decoder side is an SID check-first-frame-is-sid: extends: - .test-job-linux-needs-testv-dir - .rules-merge-request tags: - ivas-linux stage: test needs: ["build-codec-linux-cmake"] script: - *print-common-info - *update-ltv-repo - cmake . - make -j # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA) - echo $modes - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500 artifacts: paths: - out/logs when: on_failure name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart" expose_as: "logs-sidstart" # --------------------------------------------------------------- # Test jobs for main branch # --------------------------------------------------------------- Loading
scripts/config/ci_linux_sidstart_test.json 0 → 100644 +25 −0 Original line number Diff line number Diff line { "afspPath": "not_needed", "utilPath": "/tools", "inpaths": { "MONO": "/usr/local/testv/test_mono.wav", "STEREO": "/usr/local/testv/test_stereo.wav", "FOA": "/usr/local/ltv/ltv48_FOA.wav", "HOA2": "/usr/local/ltv/ltv48_HOA2.wav", "HOA3": "/usr/local/ltv/ltv48_HOA3.wav", "SBA": "/usr/local/ltv/ltv48_HOA3.wav", "MASA1TC1DIR": "/usr/local/testv/test_MASA_1dir1TC.wav", "MASA1TC2DIR": "/usr/local/testv/test_MASA_2dir1TC.wav", "MASA2TC1DIR": "/usr/local/testv/test_MASA_1dir2TC.wav", "MASA2TC2DIR": "/usr/local/testv/test_MASA_2dir2TC.wav", "5_1": "/usr/local/testv/test_MC51.wav", "5_1_2": "/usr/local/testv/test_MC51p2.wav", "5_1_4": "/usr/local/testv/test_MC51p4.wav", "7_1": "/usr/local/testv/test_MC71.wav", "7_1_4": "/usr/local/testv/test_MC71p4.wav", "ISM1": "/usr/local/testv/test_mono.wav", "ISM2": "/usr/local/testv/test_ISM_2obj.wav", "ISM3": "/usr/local/testv/test_ISM_3obj.wav", "ISM4": "/usr/local/testv/test_ISM_4obj.wav" } }
scripts/cut_bs.py +38 −11 Original line number Diff line number Diff line Loading @@ -35,12 +35,32 @@ import argparse import os.path import sys #SID_BITS = {35, 48, 88, 100} SID_BITS = {35, 48, 104} SYNC_WORDS = {b"!k", b" k"} def cut_bs(fp, fp_out, start_frame = 0, start_with_sid = False): def cut_to_length(fp, fp_out, length): assert length > 0 fr_cnt = 0 for f in range(length): sync_word = fp.read(2) if sync_word == b"": return fr_cnt if sync_word not in SYNC_WORDS: raise ValueError("Bad Sync word!") n_bits_bs = fp.read(2) n_bits = struct.unpack("h", n_bits_bs)[0] fp_out.write(sync_word) fp_out.write(n_bits_bs) fp_out.write(fp.read(n_bits * 2)) fr_cnt += 1 return fr_cnt def cut_from_start(fp, fp_out, start_frame=0, start_with_sid=False): # cut until start frame fr_cnt = 0 cut_cnt = 0 Loading Loading @@ -92,14 +112,15 @@ def cut_bs(fp, fp_out, start_frame = 0, start_with_sid = False): if __name__ == "__main__": my_parser = argparse.ArgumentParser( description="Cut frames from the beginning of a G.192 bit stream file" description="Cut a G.192 bit stream file" ) my_parser.add_argument( "--sid", "-s", help="Cut until the first SID frame", action="store_true" "--sid", "-s", help="Cut away all frames before the first SID frame", action="store_true" ) my_parser.add_argument( "--frame", "-f", type=int, help="Number of frames to cut.", default=0 "--frame", "-f", type=int, help="Number of frames to cut from the start of the file.", default=0 ) my_parser.add_argument("--length", "-l", type=int, help="Cut bitstream to this length (in frames)", default=-1) my_parser.add_argument("bs_in", type=str, help="G.192 bit stream file name to cut") my_parser.add_argument("bs_out", type=str, help="Cut G.192 bit stream file name") my_args = my_parser.parse_args() Loading @@ -113,10 +134,16 @@ if __name__ == "__main__": with open(my_args.bs_in, "rb") as fp_in: with open(my_args.bs_out, "wb") as fp_out: fr_cnt, cut_cnt = cut_bs( if my_args.sid or my_args.frame: fr_cnt, cut_cnt = cut_from_start( fp_in, fp_out, start_frame=my_args.frame, start_with_sid=my_args.sid ) if my_args.sid and (fr_cnt == cut_cnt): print("Warning! No SID frame found in bitstream!") print(f"Cut {cut_cnt} of {fr_cnt} frames from {my_args.bs_in}") elif my_args.length: fr_cnt = cut_to_length(fp_in, fp_out, my_args.length) if fr_cnt != my_args.length: print(f"Warning! Could not cut to length {my_args.length} as bitstream only contained {fr_cnt} frames!") print(f"Cut {my_args.bs_in} to {fr_cnt} frames")
scripts/pyivastest/IvasScriptsCommon.py +18 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,12 @@ class IvasScriptArgParser(argparse.ArgumentParser): help="Cut frames from the beginning of the encoded bit stream until the first SID frame", action="store_true", ) self.add_argument( "--bs_length", help="Cut bitstream to this (maximum) length. Is applied AFTER --sidstart processing, if this is given", type=int, default=-1, ) self.add_argument( "--info", help="Ouput debug info in subfolders of /res (use with caution, this can generate a huge amount of data)", Loading Loading @@ -613,6 +619,18 @@ def runner_setup(runner, args): ] add_to_proc_chain(bs_proc_chain, sidstart_cmd) if args["bs_length"] > 0: bs_len = args["bs_length"] bs_cut_cmd = [ os.path.join(constants.SCRIPTS_BASE_DIR, "cut_bs.py"), "--length", f"{bs_len}", "{in_file}", "{out_file}", f"{bs_len}frames", ] add_to_proc_chain(bs_proc_chain, bs_cut_cmd) if bs_proc_chain != {}: runner.global_bitstream_processing = bs_proc_chain Loading
scripts/runIvasCodec.py +5 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,11 @@ class RunIvasCodec(IvasScriptsCommon.IvasScript): self.logger.console(" ") encs_failed = len(runner.failed_modes["enc"]) > 0 decs_failed = len(runner.failed_modes["dec"]) > 0 return encs_failed or decs_failed if __name__ == "__main__": script = RunIvasCodec() script.run() sys.exit(script.run())