Skip to content
This repository has been archived by the owner on Feb 27, 2025. It is now read-only.

Commit

Permalink
Replace deprecated scale_8bit
Browse files Browse the repository at this point in the history
LightArrowsEXE committed Oct 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 5b7ab5a commit 0ac0674
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions vsdehalo/alpha.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
ColorRange, ConvMode, CustomIndexError, CustomIntEnum, CustomValueError, FieldBased, FuncExceptT, FunctionUtil,
InvalidColorFamilyError, KwargsT, PlanesT, UnsupportedFieldBasedError, check_ref_clip, check_variable, clamp,
cround, fallback, get_peak_value, get_y, join, mod4, normalize_planes, normalize_seq, scale_value, split, to_arr,
scale_8bit, vs
vs
)

__all__ = [
@@ -202,7 +202,7 @@ def __call__(
raise CustomValueError('valid values for show_mask are 1–7!', func)

thmif, thmaf, thlimif, thlimaf = [
scale_8bit(clip, x)
scale_value(x, 8, clip, ColorRange.FULL)
for x in [thmi, thma, thlimi, thlima]
]

4 changes: 2 additions & 2 deletions vsdehalo/mask.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
from vskernels import Point
from vsmasktools import Morpho, PrewittTCanny
from vsrgtools import BlurMatrix
from vstools import FieldBased, UnsupportedFieldBasedError, get_y, scale_8bit, vs
from vstools import ColorRange, FieldBased, UnsupportedFieldBasedError, get_y, scale_value, vs


__all__ = [
@@ -43,7 +43,7 @@ def base_dehalo_mask(

exp_edges = norm_expr(
[luma, Morpho.maximum(luma, iterations=2)], 'y x - {shift} - range_half *',
shift=scale_8bit(luma, shift)
shift=scale_value(shift, 8, luma, ColorRange.FULL)
)

edgemask = PrewittTCanny.edgemask(exp_edges, sigma=sqrt(expand * 2), mode=-1, multi=16)
17 changes: 11 additions & 6 deletions vsdehalo/warp.py
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@
from vsrgtools import min_blur, removegrain, repair
from vsrgtools.util import mean_matrix, wmean_matrix
from vstools import (
DitherType, PlanesT, core, cround, disallow_variable_format, disallow_variable_resolution, depth_func,
get_peak_value, get_y, join, normalize_planes, padder, scale_8bit, split, vs
ColorRange, DitherType, PlanesT, core, cround, disallow_variable_format, disallow_variable_resolution, depth_func,
get_peak_value, get_y, join, normalize_planes, padder, scale_value, split, vs
)

__all__ = [
@@ -63,7 +63,8 @@ def edge_cleaner(
y_mask = get_y(work_clip)

mask = edgemask.edgemask(y_mask).std.Expr(
f'x {scale_8bit(work_clip, 4)} < 0 x {scale_8bit(work_clip, 32)} > {peak} x ? ?'
f'x {scale_value(4, 8, work_clip, ColorRange.FULL)} < 0 x '
f'{scale_value(32, 8, work_clip, ColorRange.FULL)} > {peak} x ? ?'
).std.InvertMask()
mask = mask.std.Convolution(mean_matrix)

@@ -78,10 +79,14 @@ def edge_cleaner(
diff = y_mask.std.MakeDiff(clean)

mask = edgemask.edgemask(
diff.std.Levels(scale_8bit(work_clip, 40), scale_8bit(work_clip, 168), 0.35)
diff.std.Levels(
scale_value(40, 8, work_clip, ColorRange.FULL),
scale_value(168, 8, work_clip, ColorRange.FULL),
0.35
)
)
sc4 = scale_8bit(work_clip, 4)
sc16 = scale_8bit(work_clip, 16)
sc4 = scale_value(4, 8, work_clip, ColorRange.FULL)
sc16 = scale_value(16, 8, work_clip, ColorRange.FULL)
mask = removegrain(mask, 7).std.Expr(f'x {sc4} < 0 x {sc16} > {peak} x ? ?')

final = final.std.MaskedMerge(work_clip, mask)

0 comments on commit 0ac0674

Please sign in to comment.