Advertisement
Guest User

CalmGrain (old)

a guest
Nov 22nd, 2011
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function CalmGrain(clip clp,int "tstr",float "nboost",bool "soften")
  2. {
  3. # Requirements: RemoveGrain(SSE3).dll, FluxSmooth.dll, MaskTools2
  4. # By yours truly, Bloax.
  5.  
  6. # ~~~~~ Wuzzis now?
  7. # This 'should' calm grain down, whether or not it improves compressibility is a good question.
  8. # It certainly reduces the eye-tearing effect of heavy noise compression artifacts post-encoding though. :-)
  9. # ~~~~~
  10.  
  11. # ~~~~~ Wuzzis do now?
  12. # "tstr" Is the strength of FluxSmoothT, higher values cause more pixels to hang around for the ride.
  13. # Use values around 10 (for very slight reduction) to about 30-50 (or 255 if you so wish), too high values can look bad though.
  14.  
  15. # "nboost" Is a little something I'd hope tricks RemoveGrain to detect more grain. (Contrast boosting, *cough*)
  16. # Just leave it at the default value, unless you feel like messing around with it.
  17.  
  18. # "soften" Adds a little blurring before FluxSmooth kicks in.
  19. # Results are quite nice, though it blurs the scene a little bit.
  20. # ~~~~~
  21.  
  22. tstr = Default(tstr, 25)
  23. nboost = Default(nboost, 1.5)
  24. soften = Default(soften, false)
  25.  
  26. a = clp.IsYV12() ? clp : clp.ConvertToYV12()
  27.  
  28. b = a.Tweak(Cont=1.66*nboost,Bright=-33*nboost,interp=0).RemoveGrain(mode=4,modeu=-1).RemoveGrain(mode=9,modeu=-1).Tweak(Cont=0.66/nboost,Bright=33)
  29. c = Mt_MakeDiff(a,b).Mt_Expand().Mt_Inflate()
  30. d = soften ? a.RemoveGrain(mode=19).FluxSmoothT(tstr) : a.FluxSmoothT(tstr)
  31. Mt_Merge(a,d,c)
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement