SetMemoryMax(1920) SetMTMode(5,5) a=ImageSource("F:\Super8mm_Sound\HDR2\image%d.tiff",start=0,end=3629,fps=18).ConvertToYV12() return denoise(a) ###############...Functions...##################################### function denoise(clip movie) { block_size=16 block_over=block_size/2 USM_sharp_ness=28 USM_radi_us=3 USM_sharp_ness1 = USM_sharp_ness USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/4) USM_sharp_ness3 = USM_sharp_ness*4 USM_radi_us1 = USM_radi_us USM_radi_us2 = USM_radi_us-1 USM_radi_us3 = USM_radi_us2-1 cleaned=movie.RemoveGrain(2).unsharpmask(USM_sharp_ness1,USM_radi_us1,0).RemoveGrain(2).unsharpmask( USM_sharp_ness2,USM_radi_us2,0).RemoveGrain(2) vectors= MVAnalyseMulti(cleaned,refframes=6, pel=2,truemotion=true, blksize=block_size ,blksizev=block_size, overlap=block_over,dct=0,idx=1,search=1,threads=4, prefetch=1) T=MVDegrainMulti(cleaned,vectors, thSAD=1100,thSADC=500,limit=15, SadMode=0, idx=2,plane=4,threads=4).unsharpmask(USM_sharp_ness3,USM_radi_us3,0) b2=t.mgrain33().mgrain3().NonlinUSM(1.2,1.5,1.2,3.5) b22=overlay(b2,movie,mask=b2.GaussianBlur(VarY=20) ,opacity=1.0,greymask=true,mode="blend",pc_range=true).unsharpmask(30,3,0).sharpen(0.2) return b22 } function mgrain3(clip last) { blksize_size=4 overlap_size=blksize_size/2 dct=0 tmotion=false super= last.MSuper(pel=2) bv1 = MAnalyse(super, isb = true, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv1 = MAnalyse(super, isb = false, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) bv2 = MAnalyse(super, isb = true, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv2 = MAnalyse(super, isb = false, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) bv3 = MAnalyse(super, isb = true, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv3 = MAnalyse(super, isb = false, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) l=last.MDegrain3(super, bv1,fv1,bv2,fv2,bv3,fv3,plane=4,thSAD=650,thSADC=100,limit=15) return l } function mgrain33(clip last) { blksize_size=32 overlap_size=blksize_size/2 dct=0 tmotion=false super= last.MSuper(pel=2) bv1 = MAnalyse(super, isb = true, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv1 = MAnalyse(super, isb = false, delta=1,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) bv2 = MAnalyse(super, isb = true, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv2 = MAnalyse(super, isb = false, delta=2,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) bv3 = MAnalyse(super, isb = true, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) fv3 = MAnalyse(super, isb = false, delta=3,truemotion=tmotion,blksize=blksize_size,overlap=overlap_size, dct=dct) l=last.MDegrain3(super, bv1,fv1,bv2,fv2,bv3,fv3,plane=4,thSAD=250,thSADC=100,limit=15) return l } function NonlinUSM(clip o, float "z", float "pow", float "str", float "rad", float "ldmp") { z = default(z, 6.0) # zero point pow = default(pow, 1.6) # power str = default(str, 1.0) # strength rad = default(rad, 9.0) # radius for "gauss" ldmp= default(ldmp, 0.001) # damping for verysmall differences g = o.bicubicresize(round(o.width()/rad/4)*4,round(o.height()/rad/4)*4).bicubicresize(o.width(),o.height(),1,0) mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(pow)+" / ^ "+string(z)+" * "+string(str)+ \ " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +",U=2,V=2) return(last) }