Guest User

ASTDR and ASTDRmc

a guest
Jan 1st, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # ASTDR DeRainbow function v1.56
  2.  
  3.   function ASTDR(clip input, int "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem")
  4.   {
  5.   strn          = Default(strength, 5)
  6.   blstr         = Default(blstr, 0.5)
  7.   tht           = Default(tht, 255)
  8.   tschrth       = Default(tempsoftth, 30)
  9.   tschrrad      = Default(tempsoftrad, 3)
  10.   tschrsc       = Default(tempsoftsc, 3)
  11.   FluxStv       = Default(FluxStv, 75)
  12.   dcn           = Default(dcn, 15)
  13.   edgem         = default(edgem, input.IsFieldBased())
  14.  
  15.   momask    = input.tweak(sat=1.1).mt_motion(thc2=1,thc1=1,thy2=1,thy1=1,y=3,v=3,u=3,tht=tht)
  16.   momaskinv = momask.mt_expand(u=3, v=3).mt_inflate(u=3, v=3).Invert().Levels(0,2,255,0,255)
  17.  
  18.   inrainev    = input.IsFieldBased() ? input.selecteven() : input
  19.   filtered_uv = inrainev.DeCross(ThresholdY=15, Noise=dcn, Margin=1).FluxSmoothST(FluxStv,FluxStv).Mergeluma(input)
  20.   filtered_uv = input.IsFieldBased() ? filtered_uv : filtered_uv.awarpsharp2(depth=4,chroma=6,cplace="MPEG2")
  21.   filtered_uv = filtered_uv.hqdn3d(ls=0,lt=0,cs=strn*3/5,ct=strn).temporalsoften(tschrrad,0,tschrth,tschrsc,2).blur(blstr).Mergeluma(input)
  22.   filtered_uv = input.IsFieldBased() ? filtered_uv : filtered_uv.aWarpSharp2(depth=4,chroma=6,cplace="MPEG2")
  23.   filtered_uv = filtered_uv.fft3dfilter(sigma=1,sigma3=4,plane=3,degrid=1)
  24.  
  25.   input.IsFieldBased() ? eval("""
  26. filtered_uve = filtered_uv
  27.  filtered_uv = input.selectodd().DeCross(ThresholdY=15, Noise=dcn, Margin=1).FluxSmoothST(FluxStv,FluxStv).Mergeluma(input)
  28.  filtered_uv = filtered_uv.awarpsharp2(depth=4,chroma=6,cplace="MPEG2")
  29.  filtered_uv = filtered_uv.hqdn3d(ls=0,lt=0,cs=strn*3/5,ct=strn).temporalsoften(tschrrad,0,tschrth,tschrsc,2).blur(blstr).Mergeluma(input)
  30.  filtered_uv = filtered_uv.aWarpSharp2(depth=4,chroma=6,cplace="MPEG2")
  31.  filtered_uv = filtered_uv.fft3dfilter(sigma=1,sigma3=4,plane=3,degrid=1)
  32.  filtered_uv = interleave(filtered_uve,filtered_uv)
  33.                              """) : nop()
  34.  
  35.   filtered = mt_merge(filtered_uv, input, momaskinv,y=2,u=3,v=3,luma=true)
  36.  
  37.   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)
  38.   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
  39.   }
  40.  
  41. # ASTDRmc DeRainbow function v1.56
  42.  
  43.   function ASTDRmc(clip input, int "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem", int "thSAD", clip "prefil")
  44.   {
  45.  
  46.   tht      = Default(tht, 255)
  47.   tschrrad = Default(tempsoftrad, 3).min(5)
  48.   thSAD    = Default(thSAD, tht)
  49.  
  50. sisfield = input.IsFieldBased()
  51. derbmask = sisfield ? nop() : (VersionNumber() < 2.60) ? input.tedgemask(threshY=2,u=0,v=0).mt_inflate() : input.TEMmod(threshY=2,chroma=0).mt_inflate()
  52.  
  53. prefil    = defined(prefil) ? prefil : input.Blur(1.5)
  54. ieven     = sisfield ? input.selecteven().mc4ASTDRmc(tschrrad,prefil.selecteven(),thSAD) : nop()
  55. iodd      = sisfield ? input.selectodd().mc4ASTDRmc(tschrrad,prefil.selectodd(),thSAD) : nop()
  56. mcclip    = sisfield ? interleave(ieven,iodd) : input.mc4ASTDRmc(tschrrad,prefil,thSAD)
  57.  
  58. ASTDRclip = mcclip.ASTDR(strength=strength,tempsoftth=tempsoftth,tempsoftrad=tempsoftrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem)
  59.  
  60. sisfield ? ASTDRclip.selectevery(tschrrad * 2 + 1, tschrrad) : mt_merge(input,ASTDRclip.selectevery(tschrrad * 2 + 1, tschrrad), derbmask,luma=true,y=2,u=3,v=3)
  61.   }
  62.  
  63.   function mc4ASTDRmc(clip input, int "tschrrad", clip "prefil", int "thSAD")
  64.   {
  65. masuper = prefil.MSuper()
  66. mcsuper = input.MSuper(levels=1)
  67.  
  68. b5v = tschrrad > 4 ? MAnalyse(masuper, delta=5, truemotion = true, isb = true, chroma=false) : nop()
  69. b4v = tschrrad > 3 ? MAnalyse(masuper, delta=4, truemotion = true, isb = true, chroma=false) : nop()
  70. b3v = tschrrad > 2 ? MAnalyse(masuper, delta=3, truemotion = true, isb = true, chroma=false) : nop()
  71. b2v = tschrrad > 1 ? MAnalyse(masuper, delta=2, truemotion = true, isb = true, chroma=false) : nop()
  72. b1v = MAnalyse(masuper, delta=1, truemotion = true, isb = true, chroma=false)
  73. f1v = MAnalyse(masuper, delta=1, truemotion = true, isb = false, chroma=false)
  74. f2v = tschrrad > 1 ? MAnalyse(masuper, delta=2, truemotion = true, isb = false, chroma=false) : nop()
  75. f3v = tschrrad > 2 ? MAnalyse(masuper, delta=3, truemotion = true, isb = false, chroma=false) : nop()
  76. f4v = tschrrad > 3 ? MAnalyse(masuper, delta=4, truemotion = true, isb = false, chroma=false) : nop()
  77. f5v = tschrrad > 4 ? MAnalyse(masuper, delta=5, truemotion = true, isb = false, chroma=false) : nop()
  78.  
  79. f5c = tschrrad > 4 ? input.MCompensate(mcsuper, f5v, thSAD=thSAD) : nop()
  80. f4c = tschrrad > 3 ? input.MCompensate(mcsuper, f4v, thSAD=thSAD) : nop()
  81. f3c = tschrrad > 2 ? input.MCompensate(mcsuper, f3v, thSAD=thSAD) : nop()
  82. f2c = tschrrad > 1 ? input.MCompensate(mcsuper, f2v, thSAD=thSAD) : nop()
  83. f1c = input.MCompensate(mcsuper, f1v)
  84. b1c = input.MCompensate(mcsuper, b1v)
  85. b2c = tschrrad > 1 ? input.MCompensate(mcsuper, b2v, thSAD=thSAD) : nop()
  86. b3c = tschrrad > 2 ? input.MCompensate(mcsuper, b3v, thSAD=thSAD) : nop()
  87. b4c = tschrrad > 3 ? input.MCompensate(mcsuper, b4v, thSAD=thSAD) : nop()
  88. b5c = tschrrad > 4 ? input.MCompensate(mcsuper, b5v, thSAD=thSAD) : nop()
  89.  
  90.          tschrrad == 5 ? interleave(f5c,f4c,f3c,f2c,f1c,input,b1c,b2c,b3c,b4c,b5c) : \
  91.          tschrrad == 4 ? interleave(f4c,f3c,f2c,f1c,input,b1c,b2c,b3c,b4c) : \
  92.          tschrrad == 3 ? interleave(f3c,f2c,f1c,input,b1c,b2c,b3c) : \
  93.          tschrrad == 2 ? interleave(f2c,f1c,input,b1c,b2c) : \
  94.                          interleave(f1c,input,b1c)
  95.   }
Advertisement
Add Comment
Please, Sign In to add comment