Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: None | Size: 1.12 KB | Hits: 85 | Expires: Never
Copy text to clipboard
  1. # CondLI - Conditional Luma Interpolator v 0.55
  2.  
  3. function LumaInterpolation(clip clp,bool "ym"){
  4. ym=Default(ym,false)
  5. clp
  6. nnedi2(0)
  7. w=width
  8. h=height
  9. c0=last
  10. c1=blackmanresize(w,h*2,taps=8).mt_convolution("0 1 0","0 0 1",u=2,v=2).spline144resize(w,h)
  11. ym? mergeluma(clp,c1) : mergeluma(clp,c0)
  12. return last
  13. }
  14.  
  15. function CondLI(clip clp,float "thr", float "thrm", float "darkm",bool "ym",bool "show"){
  16. thr=Default(thr,20.0)
  17. thrm=Default(thrm,1.0)
  18. darkm=Default(darkm,1.5)
  19. ym=Default(ym,false)
  20. show=Default(show,false)
  21. sthr=String(thr)
  22. clp
  23. li=LumaInterpolation(ym)
  24. separatefields()
  25. a=selecteven()
  26. b=selectodd()
  27. m=a.FrameEvaluate("condli_k=exp(-log("+string(darkm)+")*AverageLuma()/256)*"+string(darkm))
  28. m=m.mt_lutxy(b,"x y > x y - y x -",u=-128,v=-128)
  29. m.ConditionalFilter(clp,li,"YPlaneMax("+string(thrm)+")*condli_k",">",sthr)
  30. show ? stackvertical(m.ScriptClip("""Subtitle(string(YPlaneMax(""" + String(thrm) + """)*condli_k),20,50)
  31. Subtitle("darkm = """ + String(darkm) + """ / thrm = """ + String(thrm) + """ / thr = """ + String(thr) + """",20,20)"""),clp.subtitle("source"),li.subtitle("interpolated")) : last
  32. }