tensura: s2: tv: 13
This commit is contained in:
parent
94cf2ae726
commit
22d1a0adf6
98
Tensei Shitara Slime Datta Ken/S2 [TV]/13/13.vpy
Normal file
98
Tensei Shitara Slime Datta Ken/S2 [TV]/13/13.vpy
Normal file
@ -0,0 +1,98 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from tensura_common import (TenSuraS2Config, TenSuraS2AODSource, antialias, deband,
|
||||
dehalo, denoise, descale, edgefix, finalize, regrain)
|
||||
|
||||
from yt_common.automation import SelfRunner
|
||||
from yt_common.chapters import Chapter
|
||||
from yt_common.video import Zone
|
||||
|
||||
from lvsfunc.mask import BoundingBox
|
||||
from lvsfunc.dehardsub import HardsubASS, HardsubMask, bounded_dehardsub
|
||||
from lvsfunc.types import Range
|
||||
from lvsfunc.util import replace_ranges, normalize_ranges
|
||||
|
||||
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
import os
|
||||
|
||||
DESC: str = os.path.basename(os.path.splitext(__file__)[0])
|
||||
CONFIG: TenSuraS2Config = TenSuraS2Config(DESC)
|
||||
SOURCE: TenSuraS2AODSource = TenSuraS2AODSource(CONFIG, [(24, -24)])
|
||||
|
||||
OP: Optional[int] = 3189
|
||||
|
||||
CHAPTERS: List[Chapter] = [
|
||||
Chapter("Intro", 0),
|
||||
Chapter("OP", 3189),
|
||||
Chapter("Part A", 5347),
|
||||
Chapter("Part B", 17646),
|
||||
Chapter("ED", 31768),
|
||||
Chapter("Next", 33926),
|
||||
]
|
||||
|
||||
DEHARDSUB: List[HardsubMask] = [
|
||||
HardsubASS("./ger.ass"),
|
||||
]
|
||||
|
||||
NOD3: List[Range] = [
|
||||
(2261, 2452),
|
||||
(2481, 2816),
|
||||
(26614, 26733),
|
||||
(33926, None),
|
||||
]
|
||||
|
||||
if OP is not None:
|
||||
NOD3 += [
|
||||
(OP+1520, OP+1576)
|
||||
]
|
||||
|
||||
NODEN: List[Range] = [
|
||||
]
|
||||
|
||||
if OP is not None:
|
||||
NODEN += [
|
||||
(OP+1385, OP+1519)
|
||||
]
|
||||
|
||||
ZONES: List[Zone] = [
|
||||
]
|
||||
|
||||
ZONES += [Zone(r, 0.75) for r in normalize_ranges(SOURCE.source(), NOD3 + NODEN)]
|
||||
|
||||
AA_STRONG: List[Range] = [
|
||||
(29341, 29406),
|
||||
(29698, 29829),
|
||||
(30089, 30206),
|
||||
]
|
||||
|
||||
SANGNOM: List[Tuple[Range, List[BoundingBox]]] = [
|
||||
]
|
||||
|
||||
core = vs.core
|
||||
|
||||
|
||||
def filter() -> vs.VideoNode:
|
||||
aod, ref = SOURCE.dhs_source()
|
||||
src = bounded_dehardsub(aod[0], ref, DEHARDSUB)
|
||||
ef = edgefix(src)
|
||||
den = denoise(ef)
|
||||
den = replace_ranges(den, src, NODEN)
|
||||
descaled = descale(den)
|
||||
deb = deband(descaled)
|
||||
deb = replace_ranges(deb, src, NOD3)
|
||||
aa = antialias(deb, strong=AA_STRONG, sangnom=SANGNOM)
|
||||
dh = dehalo(aa)
|
||||
dh = replace_ranges(dh, aa, NOD3 + NODEN)
|
||||
grain = regrain(dh)
|
||||
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()
|
@ -1,4 +1,4 @@
|
||||
from .config import (TenSuraS2Config, TenSuraS2Source, TenSuraS2BDSource, # noqa: F401
|
||||
from .config import (TenSuraS2Config, TenSuraS2Source, TenSuraS2BDSource, TenSuraS2AODSource, # noqa: F401
|
||||
TenSuraS1BDConfig, TenSuraS1BDSource)
|
||||
from .filter import (antialias, deband, denoise, descale, edgefix, finalize, # noqa: F401
|
||||
from .filter import (antialias, deband, denoise, descale, dehalo, edgefix, finalize, # noqa: F401
|
||||
megurumono_scenefilter, regrain)
|
||||
|
@ -1,15 +1,34 @@
|
||||
import vapoursynth as vs
|
||||
|
||||
from acsuite.types import Trim
|
||||
|
||||
from yt_common.audio import AudioStream, CodecPassthrough, CodecOpus, CodecFlac
|
||||
from yt_common.config import Config
|
||||
from yt_common.source import SimpleSource
|
||||
from yt_common.source import DehardsubFileFinder, FileTrim, SimpleSource, glob_filename
|
||||
|
||||
from typing import List, Union
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
import os
|
||||
|
||||
core = vs.core
|
||||
|
||||
RESOLUTION: int = 1080
|
||||
DATAPATH: str = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def apply_trim(clip: vs.VideoNode, trim: Optional[Trim]) -> vs.VideoNode:
|
||||
if trim is None:
|
||||
return clip
|
||||
s, e = trim
|
||||
if s is None and e is None:
|
||||
return clip
|
||||
if s is None:
|
||||
return clip[:e]
|
||||
if e is None:
|
||||
return clip[s:]
|
||||
return clip[s:e]
|
||||
|
||||
|
||||
class TenSuraS1BDConfig(Config):
|
||||
def __init__(self, desc: Union[str, int]) -> None:
|
||||
super().__init__(
|
||||
@ -42,6 +61,33 @@ class TenSuraS2Source(SimpleSource):
|
||||
return [AudioStream(0, CodecPassthrough())]
|
||||
|
||||
|
||||
class TenSuraS2AODSource(DehardsubFileFinder):
|
||||
trims: List[Trim]
|
||||
|
||||
def __init__(self, config: Config, trims: Optional[List[Trim]] = None) -> None:
|
||||
self.trims = trims or [(None, None)]
|
||||
super().__init__(config)
|
||||
|
||||
def get_waka_filenames(self) -> List[str]:
|
||||
return [f"Tensei Shitara Slime Datta Ken S2 - {int(self.config.desc)} (AoD 1080p+).mkv"]
|
||||
|
||||
def get_ref(self) -> vs.VideoNode:
|
||||
ref = self._open(glob_filename("[SubsPlease] Tensei Shitara Slime Datta Ken - "
|
||||
f"{int(self.config.desc)+24} (1080p) [$GLOB].mkv"))
|
||||
return core.std.Splice([apply_trim(ref, t) for t in self.trims]) if self.trims else ref
|
||||
|
||||
def dhs_source(self) -> Tuple[List[vs.VideoNode], vs.VideoNode]:
|
||||
hs = self._open(self.get_waka_filenames()[0])
|
||||
hs = core.std.Splice([apply_trim(hs, t) for t in self.trims]) if self.trims else hs
|
||||
ref = self.get_ref()
|
||||
return [hs], ref
|
||||
|
||||
def audio_src(self) -> List[FileTrim]:
|
||||
return [FileTrim(self.get_waka_filenames()[0], t) for t in self.trims]
|
||||
# return [FileTrim("Tensei Shitara Slime Datta Ken S2 - 13 (AoD 1080p+).mkv", (24, -24))]
|
||||
# return [FileTrim("[SubsPlease] Tensei Shitara Slime Datta Ken - 37 (1080p) [1FE9B194].mkv", (24, -24))]
|
||||
|
||||
|
||||
class TenSuraS2BDSource(SimpleSource):
|
||||
def audio_streams(self) -> List[AudioStream]:
|
||||
return [AudioStream(0, CodecFlac())]
|
||||
|
@ -11,6 +11,7 @@ from lvsfunc.misc import replace_ranges, scale_thresh
|
||||
from lvsfunc.scale import descale as ldescale
|
||||
from lvsfunc.types import Range
|
||||
|
||||
from G41Fun import MaskedDHA
|
||||
from awsmfunc import bbmod
|
||||
from debandshit import f3kbilateral
|
||||
from kagefunc import retinex_edgemask
|
||||
@ -92,6 +93,11 @@ def antialias(clip: vs.VideoNode, strong: Optional[List[Range]] = None,
|
||||
return clamp
|
||||
|
||||
|
||||
def dehalo(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
dh: vs.VideoNode = MaskedDHA(clip, rx=1.2, ry=1.2, darkstr=0, brightstr=0.7)
|
||||
return dh
|
||||
|
||||
|
||||
def regrain(clip: vs.VideoNode) -> vs.VideoNode:
|
||||
# doing a fairly heavy regrain since the source was so insanely grainy
|
||||
# but still nowhere near to the extent the source was
|
||||
|
Loading…
x
Reference in New Issue
Block a user