Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ASTDR DeRainbow function v1.61
- function ASTDR(clip input, float "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem", bool "fmc")
- {
- fmc = default(fmc, false)
- sisfield = input.IsFieldBased()
- fnomc = sisfield && !fmc
- strn = Default(strength, 5)
- blstr = Default(blstr, sisfield ? 0.3 : 0.5)
- tht = Default(tht, 255)
- tschrth = Default(tempsoftth, 30)
- tschrrad = Default(tempsoftrad, 3)
- tschrsc = Default(tempsoftsc, 3)
- FluxStv = Default(FluxStv, sisfield ? 60 : 75)
- dcn = Default(dcn, fmc ? 10 : 15)
- edgem = default(edgem, sisfield)
- momask = fmc ? nop() : input.tweak(sat=1.1).mt_motion(thc2=1,thc1=1,thy2=1,thy1=1,y=3,v=3,u=3,tht=tht)
- momaskinv = fmc ? nop() : momask.mt_expand(u=3, v=3).mt_inflate(u=3, v=3).Invert().Levels(0,2,255,0,255)
- inrainev = fnomc ? input.selecteven() : input
- filtered_uv = inrainev.DeCross(ThresholdY=15, Noise=dcn, Margin=1).FluxSmoothST(FluxStv,sisfield ? FluxStv/2 : FluxStv).Mergeluma(inrainev)
- filtered_uv = sisfield ? filtered_uv : filtered_uv.awarpsharp2(depth=4,chroma=6,cplace="MPEG2")
- filtered_uv = filtered_uv.hqdn3d(ls=0,lt=0,cs=sisfield ? strn*2/5 : strn*3/5,ct=strn).temporalsoften(tschrrad,0,tschrth,tschrsc,2).blur(blstr).Mergeluma(inrainev)
- filtered_uv = sisfield ? filtered_uv : filtered_uv.aWarpSharp2(depth=4,chroma=6,cplace="MPEG2")
- filtered_uv = filtered_uv.fft3dfilter(sigma=sisfield ? 0.7 : 1,sigma3=sisfield ? 3 : 4,plane=3,degrid=1)
- fnomc ? eval("""
- filtered_uve = filtered_uv
- inputodd = input.selectodd()
- filtered_uv = inputodd.DeCross(ThresholdY=15, Noise=dcn, Margin=1).FluxSmoothST(FluxStv,sisfield ? FluxStv/2 : FluxStv).Mergeluma(inputodd)
- filtered_uv = filtered_uv.hqdn3d(ls=0,lt=0,cs=sisfield ? strn*2/5 : strn*3/5.0,ct=strn).temporalsoften(tschrrad,0,tschrth,tschrsc,2).blur(blstr).Mergeluma(inputodd)
- filtered_uv = filtered_uv.fft3dfilter(sigma=sisfield ? 0.7 : 1,sigma3=sisfield ? 3 : 4,plane=3,degrid=1)
- filtered_uv = interleave(filtered_uve,filtered_uv)
- """) : nop()
- filtered = fmc ? nop() : mt_merge(filtered_uv, input, momaskinv,y=2,u=3,v=3,luma=true)
- fmc ? filtered_uv : mt_merge(input, filtered, momask.mt_expand(mode="both", y=1,u=3,v=3).mt_inflate(y=1,u=3,v=3),y=2,u=3,v=3)
- edgem ? mt_merge(input, last, input.mt_edge("sobel", 4, 4, 4, 4).mt_expand().mt_inflate(),y=2,u=3,v=3,luma=true) : last
- }
- # ASTDRmc DeRainbow function v1.61
- function ASTDRmc(clip input, float "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem", int "thSAD", clip "prefil")
- {
- sisfield = input.IsFieldBased()
- tht = Default(tht, 255)
- tschrrad = Default(tempsoftrad, sisfield ? 5 : 3).min(5)
- tschrth = Default(tempsoftth, sisfield ? 50 : 30)
- thSAD = Default(thSAD, tht)
- derbmask = sisfield ? nop() : (VersionNumber() < 2.60) ? input.tedgemask(threshY=2,u=0,v=0).mt_inflate() : input.TEMmod(threshY=2,chroma=0).mt_inflate()
- prefil = defined(prefil) ? prefil : input.Blur(1.5)
- ieven = sisfield ? input.selecteven().mc4ASTDRmc(tschrrad,prefil.selecteven(),thSAD) : nop()
- iodd = sisfield ? input.selectodd().mc4ASTDRmc(tschrrad,prefil.selectodd(),thSAD) : nop()
- mcclip = sisfield ? nop() : input.mc4ASTDRmc(tschrrad,prefil,thSAD)
- astev = sisfield ? ieven.ASTDR(strength=strength,tempsoftth=tschrth,tempsoftrad=tschrrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem,fmc=true).selectevery(tschrrad * 2 + 1, tschrrad) : nop()
- astod = sisfield ? iodd.ASTDR(strength=strength,tempsoftth=tschrth,tempsoftrad=tschrrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem,fmc=true).selectevery(tschrrad * 2 + 1, tschrrad) : nop()
- ASTDRclip = !sisfield ? mcclip.ASTDR(strength=strength,tempsoftth=tschrth,tempsoftrad=tschrrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem) : interleave(astev,astod)
- sisfield ? ASTDRclip : mt_merge(input,ASTDRclip.selectevery(tschrrad * 2 + 1, tschrrad), derbmask,luma=true,y=2,u=3,v=3)
- }
- function mc4ASTDRmc(clip input, int "tschrrad", clip "prefil", int "thSAD")
- {
- masuper = prefil.MSuper()
- mcsuper = input.MSuper(levels=1)
- b5v = tschrrad > 4 ? MAnalyse(masuper, delta=5, truemotion = true, isb = true, chroma=false) : nop()
- b4v = tschrrad > 3 ? MAnalyse(masuper, delta=4, truemotion = true, isb = true, chroma=false) : nop()
- b3v = tschrrad > 2 ? MAnalyse(masuper, delta=3, truemotion = true, isb = true, chroma=false) : nop()
- b2v = tschrrad > 1 ? MAnalyse(masuper, delta=2, truemotion = true, isb = true, chroma=false) : nop()
- b1v = MAnalyse(masuper, delta=1, truemotion = true, isb = true, chroma=false)
- f1v = MAnalyse(masuper, delta=1, truemotion = true, isb = false, chroma=false)
- f2v = tschrrad > 1 ? MAnalyse(masuper, delta=2, truemotion = true, isb = false, chroma=false) : nop()
- f3v = tschrrad > 2 ? MAnalyse(masuper, delta=3, truemotion = true, isb = false, chroma=false) : nop()
- f4v = tschrrad > 3 ? MAnalyse(masuper, delta=4, truemotion = true, isb = false, chroma=false) : nop()
- f5v = tschrrad > 4 ? MAnalyse(masuper, delta=5, truemotion = true, isb = false, chroma=false) : nop()
- f5c = tschrrad > 4 ? input.MCompensate(mcsuper, f5v, thSAD=thSAD) : nop()
- f4c = tschrrad > 3 ? input.MCompensate(mcsuper, f4v, thSAD=thSAD) : nop()
- f3c = tschrrad > 2 ? input.MCompensate(mcsuper, f3v, thSAD=thSAD) : nop()
- f2c = tschrrad > 1 ? input.MCompensate(mcsuper, f2v, thSAD=thSAD) : nop()
- f1c = input.MCompensate(mcsuper, f1v)
- b1c = input.MCompensate(mcsuper, b1v)
- b2c = tschrrad > 1 ? input.MCompensate(mcsuper, b2v, thSAD=thSAD) : nop()
- b3c = tschrrad > 2 ? input.MCompensate(mcsuper, b3v, thSAD=thSAD) : nop()
- b4c = tschrrad > 3 ? input.MCompensate(mcsuper, b4v, thSAD=thSAD) : nop()
- b5c = tschrrad > 4 ? input.MCompensate(mcsuper, b5v, thSAD=thSAD) : nop()
- tschrrad == 5 ? interleave(f5c,f4c,f3c,f2c,f1c,input,b1c,b2c,b3c,b4c,b5c) : \
- tschrrad == 4 ? interleave(f4c,f3c,f2c,f1c,input,b1c,b2c,b3c,b4c) : \
- tschrrad == 3 ? interleave(f3c,f2c,f1c,input,b1c,b2c,b3c) : \
- tschrrad == 2 ? interleave(f2c,f1c,input,b1c,b2c) : \
- interleave(f1c,input,b1c)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement