View difference between Paste ID: Y0RQYJNr and 1GL9pfZ7
SHOW: | | - or go back to the newest paste.
1-
# FixChromaBleedingMod v1.1
1+
# FixChromaBleedingMod v1.2
2
3-
Function FixChromaBleedingMod (clip input, int "Shift", float "thr", float "strength", bool "f") {
3+
Function FixChromaBleedingMod (clip input, int "Shift", float "thr", float "strength", bool "f", float "opacity") {
4
5
  Shift	= default ( Shift,       -4 )
6
  thr	= default ( thr,       4.0 )
7
  stre = default ( strength,       0.8 )
8
  f =  default ( f,       true )
9
  opacity = default ( opacity,       1 )
10
11-
  areaf = input.tweak3(sat=thr).VtoY.ReduceBy2
11+
12-
  area = input.tweak3(sat=thr).VtoY.Blur(1.5)
12+
  areaf = input.tweak(sat=thr).VtoY.ReduceBy2
13
  area = input.tweak(sat=thr).VtoY.Blur(1)
14
15
  # select and normalize both extremes of the scale
16
  red = f ? areaf.Levels(255,1.0,255,255,0) : area.Levels(255,1.0,255,255,0)
17
  blue = f ? areaf.Levels(0,1.0,0,0,255) : area.Levels(0,1.0,0,0,255)
18
19-
  mask = MergeLuma(red, blue, 0.5).Levels(250,1.0,250,255,0).mt_expand(mode="both", y=3,u=3,v=3).mt_inflate(y=3,u=3,v=3)
19+
20
  maskc = MergeLuma(red, blue, 0.5).Levels(250,1.0,250,255,0)
21
22-
   mask = mask.mt_edge("0 0 0 1 0 0 0 0 0", 0,255,0,255).mt_edge("1 1 1 1 1 1 0 0 0", 0,255,0,255).mt_expand(mode="both", y=3,u=3,v=3).mt_inflate(y=3,u=3,v=3)
22+
23
   maskc = maskc.mt_edge("0 0 0 1 0 0 0 0 0", 0,255,0,255).mt_edge("1 1 1 1 1 1 0 0 0", 0,255,0,255)
24
25-
  mask = mask.BilinearResize(Width(input),Height(input)).Levels(10,1.0,10,0,255).mt_expand(mode="both", y=3,u=3,v=3).mt_inflate(y=3,u=3,v=3)
25+
26
  maskc = maskc.BilinearResize(Width(input),Height(input)).Levels(10,1.0,10,0,255)
27
28-
  input_c = input.ChromaShift(C=Shift).tweak3(sat=stre)
28+
29
  input_c = input.ChromaShift(C=Shift).tweak(sat=stre)
30
31-
  return input.overlay(input_c,mask=mask,mode="blend",opacity=1)
31+
32
  return input.overlay(input_c,mask=maskc,mode="blend",opacity=opacity)
33
}