Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MDegrain (clip input, int "method", clip "pp", int "thSAD", int "thSCD1", int "thSCD2", int "blksize", int "pel", int "overlap", int "dct", int "search")
- {
- method = default(method, 1)
- pp = default(pp, input)
- thSAD = default(thSAD, 400)
- thSCD1 = default(thSCD1, 400)
- thSCD2 = default(thSCD2, 130)
- blksize = default(blksize, 8)
- pel = default(pel, 4)
- overlap = default(overlap, blksize / 2)
- dct = default(dct, 7)
- search = default(search, 4)
- # MSuper
- pp_super = pp.MSuper(pel=pel)
- # Motion vector search
- b3vec = (method>=3) ? MAnalyse(pp_super,isb=true,search=search,delta=3,overlap=overlap,blksize=blksize,dct=dct) : NOP
- b2vec = (method>=2) ? MAnalyse(pp_super,isb=true,search=search,delta=2,overlap=overlap,blksize=blksize,dct=dct) : NOP
- b1vec = MAnalyse(pp_super,isb=true,search=search,delta=1,overlap=overlap,blksize=blksize,dct=dct)
- f1vec = MAnalyse(pp_super,isb=false,search=search,delta=1,overlap=overlap,blksize=blksize,dct=dct)
- f2vec = (method>=2) ? MAnalyse(pp_super,isb=false,search=search,delta=2,overlap=overlap,blksize=blksize,dct=dct) : NOP
- f3vec = (method>=3) ? MAnalyse(pp_super,isb=false,search=search,delta=3,overlap=overlap,blksize=blksize,dct=dct) : NOP
- # Now we perform the actual MDegrain.
- super = input.MSuper(pel=pel,levels=1)
- output = (method>=3) ? input.MDegrain3(super,b1vec,f1vec,b2vec,f2vec,b3vec,f3vec,thSAD=thSAD,thSCD1=thSCD1,thSCD2=thSCD2) :
- \ (method==2) ? input.MDegrain2(super,b1vec,f1vec,b2vec,f2vec,thSAD=thSAD,thSCD1=thSCD1,thSCD2=thSCD2) :
- \ input.MDegrain1(super,b1vec,f1vec,thSAD=thSAD,thSCD1=thSCD1,thSCD2=thSCD2)
- return(output)
- }
- function AAA(clip input, int "type", bool "mask", bool "chroma", bool "mc", float "reduc", clip "pp")
- {
- ox = input.width
- oy = input.height
- type = default(type, 1).max(0).min(2)
- mask = default(mask, true)
- chroma = default(chroma, false)
- mc = default(mc, false)
- reduc = default(reduc, 0.6).max(0).min(1)
- pp = default(pp, input)
- gscale = (chroma) ? input : input.Greyscale()
- aa = (type==2) ? gscale.TurnLeft().nnedi2(dh=true,field=1).TurnRight().nnedi2(dh=true,field=1) :
- \ (type==1) ? gscale.TurnLeft().EEDI2(field=1).TurnRight().EEDI2(field=1) :
- \ gscale.PointResize(ox*2,oy*2).TurnLeft().SangNom().TurnRight().SangNom()
- edge = mt_logic(aa.mt_edge("5 10 5 0 0 0 -5 -10 -5 4",0,255,0,255),
- \ aa.mt_edge("5 0 -5 10 0 -10 5 0 -5 4",0,255,0,255),"max").Greyscale().
- \ Levels(0,0.8,128,0,255,false)
- edge_ds = (type>=1) ? edge.Spline36Resize(ox,oy,0.5,-0.5,2*ox+.001,2*oy+.001) : edge.Spline36Resize(ox,oy)
- ds = (type>=1) ? aa.Spline36Resize(ox,oy,0.5,-0.5,2*ox+.001,2*oy+.001) : aa.Spline36Resize(ox,oy)
- maskmerge = (mask) ? mt_merge(input,ds,edge_ds,U=1,V=1) : ds
- chromamerge = (chroma) ? maskmerge.MergeChroma(ds) : maskmerge.MergeChroma(input)
- aadiff = mt_makediff(input,chromamerge)
- aadiffd = aadiff.MDeGrain(method=2,pp=pp)
- mcmerge = mt_lutxy(aadiff,aadiffd,"x 128 - abs y 128 - abs < x y ?").MergeLuma(aadiffd,reduc)
- output = (mc) ? input.mt_makediff(mcmerge,U=2,V=2) : chromamerge
- return(output)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement