View Full Version : RemoveDirt
Paazabel
8th November 2009, 15:08
Sweet results, LaTo.
Given the nature of this particular clip (someone spinning around with the camera in-hand), I'm not sure this is a "detectable" detail playing it back; no frame stands on the field of view long enough to notice. It looks good to me played as DVD.
However ...
I have a few scenes on that same tape where there is a definite "plastic" look from over-smoothing. I will try your filter on those because this one did not produce a good result in a few places.
LaTo
8th November 2009, 15:25
Sweet results, LaTo.
Given the nature of this particular clip (someone spinning around with the camera in-hand), I'm not sure this is a "detectable" detail playing it back; no frame stands on the field of view long enough to notice. It looks good to me played as DVD.
However ...
I have a few scenes on that same tape where there is a definite "plastic" look from over-smoothing. I will try your filter on those because this one did not produce a good result in a few places.
Sure, the gain is more or less visible depending on the scene...
Static scenes are the most improved by this "masking".
jmac698
3rd May 2010, 04:03
I'm having a bug in removedirt 1.0.
It works great for me on a very bad source, better than mc_spuds.
However, every 12 frames or so it's like it stops... the noise comes back, so watching the video there is a distracting noise flashing.
What could cause this? Are these frames somehow not being recognized?
Jenyok
13th February 2012, 13:22
Question.
Where could I get function TemporalRepair ?
Boulder
13th February 2012, 13:32
http://home.pages.at/kassandro/RemoveGrain/
Jenyok
14th February 2012, 07:16
This is a code of all known RemoveDirt and RemoveDirtMC functions, collected together.
MC - moution compensated.
Code is adapted to MVTools V2.
Didee
neuron2
Gavino
Any your suggestion, addition, correction and improvment of this code ?!
##
#
# File: RemoveDirt.avsi
#
# RemoveTempGrain, RemoveDirt and moution compensated RemoveDirt functions
#
# Functions:
#
# function RemoveTempGrain(clip input, int "_mode")
#
# function RemoveDirt(clip clp, int "repmode", bool "_grey")
# function RemoveDirtMC(clip clp, int "limit", bool "_grey")
#
# function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
# function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey")
#
# function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
# function RemoveDirtMC_HQ(clip clp, int limit, int rgrain, bool "_grey")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
# =============================================================================
#
#
function RemoveTempGrain(clip input, int "_mode")
{
_mode = Default(_mode, 17)
rg = RemoveGrain(input, mode=_mode)
return TemporalRepair(rg, input)
}
# =============================================================================
#
#
function RemoveDirt(clip clp, int "repmode", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=repmode, modeU = _grey ? -1 : repmode)
restore = Repair(clensed, clp, mode=repmode, modeU = _grey ? -1 : repmode)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode)
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDirt(clipa, repmode=limit, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr1 = 0.35 + rgrain * 0.3
_dgr2 = 0.45 + rgrain * 0.4
repmode = 1
clensed = Clense(clp, grey=_grey, cache=4)
restore = clp.FluxSmoothST(3 + 3 * rgrain, rgrain)
restore = Repair(restore, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
restore = (rgrain == 0) ? restore.RemoveGrain(1) : \
restore.VagueDenoiser(threshold=_dgr1, chromaT=_dgr1, nsteps=7, percent=75).RemoveGrain(1)
alt = clp.VagueDenoiser(threshold=_dgr2, chromaT=_dgr2, nsteps=7, percent=100).RemoveGrain(5)
return RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, \
pthreshold=4 + 2 * rgrain, cthreshold=6 + 2 * rgrain, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=12, grey=_grey)
# Alternative settings
# return RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, dist=1, dmode=2, \
# debug=false, noise=limit, noisy=12, grey=_grey, show=true)
# return RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=6, cthreshold=8, gmthreshold=40, dist=3, \
# tolerance=12, dmode=2, debug=false, noise=limit, noisy=12, grey=_ grey, show=false)
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDirt2(clipa, limit=limit, rgrain=rgrain, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
{
_grey = Default(_grey, false)
_dgr = 0.4 + rgrain * 0.25
clensed = clp.RemoveTempGrain(1).FluxSmoothST(tlimit, rgrain)
restore = clp.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
return RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, pthreshold=3 + 2 * rgrain, \
cthreshold=3 + 2 * rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, \
noise=tlimit + 1, noisy=12, grey=_grey)
}
function RemoveDirtMC_HQ(clip clp, int limit, int rgrain, bool "_grey")
{
_grey = Default(_grey, false)
super = MSuper(clp, pel=2, sharp=2)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
clipa = interleave(backw, clp, forw)
clipb = RemoveDirt_HQ(clipa, limit, rgrain, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
return clipc
}
Jenyok
14th February 2012, 07:22
This is a code of all known RemoveNoise and various filters functions, used RemoveNoise, collected together.
MC - moution compensated.
Code is adapted to MVTools V2.
Didee
neuron2
Gavino
Any your suggestion, addition, correction and improvment of this code ?!
Also needed your help to replace function Deen() beta1 to Deen() beta2.
#
#
# File: RemoveNoise.avsi
#
# Moution compensated RemoveNoise and variuos filters functions
#
# Functions:
#
# function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey")
# function HQ_Filter(clip clp)
# function MQ_Filter(clip clp)
# function LQ_Filter(clip clp)
#
# function RemoveNoiseMC_HQ(clip clp, int "tlimit", int "rgrain", float "csharp")
# function HQ_Filter2(clip clp)
#
# function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey")
# function VLQ_Filter(clip clp)
# function VLQ_Filter_Ultimate(clip clp)
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ZZZ_OLD\DEEN_25_DLL_20030813\deen.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEBLOCK_25_DLL_20060214\deblock.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_LIMITEDSHARPENFASTER\limitedsharpenfaster.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.avsi")
#global idx_c = 4
# =============================================================================
#
#
function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 11)
rgrain = Default(rgrain, 2)
denoise = Default(denoise, 8)
sharp = (rgrain < 1) ? Default(sharp, true) : Default(sharp, false)
csharpen = (rgrain > 2) ? Default(csharpen, 0.17) : (rgrain > 1) ? Default(csharpen, 0.15) : Default(csharpen, 0.13)
# global idx_c = idx_c + 1
dummy = clp.BlankClip(length=0)
csharpen = (sharp) ? csharpen : csharpen + 0.08
_dgr = 0.45 + rgrain * 0.4
cbs = 8
cov = (cbs > 4) ? cbs / 4 : 0
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : (denoise > 8) ? 58 * ccf : (denoise > 5) ? 66 * ccf : 72 * ccf
csh = (sharp) ? 1 : 0
super = MSuper(clp, pel=2, sharp=csh)
bvec3 = MAnalyse(super, isb=true, blksize=cbs, delta=3, truemotion=true, pnew=cpn, overlap=cov)
bvec2 = MAnalyse(super, isb=true, blksize=cbs, delta=2, truemotion=true, pnew=cpn, overlap=cov)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, truemotion=true, pnew=cpn, overlap=cov)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, truemotion=true, pnew=cpn, overlap=cov)
fvec2 = MAnalyse(super, isb=false, blksize=cbs, delta=2, truemotion=true, pnew=cpn, overlap=cov)
fvec3 = MAnalyse(super, isb=false, blksize=cbs, delta=3, truemotion=true, pnew=cpn, overlap=cov)
backw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, bvec1)
forw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, fvec1)
# bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = (rdlimit > 13) ? (rdlimit > 20) ? clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
# clip.MVFlow(bvec1, idx=idx_c)
# forw1 = (rdlimit > 13) ? (rdlimit > 20) ? clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
# clip.MVFlow(fvec1, idx=idx_c)
clp = interleave(backw1, clp, forw1)
clp = clp.RemoveDirt2(rdlimit, rgrain, _grey)
# clp = clp.RemoveDirtMC2(rdlimit, rgrain, _grey)
dnc = (denoise == 0) ? clp.RemoveTempGrain(rgrain).SelectEvery(3, 1) : dummy
clp = clp.SelectEvery(3, 1)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=190 + 15 * denoise, \
thSCD1=230 + 5 * denoise)
# dnc = (denoise == 0) ? dnc : clp.MVDenoise(bvec2, bvec1, fvec1, fvec2, thT=denoise, thSAD=190 + 15 * denoise, \
# thmv=40, thSCD1=230 + 5 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=7, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = clp.SeeSaw(dnc, Sstr=csharpen, Szp=12, SdampHi=20, bias=40)
return clp
}
# for slight noisy video or spot/dirt removing only
#
function HQ_Filter(clip clp)
{
clp = clp.RemoveNoiseMC(rdlimit=6, rgrain=1, denoise=0)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=0, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# medium noise, higher grain:
#
function MQ_Filter(clip clp)
{
clp = clp.RemoveNoiseMC(rdlimit=10, rgrain=2, denoise=8)
clp = clp.LimitedSharpenFaster(Smode=4, strength=20, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# high noise or analog capture:
#
function LQ_Filter(clip clp)
{
clp = clp.RemoveNoiseMC(rdlimit=18, rgrain=3, denoise=14)
clp = clp.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
clp = clp.deen("a3d", rad=3, thrY=3, thrUV=5, min=0.25, tthY=2, tthUV=3, scd=6)
clp = clp.LimitedSharpenFaster(Smode=4, strength=24, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# =============================================================================
#
#
function RemoveNoiseMC_HQ(clip clp, int "tlimit", int "rgrain", float "csharp")
{
tlimit = Default(tlimit, 4)
rgrain = Default(rgrain, 1)
csharp = (rgrain > 1) ? Default(csharp, 0.14) : Default(csharp, 0.13)
# global idx_c = idx_c + 1
cbs = 4
ccf = cbs * cbs / 64
cpn = (tlimit > 6) ? 70 * ccf : 75 * ccf
super = MSuper(clp, pel=2, sharp=1)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, overlap=0, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, overlap=0, truemotion=true, pnew=cpn)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = clip.MVFlow(bvec1, idx=idx_c)
# forw1 = clip.MVFlow(fvec1, idx=idx_c)
dnc = interleave(backw1, clp, forw1)
dnc = dnc.RemoveDirt_HQ(tlimit, rgrain)
# dnc = dnc.RemoveDirtMC_HQ(tlimit, rgrain)
dnc = dnc.SelectEvery(3, 1)
return ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
}
function HQ_Filter2(clip clp)
{
clp = clp.RemoveNoiseMC_HQ(tlimit=4, rgrain=1)
clp = clp.LimitedSharpenFaster(Smode=4, strength=15, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
#global idx_c = 25
# =============================================================================
#
#
function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 24)
rgrain = Default(rgrain, 3)
denoise = Default(denoise, 15)
csharp = (rgrain > 2) ? Default(csharp, 0.32) : Default(csharp, 0.28)
# global idx_c = idx_c + 1
_dgr = 0.7 + rgrain * 0.5
cbs = 8
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : 57 * ccf
super = MSuper(clp, pel=2, sharp=0)
bvec3 = MAnalyse(super, isb=true, blksize=cbs, delta=3, truemotion=true, pnew=cpn)
bvec2 = MAnalyse(super, isb=true, blksize=cbs, delta=2, truemotion=true, pnew=cpn)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, truemotion=true, pnew=cpn)
fvec2 = MAnalyse(super, isb=false, blksize=cbs, delta=2, truemotion=true, pnew=cpn)
fvec3 = MAnalyse(super, isb=false, blksize=cbs, delta=3, truemotion=true, pnew=cpn)
backw1 = (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
# bvec3 = clip.MVAnalyse(isb=false, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec3 = clip.MVAnalyse(isb=true, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = (rdlimit > 20) ? clip.MVFlow(bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
# forw1 = (rdlimit > 20) ? clip.MVFlow(fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
clp = interleave(backw1, clp, forw1)
clp = clp.RemoveDirt2(limit=rdlimit, rgrain=rgrain, _grey=_grey)
# clp = clp.RemoveDirtMC2(limit=rdlimit, rgrain=rgrain, _grey=_grey)
clp = clp.SelectEvery(3, 1)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=160 + 12 * denoise, \
thSCD1=255 + 4 * denoise)
# dnc = clp.MVDenoise(bvec3, bvec2, bvec1, fvec1, fvec2, fvec3, thT=denoise, thSAD=160 + 12 * denoise, \
# thmv=40, thSCD1=255 + 4 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=6, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
return ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
}
function VLQ_Filter(clip clp)
{
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.3)
clp = clp.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
clp = clp.LimitedSharpenFaster(Smode=4, strength=28, overshoot=1, wide=false, ss_x=1.2, ss_y=1.2)
return clp
}
function VLQ_Filter_Ultimate(clip clp)
{
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16)
clp = clp.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
return clp
}
Jenyok
14th February 2012, 11:41
This is a code of all known RemoveSpots and RemoveSpotsMC functions, collected together.
MC - moution compensated.
Code is adapted to MVTools V2.
Didee
neuron2
Gavino
Any your suggestion, addition, correction and improvment of this code ?!
#
#
# File: RemoveSpots.avsi
#
# RemoveSpots and moution compensated RemoveSpots functions
#
# Functions:
#
# function RemoveSpots(clip clp, int "repmode", bool "_grey")
# function RemoveSpotsMC(clip clp, int "limit", bool "_grey")
#
# function RemoveSpotsMC2(clip clp)
#
# function RemoveSpotsMC3(clip clp)
#
# function RemoveSpotsMC4(clip clp)
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEFLICKER_25_DLL_20040816\deflicker.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DESPOT_3_6_1\despot.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadVirtualDubPlugin("C:\PROGRAM FILES\VIRTUALDUB 1.9.11\PLUGINS\spotremover.vdf", "SpotRemover", 11)
# =============================================================================
#
#
function RemoveSpots(clip clp, int "repmode", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=repmode, modeU = _grey ? -1 : repmode )
restore = Repair(clensed, clp, mode=repmode, modeU = _grey ? -1 : repmode)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return corrected
}
function RemoveSpotsMC(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveSpots(clipa, repmode=limit, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function RemoveSpotsMC2(clip clp)
{
# create auxialiary smooth clip for easier motion detection
#
prefiltered = clp.DeFlicker(noise=6).Blur(1.58)
# this is for internal use by MVtools functions. MVtools' version must be 2.0 or higher.
#
super = MSuper(clp, pel=1, sharp=0)
superfilt = MSuper(prefiltered, pel=1, sharp=0)
# calculate the motion vectors
#
b_vec3 = MAnalyse(superfilt, isb=true, delta=3, blksize=8, overlap=2)
b_vec2 = MAnalyse(superfilt, isb=true, delta=2, blksize=8, overlap=2)
b_vec1 = MAnalyse(superfilt, isb=true, delta=1, blksize=8, overlap=2)
f_vec1 = MAnalyse(superfilt, isb=false, delta=1, blksize=8, overlap=2)
f_vec2 = MAnalyse(superfilt, isb=false, delta=2, blksize=8, overlap=2)
f_vec3 = MAnalyse(superfilt, isb=false, delta=3, blksize=8, overlap=2)
# create 4 additional clips: two predicted backward and two predicted forward
#
bf2 = clp.MCompensate(super, b_vec2)
bf1 = clp.MCompensate(super, b_vec1)
ff1 = clp.MCompensate(super, f_vec1)
ff2 = clp.MCompensate(super, f_vec2)
# combine the 5 frames (2+1+2), the central one undergoes the degrain filter
#
clp = interleave(bf2, bf1, clp.MDegrain3(super, b_vec1, f_vec1, b_vec2, f_vec2, b_vec3, f_vec3, plane=4, thsad=400), ff1, ff2)
# run SpotRemover over each block of 5 frames
# removing spots only, no smoothing
# !!! change to DSD:0 to turn the debug mode off
# !!! change to DSD:1 to turn the debug mode on
#
clp = clp.ConvertToRGB32()
clp = clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:0 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "")
clp = clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0 ", "")
clp = clp.SpotRemover("SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "")
# clp = clp.ConvertBackToYUY2()
clp = clp.ConvertToYV12()
# discard extra frames, keep only the central one
#
clp = clp.SelectEvery(5, 3)
# compensate for the SpotRemover lag. We will loose the last frame in the movie, but the audio will be in sync
#
# clp = clp.Trim(1, 0)
# enhance the contrast (optional)
#
clp = clp.ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80, cont_u=0, cont_v=0)
return clp
}
global Width2 = 768
global Height2 = 576
# =============================================================================
#
#
function RemoveSpotsMC3(clip clp)
{
# Constants
#
block_size = 16
block_over = 2
pref = clp.deflicker(border=150, percent=70, lmin=5, lmax=240)
pref_super = pref.MSuper(hpad=block_size, vpad=block_size, pel=2, sharp=2, rfilter=2)
bvec3 = MAnalyse(pref_super,isb=true, truemotion=false, delta=3, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
bvec2 = MAnalyse(pref_super,isb=true, truemotion=false, delta=2, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
bvec1 = MAnalyse(pref_super,isb=true, truemotion=false, delta=1, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
fvec1 = MAnalyse(pref_super,isb=false, truemotion=false, delta=1, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
fvec2 = MAnalyse(pref_super,isb=false, truemotion=false, delta=2, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
fvec3 = MAnalyse(pref_super,isb=false, truemotion=false, delta=3, blksize=block_size, search=3, overlap=block_over, lambda=2000, badSAD=18800)
backw1 = MFlow(clp, pref_super, bvec1)
backw2 = MFlow(clp, pref_super, bvec2)
backw3 = MFlow(clp, pref_super, bvec3)
forw1 = MFlow(clp, pref_super, fvec1)
forw2 = MFlow(clp, pref_super, fvec2)
forw3 = MFlow(clp, pref_super, fvec3)
clp=interleave(backw3, backw2, backw1, clip, forw1, forw2, forw3)
clp=clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=0, seg=0, color=true, motpn=true, fitluma=true, blur=1) \
.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=0, seg=2, color=true, motpn=true, fitluma=true, blur=1)
# clp=clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0,ranked=true, p1percent=5, mscene=98, \
# merode=35, mwidth=20, mheight=10, sign=2, show=0, seg=0, color=true, motpn=true, fitluma=true, blur=1)
# # \ .Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
# # merode=35, sign=-2, show=0, seg=2, color=true, motpn=true, fitluma=true, blur=1)
# clp=clp.RemoveDirtMC2(_grey=false)
clp=clp.SelectEvery(7, 3)
return clp
}
# =============================================================================
#
#
function RemoveSpotsMC4(clip clp)
{
prefiltered = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
prefilteredSuper = MSuper(prefiltered, pel=2, sharp=2)
osuper = MSuper(clp, pel=2, sharp=2)
vb = MAnalyse(prefilteredSuper, isb=true, delta=1, search=3, overlap=2, lambda=2000, badSAD=18800)
cb = MFlow(osuper, prefilteredSuper, vb, thSCD1=400)
sadb = MMask(clp, vb, ml=100, thSCD1=400, gamma=1, kind=1)
vf = MAnalyse(prefilteredSuper, isb=false, delta=1, search=3, overlap=2, lambda=2000, badSAD=18800)
cf = MFlow(osuper, prefilteredSuper, vf, thSCD1=400)
sadf = MMask(clp, vf, ml=100, thSCD1=400, gamma=1, kind=1)
msadf = MT_Binarize(sadf, 20, upper=true)
msadb = MT_Binarize(sadb, 20, upper=true)
msad = MT_Logic(msadf, msadb, "or")
msad = MT_Expand(msad)
msadi = Interleave(msad, msad, msad)
clp = Interleave(cf, clp, cb)
# big black spots
clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, extmask=msadi)
# thin white lines
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, extmask=msadi)
# thick hair lines (avoid real hair)
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, extmask=msadi)
# lines contacting motion, avoid motion areas
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, extmask=msadi)
# small dots and dust
clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, extmask=msadi)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, extmask=msadi)
# Long horizontal scratches
clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=Color, extmask=msadi)
# Small compact spots
clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=Color, extmask=msadi)
clp = clp.SelectEvery(3, 1)
return clp
}
Jenyok
14th February 2012, 16:04
This is a code of all known RemoveDust and RemoveDustMC functions, collected together.
MC - moution compensated.
Code is adapted to MVTools V2.
Didee
neuron2
Gavino
Any your suggestion, addition, correction and improvment of this code ?!
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\ssetools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
# =============================================================================
#
#
function RemoveDustOld(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU = _modeU)
return (RemoveGrain(rep, mode=_mode, modeU = _modeU))
}
# =============================================================================
#
#
function RemoveDustOldMC(clip clp, int "_smooth", bool "_grey")
{
_smooth = Default(_smooth, 0)
_grey = Default(_grey, false)
repmode = 2
clmode = 4
quad = Quadruple(clp, grey=_grey) # each pixel is quadrupled, SSETools are needed
qpel = RemoveGrain(quad, mode=12, modeU=-1) # blur the luma for searching motion vectors
super = MSuper(qpel, pel=2)
# bvectors3 = MAnalyse(super, isb=true, blksize=16, delta=3, truemotion=true, lambda=2000, badSAD=18800) # for a backward search isb should be "true" not "false"
# bvectors2 = MAnalyse(super, isb=true, blksize=16, delta=2, truemotion=true, lambda=2000, badSAD=18800) # for a backward search isb should be "true" not "false"
bvectors = MAnalyse(super, isb=true, blksize=16, delta=1, truemotion=true, lambda=2000, badSAD=18800) # for a backward search isb should be "true" not "false"
fvectors = MAnalyse(super, isb=false, blksize=16, delta=1, truemotion=true, lambda=2000, badSAD=18800) # for a forward search isb should be "false" not "true"
# fvectors2 = MAnalyse(super, isb=false, blksize=16, delta=2, truemotion=true, lambda=2000, badSAD=18800) # for a forward search isb should be "false" not "true"
# fvectors3 = MAnalyse(super, isb=false, blksize=16, delta=3, truemotion=true, lambda=2000, badSAD=18800) # for a forward search isb should be "false" not "true"
backward = MCompensate(quad, super, bvectors)
forward = MCompensate(quad, super, fvectors)
# backward2 = MCompensate(quad, super, bvectors2)
# forward2 = MCompensate(quad, super, fvectors2)
# backward3 = MCompensate(quad, super, bvectors3)
# forward3 = MCompensate(quad, super, fvectors3)
clipb = interleave(backward3, backward2, backward)
clipf = interleave(forward3, forward2, forward)
# bvectors = MVAnalyse(qpel, blksize=16, lambda=200, isb=true)
# fvectors = MVAnalyse(qpel, blksize=16, lambda=200, isb=false)
# backward = MVCompensate(quad, bvectors, mode=1)
# forward = MVCompensate(quad, fvectors, mode=1)
# clensed = mcclense(quad, backward, forward, grey=_grey).shrinkby2(grey=_grey) # SSETools are needed for shrinking
clensed = Clense(quad, backward, forward, grey=_grey).shrinkby2(grey=_grey) # SSETools are needed for shrinking
# clensed = Clense(quad, clipb, clipf, grey=_grey).shrinkby2(grey=_grey) # SSETools are needed for shrinking
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
clipc = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
# clipc = SelectEvery(3, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDust(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU = _modeU )
rg = RemoveGrain(rep, mode=_mode, modeU = _modeU)
return (TemporalRepair(rg, rep, grey=_grey, smooth=true))
}
function RemoveDustMC(clip clp, int "mode", bool "_grey")
{
_grey = Default(_grey, false)
mode = Default(mode, 5)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDust(clipa, _mode=mode, _grey=_frey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDust2(clip clp, int "repmode", int "_smooth", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
_smooth = Default(_smooth, 0)
clmode = 4
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
return (TemporalRepair(rg, rep, grey=_grey, smooth=_smooth))
}
function RemoveDustMC2(clip clp, int "mode", int "smooth", bool "_grey")
{
_grey = Default(_grey, false)
mode = Default(mode, 16)
smooth = Default(smooth, 0)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDust2(clipa, _mode=mode, _smooth=smooth, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function RemoveDust3(clip clp, int "repmode", int "TRsmooth", int "RGmode", int "RGmodeChroma", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 9)
TRsmooth = Default(TRsmooth, 0)
RGmode = Default(RGmode, 2) # 1,2,5,17,18
RGmodeChroma = Default(RGmodeChroma, 1) # 1,2,5,17,18
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=RGmode, modeU=(_grey) ? -1 : RGmodeChroma, modeV=(_grey) ? -1 : RGmodeChroma)
return (TemporalRepair(rg, rep, grey=_grey, smooth=TRsmooth))
}
function RemoveDustMC3(clip clp, int "mode", int "smooth", int "RGmode", int "RGmodeChroma", bool "_grey")
{
_grey = Default(_grey, false)
mode = Default(mode, 9)
smooth = Default(smooth, 0)
RGmode = Default(RGmode, 2) # 1,2,5,17,18
RGmodeChroma = Default(RGmodeChroma, 1) # 1,2,5,17,18
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = RemoveDust3(clipa, repmode=mode, TRsmooth=smooth, RGmode=RGmode, RGmodeChroma=RGmodeChroma, _grey=_grey)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function LRemoveDust_YUY2(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp, grey=true)
rep = Repair(clensed, clp, mode=repmode, modeU=-1)
rg = RemoveGrain(rep, mode=clmode, modeU=-1)
return (LimitChange(rg, clp, limit, limitU=255))
}
function LRemoveDust_YUY2MC(clip clp, int "mode", int "limit")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = LRemoveDust_YUY2(clipa, clmode=mode, limit=limit)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function LRemoveDust_YV12(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return (LimitChange(rg, clp, limit))
}
function LRemoveDust_YV12MC(clip clp, int "mode", int "limit")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = LRemoveDust_YV12(clipa, clmode=mode, limit=limit)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
# =============================================================================
#
#
function LRemoveDust(clip clp, int "_mode", int "limit")
{
_mode = Default(_mode, 2)
limit = Default(limit, 4)
LL = string(limit)
STR = "x "+LL+" + y < y "+LL+" - x "+LL+" - y > y "+LL+" + x ? ?"
repmode = 2
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=_mode)
trep = TemporalRepair(rg, rep)
trep2 = isyuy2(clp) ? trep.ConvertToYV12() : trep
input2 = isyuy2(clp) ? clp.ConvertToYV12() : clp
clp = (limit != 0) ? yv12lutxy(trep2, input2, yexpr=STR, U=2, V=2) : clp
out = isyuy2(clp) ? clp.ConvertToYUY2().MergeChroma(trep) : clp
return (out)
}
function LRemoveDustMC(clip clp, int "mode", int "limit")
{
mode = Default(mode, 2)
limit = Default(limit, 4)
super = MSuper(clp, pel=2, sharp=2)
# bvec3 = MAnalyse(super, isb=true, blksize=8, delta=3, truemotion=false)
# bvec2 = MAnalyse(super, isb=true, blksize=8, delta=2, truemotion=false)
bvec = MAnalyse(super, isb=true, blksize=8, delta=1, truemotion=false)
fvec = MAnalyse(super, isb=false, blksize=8, delta=1, truemotion=true)
# fvec2 = MAnalyse(super, isb=false, blksize=8, delta=2, truemotion=true)
# fvec3 = MAnalyse(super, isb=false, blksize=8, delta=3, truemotion=true)
backw = MFlow(clp, super, bvec)
forw = MFlow(clp, super, fvec)
# backw2 = MFlow(clp, super, bvec2)
# forw2 = MFlow(clp, super, fvec2)
# backw3 = MFlow(clp, super, bvec3)
# forw3 = MFlow(clp, super, fvec3)
clipa = interleave(backw, clp, forw)
# clipa = interleave(backw2, backw, clp, forw, forw2)
# clipa = interleave(backw3, backw2, backw, clp, forw, forw2, forw3)
clipb = LRemoveDust(clipa, _mode=mode, limit=limit)
clipc = SelectEvery(clipb, 3, 1)
# clipc = SelectEvery(clipb, 5, 1)
# clipc = SelectEvery(clipb, 7, 1)
return clipc
}
cobo
18th February 2012, 16:09
Can anyone see why I should be getting this error message from the script below? I don't see where there's a problem with the script.
Avisynth open failure:
Interleave: videos must be of the same size
(I:\2avi_RemoveSpotsMC4.avs, line 27)
(I:\2avi_RemoveSpotsMC4.avs, line 8)
LoadPlugin("C:\Program Files\AviSynth 2.58\plugins\All\mvtools2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.58\plugins\MaskTools v2.0a48\mt_masktools-25.dll")
LoadPlugin("C:\Program Files\AviSynth 2.58\plugins\All\FFT3Dfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.58\plugins\All\Despot.dll")
avisource("2.avi")
RemoveSpotsMC4()
function RemoveSpotsMC4(clip clp)
{
prefiltered = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
prefilteredSuper = MSuper(prefiltered, pel=2, sharp=2)
osuper = MSuper(clp, pel=2, sharp=2)
vb = MAnalyse(prefilteredSuper, isb=true, delta=1, search=3, overlap=2, lambda=2000, badSAD=18800)
cb = MFlow(osuper, prefilteredSuper, vb, thSCD1=400)
sadb = MMask(clp, vb, ml=100, thSCD1=400, gamma=1, kind=1)
vf = MAnalyse(prefilteredSuper, isb=false, delta=1, search=3, overlap=2, lambda=2000, badSAD=18800)
cf = MFlow(osuper, prefilteredSuper, vf, thSCD1=400)
sadf = MMask(clp, vf, ml=100, thSCD1=400, gamma=1, kind=1)
msadf = MT_Binarize(sadf, 20, upper=true)
msadb = MT_Binarize(sadb, 20, upper=true)
msad = MT_Logic(msadf, msadb, "or")
msad = MT_Expand(msad)
msadi = Interleave(msad, msad, msad)
clp = Interleave(cf, clp, cb)
# big black spots
clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, extmask=msadi)
# thin white lines
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, extmask=msadi)
# thick hair lines (avoid real hair)
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, extmask=msadi)
# lines contacting motion, avoid motion areas
clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, extmask=msadi)
# small dots and dust
clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, extmask=msadi)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, extmask=msadi)
# Long horizontal scratches
clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=Color, extmask=msadi)
# Small compact spots
clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=Color, extmask=msadi)
clp = clp.SelectEvery(3, 1)
return clp
}
Didée
18th February 2012, 16:28
Because the "MFlow" calls do have wrong 1st clip arguments:
cb = MFlow(osuper, prefilteredSuper, vb, thSCD1=400)
...
cf = MFlow(osuper, prefilteredSuper, vf, thSCD1=400)
Those should be "clp" instead of "osuper", together with "osuper" instead of "prefilteredSuper".
Or, maybe it should be "prefiltered" and "prefilteredSuper", I'm not quite sure about the intended workflow-logic.
In any case, the 1st clip argument must be a "normal" clip, and only the 2nd clip argument be a superclip.
cobo
18th February 2012, 18:56
Thanks Didée. Either way gets rid of the initial error message. Unfortunately after dealing with a couple of other ones caused by "Width2" and "COLOR" both versions of the script result in these responses:
Avisynth read error: CAVIStreamSynth: System exception - Access violation at 0x7c911895, reading
Runtime Error!
Program: I:\Virtualdub.exe
R6025
- pure virtual function call
Using QuEnc or MPCH produces the same complaints.
Jenyok
18th February 2012, 22:07
cobo
Use "clp" instead "osuper" in MFlow() function, first clip argument...
I tried, really work.
cobo
18th February 2012, 22:56
I'm still getting the same "Avisynth read error" and "Runtime Error" as in my last post.
Didée
18th February 2012, 23:26
The scipt is crashing for me, too. (After fixing width2/height2/color, by defining them.)
I cannot see why it is, but for me, it is the "MFlow" lines that cause the crash. Swap "MFlow" for "MCompensate", and it works.
cobo
18th February 2012, 23:46
My problem seems to have been caused by using an older version of Despot - 3.5.1.0. The latest version 3.6.1.0 allows me to open the script in Vdub without any error. I'm encoding with QuEnc without a problem for the first five minutes, but there's 14 hours to go yet on a two minute clip.
Didée
19th February 2012, 00:09
14 hours for those 2 minutes? Heaven help, what hardware do you have? When I start that script in Vdub, it's estimating alittle over 13 minutes for the job!
Still I'm wondering why for me it crashes when using MFlow ...
cobo
19th February 2012, 00:19
P4 2.4GHz with 1GB memory. I restarted it on my other PC which has a P4 2.66GHz CPU and 2GB memory and now it's only going to take 12 hours. I used SetMemoryMax(32), I don't know if setting it higher might speed it up.
Edit: Big difference! Deleting the SetMemoryMax line changes the encode time to 40 minutes.
Didée
19th February 2012, 00:29
OOOooohhh, sure! Wait a moment ...
With your script from above -
SetMemoryMax(32) ==> 0.4 fps
SetMemoryMax(128) ==> 3.5 fps
That's on an i7-860, your numbers surely wil be lower. However, SMM(32) definetly is much too little for such a script! As soon as MVTools is involved in any way, I usually wouldn't start lower than SMM(256).
cobo
19th February 2012, 01:52
The encode finished without crashing. I think I got about 1.58fps.
canuckerfan
6th March 2012, 07:25
^Jenyok, I seem to have encountered a typo in the code. In the function RemoveSpotsMC3, you have this piece of code:
.
.
.
forw2 = MFlow(clp, pref_super, fvec2)
forw3 = MFlow(clp, pref_super, fvec3)
clp=interleave(backw3, backw2, backw1, clip, forw1, forw2, forw3)
clp=clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=0, seg=0, color=true, motpn=true, fitluma=true, blur=1) \
.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=0, seg=2, color=true, motpn=true, fitluma=true, blur=1)
.
.
.
which I think should be this:
.
.
.
forw2 = MFlow(clp, pref_super, fvec2)
forw3 = MFlow(clp, pref_super, fvec3)
clp=interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp=clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=0, seg=0, color=true, motpn=true, fitluma=true, blur=1) \
.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=0, seg=2, color=true, motpn=true, fitluma=true, blur=1)
.
.
.
By the way, I've tried all these RemoveSpot functions and what is the difference between them all?
Eluent
8th November 2012, 01:02
@Jenyok : I've added grey option to the filter functions :
#
#
# File: RemoveNoise.avsi
#
# Moution compensated RemoveNoise and variuos filters functions
#
# Functions:
#
# function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey")
# function HQ_Filter(clip clp)
# function MQ_Filter(clip clp)
# function LQ_Filter(clip clp)
#
# function RemoveNoiseMC_HQ(clip clp, int "tlimit", int "rgrain", float "csharp")
# function HQ_Filter2(clip clp)
#
# function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey")
# function VLQ_Filter(clip clp)
# function VLQ_Filter_Ultimate(clip clp)
#
#
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ZZZ_OLD\DEEN_25_DLL_20030813\deen.dll")
#~ LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEBLOCK_25_DLL_20060214\deblock.dll")
#~ Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_LIMITEDSHARPENFASTER\limitedsharpenfaster.avsi")
#~ Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
#~ Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.avsi")
#global idx_c = 4
# =============================================================================
#
#
function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 11)
rgrain = Default(rgrain, 2)
denoise = Default(denoise, 8)
sharp = (rgrain < 1) ? Default(sharp, true) : Default(sharp, false)
csharpen = (rgrain > 2) ? Default(csharpen, 0.17) : (rgrain > 1) ? Default(csharpen, 0.15) : Default(csharpen, 0.13)
# global idx_c = idx_c + 1
dummy = clp.BlankClip(length=0)
csharpen = (sharp) ? csharpen : csharpen + 0.08
_dgr = 0.45 + rgrain * 0.4
cbs = 8
cov = (cbs > 4) ? cbs / 4 : 0
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : (denoise > 8) ? 58 * ccf : (denoise > 5) ? 66 * ccf : 72 * ccf
csh = (sharp) ? 1 : 0
super = MSuper(clp, pel=2, sharp=csh)
bvec3 = MAnalyse(super, isb=true, blksize=cbs, delta=3, truemotion=true, pnew=cpn, overlap=cov)
bvec2 = MAnalyse(super, isb=true, blksize=cbs, delta=2, truemotion=true, pnew=cpn, overlap=cov)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, truemotion=true, pnew=cpn, overlap=cov)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, truemotion=true, pnew=cpn, overlap=cov)
fvec2 = MAnalyse(super, isb=false, blksize=cbs, delta=2, truemotion=true, pnew=cpn, overlap=cov)
fvec3 = MAnalyse(super, isb=false, blksize=cbs, delta=3, truemotion=true, pnew=cpn, overlap=cov)
backw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, bvec1)
forw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, fvec1)
# bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=csh, overlap=cov, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = (rdlimit > 13) ? (rdlimit > 20) ? clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(bvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
# clip.MVFlow(bvec1, idx=idx_c)
# forw1 = (rdlimit > 13) ? (rdlimit > 20) ? clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(fvec1, idx=idx_c).Deblock(quant=16, aOffset=4, bOffset=4) : \
# clip.MVFlow(fvec1, idx=idx_c)
clp = interleave(backw1, clp, forw1)
clp = clp.RemoveDirt2(rdlimit, rgrain, _grey)
# clp = clp.RemoveDirtMC2(rdlimit, rgrain, _grey)
dnc = (denoise == 0) ? clp.RemoveTempGrain(rgrain).SelectEvery(3, 1) : dummy
clp = clp.SelectEvery(3, 1)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=190 + 15 * denoise, \
thSCD1=230 + 5 * denoise)
# dnc = (denoise == 0) ? dnc : clp.MVDenoise(bvec2, bvec1, fvec1, fvec2, thT=denoise, thSAD=190 + 15 * denoise, \
# thmv=40, thSCD1=230 + 5 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=7, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = clp.SeeSaw(dnc, Sstr=csharpen, Szp=12, SdampHi=20, bias=40)
return clp
}
# for slight noisy video or spot/dirt removing only
#
function HQ_Filter(clip clp, bool "grey")
{
grey = Default(grey, false)
clp = clp.RemoveNoiseMC(rdlimit=6, rgrain=1, denoise=0, _grey=grey)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=0, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# medium noise, higher grain:
#
function MQ_Filter(clip clp, bool "grey")
{
grey = Default(grey, false)
clp = clp.RemoveNoiseMC(rdlimit=10, rgrain=2, denoise=8, _grey=grey)
clp = clp.LimitedSharpenFaster(Smode=4, strength=20, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# high noise or analog capture:
#
function LQ_Filter(clip clp, bool "grey")
{
grey = Default(grey, false)
clp = clp.RemoveNoiseMC(rdlimit=18, rgrain=3, denoise=14, _grey=grey)
clp = clp.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
clp = clp.deen("a3d", rad=3, thrY=3, thrUV=5, min=0.25, tthY=2, tthUV=3, scd=6)
clp = clp.LimitedSharpenFaster(Smode=4, strength=24, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# =============================================================================
#
#
function RemoveNoiseMC_HQ(clip clp, int "tlimit", int "rgrain", float "csharp")
{
tlimit = Default(tlimit, 4)
rgrain = Default(rgrain, 1)
csharp = (rgrain > 1) ? Default(csharp, 0.14) : Default(csharp, 0.13)
# global idx_c = idx_c + 1
cbs = 4
ccf = cbs * cbs / 64
cpn = (tlimit > 6) ? 70 * ccf : 75 * ccf
super = MSuper(clp, pel=2, sharp=1)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, overlap=0, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, overlap=0, truemotion=true, pnew=cpn)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=1, overlap=0, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = clip.MVFlow(bvec1, idx=idx_c)
# forw1 = clip.MVFlow(fvec1, idx=idx_c)
dnc = interleave(backw1, clp, forw1)
dnc = dnc.RemoveDirt_HQ(tlimit, rgrain)
# dnc = dnc.RemoveDirtMC_HQ(tlimit, rgrain)
dnc = dnc.SelectEvery(3, 1)
return ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
}
function HQ_Filter2(clip clp)
{
clp = clp.RemoveNoiseMC_HQ(tlimit=4, rgrain=1)
clp = clp.LimitedSharpenFaster(Smode=4, strength=15, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
#global idx_c = 25
# =============================================================================
#
#
function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 24)
rgrain = Default(rgrain, 3)
denoise = Default(denoise, 15)
csharp = (rgrain > 2) ? Default(csharp, 0.32) : Default(csharp, 0.28)
# global idx_c = idx_c + 1
_dgr = 0.7 + rgrain * 0.5
cbs = 8
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : 57 * ccf
super = MSuper(clp, pel=2, sharp=0)
bvec3 = MAnalyse(super, isb=true, blksize=cbs, delta=3, truemotion=true, pnew=cpn)
bvec2 = MAnalyse(super, isb=true, blksize=cbs, delta=2, truemotion=true, pnew=cpn)
bvec1 = MAnalyse(super, isb=true, blksize=cbs, delta=1, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, blksize=cbs, delta=1, truemotion=true, pnew=cpn)
fvec2 = MAnalyse(super, isb=false, blksize=cbs, delta=2, truemotion=true, pnew=cpn)
fvec3 = MAnalyse(super, isb=false, blksize=cbs, delta=3, truemotion=true, pnew=cpn)
backw1 = (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
# bvec3 = clip.MVAnalyse(isb=false, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# bvec2 = clip.MVAnalyse(isb=false, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# bvec1 = clip.MVAnalyse(isb=false, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec1 = clip.MVAnalyse(isb=true, blksize=cbs, delta=1, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec2 = clip.MVAnalyse(isb=true, blksize=cbs, delta=2, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# fvec3 = clip.MVAnalyse(isb=true, blksize=cbs, delta=3, pel=2, sharp=0, truemotion=true, pnew=cpn, idx=idx_c)
# backw1 = (rdlimit > 20) ? clip.MVFlow(bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
# forw1 = (rdlimit > 20) ? clip.MVFlow(fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
# clip.MVFlow(fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
clp = interleave(backw1, clp, forw1)
clp = clp.RemoveDirt2(limit=rdlimit, rgrain=rgrain, _grey=_grey)
# clp = clp.RemoveDirtMC2(limit=rdlimit, rgrain=rgrain, _grey=_grey)
clp = clp.SelectEvery(3, 1)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=160 + 12 * denoise, \
thSCD1=255 + 4 * denoise)
# dnc = clp.MVDenoise(bvec3, bvec2, bvec1, fvec1, fvec2, fvec3, thT=denoise, thSAD=160 + 12 * denoise, \
# thmv=40, thSCD1=255 + 4 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=6, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
return ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
}
function VLQ_Filter(clip clp, bool "grey")
{
grey = Default(grey, false)
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.3, _grey=grey)
clp = clp.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
clp = clp.LimitedSharpenFaster(Smode=4, strength=28, overshoot=1, wide=false, ss_x=1.2, ss_y=1.2)
return clp
}
function VLQ_Filter_Ultimate(clip clp, bool "grey")
{
grey = Default(grey, false)
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, _grey=grey)
clp = clp.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
return clp
}
Also, I can't make removegrainT work (if i don't get unable to load RemoveGrainT.dll, then it's another dll like SSExTools, RemoveDirt(s), I've tried lots of combination, some only give me a message in mpc..).
I've searched and searched applied all the fixes I could find, nothing works. My installed dlls are the required one, I've added AvsRecursion, I already have msvcrt7(0)1.dll etc..
I don't even know if there's a point asking for help on this one. I feel like giving up. (I'm on 2.6, W7 32).
Jenyok
8th November 2012, 07:17
Some changes...
.
#
#
# File: RemoveNoise.avsi
#
# Moution compensated RemoveNoise and variuos filters functions, used RemoveNoise
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey", int "Vectors")
#
# function HQ_Filter(clip clp, int "Vectors")
# function MQ_Filter(clip clp, int "Vectors")
# function LQ_Filter(clip clp, int "Vectors")
#
# function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
# function HQ_Filter2(clip clp, int "Vectors")
#
# function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey", int "Vectors")
#
# function VLQ_Filter(clip clp, int "Vectors")
# function VLQ_Filter_Ultimate(clip clp, int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ZZZ_OLD\DEEN_25_DLL_20030813\deen.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEBLOCK_25_DLL_20060214\deblock.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_LIMITEDSHARPENFASTER\limitedsharpenfaster.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.avsi")
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 11)
rgrain = Default(rgrain, 2)
denoise = Default(denoise, 8)
sharp = (rgrain < 1) ? Default(sharp, true) : Default(sharp, false)
csharpen = (rgrain > 2) ? Default(csharpen, 0.17) : (rgrain > 1) ? Default(csharpen, 0.15) : Default(csharpen, 0.13)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
csharpen = (sharp) ? csharpen : csharpen + 0.08
_dgr = 0.45 + rgrain * 0.4
cbs = 8
cov = (cbs > 4) ? cbs / 4 : 0
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : (denoise > 8) ? 58 * ccf : (denoise > 5) ? 66 * ccf : 72 * ccf
csh = (sharp) ? 1 : 0
super = MSuper(clp, pel=2, sharp=csh)
bvec3 = MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec2 = MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec2 = MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec3 = MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
backw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, bvec1)
forw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, fvec1)
forw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
dnc = RemoveTempGrain(clp, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
dnc = (denoise == 0) ? dnc : NullClip(clp)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = (denoise == 0) ? dnc : MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, \
thSAD=190 + 15 * denoise, thSCD1=230 + 5 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=7, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = clp.SeeSaw(dnc, Sstr=csharpen, Szp=12, SdampHi=20, bias=40)
return clp
}
# for slight noisy video or spot/dirt removing only
#
function HQ_Filter(clip clp, int "Vectors", bool "grey")
{
Vectors = Default(Vectors, 1)
grey = Default(grey, false)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=6, rgrain=1, denoise=0, Vectors=Vectors, _grey=grey)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=0, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# medium noise, higher grain:
#
function MQ_Filter(clip clp, int "Vectors", bool "grey")
{
Vectors = Default(Vectors, 1)
grey = Default(grey, false)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=10, rgrain=2, denoise=8, Vectors=Vectors, _grey=grey)
clp = clp.LimitedSharpenFaster(Smode=4, strength=20, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# high noise or analog capture:
#
function LQ_Filter(clip clp, int "Vectors", bool "grey")
{
Vectors = Default(Vectors, 1)
grey = Default(grey, false)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=18, rgrain=3, denoise=14, Vectors=Vectors, _grey=grey)
clp = clp.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
clp = clp.deen("a3d", rad=3, thrY=3, thrUV=5, min=0.25, tthY=2, tthUV=3, scd=6)
clp = clp.LimitedSharpenFaster(Smode=4, strength=24, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
Jenyok
8th November 2012, 07:17
Some changes, continiue...
.
# =============================================================================
#
#
function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
{
tlimit = Default(tlimit, 4)
rgrain = Default(rgrain, 1)
csharp = (rgrain > 1) ? Default(csharp, 0.14) : Default(csharp, 0.13)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
cbs = 4
ccf = cbs * cbs / 64
cpn = (tlimit > 6) ? 70 * ccf : 75 * ccf
super = MSuper(clp, pel=2, sharp=1)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
dnc = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
dnc = RemoveDirt_HQ(dnc, tlimit, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
clp = (csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
return dnc
}
function HQ_Filter2(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC_HQ(tlimit=4, rgrain=1, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=15, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# =============================================================================
#
#
function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 24)
rgrain = Default(rgrain, 3)
denoise = Default(denoise, 15)
csharp = (rgrain > 2) ? Default(csharp, 0.32) : Default(csharp, 0.28)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
_dgr = 0.7 + rgrain * 0.5
cbs = 8
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : 57 * ccf
super = MSuper(clp, pel=2, sharp=0)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw1 = (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=160 + 12 * denoise, \
thSCD1=255 + 4 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=6, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
return clp
}
function VLQ_Filter(clip clp, int "Vectors", bool "grey")
{
Vectors = Default(Vectors, 1)
grey = Default(grey, false)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.3, Vectors=Vectors, _grey=grey)
clp = clp.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
clp = clp.LimitedSharpenFaster(Smode=4, strength=28, overshoot=1, wide=false, ss_x=1.2, ss_y=1.2)
return clp
}
function VLQ_Filter_Ultimate(clip clp, int "Vectors", bool "grey")
{
Vectors = Default(Vectors, 1)
grey = Default(grey, false)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.48, Vectors=Vectors, _grey=grey)
clp = clp.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
return clp
}
Eluent
10th November 2012, 02:49
Jeniok or Whomever is responsible for the RemoveDirt function :
I might misunderstand the point of the last RemoveGrain(mode=17) call, but as I understand it, and as it showed on the movie I was working on, it killed detail by way of strong denoising, which isn't the point of a removedirt function is it ?
If I'm right I think it should be removed : to the RemoveNoise functions the strong denoising.
Still, thx a lot, after this "fix" I was able to reduce the dirt to the point of almost invisibility and still got a very detailed output, just what I was looking for !
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.