Advertisement
nanogyth

Untitled

Apr 10th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NGcode.avs version BETA 0
  2.  
  3. LoadPlugin("ExactDedup.dll")
  4.  
  5. function AudioTrimSample(clip clp, int samples){
  6.     clp
  7.     AssumeSampleRate(samples+1)
  8.     DelayAudio(-1)
  9.     AssumeSampleRate(clp.AudioRate)
  10. }
  11.  
  12. function TestSource(string name){
  13.     Assert(VersionNumber >= 2.6,
  14.     \      "[TestSource] AVISynth 2.6 required, found " + VersionString)
  15.  
  16.     a=AviSource(name)
  17.     Assert(a.isRGB, "[TestSource] RGB source required")
  18.     return a
  19. }
  20.  
  21. function resize512(clip clp, int AR_num, int AR_den){
  22.     h = (clp.height +1) /2 *2
  23.     h = (h > 240) ? 240 : h
  24.     w = ((h *AR_num -1) /AR_den +2) /2 *2
  25.     clp.lanczosresize(w, h, taps=2)
  26. }
  27.  
  28. function rgbtoyv12(clip clp){
  29.     clp
  30.     ConvertToYV24(chromaresample=  "point", matrix="PC.601")
  31.     ConvertToYV12(chromaresample="lanczos", matrix="PC.601")
  32. }
  33.  
  34. function TASBlend(clip clp, float "ratio", int "level")  {
  35.     ratio = default(ratio, 2.0 /3)
  36.     assert(ratio >= 0.0 && 1.0 >= ratio,
  37.     \      "[TASBlend] 1.0 >= ratio >= 0.0, it was " + string(ratio))
  38.  
  39.     level = default(level, round(ratio * 257))
  40.     assert(level >= 0 && 257 >= level,
  41.     \      "[TASBlend] 257 >= level >= 0, it was " + string(level))
  42.  
  43.     clp
  44.     Assert(isRGB, "[TASBlend] RGB source required")
  45.     ConverttoRGB32
  46.  
  47.     Interleave(Layer(SelectEvery(4, 0), SelectEvery(4, 1), level=level),
  48.     \          Layer(SelectEvery(4, 2), SelectEvery(4, 3), level=(257-level)))
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement