Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MotionThresh by mf
- # Simple scenechange-proof motion threshold
- # Tile outputs 16x16 clip for speed
- # Use tile=true for conditional filtering, tile=false for masking
- function MotionThresh(clip input, float thresh, bool "tile") {
- tile = Default(tile, false)
- black = BlankClip(input, width=16, height=16)
- white = BlankClip(input, width=16, height=16, color=$FFFFFF)
- cond1 = ConditionalFilter(input, white, black, "YDifferenceFromPrevious()", "greaterthan", String(thresh))
- cond2 = ConditionalFilter(input, white, black, "YDifferenceToNext()", "greaterthan", String(thresh))
- Overlay(cond1, cond2, mode="darken")
- tile ? last : PointResize(input.width, input.height)
- }
- ######################################################################
- # MotionRamp by mf
- # Average motion soft-thresholding based on 5 thresholds
- # Dependancies: MotionThresh, BlendMulti
- function MotionRamp(clip input, int thresh1, int thresh2, int thresh3, int thresh4, int thresh5, int "min", int "max", int "floor", int "ceil", int "radius", bool "tile") {
- min = Default(min, 0)
- max = Default(max, 255)
- floor = Default(floor, 0)
- ceil = Default(ceil, 255)
- radius = Default(radius, 2)
- tile = Default(tile, false)
- input
- BlendMulti(MotionThresh(thresh1, tile=true), MotionThresh(thresh2, tile=true), MotionThresh(thresh3, tile=true), MotionThresh(thresh4, tile=true), MotionThresh(thresh5, tile=true))
- TemporalSoften(radius,255,0,255,2)
- Levels(floor, 1, ceil, min, max)
- ColorYUV(levels="TV->PC")
- tile ? last : PointResize(input.width, input.height)
- }
- ##########
- function admfilter(clip input)
- {
- input
- MotionRampadc=last.MotionRamp(5,10,15,20,25,Max=255,Tile=True)
- return ScriptClip("""
- adden=dfttestmc(pp=blur(1.53),lsb=true, Sigma=(AverageLuma(MotionRampadc)/16.0))
- Dither_merge16_8(adden, last.Dither_convert_8_to_16(), last.mt_lut("x 16 < 255 x 75 > 0 255 x 16 - 255 75 16 - / * - ? ?",u=1,v=1), luma=true, u=3,v=3).Ditherpost(mode=7, slice=false)
- """, args="MotionRampadc")
- }
- ##########
- #edge side bleed
- ##########
- function edgesidebleed(clip input, float "w32", float "w16", float "w8", float "w4", float "w2", int "y", int "u", int "v") {
- w2 = Default(w2, 0.001)
- w4 = Default(w4, 0.055)
- w8 = Default(w8, 0.015)
- w16 = Default(w16, 0.02)
- w32 = Default(w32, 0.001)
- input
- shift32 = Crop(Width()-32,0,32,0,true).StackHorizontal(Crop(0,0,-32,0,true))
- w32==0 ? last : raveragew(last,1+w32,shift32,-w32,y=y,u=u,v=v)
- shift16 = Crop(Width()-16,0,16,0,true).StackHorizontal(Crop(0,0,-16,0,true))
- w16==0 ? last : raveragew(last,1+w16,shift16,-w16,y=y,u=u,v=v)
- shift8 = Crop(Width()-8,0,8,0,true).StackHorizontal(Crop(0,0,-8,0,true))
- w8==0 ? last : raveragew(last,1+w8,shift8,-w8,y=y,u=u,v=v)
- shift4 = Crop(Width()-4,0,4,0,true).StackHorizontal(Crop(0,0,-4,0,true))
- w4==0 ? last : raveragew(last,1+w4,shift4,-w4,y=y,u=u,v=v)
- shift2 = Crop(Width()-2,0,2,0,true).StackHorizontal(Crop(0,0,-2,0,true))
- w2==0 ? last : raveragew(last,1+w2,shift2,-w2,y=y,u=u,v=v)
- }
- ###############
- #motion adaptive by A.SONY
- function smam(clip input, clip "prefilter", val "filter", int "pel", int "blksize") {
- defined(filter) ? Assert((Isclip(filter) || IsString(filter)), "'filter' only accepts clip or string") : nop()
- preclip= defined(prefilter) ? prefilter : input.HQdn3d().FFT3DFilter()
- filclip= defined(filter) ? isclip(filter) ? filter : eval("input." + filter) : input.QTGMC(InputType=1, tr0=0, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.0).daa3mod()
- sup = preclip.MSuper(pel=pel,sharp=1)
- fv1 = sup.MAnalyse(isb=false,delta=1,DCT=2,Truemotion=false,blksize=blksize)
- fv2 = sup.MAnalyse(isb=true,delta=1,DCT=2,Truemotion=true,blksize=blksize)
- csaa = filclip
- momask1 = input.MMask(fv1, kind = 1, ml=2)
- momask2 = input.MMask(fv2, kind = 1, ml=3)
- momask = mt_average(momask1,momask2,u=3,v=3)
- mt_merge(input,csaa,momask,u=3,v=3)
- }
- ##############
- # sanimebob by A.SONY
- function sanimebob(clip i, int "useqtgmc", bool "bobpresmooth") {
- bobpresmooth = default (bobpresmooth , false)
- useqtgmc = default (useqtgmc , 0)
- iforbob = bobpresmooth ? i.QTGMC_bob(0,0.5).reduceflicker(strength=2).interlaced60or50(BFF=!(GetParity(i))) : i
- iforbob = bobpresmooth ? isyuy2(i) ? iforbob.SeparateFields.Interleaved2Planar.Repair(i.SeparateFields.Interleaved2Planar,Planar=true).Planar2Interleaved.weave : iforbob.SeparateFields.Repair(i.SeparateFields).weave : i
- pi = i.pointresize(width(i),height(i)+8,0,-4,width(i),height(i)+8.0001)
- yadifclip= isyuy2(i) ? pi.yadifmod(mode=3, edeint=i.eedi3(-2,sclip=iforbob.nnedi3(-2)).pointresize(width(i),height(i)+8,0,-4,width(i),height(i)+8.0001)).crop(0,4,-0,-4).Interleaved2Planar.Repair(i.TDeint(1,emask=iforbob.tmm(1)).Interleaved2Planar,Planar=true).Planar2Interleaved : \
- pi.yadifmod(mode=3, edeint=i.eedi3(-2,sclip=iforbob.nnedi3(-2)).pointresize(width(i),height(i)+8,0,-4,width(i),height(i)+8.0001)).crop(0,4,-0,-4).Repair(i.TDeint(1,emask=iforbob.tmm(1)))
- useqtgmc==0 ? yadifclip : \
- useqtgmc==1 ? iforbob.QTGMC(SourceMatch=3, Lossless=2, EdiExt=yadifclip, tr0=1, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.1) : \
- useqtgmc==2 ? yadifclip.smam(filter=iforbob.QTGMC(SourceMatch=3, Lossless=2, EdiExt=yadifclip, tr0=1, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.1)) : \
- useqtgmc==3 ? yadifclip.smam(filter=yadifclip.QTGMC(InputType=1, tr0=1, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.1)) : \
- useqtgmc==4 ? yadifclip.smam(filter=iforbob.QTGMC(SourceMatch=3, Lossless=2, EdiExt=yadifclip, tr0=1, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.1).daa3mod) : \
- useqtgmc==5 ? yadifclip.smam(filter=yadifclip.QTGMC(InputType=1, tr0=1, tr1=1, tr2=1, lsb=true, lsbd=true, rep0=11, rep1=11, rep2=11, Sharpness=0.1).daa3mod) : \
- useqtgmc==6 ? yadifclip.smam(filter=yadifclip.QTGMC(InputType=1, tr0=0, lsb=true, lsbd=true, Sharpness=0.1)) : \
- yadifclip.smam(filter=yadifclip.QTGMC(InputType=1, tr0=0, lsb=true, lsbd=true, Sharpness=0.0).daa3mod)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement