View difference between Paste ID: n4zNifw6 and GSnAMZ4s
SHOW: | | - or go back to the newest paste.
1
# Y'et A'nother H'alo R'educing script
2
3
function YAHR(clip clp)
4
{
5
b1    = clp.minblur(2).removegrain(11,-1)
6
b1D   = mt_makediff(clp,b1)
7
w1    = clp.aWarpSharp(depth=32,blurlevel=2,thresh=0.5)
8
w1b1  = w1.minblur(2,1).removegrain(11,-1)
9
w1b1D = mt_makediff(w1,w1b1)
10
DD    = b1D.repair(w1b1D,13) 
11
DD2   = mt_makediff(b1D,DD)
12
clp.mt_makediff(DD2,U=2,V=2)
13
}
14
15
16
# Y'et A'nother H'alo R'educing script
17
# YAHR A.SONY mod 1.37, original YAHR was by Didée
18
# good deHalo for modern DVD and other cases
19
20-
function YAHR2(clip clp, int "depth", int "blur", bool "useawarp4")
20+
function YAHR2(clip clp, int "depth", int "blur", bool "useawarp4", int "depthV", int "blurV")
21
{
22
23
depth         = Default(depth, 8)
24
useawarp4     = Default(useawarp4, false)
25
26
awarp_params = defined(depthV) ? ",depthV=" + string(depthV) : ""
27
awarp_params = defined(blurV) ? awarp_params + ",blurV=" + string(blurV) : awarp_params
28-
w1    = useawarp4 ? clp.aWarpSharp4xx(depth=depth,blur=blur,chroma=1,useawarp4=true) : clp.aWarpSharp2(depth=depth,blur=blur,chroma=1)
28+
29
b1    = clp.minblur(2).removegrain(11,-1)
30
b1D   = mt_makediff(clp,b1)
31
w1    = useawarp4 ? clp.aWarpSharp4xx(depth=depth,blur=blur,chroma=1,useawarp4=true,depthV=depthV,blurV=blurV) : eval("clp.aWarpSharp2(depth=depth,blur=blur,chroma=1" + awarp_params + ")")
32
w1b1  = w1.minblur(2,1).removegrain(11,-1)
33
w1b1D = mt_makediff(w1,w1b1)
34
DD    = b1D.repair(w1b1D,13) 
35
DD2   = mt_makediff(b1D,DD)
36
clp.mt_makediff(DD2,U=2,V=2)
37-
function YAHR3(clip src, int "depth", int "radius", int "blur", bool "useawarp4")
37+
38
39
40
function YAHR3(clip src, int "depth", int "radius", int "blur", bool "useawarp4", int "depthV", int "blurV")
41
{
42
depth         = Default(depth, 32)
43-
hfil = YAHR2(depth=depth,blur=blur,useawarp4=useawarp4)
43+
44
src
45
edgm = EMask_dhh(ColorYUV(autogain=true), 3, 140,true)
46
hfil = YAHR2(depth=depth,blur=blur,useawarp4=useawarp4,depthV=depthV,blurV=blurV)
47
RM2  = DR_Radius_dhh(edgm.mt_inflate(),radius,0).mt_inflate()
48
DeRinging = mt_Merge(hfil, src, edgm.mt_inflate(155,155))
49
mt_Merge(src, DeRinging, RM2, u=2, v=2)
50
}
51
52
53-
function YAHRmask(clip input, int "expand", int "warpdepth", int "blur", bool "useawarp4", clip "yahr") {
53+
54
# With slight modifications (merging both functions into one). Output should be identical.
55
56
function YAHRmask(clip input, int "expand", int "warpdepth", int "blur", bool "useawarp4", clip "yahr", int "depthV", int "blurV") {
57
58
    expand = Default(expand,     5)
59-
    yahr  = defined(yahr) ? yahr : input.YAHR2(warpde, blur, useawarp4)
59+
60
    blur   = Default(blur,       2)
61
    
62
    yahr  = defined(yahr) ? yahr : input.YAHR2(warpde, blur, useawarp4, depthV, blurV)
63
    
64
    input
65
    vEdge = mt_lutxy(last, mt_expand().mt_expand(),"x y - abs 8 - 7 <<")
66
    
67
    mt_merge(yahr, vEdge.binomialblur(expand*2, u=1, v=1)
68
    \ .mt_lut("x 4 <<")
69
    \ .mt_logic(vEdge.removegrain(12, -1)
70
    \ .mt_invert(), "min"), true)
71
}