Skip to content

Commit

Permalink
ClampScaler: remove limited range clamping
Browse files Browse the repository at this point in the history
  • Loading branch information
emotion3459 committed Oct 8, 2024
1 parent 50693af commit 7b72a7f
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions vsscale/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class ClampScaler(GenericScaler):
reference: ScalerT | vs.VideoNode = Nnedi3
"""Reference Scaler used to clamp ref_scaler"""

range_out: ColorRange | None = None
"""Range out for clamping the output. If None it will be fetched from the VideoNode."""

def __post_init__(self) -> None:
super().__post_init__()

Expand Down Expand Up @@ -160,8 +157,6 @@ def scale( # type: ignore

check_ref_clip(ref, smooth)

range_out = ColorRange.from_video(clip, False) if self.range_out is None else self.range_out

merge_weight = self.strength / 100

if self.limit is True:
Expand All @@ -171,18 +166,11 @@ def scale( # type: ignore
'up@ z O@ + > z O@ + up@ ? a U@ - < a U@ - up@ z O@ + > z O@ + up@ ? ?'
]

if range_out is ColorRange.LIMITED:
expression.append(f'{scale_value(16, 8, clip, ColorRange.FULL)} {{clamp_max}} clamp')

merged = norm_expr(
[ref, smooth, smooth.std.Maximum(), smooth.std.Minimum()],
expression, merge_weight=merge_weight, ref_weight=1.0 - merge_weight,
undershoot=scale_value(self.undershoot, 32, clip, ColorRange.FULL),
overshoot=scale_value(self.overshoot, 32, clip, ColorRange.FULL),
clamp_max=[
scale_value(235, 8, clip, ColorRange.FULL),
scale_value(240, 8, clip, ColorRange.FULL)
]
overshoot=scale_value(self.overshoot, 32, clip, ColorRange.FULL)
)
else:
merged = smooth.std.Merge(ref, merge_weight)
Expand Down

0 comments on commit 7b72a7f

Please sign in to comment.