Advertisement
torchlight

Chromatic Aberration Fixer

Apr 15th, 2014
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Chromatic Aberration Fixer (original: http://pastebin.com/wEAp3tuM)
  2. rx/ry adjust how much to resize the red plane; bx/by is the same, but for blue.
  3. warp adjusts warpsharp strength on red/blue planes.
  4. clamp sets whether the chroma (after converting back to yv12) should be limited by the original chroma; this prevents introducing chromatic aberration on, for example, hardsubbed text without chromatic aberration.
  5. */
  6.  
  7. function caf(clip src,float "rx",float "ry",float "bx",float "by",int "warp",bool "clamp")
  8. {
  9. src
  10. rgb=ConvertToRGB32(matrix="rec709")
  11. w=width()
  12. h=height()
  13. rx=default(rx,-1.5)
  14. ry=default(ry,rx)
  15. bx=default(bx,-rx)
  16. by=default(by,bx)
  17. warp=default(warp,4)
  18. clamp=default(clamp,true)
  19. edge=src.aSobel().aBlur(type=0,blur=4)
  20. r=rgb.ShowRed("yv12").Spline36Resize(w,h,rx,ry,w-rx*2,h-ry*2)
  21. b=rgb.ShowBlue("yv12").Spline36Resize(w,h,bx,by,w-bx*2,h-by*2)
  22. rwarp=r.aWarp(edge,depth=warp,chroma=1)
  23. bwarp=b.aWarp(edge,depth=warp,chroma=1)
  24. warp==0?MergeRGB(r,rgb,b):MergeRGB(rwarp,rgb,bwarp)
  25. ConvertToYV12(matrix="rec709")
  26. clamp?mt_lutxy(src,last,"128 x y min x y max clip",y=2,u=3,v=3):MergeLuma(src)
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement