Advertisement
Guest User

santiag

a guest
Feb 23rd, 2012
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # santiag v1.1
  2. # Simple antialiasing
  3.  
  4. # This program is free software. It comes without any warranty, to
  5. # the extent permitted by applicable law. You can redistribute it
  6. # and/or modify it under the terms of the Do What The Fuck You Want
  7. # To Public License, Version 2, as published by Sam Hocevar. See
  8. # http://sam.zoy.org/wtfpl/COPYING for more details.
  9.  
  10. # type = "nnedi3", "eedi2", "eedi3" or "sangnom"
  11. Function santiag (clip c, int "strh", int "strv", string "type", int "nns", int "aa", int "threads", int "nsize", int "vcheck")
  12. {
  13.     strh    = Default (strh,        1)
  14.     strv    = Default (strv,        1)
  15.     type    = Default (type, "nnedi3")
  16.  
  17.     c
  18.     (strh >= 0) ?             santiag_dir (strh, type, nns=nns, aa=aa, threads=threads, nsize=nsize, vcheck=vcheck)              : last
  19.     (strv >= 0) ? TurnLeft ().santiag_dir (strv, type, nns=nns, aa=aa, threads=threads, nsize=nsize, vcheck=vcheck).TurnRight () : last
  20. }
  21.  
  22. Function santiag_dir (clip c, int strength, string type, int "nns", int "aa", int "threads", int "nsize", int "vcheck")
  23. {
  24.     c
  25.     w = Width ()
  26.     h = Height ()
  27.     santiag_stronger (strength, type, nns=nns, aa=aa, threads=threads, nsize=nsize, vcheck=vcheck)
  28.     Spline36Resize (w, h, 0, 0.5, w, h * 2)
  29. }
  30.  
  31. Function santiag_stronger (clip c, int strength, string type, int "nns", int "aa", int "threads", int "nsize", int "vcheck")
  32. {
  33.     strength = (strength < 0) ? 0 : strength
  34.     field = strength % 2
  35.     dh = (strength <= 0)
  36.  
  37.     (! dh) ? c.santiag_stronger (strength - 1, type) : c
  38.  
  39.       (type == "nnedi3" ) ? santiag_nnedi3  (dh, field, nns=nns, threads=threads, nsize=nsize)
  40. \   : (type == "eedi2"  ) ? santiag_eedi2   (dh, field)
  41. \   : (type == "eedi3"  ) ? santiag_eedi3   (dh, field, nns=nns, threads=threads, nsize=nsize, vcheck=vcheck)
  42. \   : (type == "sangnom") ? santiag_sangnom (dh, field, aa=aa)
  43. \   : Assert (false, "Santiag: unexpected value for type.")
  44. }
  45.  
  46. Function santiag_nnedi3 (clip c, bool dh, int field, int "nns", int "threads", int "nsize")
  47. {
  48.     c.nnedi3 (dh=dh, field=field, nns=nns, threads=threads, nsize=nsize)
  49. }
  50.  
  51. Function santiag_eedi2 (clip c, bool dh, int field)
  52. {
  53.     c
  54.     w = Width ()
  55.     h = Height ()
  56.     (dh) ? last : PointResize (w, h / 2, 0, 1-field, w, h)
  57.     eedi2 (field=field)
  58. }
  59.  
  60. Function santiag_eedi3 (clip c, bool dh, int field, int "nns", int "threads", int "nsize", int "vcheck")
  61. {
  62.     sclip = c.santiag_nnedi3 (dh, field, nns=nns, threads=threads, nsize=nsize)
  63.     c.eedi3 (dh=dh, field=field, threads=threads, vcheck=vcheck, sclip=sclip)
  64. }
  65.  
  66. Function santiag_sangnom (clip c, bool dh, int field, int "aa")
  67. {
  68.     c
  69.     w = Width ()
  70.     h = Height ()
  71.     (dh) ? Spline36Resize (w, h * 2, 0, -0.25, w, h) : last
  72.     SangNom (order=field, aa=aa)
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement