Skip to content

Commit

Permalink
Restore range_half ExprOp with new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
emotion3459 committed Nov 13, 2024
1 parent 548367b commit 71744a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vsexprtools/exprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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))
Expand Down

0 comments on commit 71744a2

Please sign in to comment.