5
0

82 lines
1.8 KiB
Python

import vapoursynth as vs
from tensura_common import TenSuraS2BDConfig, antialias, deband, denoise, descale, edgefix, finalize, regrain
from yt_common.automation import SelfRunner, Zone
from yt_common.chapters import Chapter
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.mask import BoundingBox
from lvsfunc.misc import replace_ranges
from lvsfunc.types import Range
from typing import List, Tuple
import os
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
CONFIG: TenSuraS2BDConfig = TenSuraS2BDConfig(EPNUM)
BDMV: str = "../bdmv/[BDMV][210526][Tensei Shitara Slime Datta Ken 2nd Season][Vol.2]/BDMV/STREAM"
SOURCE: SimpleSource = SimpleSource(
FileTrim(os.path.join(BDMV, "00012.m2ts"), (None, -26))
)
CHAPTERS: List[Chapter] = [
Chapter("Intro", 0),
Chapter("OP", 1272),
Chapter("Part A", 3429),
Chapter("Part B", 10549),
Chapter("ED", 31768),
]
NOD3: List[Range] = [
(3705, 3733),
(5329, 5360),
(7234, 7449),
]
NODEN: List[Range] = [
(3734, 3842),
(5361, 6372),
(26183, 27055),
]
ZONES: List[Zone] = [
]
ZONES += [Zone(r, 0.75) for r in NOD3 + NODEN if isinstance(r, tuple)]
AA_STRONG: List[Range] = [
(9805, 10155),
]
SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
]
DEBAND_NUCLEAR: List[Range] = [
]
core = vs.core
def filter() -> vs.VideoNode:
src = SOURCE.source()
ef = edgefix(src)
den = denoise(ef)
den = replace_ranges(den, src, NODEN)
descaled = descale(den)
deb = deband(descaled, nuclear=DEBAND_NUCLEAR)
deb = replace_ranges(deb, src, NOD3)
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
grain = regrain(aa)
final = finalize(grain)
src.set_output(1)
final.set_output(0)
return final
if __name__ == "__main__":
SelfRunner(CONFIG, SOURCE, filter, chapters=CHAPTERS, zones=ZONES)
else:
filter()