Advertisement
Guest User

Untitled

a guest
Apr 13th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = AVISource("YUY2-Doom.avi")
  2.  
  3. #Seperate YUV to Y, U, V Channel
  4. Y=ColorYUV(n,off_u=-256, off_v=-256).ColorYUV(off_u=128, off_v=128)
  5. U=UtoY(n)
  6. V=VtoY(n)
  7.  
  8. #Shifting U
  9.  
  10. downU = 0
  11. upU = 0
  12. leftU = 0
  13. rightU = 0
  14.  
  15. #Shifting V
  16.  
  17. downV = 0
  18. upV = 0
  19. leftV = 0
  20. rightV = 0
  21.  
  22. #Shifting U
  23.  
  24. down2U = 0
  25. up2U = 0
  26. left2U = 0
  27. right2U = 0
  28.  
  29. #Shifting V
  30.  
  31. down2V = 0
  32. up2V = 0
  33. left2V = 0
  34. right2V = 0
  35.  
  36. #Convert to YV24 for Shifting 1px to right or left
  37. U = U.ConvertToYV24()
  38. V = V.ConvertToYV24()
  39.  
  40. #New UV Shifting
  41. U1 = U.AddBorders(leftU, downU, rightU, upU, color=$000000).Crop(rightU, upU,-leftU,-downU).ConvertToYUY2()
  42. V1 = V.AddBorders(leftV, downV, rightV, upV, color=$000000).Crop(rightV, upV,-leftV,-downV).ConvertToYUY2()
  43.  
  44. #Copy UV Shifting
  45. U2 = U.AddBorders(leftU+left2U, downU+down2U, rightU+right2U, upU+up2U, color=$000000).Crop(rightU+right2U, upU+up2U,-(leftU+left2U),-(downU-down2U)).ConvertToYUY2()
  46. V2 = V.AddBorders(leftV+left2V, downV+down2V, rightV+right2V, upV+up2V, color=$000000).Crop(rightV+right2V, upV+up2V,-(leftV+left2V),-(downV-down2V)).ConvertToYUY2()
  47.  
  48. #Mix Colors from U1 and V1 with U2 and V2
  49. Yhalf = Y.PointResize(U.width, U.height)
  50. U = Overlay(U1, U2, mask=Yhalf, mode="blend")
  51. V = Overlay(V1, V2, mask=Yhalf, mode="blend")
  52.  
  53. #Convert back to YUY2
  54. Resize_faktor = 1
  55. U = U.PointResize(int(U.width / Resize_faktor), int(U.height / Resize_faktor)).PointResize(U.width, U.height)
  56. V = V.PointResize(int(V.width / Resize_faktor), int(V.height / Resize_faktor)).PointResize(V.width, V.height)
  57. U = U.ConvertToYUY2()
  58. V = V.ConvertToYUY2()
  59.  
  60. #Merge all YUV Channels
  61. YToUV(U, V, Y)
  62. ### AvsP marked script ###
  63. # n = AVISource("YUY2-Doom.avi")
  64. #
  65. # #Seperate YUV to Y, U, V Channel
  66. # Y=ColorYUV(n,off_u=-256, off_v=-256).ColorYUV(off_u=128, off_v=128)
  67. # U=UtoY(n)
  68. # V=VtoY(n)
  69. #
  70. # #Shifting U
  71. # [<separator="Shifting U1">]
  72. # downU = [<"U1 - Down", 0, 1280, 0>]
  73. # upU = [<"U1 - Up", 0, 1280, 0>]
  74. # leftU = [<"U1 - Left", 0, 1600, 0>]
  75. # rightU = [<"U1 - Right", 0, 1600, 0>]
  76. #
  77. # #Shifting V
  78. # [<separator="Shifting V1">]
  79. # downV = [<"V1 - Down", 0, 1280, 0>]
  80. # upV = [<"V1 - Up", 0, 1280, 0>]
  81. # leftV = [<"V1 - Left", 0, 1600, 0>]
  82. # rightV = [<"V1 - Right", 0, 1600, 0>]
  83. #
  84. # #Shifting U
  85. # [<separator="Shifting U2">]
  86. # down2U = [<"U2 - Down", 0, 1280, 0>]
  87. # up2U = [<"U2 - Up", 0, 1280, 0>]
  88. # left2U = [<"U2 - Left", 0, 1600, 0>]
  89. # right2U = [<"U2 - Right", 0, 1600, 0>]
  90. #
  91. # #Shifting V
  92. # [<separator="Shifting V2">]
  93. # down2V = [<"V2 - Down", 0, 1280, 0>]
  94. # up2V = [<"V2 - Up", 0, 1280, 0>]
  95. # left2V = [<"V2 - Left", 0, 1600, 0>]
  96. # right2V = [<"V2 - Right", 0, 1600, 0>]
  97. #
  98. # #Convert to YV24 for Shifting 1px to right or left
  99. # U = U.ConvertToYV24()
  100. # V = V.ConvertToYV24()
  101. #
  102. # #New UV Shifting
  103. # U1 = U.AddBorders(leftU, downU, rightU, upU, color=$000000).Crop(rightU, upU,-leftU,-downU).ConvertToYUY2()
  104. # V1 = V.AddBorders(leftV, downV, rightV, upV, color=$000000).Crop(rightV, upV,-leftV,-downV).ConvertToYUY2()
  105. #
  106. # #Copy UV Shifting
  107. # U2 = U.AddBorders(leftU+left2U, downU+down2U, rightU+right2U, upU+up2U, color=$000000).Crop(rightU+right2U, upU+up2U,-(leftU+left2U),-(downU-down2U)).ConvertToYUY2()
  108. # V2 = V.AddBorders(leftV+left2V, downV+down2V, rightV+right2V, upV+up2V, color=$000000).Crop(rightV+right2V, upV+up2V,-(leftV+left2V),-(downV-down2V)).ConvertToYUY2()
  109. #
  110. # #Mix Colors from U1 and V1 with U2 and V2
  111. # Yhalf = Y.PointResize(U.width, U.height)
  112. # U = Overlay(U1, U2, mask=Yhalf, mode="blend")
  113. # V = Overlay(V1, V2, mask=Yhalf, mode="blend")
  114. #
  115. # #Convert back to YUY2
  116. # Resize_faktor = 1
  117. # U = U.PointResize(int(U.width / Resize_faktor), int(U.height / Resize_faktor)).PointResize(U.width, U.height)
  118. # V = V.PointResize(int(V.width / Resize_faktor), int(V.height / Resize_faktor)).PointResize(V.width, V.height)
  119. # U = U.ConvertToYUY2()
  120. # V = V.ConvertToYUY2()
  121. #
  122. # #Merge all YUV Channels
  123. # YToUV(U, V, Y)
  124. ### AvsP marked script ###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement