5
0

pripri: bd: vol4

This commit is contained in:
louis f 2021-05-14 16:26:13 -04:00
parent 19f1fb5a0c
commit 61981b3993
Signed by: louis
GPG Key ID: 44D7E1DE4E23D6F2
4 changed files with 91 additions and 2 deletions
Princess Principal

@ -0,0 +1,45 @@
import vapoursynth as vs
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
from yt_common.automation import SelfRunner
from yt_common.source import FileTrim, SimpleSource
from lvsfunc.misc import replace_ranges
from typing import Optional
import os
core = vs.core
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
CONFIG: PriPriConfig = PriPriConfig(EPNUM)
SOURCE: SimpleSource = SimpleSource(
FileTrim("../bdmv/[171222][BDMV] プリンセス・プリンシパル IV/PRINCESS_PRINCIPAL_4/BDMV/STREAM/00006.m2ts", (0, -24))
)
ED: Optional[int] = None
def filter() -> vs.VideoNode:
src = SOURCE.source()
if ED is not None:
src = src.std.FreezeFrames(first=[src.num_frames-4], last=[src.num_frames-1], replacement=[src.num_frames-5])
ef = edgefix(src)
den = denoise(ef)
rescale = descale(den)
rescalem = descale(den, mask=True)
rescale = replace_ranges(rescale, rescalem, [(31722, 34767)])
aa = antialias(rescale)
grain = regrain(aa)
ed = scenefilter_ed(grain, src, ED)
final = finalize(ed)
src.set_output(1)
final.set_output(0)
return final
if __name__ == "__main__":
SelfRunner(CONFIG, SOURCE, filter, audio_codec=["-c:a", "libopus", "-b:a", "192k", "-sample_fmt", "s16"])
else:
filter()

@ -0,0 +1,41 @@
import vapoursynth as vs
from pripri_common import PriPriConfig, edgefix, denoise, descale, antialias, regrain, scenefilter_ed, finalize
from yt_common.automation import SelfRunner
from yt_common.source import FileTrim, SimpleSource
from typing import Optional
import os
core = vs.core
EPNUM: int = int(os.path.basename(os.path.splitext(__file__)[0]))
CONFIG: PriPriConfig = PriPriConfig(EPNUM)
SOURCE: SimpleSource = SimpleSource(
FileTrim("../bdmv/[171222][BDMV] プリンセス・プリンシパル IV/PRINCESS_PRINCIPAL_4/BDMV/STREAM/00007.m2ts", (0, -47))
)
ED: Optional[int] = 32609
def filter() -> vs.VideoNode:
src = SOURCE.source()
if ED is not None:
src = src.std.FreezeFrames(first=[src.num_frames-4], last=[src.num_frames-1], replacement=[src.num_frames-5])
ef = edgefix(src)
den = denoise(ef)
rescale = descale(den)
aa = antialias(rescale)
grain = regrain(aa)
ed = scenefilter_ed(grain, src, ED)
final = finalize(ed)
src.set_output(1)
final.set_output(0)
return final
if __name__ == "__main__":
SelfRunner(CONFIG, SOURCE, filter, audio_codec=["-c:a", "libopus", "-b:a", "192k", "-sample_fmt", "s16"])
else:
filter()

@ -0,0 +1,2 @@
# Princess Principal
Encoded for [Cait-Sidhe].

@ -41,7 +41,7 @@ def _nnedi3_double(clip: vs.VideoNode) -> vs.VideoNode:
return nn.resize.Bicubic(src_top=0.5, src_left=0.5) return nn.resize.Bicubic(src_top=0.5, src_left=0.5)
def descale(clip: vs.VideoNode, kernel: Kernel = Bicubic(b=0, c=1/2)) -> vs.VideoNode: def descale(clip: vs.VideoNode, kernel: Kernel = Bicubic(b=0, c=1/2), mask: bool = False) -> vs.VideoNode:
def _fsrlineart(clip: vs.VideoNode, width: int, height: int) -> vs.VideoNode: def _fsrlineart(clip: vs.VideoNode, width: int, height: int) -> vs.VideoNode:
clip = clip.resize.Point(1280, 720) clip = clip.resize.Point(1280, 720)
assert clip.format is not None assert clip.format is not None
@ -51,7 +51,8 @@ def descale(clip: vs.VideoNode, kernel: Kernel = Bicubic(b=0, c=1/2)) -> vs.Vide
mask = mask.std.Binarize(scale_thresh(0.65, mask)).std.Maximum() mask = mask.std.Binarize(scale_thresh(0.65, mask)).std.Maximum()
mask = depth(mask, clip.format.bits_per_sample, range_in=CRange.FULL, range=CRange.FULL) mask = depth(mask, clip.format.bits_per_sample, range_in=CRange.FULL, range=CRange.FULL)
return core.std.MaskedMerge(nn.resize.Bicubic(width, height, filter_param_a=0, filter_param_b=1/2), fsr, mask) return core.std.MaskedMerge(nn.resize.Bicubic(width, height, filter_param_a=0, filter_param_b=1/2), fsr, mask)
return depth(ldescale(clip, height=720, kernel=kernel, upscaler=_fsrlineart, mask=None), 16) return depth(ldescale(clip, height=720, kernel=kernel, upscaler=_fsrlineart), 16) if mask \
else depth(ldescale(clip, height=720, kernel=kernel, upscaler=_fsrlineart, mask=None), 16)
def antialias(clip: vs.VideoNode) -> vs.VideoNode: def antialias(clip: vs.VideoNode) -> vs.VideoNode: