Compare commits
1 Commits
1da1f454eb
...
2aa95e4044
Author | SHA1 | Date | |
---|---|---|---|
2aa95e4044 |
43
Vivy/03/03.vpy
Normal file
43
Vivy/03/03.vpy
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import vapoursynth as vs
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
sys.path.append("..")
|
||||||
|
|
||||||
|
from vivy_common import (HardsubSign, Range, bounded_dehardsub, antialias, deband, denoise, # noqa: E402
|
||||||
|
finalize, fsrcnnx_rescale, letterbox_edgefix, source)
|
||||||
|
|
||||||
|
core = vs.core
|
||||||
|
|
||||||
|
|
||||||
|
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||||
|
SIGNS_RU: List[HardsubSign] = [
|
||||||
|
HardsubSign((1371, 3157), ((293, 872), (1323, 162)), highpass=20000),
|
||||||
|
HardsubSign((3572, 3688), ((236, 860), (821, 103)), refframe=3671),
|
||||||
|
HardsubSign((4040, 4105), ((937, 18), (811, 338))),
|
||||||
|
HardsubSign((4040, 4105), ((132, 671), (384, 211))),
|
||||||
|
HardsubSign((8135, 8259), ((583, 65), (744, 80))),
|
||||||
|
HardsubSign((957, 9596), ((573, 74), (768, 79))),
|
||||||
|
HardsubSign((21874, 21942), ((532, 131), (445, 228)), highpass=2000),
|
||||||
|
HardsubSign((29968, 31084), ((293, 872), (1323, 162)), highpass=20000),
|
||||||
|
HardsubSign((30002, 30792), ((302, 73), (1328, 142)), highpass=2000, expand=10),
|
||||||
|
HardsubSign((31727, 31879), ((293, 872), (1323, 162)), highpass=20000),
|
||||||
|
HardsubSign((32540, 32651), ((293, 872), (1323, 162)), highpass=20000),
|
||||||
|
HardsubSign((33948, 34044), ((267, 857), (1067, 104)), refframe=34030),
|
||||||
|
]
|
||||||
|
NOSCALE: List[Range] = []
|
||||||
|
NOAA: List[Range] = []
|
||||||
|
LETTERBOX: List[Range] = [(0, 432)]
|
||||||
|
|
||||||
|
waka, ref = source(EPNUM)
|
||||||
|
|
||||||
|
src = bounded_dehardsub(waka, ref, SIGNS_RU)
|
||||||
|
rescale = fsrcnnx_rescale(src, NOSCALE)
|
||||||
|
den = denoise(rescale)
|
||||||
|
deb = deband(den)
|
||||||
|
aa = antialias(deb, NOAA)
|
||||||
|
edgefix = letterbox_edgefix(aa, LETTERBOX)
|
||||||
|
final = finalize(edgefix)
|
||||||
|
final.set_output()
|
@ -33,14 +33,16 @@ class HardsubSign():
|
|||||||
bound: Optional[BoundingBox]
|
bound: Optional[BoundingBox]
|
||||||
refframe: Optional[int]
|
refframe: Optional[int]
|
||||||
highpass: int
|
highpass: int
|
||||||
|
expand: int
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
range: Range,
|
range: Range,
|
||||||
bound: Union[BoundingBox, Tuple[Tuple[int, int], Tuple[int, int]], None],
|
bound: Union[BoundingBox, Tuple[Tuple[int, int], Tuple[int, int]], None],
|
||||||
refframe: Optional[int] = None, highpass: int = 5000):
|
refframe: Optional[int] = None, highpass: int = 5000, expand: int = 8):
|
||||||
self.range = range
|
self.range = range
|
||||||
self.refframe = refframe
|
self.refframe = refframe
|
||||||
self.highpass = highpass
|
self.highpass = highpass
|
||||||
|
self.expand = expand
|
||||||
if bound is None:
|
if bound is None:
|
||||||
self.bound = None
|
self.bound = None
|
||||||
elif isinstance(bound, BoundingBox):
|
elif isinstance(bound, BoundingBox):
|
||||||
@ -50,9 +52,10 @@ class HardsubSign():
|
|||||||
|
|
||||||
def _hardsub_mask(self, hrdsb: vs.VideoNode, ref: vs.VideoNode) -> vs.VideoNode:
|
def _hardsub_mask(self, hrdsb: vs.VideoNode, ref: vs.VideoNode) -> vs.VideoNode:
|
||||||
if self.refframe is not None:
|
if self.refframe is not None:
|
||||||
mask = kgf.hardsubmask_fades(hrdsb[self.refframe], ref[self.refframe], highpass=self.highpass)
|
mask = kgf.hardsubmask_fades(hrdsb[self.refframe], ref[self.refframe],
|
||||||
|
highpass=self.highpass, expand_n=self.expand)
|
||||||
else:
|
else:
|
||||||
mask = kgf.hardsubmask_fades(hrdsb, ref, highpass=self.highpass)
|
mask = kgf.hardsubmask_fades(hrdsb, ref, highpass=self.highpass, expand_n=self.expand)
|
||||||
|
|
||||||
assert isinstance(mask, vs.VideoNode)
|
assert isinstance(mask, vs.VideoNode)
|
||||||
return mask
|
return mask
|
||||||
|
Loading…
x
Reference in New Issue
Block a user