View difference between Paste ID: wLAqgg8h and QQ5ycB6f
SHOW: | | - or go back to the newest paste.
1
# ASTDR DeRainbow function v1.53
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, false)
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
  filtered_uv = input.DeCross(ThresholdY=15, Noise=dcn, Margin=1).FluxSmoothST(FluxStv,FluxStv).Mergeluma(input).awarpsharp2(depth=4,chroma=6,cplace="MPEG2").hqdn3d(ls=0,lt=0,cs=strn*3/5,ct=strn)
19
              \ .temporalsoften(tschrrad,0,tschrth,tschrsc,2).blur(blstr).Mergeluma(input).aWarpSharp2(depth=4,chroma=6,cplace="MPEG2").fft3dfilter(sigma=1,sigma3=4,plane=3,degrid=1)
20
 
21
  filtered = mt_merge(filtered_uv, input, momaskinv,y=2,u=3,v=3,luma=true)
22
  
23
  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)
24
  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
25
  }
26
27-
# ASTDRmc DeRainbow function v1.0
27+
# ASTDRmc DeRainbow function v1.5
28
29-
  function ASTDRmc(clip prerb, int "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem")
29+
  function ASTDRmc(clip prerb, int "strength", int "tempsoftth", int "tempsoftrad", int "tempsoftsc", float "blstr", int "tht", int "FluxStv", int "dcn", bool "edgem", int "thSAD")
30
  {
31
32
  tht      = Default(tht, 255)
33-
derbbackward_vectors = MAnalyse(derbsuper, truemotion = true, isb = true, chroma=false)
33+
  tschrrad = Default(tempsoftrad, 3).min(5)
34-
derbforward_vectors = MAnalyse(derbsuper, truemotion = true, isb = false, chroma=false)
34+
  thSAD    = Default(thSAD, tht)
35-
derbforward_compensation = prerb.MCompensate(derbsuper, derbforward_vectors)
35+
36-
derbbackward_compensation = prerb.MCompensate(derbsuper, derbbackward_vectors)
36+
37-
mcclip = interleave(derbforward_compensation,prerb,derbbackward_compensation)
37+
38-
ASTDRclip = mcclip.ASTDR(strength=strength,tempsoftth=tempsoftth,tempsoftrad=tempsoftrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem).selectevery(3,1)
38+
39-
mt_merge(prerb,ASTDRclip, derbmask,luma=true,y=2,u=3,v=3)
39+
40
b5v = tschrrad > 4 ? MAnalyse(derbsuper, delta=5, truemotion = true, isb = true, chroma=false) : nop()
41
b4v = tschrrad > 3 ? MAnalyse(derbsuper, delta=4, truemotion = true, isb = true, chroma=false) : nop()
42
b3v = tschrrad > 2 ? MAnalyse(derbsuper, delta=3, truemotion = true, isb = true, chroma=false) : nop()
43
b2v = tschrrad > 1 ? MAnalyse(derbsuper, delta=2, truemotion = true, isb = true, chroma=false) : nop()
44
b1v = MAnalyse(derbsuper, delta=1, truemotion = true, isb = true, chroma=false)
45
f1v = MAnalyse(derbsuper, delta=1, truemotion = true, isb = false, chroma=false)
46
f2v = tschrrad > 1 ? MAnalyse(derbsuper, delta=2, truemotion = true, isb = false, chroma=false) : nop()
47
f3v = tschrrad > 2 ? MAnalyse(derbsuper, delta=3, truemotion = true, isb = false, chroma=false) : nop()
48
f4v = tschrrad > 3 ? MAnalyse(derbsuper, delta=4, truemotion = true, isb = false, chroma=false) : nop()
49
f5v = tschrrad > 4 ? MAnalyse(derbsuper, delta=5, truemotion = true, isb = false, chroma=false) : nop()
50
51
f5c = tschrrad > 4 ? prerb.MCompensate(derbsuper, f5v, thSAD=thSAD) : nop()
52
f4c = tschrrad > 3 ? prerb.MCompensate(derbsuper, f4v, thSAD=thSAD) : nop()
53
f3c = tschrrad > 2 ? prerb.MCompensate(derbsuper, f3v, thSAD=thSAD) : nop()
54
f2c = tschrrad > 1 ? prerb.MCompensate(derbsuper, f2v, thSAD=thSAD) : nop()
55
f1c = prerb.MCompensate(derbsuper, f1v)
56
b1c = prerb.MCompensate(derbsuper, b1v)
57
b2c = tschrrad > 1 ? prerb.MCompensate(derbsuper, b2v, thSAD=thSAD) : nop()
58
b3c = tschrrad > 2 ? prerb.MCompensate(derbsuper, b3v, thSAD=thSAD) : nop()
59
b4c = tschrrad > 3 ? prerb.MCompensate(derbsuper, b4v, thSAD=thSAD) : nop()
60
b5c = tschrrad > 4 ? prerb.MCompensate(derbsuper, b5v, thSAD=thSAD) : nop()
61
62
mcclip = tschrrad == 5 ? interleave(f5c,f4c,f3c,f2c,f1c,prerb,b1c,b2c,b3c,b4c,b5c) : \
63
         tschrrad == 4 ? interleave(f4c,f3c,f2c,f1c,prerb,b1c,b2c,b3c,b4c) : \
64
         tschrrad == 3 ? interleave(f3c,f2c,f1c,prerb,b1c,b2c,b3c) : \
65
         tschrrad == 2 ? interleave(f2c,f1c,prerb,b1c,b2c) : \
66
                         interleave(f1c,prerb,b1c)
67
68
ASTDRclip = mcclip.ASTDR(strength=strength,tempsoftth=tempsoftth,tempsoftrad=tempsoftrad,tempsoftsc=tempsoftsc,blstr=blstr,tht=tht,FluxStv=FluxStv,dcn=dcn,edgem=edgem)
69
70
mt_merge(prerb,ASTDRclip.selectevery(tschrrad * 2 + 1, tschrrad), derbmask,luma=true,y=2,u=3,v=3)
71
  }