Advertisement
Guest User

CalmGrain, pre-RedAverage version

a guest
Dec 3rd, 2011
336
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" Does something to the difference mask, not quite sure of the big, bad details.
  16. # It does seem to improve compression by a little bit, so just leave it be.
  17.  
  18. # "soften" Is a deprecated feature (for now, at least*), it softens the picture before FluxSmooth kicks in.
  19. # Which results in softer noise, or whatever the initial denoising catches.
  20. # * With me, that usually means for a long, long while!
  21.  
  22. tstr = Default(tstr, 40)
  23. nboost = Default(nboost, 1.25)
  24. soften = Default(soften, false)
  25.  
  26. a = clp.IsYV12() ? clp : clp.ConvertToYV12()
  27.  
  28. b = a.RemoveGrain(1,-1).RemoveGrain(18,-1).RemoveGrain(17,-1)
  29. c = Mt_MakeDiff(a,b).Mt_Expand().Tweak(Cont=nboost,Bright=(0-nboost*8))
  30. d = soften ? a.RemoveGrain(19).FluxSmoothT(tstr) : a.FluxSmoothT(tstr)
  31. Mt_Merge(a,d,c)
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement