From fdf970e97d838225a8820bcb267c353b5450c10a Mon Sep 17 00:00:00 2001 From: louis Date: Thu, 15 Apr 2021 09:52:57 -0400 Subject: [PATCH] vivy: tv: 01 adjustments before release --- .gitignore | 1 + Vivy/01/01.vpy | 12 ++++++++---- Vivy/02/02.vpy | 4 ++-- Vivy/vivy_common/__init__.py | 2 +- Vivy/vivy_common/filter.py | 8 +++++++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 3e4b3b5..d22468b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.aac *.m4a *.h265 +*.eac3 cudnn_data/ *.webm ffmpeg2pass*.log diff --git a/Vivy/01/01.vpy b/Vivy/01/01.vpy index a66787c..168c5fa 100644 --- a/Vivy/01/01.vpy +++ b/Vivy/01/01.vpy @@ -7,7 +7,7 @@ import sys sys.path.append("..") from vivy_common import (HardsubSign, Range, bounded_dehardsub, antialias, deband, denoise, # noqa: E402 - finalize, fsrcnnx_rescale, source) + finalize, fsrcnnx_rescale, letterbox_edgefix, source) core = vs.core @@ -33,14 +33,18 @@ PIXELSHIT: List[Range] = [ ] NOSCALE: List[Range] = CREDITS + PIXELSHIT NOAA: List[Range] = PIXELSHIT +LETTERBOX: List[Range] = [ + (659, 14071) +] -waka, funi = source(EPNUM) +waka, ref = source(EPNUM) waka = waka[:37301] + core.std.BlankClip(waka, length=6) + waka[37301:] -src = bounded_dehardsub(waka, funi, SIGNS_RU) +src = bounded_dehardsub(waka, ref, SIGNS_RU) rescale = fsrcnnx_rescale(src, NOSCALE) den = denoise(rescale) deb = deband(den) aa = antialias(deb, NOAA) -final = finalize(aa) +edgefix = letterbox_edgefix(aa, LETTERBOX) +final = finalize(edgefix) final.set_output() diff --git a/Vivy/02/02.vpy b/Vivy/02/02.vpy index 5cb383e..9ae84cf 100644 --- a/Vivy/02/02.vpy +++ b/Vivy/02/02.vpy @@ -45,10 +45,10 @@ PIXELSHIT: List[Range] = [ NOSCALE: List[Range] = CREDITS + PIXELSHIT NOAA: List[Range] = PIXELSHIT -waka, funi = source(EPNUM) +waka, ref = source(EPNUM) waka = waka[:32344] + waka[32349:] -src = bounded_dehardsub(waka, funi, SIGNS_RU) +src = bounded_dehardsub(waka, ref, SIGNS_RU) rescale = fsrcnnx_rescale(src, NOSCALE) den = denoise(rescale) deb = deband(den) diff --git a/Vivy/vivy_common/__init__.py b/Vivy/vivy_common/__init__.py index d4ca774..49d630f 100644 --- a/Vivy/vivy_common/__init__.py +++ b/Vivy/vivy_common/__init__.py @@ -1,3 +1,3 @@ from .dehardsub import HardsubSign, bounded_dehardsub # noqa: F401 -from .filter import antialias, deband, denoise, finalize, fsrcnnx_rescale # noqa: F401 +from .filter import antialias, deband, denoise, finalize, fsrcnnx_rescale, letterbox_edgefix # noqa: F401 from .util import Range, glob_crc, source # noqa: F401 diff --git a/Vivy/vivy_common/filter.py b/Vivy/vivy_common/filter.py index a5191b7..dd34ec4 100644 --- a/Vivy/vivy_common/filter.py +++ b/Vivy/vivy_common/filter.py @@ -3,6 +3,7 @@ import kagefunc as kgf import lvsfunc as lvf import vardefunc as vdf +from awsmfunc import bbmod from mvsfunc import BM3D from typing import List, Optional @@ -29,6 +30,11 @@ def fsrcnnx_rescale(src: vs.VideoNode, noscale: Optional[List[Range]] = None) -> return lvf.misc.replace_ranges(descale, src, noscale) if noscale else descale +def letterbox_edgefix(clip: vs.VideoNode, ranges: List[Range]) -> vs.VideoNode: + edgefix = bbmod(clip.std.Crop(top=132, bottom=132), top=2, bottom=2, blur=500).std.AddBorders(top=132, bottom=132) + return lvf.misc.replace_ranges(clip, edgefix, ranges) + + def denoise(clip: vs.VideoNode) -> vs.VideoNode: bm3d = BM3D(clip, sigma=[1.5, 0], depth=16) knl = core.knlm.KNLMeansCL(clip, d=3, a=2, h=0.4, channels="UV", device_type='gpu', device_id=0) @@ -36,7 +42,7 @@ def denoise(clip: vs.VideoNode) -> vs.VideoNode: def deband(clip: vs.VideoNode) -> vs.VideoNode: - return clip.neo_f3kdb.Deband(range=18, y=32, cb=24, cr=24, grainy=24, grainc=0, output_depth=16, sample_mode=4) + return vdf.dumb3kdb(clip, radius=18, threshold=36, grain=[24, 0]) def antialias(clip: vs.VideoNode, noaa: Optional[List[Range]] = None) -> vs.VideoNode: