5
0

xv: bd: common: add missing typehints

This commit is contained in:
louis f 2020-05-11 17:25:54 -04:00
parent 0660a7e620
commit 4da7eb7d24
Signed by: louis
GPG Key ID: 44D7E1DE4E23D6F2
2 changed files with 13 additions and 9 deletions
Symphogear/XV [BD]/common

@ -32,7 +32,7 @@ def w2x(clip: vs.VideoNode, w2x_range: List[Union[int, Tuple[int, int]]]
def deband(clip: vs.VideoNode, hard: List[Union[int, Tuple[int, int]]],
harder: List[Union[int, Tuple[int, int]]]):
harder: List[Union[int, Tuple[int, int]]]) -> vs.VideoNode:
line = retinex_edgemask(clip).std.Binarize(9500).rgvs.RemoveGrain(3) \
.std.Inflate()
nf3kdb = clip.neo_f3kdb.Deband(range=18, y=32, cb=24, cr=24, grainy=24,
@ -42,9 +42,9 @@ def deband(clip: vs.VideoNode, hard: List[Union[int, Tuple[int, int]]],
grain=4)
placebo2 = clip.placebo.Deband(iterations=3, threshold=5, radius=32,
grain=4)
deband = replace_ranges(nf3kdb, placebo, hard)
deband = replace_ranges(deband, placebo2, harder)
return deband
debanded = replace_ranges(nf3kdb, placebo, hard)
debanded = replace_ranges(debanded, placebo2, harder)
return debanded
def ncop_mask(clip: vs.VideoNode, src: vs.VideoNode,

@ -17,7 +17,8 @@ class FadeRange(NamedTuple):
range_: Tuple[int, int]
def _sraa_frameeval(n: int, clip: vs.VideoNode, w: int, h: int):
def _sraa_frameeval(n: int, clip: vs.VideoNode, w: int, h: int
) -> vs.VideoNode:
frame = clip.get_frame(n)
if frame.height < 1080:
rfactor = 2.5
@ -27,14 +28,16 @@ def _sraa_frameeval(n: int, clip: vs.VideoNode, w: int, h: int):
rfactor=rfactor, h=h, ar=w/h)
def _sraa_reupscale(clip: vs.VideoNode, width: int, height: int):
def _sraa_reupscale(clip: vs.VideoNode, width: int, height: int
) -> vs.VideoNode:
sraa = clip.std.FrameEval(partial(_sraa_frameeval, clip=clip, w=width,
h=height))
scale = sraa.resize.Spline36(width, height, format=vs.GRAY16)
return scale
def _fade_ranges_with_refs(clip, reupscaled, ranges):
def _fade_ranges_with_refs(clip: vs.VideoNode, reupscaled: vs.VideoNode,
ranges: List[FadeRange]) -> vs.VideoNode:
mask = core.std.BlankClip(clip)
for r in ranges:
rmask = core.std.Expr([clip[r.ref], reupscaled[r.ref]], "x y - abs")
@ -46,7 +49,7 @@ def _fade_ranges_with_refs(clip, reupscaled, ranges):
return mask
def _really_dumb_inverse_mask(clip, reupscaled: vs.VideoNode,
def _really_dumb_inverse_mask(clip: vs.VideoNode, reupscaled: vs.VideoNode,
ranges: List[FadeRange]) -> vs.VideoNode:
reupscaled = reupscaled.resize.Bicubic(format=clip.format.id)
line_mask = retinex_edgemask(clip, 0.0001).std.Binarize(10000)
@ -57,7 +60,8 @@ def _really_dumb_inverse_mask(clip, reupscaled: vs.VideoNode,
def descale(clip: vs.VideoNode, force_scale: List[Union[int, Tuple[int, int]]],
no_scale: List[Union[int, Tuple[int, int]]],
fade_ranges: List[FadeRange], show_mask=False) -> vs.VideoNode:
fade_ranges: List[FadeRange], show_mask: bool = False
) -> vs.VideoNode:
dmask = partial(_really_dumb_inverse_mask, ranges=fade_ranges)
kernel = Bicubic(b=1/3, c=1/3)
heights = [871, 872, 873]