diff --git a/fluster/utils.py b/fluster/utils.py index 5331972b..5e16dd57 100644 --- a/fluster/utils.py +++ b/fluster/utils.py @@ -141,43 +141,6 @@ def normalize_path(path: str) -> str: return path -def _linux_user_data_dir(appname: str) -> str: - """Return data directory tied to the user""" - path = os.environ.get("XDG_DATA_HOME", "") - if not path.strip(): - path = os.path.expanduser("~/.local/share") - return os.path.join(path, appname) - - -def _linux_site_data_dirs(appname: str) -> List[str]: - """Return data directory shared by users""" - path = os.environ.get("XDG_DATA_DIRS", "") - if not path.strip(): - path = "/usr/local/share:/usr/share" - paths = path.split(os.pathsep) - return [os.path.join(p, appname) for p in paths] - - -def _win_user_data_dir(appname: str) -> str: - """Return data directory""" - path = os.path.expanduser(r"~\AppData\Local") - return os.path.join(path, appname) - - -def _win_site_data_dirs(appname: str) -> List[str]: - """Return data directory shared by users""" - # On Windows always user_data_dir - return [_win_user_data_dir(appname)] - - -if sys.platform == "win32": - site_data_dirs = _win_site_data_dirs - user_data_dir = _win_user_data_dir -else: - site_data_dirs = _linux_site_data_dirs - user_data_dir = _linux_user_data_dir - - def find_by_ext( dest_dir: str, exts: List[str], excludes: Optional[List[str]] = None ) -> Optional[str]: @@ -223,3 +186,40 @@ def find_by_ext_multiple( if not excluded: found_files.append(filepath) return found_files + + +def _linux_user_data_dir(appname: str) -> str: + """Return data directory tied to the user""" + path = os.environ.get("XDG_DATA_HOME", "") + if not path.strip(): + path = os.path.expanduser("~/.local/share") + return os.path.join(path, appname) + + +def _linux_site_data_dirs(appname: str) -> List[str]: + """Return data directory shared by users""" + path = os.environ.get("XDG_DATA_DIRS", "") + if not path.strip(): + path = "/usr/local/share:/usr/share" + paths = path.split(os.pathsep) + return [os.path.join(p, appname) for p in paths] + + +def _win_user_data_dir(appname: str) -> str: + """Return data directory""" + path = os.path.expanduser(r"~\AppData\Local") + return os.path.join(path, appname) + + +def _win_site_data_dirs(appname: str) -> List[str]: + """Return data directory shared by users""" + # On Windows always user_data_dir + return [_win_user_data_dir(appname)] + + +if sys.platform == "win32": + site_data_dirs = _win_site_data_dirs + user_data_dir = _win_user_data_dir +else: + site_data_dirs = _linux_site_data_dirs + user_data_dir = _linux_user_data_dir diff --git a/scripts/gen_jvet_jctvc.py b/scripts/gen_jvet_jctvc.py index 741bace1..a353138f 100755 --- a/scripts/gen_jvet_jctvc.py +++ b/scripts/gen_jvet_jctvc.py @@ -40,11 +40,6 @@ BITSTREAM_EXTS = ( ".bin", ".bit", - ".jvc", - ".jsv", - ".jvt", - ".avc", - ".26l", ) MD5_EXTS = ("yuv_2.md5", "yuv.md5", ".md5", "md5.txt", "md5sum.txt") MD5_EXCLUDES = (".bin.md5", "bit.md5") @@ -72,7 +67,7 @@ def handle_starttag(self, tag, attrs): self.links.append(base_url + value) -class JVETJCTVTGenerator: +class JVETJCTVCGenerator: """Generates a test suite from the conformance bitstreams""" def __init__( @@ -255,7 +250,7 @@ def _fill_checksum_h265(self, test_vector, dest_dir): default=2 * multiprocessing.cpu_count(), ) args = parser.parse_args() - generator = JVETJCTVTGenerator( + generator = JVETJCTVCGenerator( "HEVC_v1", "JCT-VC-HEVC_V1", Codec.H265, @@ -264,7 +259,7 @@ def _fill_checksum_h265(self, test_vector, dest_dir): ) generator.generate(not args.skip_download, args.jobs) - generator = JVETJCTVTGenerator( + generator = JVETJCTVCGenerator( "RExt", "JCT-VC-RExt", Codec.H265, @@ -274,7 +269,7 @@ def _fill_checksum_h265(self, test_vector, dest_dir): ) generator.generate(not args.skip_download, args.jobs) - generator = JVETJCTVTGenerator( + generator = JVETJCTVCGenerator( "SCC", "JCT-VC-SCC", Codec.H265, @@ -284,7 +279,7 @@ def _fill_checksum_h265(self, test_vector, dest_dir): ) generator.generate(not args.skip_download, args.jobs) - generator = JVETJCTVTGenerator( + generator = JVETJCTVCGenerator( "MV-HEVC", "JCT-VC-MV-HEVC", Codec.H265, @@ -294,7 +289,7 @@ def _fill_checksum_h265(self, test_vector, dest_dir): ) generator.generate(not args.skip_download, args.jobs) - generator = JVETJCTVTGenerator( + generator = JVETJCTVCGenerator( 'draft6', 'JVET-VVC_draft6', Codec.H266, diff --git a/scripts/gen_jvt.py b/scripts/gen_jvt.py index 2610f656..9460d8d5 100755 --- a/scripts/gen_jvt.py +++ b/scripts/gen_jvt.py @@ -37,11 +37,6 @@ BASE_URL = "https://www.itu.int/" H264_URL = BASE_URL + "wftp3/av-arch/jvt-site/draft_conformance/" BITSTREAM_EXTS = ( - ".bin", - ".bit", - ".264", - ".h264", - ".jvc", ".jsv", ".jvt", ".avc", @@ -116,9 +111,6 @@ def generate(self, download, jobs): # The first item in the AVCv1 list is a readme file if "00readme_H" in url: continue - elif "replaced" in url: - # This is in HEVC-SHVC, we don't want that. - continue file_url = os.path.basename(url) name = os.path.splitext(file_url)[0] file_input = f"{name}.bin" @@ -151,9 +143,7 @@ def generate(self, download, jobs): if not test_vector.input_file: raise Exception(f"Bitstream file not found in {dest_dir}") test_vector.source_checksum = utils.file_checksum(dest_path) - if "main10" in test_vector.name.lower(): - test_vector.output_format = OutputFormat.YUV420P10LE - elif self.use_ffprobe: + if self.use_ffprobe: ffprobe = utils.normalize_binary_cmd('ffprobe') command = [ffprobe, '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=pix_fmt', '-of', @@ -165,29 +155,7 @@ def generate(self, download, jobs): try: test_vector.output_format = OutputFormat[pix_fmt.upper()] except KeyError as e: - exceptions = { - # Feature: Test unequal luma and chroma bitdepth - # setting. The luma bitdepth is higher than the chroma - # bitdepth. Luma is 12bit, chroma is 8bit. Considering - # 12bit. - "Bitdepth_A_RExt_Sony_1": OutputFormat.YUV444P12LE, - # Same as above, but the chroma is 12bit and luma is 8bit. - "Bitdepth_B_RExt_Sony_1": OutputFormat.YUV444P12LE, - # Rest is taken by examining the error displayed by ffprobe, e.g.: - # The following bit-depths are currently specified: 8, - # 9, 10 and 12 bits, chroma_format_idc is 3, depth is 16 - "EXTPREC_MAIN_444_16_INTRA_10BIT_RExt_Sony_1": OutputFormat.YUV444P16LE, - "EXTPREC_HIGHTHROUGHPUT_444_16_INTRA_16BIT_RExt_Sony_1": OutputFormat.YUV444P16LE, - "EXTPREC_MAIN_444_16_INTRA_16BIT_RExt_Sony_1": OutputFormat.YUV444P16LE, - "GENERAL_16b_400_RExt_Sony_1": OutputFormat.GRAY16LE, - "GENERAL_16b_444_highThroughput_RExt_Sony_2": OutputFormat.YUV444P16LE, - "GENERAL_16b_444_RExt_Sony_2": OutputFormat.YUV444P16LE, - "WAVETILES_RExt_Sony_2": OutputFormat.YUV444P16LE - } - if test_vector.name in exceptions.keys(): - test_vector.output_format = exceptions[test_vector.name] - else: - raise e + raise e if self.name != "Professional_profiles": # result md5 generated from h264_reference_decoder if self.name == "SVC": # result md5 generated for different Lines (L0, L1...) @@ -236,12 +204,6 @@ def remove_r1_from_path(path): return new_test_vectors - @staticmethod - def _check_path(path): - parts = path.split(os.sep) - unique_parts = parts[:3] + list(dict.fromkeys(parts[3:])) - return os.sep.join(unique_parts) - if __name__ == "__main__": parser = argparse.ArgumentParser()