Compare commits
2 Commits
db71691c66
...
2aa95e4044
Author | SHA1 | Date | |
---|---|---|---|
2aa95e4044 | |||
37a1c77e87 |
@ -14,13 +14,13 @@ core = vs.core
|
|||||||
|
|
||||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||||
SIGNS_RU: List[HardsubSign] = [
|
SIGNS_RU: List[HardsubSign] = [
|
||||||
HardsubSign((5283, 5403), ((226, 786), (1214, 102))),
|
HardsubSign((5283, 5403), ((226, 786), (1214, 102)), highpass=2000),
|
||||||
HardsubSign((6778, 6888), ((588, 454), (434, 63))),
|
HardsubSign((6778, 6888), ((588, 454), (434, 63)), highpass=2000),
|
||||||
HardsubSign((9017, 9070), ((975, 301), (157, 24))),
|
HardsubSign((9017, 9070), ((975, 301), (157, 24)), highpass=2000),
|
||||||
HardsubSign((22276, 22350), ((480, 75), (959, 66))),
|
HardsubSign((22276, 22350), ((480, 75), (959, 66)), highpass=2000),
|
||||||
HardsubSign((25715, 25904), ((623, 73), (681, 67))),
|
HardsubSign((25715, 25904), ((623, 73), (681, 67)), highpass=2000),
|
||||||
HardsubSign((35223, 36108), ((775, 866), (1138, 211))),
|
HardsubSign((35223, 36108), ((775, 866), (1138, 211)), highpass=2000),
|
||||||
HardsubSign((37572, 37666), ((259, 856), (987, 103))),
|
HardsubSign((37572, 37666), ((259, 856), (987, 103)), highpass=2000),
|
||||||
]
|
]
|
||||||
CREDITS: List[Range] = [(35151, 37306)]
|
CREDITS: List[Range] = [(35151, 37306)]
|
||||||
PIXELSHIT: List[Range] = [
|
PIXELSHIT: List[Range] = [
|
||||||
|
@ -15,28 +15,28 @@ core = vs.core
|
|||||||
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||||
SIGNS_RU: List[HardsubSign] = [
|
SIGNS_RU: List[HardsubSign] = [
|
||||||
HardsubSign((125, 245), ((220, 865), (992, 98)), refframe=143),
|
HardsubSign((125, 245), ((220, 865), (992, 98)), refframe=143),
|
||||||
HardsubSign((865, 896), ((1173, 539), (232, 40))),
|
HardsubSign((865, 896), ((1173, 539), (232, 40)), highpass=2000),
|
||||||
HardsubSign((2274, 2318), ((431, 671), (1068, 142))),
|
HardsubSign((2274, 2318), ((431, 671), (1068, 142)), highpass=2000),
|
||||||
HardsubSign((2391, 2426), ((116, 62), (1471, 311))),
|
HardsubSign((2391, 2426), ((116, 62), (1471, 311)), highpass=2000),
|
||||||
HardsubSign((2427, 2452), ((317, 728), (1176, 80))),
|
HardsubSign((2427, 2452), ((317, 728), (1176, 80)), highpass=2000),
|
||||||
HardsubSign((3776, 3871), ((782, 286), (748, 76))),
|
HardsubSign((3776, 3871), ((782, 286), (748, 76)), highpass=2000),
|
||||||
HardsubSign((3877, 3950), ((866, 524), (494, 53))),
|
HardsubSign((3877, 3950), ((866, 524), (494, 53)), highpass=2000),
|
||||||
HardsubSign((6498, 6542), ((696, 296), (493, 31))),
|
HardsubSign((6498, 6542), ((696, 296), (493, 31)), highpass=2000),
|
||||||
HardsubSign((7212, 7221), ((430, 666), (1066, 149))),
|
HardsubSign((7212, 7221), ((430, 666), (1066, 149)), highpass=2000),
|
||||||
HardsubSign((7222, 7233), ((317, 728), (1179, 84))),
|
HardsubSign((7222, 7233), ((317, 728), (1179, 84)), highpass=2000),
|
||||||
HardsubSign((7234, 7245), ((410, 303), (1169, 129))),
|
HardsubSign((7234, 7245), ((410, 303), (1169, 129)), highpass=2000),
|
||||||
HardsubSign((7246, 7254), ((514, 687), (807, 90))),
|
HardsubSign((7246, 7254), ((514, 687), (807, 90)), highpass=2000),
|
||||||
HardsubSign((27488, 27630), ((778, 287), (758, 78))),
|
HardsubSign((27488, 27630), ((778, 287), (758, 78)), highpass=2000),
|
||||||
HardsubSign((27636, 27779), ((756, 449), (792, 87))),
|
HardsubSign((27636, 27779), ((756, 449), (792, 87)), highpass=2000),
|
||||||
HardsubSign((28907, 28934), ((758, 454), (787, 79))),
|
HardsubSign((28907, 28934), ((758, 454), (787, 79)), highpass=2000),
|
||||||
HardsubSign((28945, 28954), ((773, 481), (758, 57))),
|
HardsubSign((28945, 28954), ((773, 481), (758, 57)), highpass=2000),
|
||||||
HardsubSign((28986, 29019), ((621, 748), (657, 52))),
|
HardsubSign((28986, 29019), ((621, 748), (657, 52)), highpass=2000),
|
||||||
HardsubSign((29053, 29061), ((621, 748), (657, 52))),
|
HardsubSign((29053, 29061), ((621, 748), (657, 52)), highpass=2000),
|
||||||
HardsubSign((29062, 29077), ((649, 333), (742, 53))),
|
HardsubSign((29062, 29077), ((649, 333), (742, 53)), highpass=2000),
|
||||||
HardsubSign((29615, 29674), ((336, 74), (1244, 76))),
|
HardsubSign((29615, 29674), ((336, 74), (1244, 76)), highpass=2000),
|
||||||
HardsubSign((29675, 29758), ((587, 68), (750, 85))),
|
HardsubSign((29675, 29758), ((587, 68), (750, 85)), highpass=2000),
|
||||||
HardsubSign((30259, 30977), ((293, 843), (1321, 227))),
|
HardsubSign((30259, 30977), ((293, 843), (1321, 227)), highpass=2000),
|
||||||
HardsubSign((32608, 32703), ((281, 859), (890, 101))),
|
HardsubSign((32608, 32703), ((281, 859), (890, 101)), highpass=2000),
|
||||||
]
|
]
|
||||||
CREDITS: List[Range] = [(30152, 32343)]
|
CREDITS: List[Range] = [(30152, 32343)]
|
||||||
PIXELSHIT: List[Range] = [
|
PIXELSHIT: List[Range] = [
|
||||||
|
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()
|
@ -1,3 +1,3 @@
|
|||||||
from .dehardsub import HardsubSign, bounded_dehardsub # noqa: F401
|
from .dehardsub import HardsubSign, bounded_dehardsub, get_all_masks # noqa: F401
|
||||||
from .filter import antialias, deband, denoise, finalize, fsrcnnx_rescale, letterbox_edgefix # noqa: F401
|
from .filter import antialias, deband, denoise, finalize, fsrcnnx_rescale, letterbox_edgefix # noqa: F401
|
||||||
from .util import Range, glob_crc, source # noqa: F401
|
from .util import Range, glob_crc, source # noqa: F401
|
||||||
|
@ -32,13 +32,17 @@ class HardsubSign():
|
|||||||
range: Range
|
range: Range
|
||||||
bound: Optional[BoundingBox]
|
bound: Optional[BoundingBox]
|
||||||
refframe: Optional[int]
|
refframe: Optional[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):
|
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.expand = expand
|
||||||
if bound is None:
|
if bound is None:
|
||||||
self.bound = None
|
self.bound = None
|
||||||
elif isinstance(bound, BoundingBox):
|
elif isinstance(bound, BoundingBox):
|
||||||
@ -48,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=2000)
|
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=2000)
|
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
|
||||||
@ -71,11 +76,22 @@ class HardsubSign():
|
|||||||
return core.std.MaskedMerge(core.std.BlankClip(hm), hm, bm)
|
return core.std.MaskedMerge(core.std.BlankClip(hm), hm, bm)
|
||||||
|
|
||||||
|
|
||||||
|
def get_all_masks(hrdsb: vs.VideoNode, ref: vs.VideoNode, signs: List[HardsubSign]) -> vs.VideoNode:
|
||||||
|
"""
|
||||||
|
Scenefiltering helper, not used in encode
|
||||||
|
"""
|
||||||
|
assert ref.format is not None
|
||||||
|
mask = core.std.BlankClip(ref, format=ref.format.replace(color_family=vs.GRAY, subsampling_w=0, subsampling_h=0))
|
||||||
|
for sign in signs:
|
||||||
|
mask = lvf.misc.replace_ranges(mask, core.std.Expr([mask, sign.get_mask(hrdsb, ref)], 'x y +'), [sign.range])
|
||||||
|
return mask
|
||||||
|
|
||||||
|
|
||||||
def bounded_dehardsub(hrdsb: vs.VideoNode, ref: vs.VideoNode, signs: List[HardsubSign]) -> vs.VideoNode:
|
def bounded_dehardsub(hrdsb: vs.VideoNode, ref: vs.VideoNode, signs: List[HardsubSign]) -> vs.VideoNode:
|
||||||
bound = hrdsb
|
bound = hrdsb
|
||||||
for sign in signs:
|
for sign in signs:
|
||||||
bound = lvf.misc.replace_ranges(bound,
|
bound = lvf.misc.replace_ranges(bound,
|
||||||
core.std.MaskedMerge(hrdsb, ref, sign.get_mask(hrdsb, ref)),
|
core.std.MaskedMerge(bound, ref, sign.get_mask(hrdsb, ref)),
|
||||||
[sign.range])
|
[sign.range])
|
||||||
|
|
||||||
return bound
|
return bound
|
||||||
|
Loading…
x
Reference in New Issue
Block a user