Код:
#Denoiser script for interlaced video using MDegrain2 (will work on progressive as well)
SetMemoryMax(768)
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll")
#Modify this line to point to your video file
source=AVISource("D:\video.avi").killaudio()
#VHS chroma settings can sometimes cause smear. Skip CNR2 if not needed.
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,f alse) #VHS
#chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,f alse) #Laserdisc
#Use 4 instead of 8 in line below for better quality in shadows
output=MDegrain2i2(chroma,8,0,0)
#stackhorizontal(source,output)
return output
#-------------------------------
function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct")
{
Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Hshift=0 # determine experimentally
overlap=default(overlap,0) # overlap value (0 to 4 for blksize= 8 )
dct=default(dct,0) # use dct=1 for clip with light flicker -- works really well
fields=source.SeparateFields() # separate by fields
super = fields.MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_v ec4,thSAD=400)
unsharpmask(60,3,0) #not sure whether to put this before or after the weave. Remove if sharpening degrades video
Weave()
}