From 086af436723fbe9ecfed9976b5fb0607560df81a Mon Sep 17 00:00:00 2001 From: LightArrowsEXE Date: Wed, 9 Oct 2024 19:51:41 +0200 Subject: [PATCH] FunctionUtil: Upsample to lowest-allowed bitdepth at current or above bitdepth --- vstools/functions/funcs.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vstools/functions/funcs.py b/vstools/functions/funcs.py index 6743e76..49d9d7c 100644 --- a/vstools/functions/funcs.py +++ b/vstools/functions/funcs.py @@ -111,11 +111,9 @@ def __init__( def norm_clip(self) -> ConstantFormatVideoNode: """Get a "normalized" clip. This means color space and bitdepth are converted if necessary.""" - if isinstance(self.bitdepth, range) and self.clip.format.bits_per_sample not in self.bitdepth: - clip = depth(self.clip, self.bitdepth.stop) - elif isinstance(self.bitdepth, set) and self.clip.format.bits_per_sample not in self.bitdepth: - from .. import get_depth + from .. import get_depth + if isinstance(self.bitdepth, (range, set)) and self.clip.format.bits_per_sample not in self.bitdepth: clip = depth(self.clip, min(bits for bits in self.bitdepth if bits >= get_depth(self.clip))) elif isinstance(self.bitdepth, int): clip = depth(self.clip, self.bitdepth)