tanteidan: tv: 04
This commit is contained in:
parent
dcceb54d4c
commit
04a9ca3cff
117
Bishounen Tanteidan/04/04.vpy
Normal file
117
Bishounen Tanteidan/04/04.vpy
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import vapoursynth as vs
|
||||||
|
|
||||||
|
from tanteidan_common import (PrettyConfig, PrettySource, antialias, deband,
|
||||||
|
denoise, finalize, regrain, stupid_op_scenefilter,
|
||||||
|
wd_scenefilter)
|
||||||
|
|
||||||
|
from yt_common.automation import SelfRunner
|
||||||
|
from yt_common.source import waka_replace
|
||||||
|
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
|
from lvsfunc.dehardsub import HardsubSign, HardsubSignFade, HardsubMask, bounded_dehardsub
|
||||||
|
from lvsfunc.types import Range
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
core = vs.core
|
||||||
|
|
||||||
|
|
||||||
|
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
|
||||||
|
CONFIG: PrettyConfig = PrettyConfig(EPNUM)
|
||||||
|
SOURCE: PrettySource = PrettySource(CONFIG)
|
||||||
|
|
||||||
|
OP: Optional[int] = 0
|
||||||
|
WELCOMING_DAYS: Optional[int] = None
|
||||||
|
|
||||||
|
WAKA_REPLACE: List[List[Range]] = [
|
||||||
|
[(31864, 32650)],
|
||||||
|
[],
|
||||||
|
]
|
||||||
|
|
||||||
|
TITLECARDS: List[Range] = [
|
||||||
|
(2609, 2704),
|
||||||
|
(5174, 5221),
|
||||||
|
(5738, 5773),
|
||||||
|
(5774, 5809),
|
||||||
|
(6920, 6967),
|
||||||
|
(9209, 9256),
|
||||||
|
(10223, 10270),
|
||||||
|
(11375, 11434),
|
||||||
|
(11627, 11674),
|
||||||
|
(12806, 12853),
|
||||||
|
(14649, 14732),
|
||||||
|
(16431, 16478),
|
||||||
|
(19516, 19563),
|
||||||
|
(24622, 24669),
|
||||||
|
(25618, 25665),
|
||||||
|
(27691, 27738),
|
||||||
|
(29957, 30004),
|
||||||
|
]
|
||||||
|
|
||||||
|
SIGNS_RU: List[HardsubMask] = [
|
||||||
|
HardsubSignFade(TITLECARDS + [
|
||||||
|
(2158, 2298),
|
||||||
|
(31751, 31863),
|
||||||
|
(5666, 5683),
|
||||||
|
(5684, 5701),
|
||||||
|
(5702, 5737),
|
||||||
|
(6722, 6763),
|
||||||
|
(6764, 6811),
|
||||||
|
(10715, 10757),
|
||||||
|
(12026, 12115),
|
||||||
|
(12566, 12631),
|
||||||
|
(12632, 12683),
|
||||||
|
(20821, 20919),
|
||||||
|
(20920, 21039),
|
||||||
|
]),
|
||||||
|
HardsubSign([
|
||||||
|
(2327, 2608),
|
||||||
|
]),
|
||||||
|
]
|
||||||
|
|
||||||
|
AA_STRONGER: List[Range] = [
|
||||||
|
(15231, 15338), # this fucking plant what the hell
|
||||||
|
]
|
||||||
|
|
||||||
|
AA_STRONG: List[Range] = [
|
||||||
|
]
|
||||||
|
|
||||||
|
AA_WEAK: List[Range] = [
|
||||||
|
(13814, 14518),
|
||||||
|
]
|
||||||
|
|
||||||
|
AA_NONE: List[Range] = TITLECARDS + [ # chapter 2 title cards are insanely detailed
|
||||||
|
(20821, 21039),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def filter_basic() -> vs.VideoNode:
|
||||||
|
wakas, ref = SOURCE.source()
|
||||||
|
wakas = [w[0] + w for w in wakas]
|
||||||
|
waka = wakas[0]
|
||||||
|
waka, wakas = waka_replace(waka, wakas[1:], WAKA_REPLACE)
|
||||||
|
src = bounded_dehardsub(waka, ref, SIGNS_RU, wakas)
|
||||||
|
src.set_output(1)
|
||||||
|
return src
|
||||||
|
|
||||||
|
|
||||||
|
def filter() -> vs.VideoNode:
|
||||||
|
src = filter_basic()
|
||||||
|
den = denoise(src)
|
||||||
|
deb = deband(den)
|
||||||
|
aa = antialias(deb, stronger=AA_STRONGER, strong=AA_STRONG, weak=AA_WEAK, noaa=AA_NONE)
|
||||||
|
scenefilter = stupid_op_scenefilter(aa, deb, OP)
|
||||||
|
if WELCOMING_DAYS is not None:
|
||||||
|
scenefilter = wd_scenefilter(aa, deb, WELCOMING_DAYS)
|
||||||
|
grain = regrain(scenefilter)
|
||||||
|
final = finalize(grain)
|
||||||
|
final.set_output()
|
||||||
|
return final
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
SelfRunner(CONFIG, filter, filter_basic)
|
||||||
|
else:
|
||||||
|
filter()
|
@ -46,9 +46,9 @@ def deband(clip: vs.VideoNode) -> vs.VideoNode:
|
|||||||
return deband
|
return deband
|
||||||
|
|
||||||
|
|
||||||
def antialias(clip: vs.VideoNode, strong: Optional[List[Range]] = None,
|
def antialias(clip: vs.VideoNode, stronger: Optional[List[Range]] = None,
|
||||||
weak: Optional[List[Range]] = None, noaa: Optional[List[Range]] = None,
|
strong: Optional[List[Range]] = None, weak: Optional[List[Range]] = None,
|
||||||
dehalo: bool = True, sharpen: bool = False) -> vs.VideoNode:
|
noaa: Optional[List[Range]] = None, dehalo: bool = True, sharpen: bool = False) -> vs.VideoNode:
|
||||||
def _sraa_pp_sharpdehalo(sraa: vs.VideoNode) -> vs.VideoNode:
|
def _sraa_pp_sharpdehalo(sraa: vs.VideoNode) -> vs.VideoNode:
|
||||||
if sharpen: # all this really seems to do is make the haloing worse, will not be using!
|
if sharpen: # all this really seems to do is make the haloing worse, will not be using!
|
||||||
y = LSFmod(vsutil.get_y(sraa), strength=70, Smode=3, edgemode=0, source=vsutil.get_y(clip))
|
y = LSFmod(vsutil.get_y(sraa), strength=70, Smode=3, edgemode=0, source=vsutil.get_y(clip))
|
||||||
@ -58,7 +58,9 @@ def antialias(clip: vs.VideoNode, strong: Optional[List[Range]] = None,
|
|||||||
mask = combine_mask(clip, weak or [])
|
mask = combine_mask(clip, weak or [])
|
||||||
clamp = sraa_clamp(clip, mask=mask, postprocess=_sraa_pp_sharpdehalo)
|
clamp = sraa_clamp(clip, mask=mask, postprocess=_sraa_pp_sharpdehalo)
|
||||||
sraa = core.std.MaskedMerge(clip, upscaled_sraa(clip, rfactor=2, downscaler=Bicubic(b=0, c=1/2).scale), mask)
|
sraa = core.std.MaskedMerge(clip, upscaled_sraa(clip, rfactor=2, downscaler=Bicubic(b=0, c=1/2).scale), mask)
|
||||||
return replace_ranges(replace_ranges(clamp, clip, noaa or []), sraa, strong or [])
|
sraa13 = upscaled_sraa(clip, rfactor=1.3, downscaler=Bicubic(b=0, c=1/2).scale)
|
||||||
|
return replace_ranges(replace_ranges(replace_ranges(clamp, clip, noaa or []), sraa, strong or []), sraa13,
|
||||||
|
stronger or [])
|
||||||
|
|
||||||
|
|
||||||
def regrain(clip: vs.VideoNode) -> vs.VideoNode:
|
def regrain(clip: vs.VideoNode) -> vs.VideoNode:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user