From 71744a2cec77ae24ded9507200400c7c9236e9ab Mon Sep 17 00:00:00 2001 From: emotion3459 <176516814+emotion3459@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:27:20 -0500 Subject: [PATCH] Restore range_half ExprOp with new behavior --- vsexprtools/exprop.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vsexprtools/exprop.py b/vsexprtools/exprop.py index d7db8e5..2ecd801 100644 --- a/vsexprtools/exprop.py +++ b/vsexprtools/exprop.py @@ -47,7 +47,7 @@ class ExprToken(ExprTokenBase, CustomEnum): def is_chroma(self) -> bool: return 'chroma' in self._name_.lower() - def get_value(self, clip: vs.VideoNode, chroma: bool = False, range_in: ColorRange = ColorRange.LIMITED) -> float: + def get_value(self, clip: vs.VideoNode, chroma: bool | None = None, range_in: ColorRange | None = None) -> float: if self is ExprToken.LumaMin: return get_lowest_value(clip, False, ColorRange.LIMITED) @@ -68,8 +68,7 @@ def get_value(self, clip: vs.VideoNode, chroma: bool = False, range_in: ColorRan return get_neutral_value(clip) if self is ExprToken.RangeHalf: - warnings.warn('ExprToken.RangeHalf: Operator is deprecated and will be removed in a later version! Use ExprToken.Neutral') - return get_neutral_value(clip) + return (val := get_peak_value(clip, range_in=ColorRange.FULL)) + (1 - (val <= 1.0)) / 2 if self is ExprToken.RangeSize: return (val := get_peak_value(clip, range_in=ColorRange.FULL)) + (1 - (val <= 1.0))