diff --git a/vstools/enums/generic.py b/vstools/enums/generic.py index 7530b51..bed638f 100644 --- a/vstools/enums/generic.py +++ b/vstools/enums/generic.py @@ -28,7 +28,8 @@ def _missing_(cls: type[ChromaLocation], value: Any) -> ChromaLocation | None: return cls.LEFT if value > cls.BOTTOM: - raise UnsupportedChromaLocationError(f'ChromaLocation({value}) is unsupported.', cls) + raise UnsupportedChromaLocationError( + f'ChromaLocation({value}) is unsupported.', cls) return None @@ -48,16 +49,6 @@ def from_res(cls, frame: vs.VideoNode | vs.VideoFrame) -> ChromaLocation: :return: ChromaLocation object. """ - from .color import Matrix, Primaries, Transfer - - matrix, transfer, primaries = Matrix(frame), Transfer(frame), Primaries(frame) - - if ( - primaries == Primaries.BT2020 - or matrix in (Matrix.BT2020CL, Matrix.BT2020NCL) - or transfer in (Transfer.BT2020_10, Transfer.BT2020_12) - ): - return ChromaLocation.TOP_LEFT return ChromaLocation.LEFT @@ -92,7 +83,8 @@ def get_offsets( if isinstance(chroma_loc, vs.VideoNode): assert chroma_loc.format - subsampling = (chroma_loc.format.subsampling_w, chroma_loc.format.subsampling_h) + subsampling = (chroma_loc.format.subsampling_w, + chroma_loc.format.subsampling_h) if subsampling in [(1, 0), (1, 1)]: offsets = (0.5, 0) @@ -131,7 +123,8 @@ def _missing_(cls: type[FieldBased], value: Any) -> FieldBased | None: return cls.PROGRESSIVE if value > cls.TFF: - raise UnsupportedFieldBasedError(f'FieldBased({value}) is unsupported.', cls) + raise UnsupportedFieldBasedError( + f'FieldBased({value}) is unsupported.', cls) return None