diff --git a/vsmasktools/edge/_abstract.py b/vsmasktools/edge/_abstract.py index 9b1a08d..d7b4b29 100644 --- a/vsmasktools/edge/_abstract.py +++ b/vsmasktools/edge/_abstract.py @@ -9,7 +9,7 @@ from vstools import ( ColorRange, CustomRuntimeError, CustomValueError, FuncExceptT, KwargsT, PlanesT, T, check_variable, core, get_lowest_values, get_peak_value, get_peak_values, get_subclasses, inject_self, join, normalize_planes, plane, - scale_value, vs + scale_mask, vs ) from ..exceptions import UnknownEdgeDetectError, UnknownRidgeDetectError @@ -183,8 +183,8 @@ def _mask( peak = get_peak_value(clip) hthr = 1.0 if hthr is None else hthr - lthr = scale_value(lthr, 32, clip, range_out=ColorRange.FULL) - hthr = scale_value(hthr, 32, clip, range_out=ColorRange.FULL) + lthr = scale_mask(lthr, 32, clip) + hthr = scale_mask(hthr, 32, clip) discard_planes = False if isinstance(planes, tuple): diff --git a/vsmasktools/edge_funcs.py b/vsmasktools/edge_funcs.py index 707d13d..0d24239 100644 --- a/vsmasktools/edge_funcs.py +++ b/vsmasktools/edge_funcs.py @@ -8,7 +8,7 @@ from vsrgtools.util import wmean_matrix from vstools import ( ColorRange, CustomEnum, VSFunctionAllArgs, check_variable, core, depth, get_peak_value, get_y, iterate, plane, - scale_value, vs + scale_value, scale_mask, vs ) from .details import multi_detail_mask @@ -41,7 +41,7 @@ def ringing_mask( assert check_variable(clip, ringing_mask) thmi, thma, thlimi, thlima = ( - scale_value(t, 32, clip, range_out=ColorRange.FULL) for t in [thmi, thma, thlimi, thlima] + scale_mask(t, 32, clip, range_out=ColorRange.FULL) for t in [thmi, thma, thlimi, thlima] ) edgemask = normalize_mask(credit_mask, plane(clip, 0), **kwargs).std.Limiter() @@ -83,7 +83,7 @@ def luma_credit_mask( edge_mask = normalize_mask(edgemask, y, **kwargs) - credit_mask = norm_expr([edge_mask, y], f'y {scale_value(thr, 32, y, range_out=ColorRange.FULL)} > y 0 ? x min') + credit_mask = norm_expr([edge_mask, y], f'y {scale_mask(thr, 32, y)} > y 0 ? x min') if not draft: credit_mask = Morpho.maximum(credit_mask, iterations=4) diff --git a/vsmasktools/hardsub.py b/vsmasktools/hardsub.py index 4aad9e6..1904345 100644 --- a/vsmasktools/hardsub.py +++ b/vsmasktools/hardsub.py @@ -13,7 +13,7 @@ ColorRange, CustomOverflowError, FileNotExistsError, FilePathType, FrameRangeN, FrameRangesN, Matrix, VSFunction, check_variable, core, depth, fallback, get_lowest_value, get_neutral_value, get_neutral_values, get_peak_value, get_y, iterate, normalize_ranges, replace_ranges, - scale_value, vs, vs_object + scale_value, scale_delta, vs, vs_object ) from .abstract import DeferredMask, GeneralMask @@ -131,7 +131,7 @@ def get_progressive_dehardsub( assert masks[-1].format is not None - thr = scale_value(self.bin_thr, 32, masks[-1], range_out=ColorRange.FULL) + thr = scale_value(self.bin_thr, 32, masks[-1]) for p in partials: masks.append( @@ -180,7 +180,7 @@ def _mask(self, clip: vs.VideoNode, ref: vs.VideoNode, **kwargs: Any) -> vs.Vide for x in (clip, ref) ) - highpass = scale_value(self.highpass, 32, clip) + highpass = scale_delta(self.highpass, 32, clip) mask = norm_expr( [clipedge, refedge], f'x y - {highpass} < 0 {ExprToken.RangeMax} ?'