board123
23rd July 2010, 04:42
I'm a newb to MVTools, so pardon me if I've done something catastrophic here. I'm trying to make a specialized MDegrain script that's going to be used exclusive for HD anime content.
The script I have right now works okay, but I'm looking to speed it up a bit. In particular, I'd like to know if there's anything I can do with the MSuper and MAnalyse parameters to make them better suited for anime content. For example, would decreasing search in MSuper be faster and cause minimal quality drop?
Any improvements (speed or quality) for this script would be greatly appreciated.
function MDegrainA ( clip input, int "radius", int "plane", int "thSAD", bool "preblur", \
int "pel", int "sharp", int "blksize", int "overlap", bool "truemotion", \
int "maxr", int "strength", int "dRad")
{
radius = default( radius, 1 ) # Temporal radius to select MDegrain1/2/3
plane = default( plane, 4 ) # 0=Y, 1=U, 2=V, 3=UV, 4=YUV
thSAD = default( thSAD, 400 ) # Threshold for block SAD
pel = default( pel, 2 ) # Motion estimation accuracy. 1=pixel, 2=half pixel, 4=quarter pixel
sharp = default( sharp, 2 ) # Subpixel interpolation
blksize = default( blksize, 8 ) # MAnalyse block size
overlap = default( overlap, blksize/2 ) # MAnalyse block overlap
tm = default( truemotion,true) # Truemotion
preblur = default( preblur, false ) # Use FFT3DFilter to preblur noisy input
maxr = default( maxr, 3 ) # Temporal radius for TTempSmooth
strength= default( strength, 3 ) # Smoothing strength for TTempSmooth
dRad = default( dRad, 3 ) # Spatial radius for deen
src = preblur ? input.TTempSmooth(maxr=maxr, strength=strength) : input
super = src.MSuper(pel=pel, sharp=sharp)
pb_super = preblur ? src.deen("a2d",mode=dRad).deen("a2d",mode=dRad).MSuper(pel=pel, sharp=sharp) : super
vb3 = (radius >= 3) ? MAnalyse(pb_super, blksize=blksize, isb = true, delta = 3, overlap=overlap, truemotion=tm) : BlankClip()
vb2 = (radius >= 2) ? MAnalyse(pb_super, blksize=blksize, isb = true, delta = 2, overlap=overlap, truemotion=tm) : BlankClip()
vb1 = MAnalyse(pb_super, blksize=blksize, isb = true, delta = 1, overlap=overlap, truemotion=tm)
vf1 = MAnalyse(pb_super, blksize=blksize, isb = false, delta = 1, overlap=overlap, truemotion=tm)
vf2 = (radius >= 2) ? MAnalyse(pb_super, blksize=blksize, isb = false, delta = 2, overlap=overlap, truemotion=tm) : BlankClip()
vf3 = (radius >= 3) ? MAnalyse(pb_super, blksize=blksize, isb = false, delta = 3, overlap=overlap, truemotion=tm) : BlankClip()
output = (radius == 1) ? src.MDegrain1(super, vb1, vf1, thSAD=thSAD, plane=plane)
\ : (radius == 2) ? src.MDegrain2(super, vb1, vf1, vb2, vf2, thSAD=thSAD, plane=plane)
\ : src.MDegrain3(super, vb1, vf1, vb2, vf2, vb3, vf3, thSAD=thSAD, plane=plane)
return output
}
The script I have right now works okay, but I'm looking to speed it up a bit. In particular, I'd like to know if there's anything I can do with the MSuper and MAnalyse parameters to make them better suited for anime content. For example, would decreasing search in MSuper be faster and cause minimal quality drop?
Any improvements (speed or quality) for this script would be greatly appreciated.
function MDegrainA ( clip input, int "radius", int "plane", int "thSAD", bool "preblur", \
int "pel", int "sharp", int "blksize", int "overlap", bool "truemotion", \
int "maxr", int "strength", int "dRad")
{
radius = default( radius, 1 ) # Temporal radius to select MDegrain1/2/3
plane = default( plane, 4 ) # 0=Y, 1=U, 2=V, 3=UV, 4=YUV
thSAD = default( thSAD, 400 ) # Threshold for block SAD
pel = default( pel, 2 ) # Motion estimation accuracy. 1=pixel, 2=half pixel, 4=quarter pixel
sharp = default( sharp, 2 ) # Subpixel interpolation
blksize = default( blksize, 8 ) # MAnalyse block size
overlap = default( overlap, blksize/2 ) # MAnalyse block overlap
tm = default( truemotion,true) # Truemotion
preblur = default( preblur, false ) # Use FFT3DFilter to preblur noisy input
maxr = default( maxr, 3 ) # Temporal radius for TTempSmooth
strength= default( strength, 3 ) # Smoothing strength for TTempSmooth
dRad = default( dRad, 3 ) # Spatial radius for deen
src = preblur ? input.TTempSmooth(maxr=maxr, strength=strength) : input
super = src.MSuper(pel=pel, sharp=sharp)
pb_super = preblur ? src.deen("a2d",mode=dRad).deen("a2d",mode=dRad).MSuper(pel=pel, sharp=sharp) : super
vb3 = (radius >= 3) ? MAnalyse(pb_super, blksize=blksize, isb = true, delta = 3, overlap=overlap, truemotion=tm) : BlankClip()
vb2 = (radius >= 2) ? MAnalyse(pb_super, blksize=blksize, isb = true, delta = 2, overlap=overlap, truemotion=tm) : BlankClip()
vb1 = MAnalyse(pb_super, blksize=blksize, isb = true, delta = 1, overlap=overlap, truemotion=tm)
vf1 = MAnalyse(pb_super, blksize=blksize, isb = false, delta = 1, overlap=overlap, truemotion=tm)
vf2 = (radius >= 2) ? MAnalyse(pb_super, blksize=blksize, isb = false, delta = 2, overlap=overlap, truemotion=tm) : BlankClip()
vf3 = (radius >= 3) ? MAnalyse(pb_super, blksize=blksize, isb = false, delta = 3, overlap=overlap, truemotion=tm) : BlankClip()
output = (radius == 1) ? src.MDegrain1(super, vb1, vf1, thSAD=thSAD, plane=plane)
\ : (radius == 2) ? src.MDegrain2(super, vb1, vf1, vb2, vf2, thSAD=thSAD, plane=plane)
\ : src.MDegrain3(super, vb1, vf1, vb2, vf2, vb3, vf3, thSAD=thSAD, plane=plane)
return output
}