Skip to content

Commit

Permalink
FunctionUtil: Upsample to lowest-allowed bitdepth at current or above…
Browse files Browse the repository at this point in the history
… bitdepth
  • Loading branch information
LightArrowsEXE committed Oct 10, 2024
1 parent a69ab89 commit 086af43
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions vstools/functions/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 086af43

Please sign in to comment.