Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # avisynth script template for cel anime dvds that contain field blending/aliasing, dot-crawl and rainbowing.
- # note: this thing tries to be mild, since the creator doesn't believe in overfiltering and destroying the original sources.
- function daa3slow(clip c) {
- dbl = merge(c.nnedi3(etype=1, field = 1, nns = 4, qual=2, nsize = 3,fapprox = 7,pscrn=1),c.nnedi3(etype=1, field = 0, nns = 4, qual=2, nsize = 3,fapprox = 7,pscrn=1))
- dblD = mt_makediff(c,dbl,U=3,V=3)
- shrpD = mt_makediff(dbl,dbl.removegrain(11),U=3,V=3)
- DD = shrpD.repair(dblD,13)
- return dbl.mt_adddiff(DD,U=3,V=3) }
- #or use this faster version if daa3slow is too fast for you:
- function daa3(clip c) {
- dbl = merge(c.nnedi3(etype=1, field = 1, nns = 2,nsize = 3,fapprox = 7,pscrn=1),c.nnedi3(etype=1, field = 0, nns = 2, nsize = 3,fapprox = 7,pscrn=1))
- dblD = mt_makediff(c,dbl,U=3,V=3)
- shrpD = mt_makediff(dbl,dbl.removegrain(11),U=3,V=3)
- DD = shrpD.repair(dblD,13)
- return dbl.mt_adddiff(DD,U=3,V=3) }
- # Here comes your video source line (your video must still be interlaced - it gets IVTCed/decimated as a first step, below)
- # inverse telecine + decimation, to get to 24 fps.
- # if your source is not DVD footage via dgindex/dgdecode, you probably need to uncomment
- # the following line to make TFM() work.
- #assumetff()
- tfm(slow=2,pp=1,mode=2).tdecimate()
- assumefps(24000,1001)
- # Here comes a hack against dot crawl - it doesn't remove it 100%ly, but is rather detail safe.
- # It however needs that the file "noisepattern.avi" must be present in the location specified below.
- # That video contains a sample of dot-crawl noise to serve as a 'training' for fft3dfilter.
- # it is a sample video from a lousy ADV DVD... ask and ye shall be given, I guess?
- # try htttp://ulozto.net/x493J9tg/noisepattern-avi
- # also, your video needs to be 720x480 here - crop at the end of the script instead
- src = last
- # change the path of the noisepattern.avi file to wherever you put it
- avisource("c:\pattern\noisepattern.avi") + last
- unf = last
- fft3dfilter(sigma= 1.7500, plane=0,bw=8,bh=8)
- den = last
- denoisediff = mt_makediff(unf,den,U=3,V=3)
- fft3dfilter(sigma= 0.01, pframe = 0, px = 34,py = 18, plane=0,pfactor =0.7,pcutoff=0.01,pshow=false,bw=8,bh=8)
- mt_adddiff(denoisediff,U=3,V=3)
- trim(1,0)
- # Now we will derainbow. Again, rather detail safe, but some limited discoloration can happen.
- # Current derainbowing methods available are sadly far form perfect.
- prerb = last
- derbmask = removegrainhd(rank=23,radius=6).tedgemask(threshY=8).mt_inflate()
- prefiltered = last
- derbsuperfilt = MSuper(prefiltered)
- derbsuper = derbsuperfilt
- derbbackward_vectors = MAnalyse(derbsuperfilt, truemotion = true, isb = true, chroma=false)
- derbforward_vectors = MAnalyse(derbsuperfilt, truemotion = true, isb = false, chroma=false)
- derbforward_compensation = MCompensate(derbsuper, derbforward_vectors)
- derbbackward_compensation = MCompensate(derbsuper, derbbackward_vectors)
- interleave(derbforward_compensation,last,derbbackward_compensation)
- dfmderainbow(maskthresh=10)
- selectevery(3,1)
- mt_merge(prerb,last, derbmask,luma=true)
- # now antialising (your video should still be 720x480 here - or at least should have height divisible by 4)
- # this line covers up nasty aliasing and interlacing artifacts (combing) that are left from field blends.
- # It nicely smooths those nasties and is still quite nice to detail.
- # The daa3slow() function is defined at the start of this script.
- spline36resize(width,height*3/2).daa3slow.spline36resize(width,height)
- #now we will stabilise lines/edges, it also helps against some dot crawl and shimmering. It should be detail-safe, though not 100%.
- source = last
- prefilt = last.removegrain(6).FFT3Dfilter(sigma=1.5,bw=16,bh=16,bt=3,ow=8,oh=8,plane=4)
- superfilt = prefilt.MSuper(pel=2, sharp=1)
- super = MSuper(pel=2, sharp=1)
- backward_vec2 = MAnalyse(superfilt, isb = true, delta = 2, overlap=4)
- backward_vec1 = MAnalyse(superfilt, isb = true, delta = 1, overlap=4)
- forward_vec1 = MAnalyse(superfilt, isb = false, delta = 1, overlap=4)
- forward_vec2 = MAnalyse(superfilt, isb = false, delta = 2, overlap=4)
- degrainedge = source.MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=230)
- edgemask = removegrainhd(rank=25,radius=6).tedgemask(threshY=8)
- mt_merge(source,degrainedge,edgemask,luma=true)
- #You can crop now. Also, add denoising filters now if desired. /Please be gentle ;)/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement