Advertisement
Guest User

Untitled

a guest
Feb 20th, 2012
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AVISource("00a.avi", "00b.avi")
  2. ConvertToRGB32
  3.  
  4. Range( 8432, 13260, Fix_HUD)
  5. Range(15344, 77760, Fix_HUD)
  6.  
  7. p01 = Trim(    0,   349).Simple30                       # title screen: "Nintendo"
  8. p02 = Trim(  350,   387).TASBlend                       # title screen: monitors
  9. p03 = Trim(  388,  2157).Simple30                       # intro
  10. p04 = Trim( 2158,  2791).Mother_Brain                   # intro: Mother Brain
  11. p05 = Trim( 2792,  7521).Simple30                       # intro
  12. p06 = Trim( 7522,  8239).TASBlend                       # approaching Space Colony
  13. p07 = Trim( 8240, 13370).Advanced30                     # Space Colony gameplay
  14. p08 = Trim(13371, 15343).TASBlend                       # exploding Space Colony and approaching Zebes
  15. p09 = Trim(15344, 29753).Advanced30                     # gameplay
  16. p10 = Trim(29754, 30101).Simple30                       # title screen: "Nintendo"
  17. p11 = Trim(30102, 30139).TASBlend                       # title screen: monitors
  18. p12 = Trim(30140, 30707).Simple30                       # copy & load savegame
  19. p13 = Trim(30708, 68225).Advanced30                     # gameplay up to Tourian save station
  20. p14 = Trim(68226, 68573).Simple30                       # title screen: "Nintendo"
  21. p15 = Trim(68574, 68613).TASBlend                       # title screen: monitors
  22. p16 = Trim(68614, 69027).Simple30                       # load savegame
  23. p17 = Trim(69028, 70007).Advanced30                     # gameplay up to death
  24. p18 = Trim(70008, 70495).Simple30                       # death and try again
  25. p19 = Trim(70496, 70545).TASBlend                       # title screen: monitors
  26. p20 = Trim(70546, 70931).Simple30                       # load savegame
  27. p21 = Trim(70932, 77761).Advanced30                     # gameplay up to last input
  28. p22 = Trim(77762,     0).Simple30                       # extro
  29. p01+p02+p03+p04+p05+p06+p07+p08+p09+p10+p11+p12+p13+p14+p15+p16+p17+p18+p19+p20+p21+p22
  30.  
  31. Trim(0, -45900)
  32.  
  33. PointResize(1792, 1344)
  34. BilinearResize(960, 720)
  35. ConvertToYV24(chromaresample="point", matrix="PC.601")
  36. ConvertToYV12(chromaresample="point", matrix="PC.601")
  37.  
  38.  
  39. # ------------------------------------------------------------------------------------------------------------------------------
  40.  
  41.  
  42. function Advanced30(clip c)  {
  43.         c
  44.         # TASBlend
  45.         Deblink
  46. }
  47.  
  48.  
  49. function Fix_HUD(clip c)  {
  50.         HUD  = c.Crop(0,  0, 0, 31).Crop(0, 1, 0, 0).AddBorders(0, 1, 0, 0)
  51.         Main = c.Crop(0, 31, 0,  0).Crop(0, 1, 0, 0).AddBorders(0, 1, 0, 0)
  52.         StackVertical(HUD, Main)
  53. }
  54.  
  55.  
  56. function Simple30(clip c)  {
  57.         c
  58.         SelectEven
  59.         # Subtitle("SelectEven")
  60. }
  61.  
  62.  
  63. # ------------------------------------------------------------------------------------------------------------------------------
  64.  
  65.  
  66. function BlendFrames(clip c)  {
  67.         # reduces framerate to 1/2 by blending the current frame with the last frame
  68.         Layer(c, BlankClip(c, 1) + c, level=128)
  69.         # Subtitle("BlendFrames")
  70. }
  71.  
  72.  
  73. function TASBlend(clip c, float "ratio")  {
  74.         # reduces framerate to 1/2 but leaves flicker effects partly visible
  75.         # blends frame pairs with alternating opacity (default is 2/3+1/3;1/3+2/3)
  76.         # optional "ratio" is the opacity of the first frame out of the four
  77.         ratio    = default(ratio, 2.0 / 3)
  78.         opacity1 = round((1 - ratio) * 257)
  79.         opacity2 = round((    ratio) * 257)
  80.         c
  81.         Interleave(Layer(SelectEvery(4, 0), SelectEvery(4, 1), level=opacity1),
  82.         \          Layer(SelectEvery(4, 2), SelectEvery(4, 3), level=opacity2))
  83.         # Subtitle("TASBlend")
  84. }
  85.  
  86.  
  87. function Deblink(clip c) {
  88.         # blend on the frame it blinks in and out
  89.         blink1 = c.ng_BlinkMask
  90.         blink2 = MT_Logic(blink1.SelectEvery(1, -1), blink1, mode="or").ConvertToRGB32
  91.         Layer(c, c.Trim(1, 0).Mask(blink2), level=127)
  92.         SelectEven
  93.         # Subtitle("Deblink")
  94. }
  95.  
  96.  
  97. function ng_BlinkMask(clip c, int "ml")  {
  98.         ml    = default(ml, 128)
  99.         src   = c.ConvertToYV12
  100.         super = MSuper(src, pel=1)
  101.         VecF  = MAnalyse(super, isb=false, blksize=4)
  102.         VecB  = MAnalyse(super, isb=true , blksize=4)
  103.         MaskF = Mmask(src, VecF, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  104.         MaskB = Mmask(src, VecB, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  105.  
  106.         eo0_to  = MaskF.SelectEvery(2, 1)
  107.         oe_from = MaskB.SelectEvery(2, 1)
  108.         front   = MT_Logic(eo0_to, oe_from, mode="and")
  109.  
  110.         oe_to   = MaskF.SelectEvery(2, 2)
  111.         eo_from = MaskB.SelectEvery(2, 2)
  112.         back    = MT_Logic(oe_to, eo_from, mode="and")
  113.  
  114.         ee_src   = src.SelectEven
  115.         ee_super = MSuper(ee_src, pel=1)
  116.         ee_VecF  = MAnalyse(ee_super, isb=false, blksize=4)
  117.         ee_VecB  = MAnalyse(ee_super, isb=true , blksize=4)
  118.         ee_MaskF = Mmask(ee_src, ee_VecF, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  119.         ee_MaskB = Mmask(ee_src, ee_VecB, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  120.  
  121.         ee_to    = ee_MaskF.Trim(1, 0)
  122.         ee_from  = ee_MaskB
  123.         ee       = MT_Logic(ee_to, ee_from, mode="or")
  124.  
  125.         oo_src   = src.SelectOdd
  126.         oo_super = MSuper(oo_src, pel=1)
  127.         oo_VecF  = MAnalyse(oo_super, isb=false, blksize=4)
  128.         oo_VecB  = MAnalyse(oo_super, isb=true , blksize=4)
  129.         oo_MaskF = Mmask(oo_src, oo_VecF, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  130.         oo_MaskB = Mmask(oo_src, oo_VecB, kind=1, ml=ml).MT_Binarize(u=-128, v=-128)
  131.  
  132.         oo_to    = oo_MaskF.trim(1, 0)
  133.         oo_from  = oo_MaskB
  134.         oo       = MT_Logic(oo_to, oo_from, mode="or")
  135.  
  136.         # to e0-o1, from o1-e2, nothing e0-e2
  137.         even_blink = MT_Logic(front, ee.MT_Invert, mode="and")
  138.  
  139.         # to o1-e2, from e2-o3, nothing o1-o3
  140.         odd_blink  = MT_Logic(back, oo.MT_Invert, mode="and")
  141.  
  142.         Interleave(even_blink, odd_blink)
  143. }
  144.  
  145.  
  146. function Mother_Brain(clip c)  {
  147.         c
  148.         ConvertToYV12
  149.  
  150.         MT_Edge("-1 0 0 0 1 0 0 0 0", thY1=0, thY2=0)
  151.         om1  = SelectEvery(4, -1)
  152.         e0   = SelectEvery(4,  0)
  153.         o1   = SelectEvery(4,  1)
  154.         e2   = SelectEvery(4,  2)
  155.         diff = MT_Logic(e0  , o1, mode="xor")
  156.         s1   = MT_Logic(om1 , o1, mode="xor")
  157.         s2   = MT_Logic(e0  , e2, mode="xor")
  158.         same = MT_Logic(s1  , s2, mode="or" ).MT_Invert
  159.         mask = MT_Logic(diff, same, mode="and").MT_Expand.MT_Expand.MT_Deflate(u=-128, v=-128).ConvertToRGB32
  160.  
  161.         sm1 = c.SelectEvery(4, -1)
  162.         s0  = c.SelectEvery(4,  0)
  163.         s1  = c.SelectEvery(4,  1)
  164.         s2  = c.SelectEvery(4,  2)
  165.         n0  = Layer(s0, s1.Mask(mask))
  166.         n1  = Layer(s1, s0.Mask(mask))
  167.  
  168.         Interleave(sm1, n0, n1, s2).Trim(1, 0)
  169.         SelectEven
  170.         # Subtitle("Mother Brain")
  171. }
  172.  
  173.  
  174. # ------------------------------------------------------------------------------------------------------------------------------
  175.  
  176.  
  177. function Range(clip clip1, int a, int b, clip clip2)  {
  178.         # inserts clip2 at a..b; replacement for ApplyRange
  179.         SafeTrim(clip1, 0    , a - 1               ) +\
  180.         SafeTrim(clip2, a    , b                   ) +\
  181.         SafeTrim(clip1, b + 1, clip1.FrameCount - 1)
  182. }
  183.  
  184.  
  185. function SafeTrim(clip c, int a, int b)  {
  186.         # values are clipped to the clip's range; values < 1 have no special meaning
  187.         c
  188.         i = FrameCount - 1
  189.         l = b - a + 1
  190.         a = (a < 0)  ?  0  :  (a > i)  ?  i  :  a
  191.         l = (l < 0)  ?  0  :  (l > i)  ?  i  :  l
  192.         Trim(a, -l)
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement