Dogway
30th April 2011, 16:40
Sorry if Im a bit thick.
Im trying to make up a function to simplify things a little because depending on scene I need to use certain procedures.
If I run this one raw without a function, ram usage goes up to 2140 and render.
Inside a function like the one I show, it reaches 2175 and throws a System Exception (Out of ram I suppose). What's the difference and what is heavy about this? How can I optimize it?
...
setmemorymax(768)
mpg2source...
IVTC
...
trim(6037,6139).do(dejitter=true,stab=true,dups=true)+\
trim(6140,6451).do(dejitter=true,stab=true,dups=true)+\
trim(6452,6540).do(dejitter=true,stab=true,dups=true)+\
trim(6541,6671).do(dejitter=true,stab=true,dups=true)+\
trim(6672,6826).do(dejitter=true,stab=true,dups=true)+\
trim(6827,6922).do(dejitter=true,stab=true,dups=true)+\
trim(6923,6989).do(dejitter=true,stab=true,dups=true)+\
trim(6990,7150).do(dejitter=true,stab=true,dups=true)+\
trim(7151,7293).do(dejitter=true,stab=true,dups=true)+\
trim(7294,7403).do(dejitter=true,stab=true,dups=true)+\
trim(7404,7690).do(dejitter=true,stab=true,dups=true)
function do(clip clp, bool "dejitter",bool "stab",bool "dups"){
clp
# Dejitter
_fft = 6
_thSAD = 600
_bs = 16
_ov = 4
prefilt=clp.FFT3DFilter(sigma=_fft,plane=4,bw=32,bh=32,ow=8,oh=8,bt=5,ncpu=2)
osuper=clp.MSuper()
asuper=prefilt.MSuper()
b3v = MAnalyse(asuper, isb=true, delta=3, blksize=_bs, overlap=_ov)
b2v = MAnalyse(asuper, isb=true, delta=2, blksize=_bs, overlap=_ov)
b1v = MAnalyse(asuper, isb=true, delta=1, blksize=_bs, overlap=_ov)
f1v = MAnalyse(asuper, delta=1, blksize=_bs, overlap=_ov)
f2v = MAnalyse(asuper, delta=2, blksize=_bs, overlap=_ov)
f3v = MAnalyse(asuper, delta=3, blksize=_bs, overlap=_ov)
process = MDeGrain3(osuper, b1v, f1v, b2v, f2v, b3v, f3v, thSAD=_thSAD)
dejit=mt_merge(process, mt_edge("min/max").RemoveGrain(19), U=3,V=3)
# Dering
b=16
s=3
dejitter== true ? dejit.FFT3DFilter(sigma=s,sigma2=s/2,sigma3=s/4,sigma4=s/8,plane=4,bw=b,bh=b,bt=1,ow=b/2,oh=b/2,ncpu=2,sharpen=0.5,wintype=1)
\ : FFT3DFilter(sigma=s,sigma2=s/2,sigma3=s/4,sigma4=s/8,plane=4,bw=b,bh=b,bt=1,ow=b/2,oh=b/2,ncpu=2,sharpen=0.5,wintype=1)
deconv_h = "-1 2 1 -8 20 -31 38 -3 -32 100 -32 -3 38 -31 20 -8 1 2 -1"
mt_convolution (deconv_h, "1", Y=3, U=2, V=2).turnleft.vinverse.turnright.Crop(12, 0, -8, -0)
# Stabilise + Edge Filling
stab==false ? nop : InpaintLogo(last.addborders(8,8,8,8),Mask=msk.converttoyv12)
StabV = (stab==false) ? last : Stabilise(capabsolutemetric(15)).crop(8,8,-8,-8)
# Dup blend
return dups==true ? StabV.Dup(threshold=8,blend=true,copy=true,chroma=false,blksize=8,show=false) : StabV}
Im trying to make up a function to simplify things a little because depending on scene I need to use certain procedures.
If I run this one raw without a function, ram usage goes up to 2140 and render.
Inside a function like the one I show, it reaches 2175 and throws a System Exception (Out of ram I suppose). What's the difference and what is heavy about this? How can I optimize it?
...
setmemorymax(768)
mpg2source...
IVTC
...
trim(6037,6139).do(dejitter=true,stab=true,dups=true)+\
trim(6140,6451).do(dejitter=true,stab=true,dups=true)+\
trim(6452,6540).do(dejitter=true,stab=true,dups=true)+\
trim(6541,6671).do(dejitter=true,stab=true,dups=true)+\
trim(6672,6826).do(dejitter=true,stab=true,dups=true)+\
trim(6827,6922).do(dejitter=true,stab=true,dups=true)+\
trim(6923,6989).do(dejitter=true,stab=true,dups=true)+\
trim(6990,7150).do(dejitter=true,stab=true,dups=true)+\
trim(7151,7293).do(dejitter=true,stab=true,dups=true)+\
trim(7294,7403).do(dejitter=true,stab=true,dups=true)+\
trim(7404,7690).do(dejitter=true,stab=true,dups=true)
function do(clip clp, bool "dejitter",bool "stab",bool "dups"){
clp
# Dejitter
_fft = 6
_thSAD = 600
_bs = 16
_ov = 4
prefilt=clp.FFT3DFilter(sigma=_fft,plane=4,bw=32,bh=32,ow=8,oh=8,bt=5,ncpu=2)
osuper=clp.MSuper()
asuper=prefilt.MSuper()
b3v = MAnalyse(asuper, isb=true, delta=3, blksize=_bs, overlap=_ov)
b2v = MAnalyse(asuper, isb=true, delta=2, blksize=_bs, overlap=_ov)
b1v = MAnalyse(asuper, isb=true, delta=1, blksize=_bs, overlap=_ov)
f1v = MAnalyse(asuper, delta=1, blksize=_bs, overlap=_ov)
f2v = MAnalyse(asuper, delta=2, blksize=_bs, overlap=_ov)
f3v = MAnalyse(asuper, delta=3, blksize=_bs, overlap=_ov)
process = MDeGrain3(osuper, b1v, f1v, b2v, f2v, b3v, f3v, thSAD=_thSAD)
dejit=mt_merge(process, mt_edge("min/max").RemoveGrain(19), U=3,V=3)
# Dering
b=16
s=3
dejitter== true ? dejit.FFT3DFilter(sigma=s,sigma2=s/2,sigma3=s/4,sigma4=s/8,plane=4,bw=b,bh=b,bt=1,ow=b/2,oh=b/2,ncpu=2,sharpen=0.5,wintype=1)
\ : FFT3DFilter(sigma=s,sigma2=s/2,sigma3=s/4,sigma4=s/8,plane=4,bw=b,bh=b,bt=1,ow=b/2,oh=b/2,ncpu=2,sharpen=0.5,wintype=1)
deconv_h = "-1 2 1 -8 20 -31 38 -3 -32 100 -32 -3 38 -31 20 -8 1 2 -1"
mt_convolution (deconv_h, "1", Y=3, U=2, V=2).turnleft.vinverse.turnright.Crop(12, 0, -8, -0)
# Stabilise + Edge Filling
stab==false ? nop : InpaintLogo(last.addborders(8,8,8,8),Mask=msk.converttoyv12)
StabV = (stab==false) ? last : Stabilise(capabsolutemetric(15)).crop(8,8,-8,-8)
# Dup blend
return dups==true ? StabV.Dup(threshold=8,blend=true,copy=true,chroma=false,blksize=8,show=false) : StabV}