Skip to content

Commit

Permalink
Update get_neutral_value usage
Browse files Browse the repository at this point in the history
  • Loading branch information
emotion3459 committed Oct 16, 2024
1 parent 389d5d9 commit a79c711
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions vsrgtools/blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from vspyplugin import FilterMode, ProcessMode, PyPluginCuda
from vstools import (
ConvMode, CustomNotImplementedError, CustomRuntimeError, FunctionUtil, NotFoundEnumValue, PlanesT, StrList,
check_variable, core, depth, fallback, get_depth, get_neutral_values, join, normalize_planes, normalize_seq, split,
check_variable, core, depth, fallback, get_depth, get_neutral_value, join, normalize_planes, normalize_seq, split,
to_arr, vs
)

Expand Down Expand Up @@ -263,7 +263,7 @@ def sbr(

planes = normalize_planes(clip, planes)

neutral = get_neutral_values(clip)
neutral = get_neutral_value(clip)

blur_func = partial(blur, radius=radius, mode=mode, planes=planes)

Expand Down
14 changes: 4 additions & 10 deletions vsrgtools/contra.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from vsexprtools import complexpr_available, norm_expr
from vstools import (
CustomValueError, GenericVSFunction, PlanesT, check_ref_clip, check_variable, clamp_arr, get_neutral_values,
CustomValueError, GenericVSFunction, PlanesT, check_ref_clip, check_variable, clamp_arr, get_neutral_value,
iterate, normalize_planes, to_arr, vs
)

Expand Down Expand Up @@ -42,10 +42,7 @@ def contrasharpening(
assert check_variable(flt, contrasharpening)
check_ref_clip(src, flt, contrasharpening)

if flt.format.sample_type == vs.INTEGER:
neutral = get_neutral_values(flt)
else:
neutral = [0.0]
neutral = get_neutral_value(flt)

planes = normalize_planes(flt, planes)

Expand Down Expand Up @@ -94,7 +91,7 @@ def contrasharpening_dehalo(
weighted2 = median_blur(weighted, 2, planes=planes)
weighted2 = iterate(weighted2, partial(repair, repairclip=weighted), 2, mode=rep_modes)

neutral = get_neutral_values(flt)
neutral = get_neutral_value(flt)

if complexpr_available:
clips = [weighted, weighted2, src, flt]
Expand Down Expand Up @@ -163,10 +160,7 @@ def fine_contra(
assert check_variable(flt, contrasharpening)
check_ref_clip(src, flt, contrasharpening)

if flt.format.sample_type == vs.INTEGER:
neutral = get_neutral_values(flt)
else:
neutral = [0.0]
neutral = get_neutral_value(flt)

planes = normalize_planes(flt, planes)

Expand Down
6 changes: 3 additions & 3 deletions vsrgtools/freqs.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

from itertools import count
from math import e, log, pi, sin, sqrt
from math import log, pi, sqrt
from typing import Iterable

from vsexprtools import ExprOp, ExprVars, combine, norm_expr
from vstools import (
ColorRange, ConvMode, CustomIntEnum, CustomNotImplementedError, FuncExceptT, FunctionUtil, KwargsT, PlanesT,
StrList, check_ref_clip, flatten_vnodes, get_y, scale_value, vs
ConvMode, CustomIntEnum, CustomNotImplementedError, FuncExceptT, FunctionUtil, KwargsT, PlanesT,
StrList, check_ref_clip, flatten_vnodes, get_y, vs
)

from .blur import gauss_blur
Expand Down
4 changes: 2 additions & 2 deletions vsrgtools/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from vsexprtools import complexpr_available, norm_expr
from vstools import (
CustomIndexError, PlanesT, VSFunction, check_variable, core, fallback, get_neutral_values, normalize_planes, vs
CustomIndexError, PlanesT, VSFunction, check_variable, core, fallback, get_neutral_value, normalize_planes, vs
)

from .enum import LimitFilterMode
Expand Down Expand Up @@ -46,7 +46,7 @@ def median_diff(clip: vs.VideoNode, diffa: vs.VideoNode, diffb: vs.VideoNode, pl
assert check_variable(clip, median_diff)

planes = normalize_planes(clip, planes)
neutral = get_neutral_values(clip)
neutral = get_neutral_value(clip)

if complexpr_available:
expr = 'y z - D! x D@ y {mid} clamp D@ {mid} y clamp - -'
Expand Down
4 changes: 2 additions & 2 deletions vsrgtools/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def _limit_filter_lut(
) -> vs.VideoNode:
assert check_variable(diff, limit_filter)

neutral = int(get_neutral_value(diff))
peak = int(get_peak_value(diff))
neutral = get_neutral_value(diff)
peak = get_peak_value(diff)

thr = int(thr * peak / 255)
largen_thr = int(largen_thr * peak / 255)
Expand Down

0 comments on commit a79c711

Please sign in to comment.