View Single Post
Old 20th July 2016, 16:06   #9  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Code:
import vapoursynth as vs
import Vine
import mvmulti

core = vs.get_core()
clp = core.lsmas.LWLibavSource ("sample.mpg")
clp = core.fmtc.bitdepth(clp,bits=32,fulls=False,fulld=True)
clp = core.std.ShufflePlanes(clp,0,vs.GRAY)

lowf = Vine.helpers.gauss (clp, 4)
hif = core.std.MakeDiff(clp,Vine.helpers.gauss (clp, 16))
ref = core.std.MergeDiff(lowf,hif)
ref = Vine.helpers.gauss (ref,8)
coarse = core.knlm.KNLMeansCL(clp, 3, 8, 4, 9.6, rclip=ref)
sup = core.mvsf.Super(coarse)
supd = core.mvsf.Super(core.std.MakeDiff(clp,coarse))
vec = mvmulti.Analyze(sup, tr=6,blksize=32,overlap=16,search=3,badrange=-24)
vec = mvmulti.Recalculate(sup,vec,tr=6,blksize=16,overlap=8,thsad=400,search=3)
vec = mvmulti.Recalculate(sup,vec,tr=6,blksize=8,overlap=4,thsad=400,search=3)
vec = mvmulti.Recalculate(sup,vec,tr=6,blksize=4,overlap=2,thsad=400,search=3)
dif = mvmulti.DegrainN(core.std.Expr(clp,"0.5"), supd, vec, tr=6, thscd1=1600, thsad=10000)
clp = core.std.MergeDiff(coarse,dif)
clp.set_output()

alternative approach, do some "stabilizing" to the grain instead of removing it
feisty2 is offline   Reply With Quote