Skip to content

Instantly share code, notes, and snippets.

@inflation
Created March 3, 2019 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inflation/0484c01e4fba052f5751cd2bcd5b0c6b to your computer and use it in GitHub Desktop.
Save inflation/0484c01e4fba052f5751cd2bcd5b0c6b to your computer and use it in GitHub Desktop.
import vapoursynth as vs
import sys
sys.path.insert(0, '.')
import mvsfunc as mvf
import havsfunc as haf
import inftools as inf
from nnedi3_resample import nnedi3_resample
core = vs.get_core()
source = \
r'/Users/inflation/Downloads/Media/[BDMV][Violet Evergarden][Vol.1-Vol.4 Fin]/VIOLET_EVERGARDEN_1/BDMV/STREAM/00003.m2ts'
src16 = core.lsmas.LWLibavSource(source)
src16 = mvf.Depth(src16, 16)
# Produce example clip
usm = inf.usm(src16, 20)
src6 = mvf.Depth(usm, 6, dither=1)
src16 = mvf.Depth(src6, 16, dither=1)
# Debanding
nr16 = core.bilateral.Bilateral(src16, sigmaS=1.5, sigmaR=0.015, algorithm=2)
noise = core.std.MakeDiff(src16, nr16)
db = core.f3kdb.Deband(nr16, 8, 256, 128, 128, 0, 0, output_depth=16)
db = core.f3kdb.Deband(db, 16, 128, 96, 96, 0, 0, output_depth=16)
db = mvf.LimitFilter(db, nr16, thr=1, thrc=0.8, elast=2)
db = core.std.MergeDiff(db, noise)
# Dering
edge = haf.HQDeringmod(src16)
# Merge
res = mvf.LimitFilter(db, edge, thr=2, elast=1.5)
# Contra-Sharp
noise = core.std.MakeDiff(src16, res)
blur = core.rgvs.RemoveGrain(res, 11)
diff = core.std.MakeDiff(res, blur)
diff = core.rgvs.Repair(diff, noise, 14)
res = core.std.MergeDiff(res, diff)
src16 = core.text.Text(src16, "Source")
res = core.text.Text(res, "After")
res = core.std.Interleave([src16, db, res])
res = mvf.ToRGB(res)
res.set_output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment