Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # scanlines: add scanlines for textmode or low-res graphics modes
- # col8: remove column 9 of textmode characters
- function VGA_to_640x480(clip c, bool "col8") {
- col8 = default(col8, false)
- c = c.IsRGB ? c.ConvertToRGB32 : c
- c = c.VGA__xres_640(col8)
- c = c.VGA__yres_480
- return c
- }
- function VGA_to_960x720(clip c, bool "scanlines", bool "col8") {
- col8 = default(col8 , false)
- scanlines = default(scanlines, true )
- c = c.IsRGB ? c.ConvertToRGB32 : c
- c = c.VGA__xres_960(col8 )
- c = c.VGA__yres_720(scanlines)
- return c.ConvertToYV12
- }
- # -------------------------------------------------------------------------------------------------------------------------------
- function VGA__xres_640(clip c, bool col8) {
- c = ((col8) && (c.Width == 720)) ? c.VGA__720_to_640 : c # process textmode characters?
- c = (640 % c.Width == 0 ) ? c. PointResize(640, c.Height) : c # can we use PointResize?
- c = (c.Width != 640 ) ? c.BilinearResize(640, c.Height) : c # use BilinearResize as a fallback
- return c
- }
- function VGA__xres_960(clip c, bool col8) {
- c = ((col8) && (c.Width == 720)) ? c.VGA__720_to_640 : c
- c = (960 % c.Width == 0 ) ? c. PointResize(960, c.Height) : c
- c = (c.Width != 960 ) ? c.BilinearResize(960, c.Height) : c
- return c
- }
- # -------------------------------------------------------------------------------------------------------------------------------
- function VGA__yres_480(clip c) {
- c = (480 % c.Height == 0 ) ? c. PointResize(c.Width, 480) : c
- c = (c.Height != 480 ) ? c. BilinearResize(c.Width, 480) : c
- return c
- }
- function VGA__yres_720(clip c, bool scanlines) {
- c = ((scanlines) && (c.Height == 400)) ? c.VGA__Add_Scanlines( 720) : c
- c = (720 % c.Height == 0 ) ? c. PointResize(c.Width, 720) : c
- c = (c.Height != 720 ) ? c. BilinearResize(c.Width, 720) : c
- return c
- }
- # -------------------------------------------------------------------------------------------------------------------------------
- function VGA__720_to_640(clip c) {
- l = c.Crop(0, 0, 8, 0) # left column
- r = c.Crop(9, 0, 0, 0) # right columns
- r = (r.Width > 9) ? VGA__720_to_640(r) : r.Crop(0, 0, 8, 0) # recursion over right columns
- StackHorizontal(l, r)
- }
- function VGA__Add_Scanlines(clip c, int LineCount, bool "spline") {
- spline = default(spline, false)
- c
- o = PointResize(Width, Height * 6).ConvertToYV12 # stay in original colorspace as long as possible
- BlankClip(o, 2).mt_lutspa(false, "y 6 % 0 == 255 0 ?")
- mt_merge(o, BlankClip(o), PointResize(Width, Height))
- y = LineCount
- #x= y * 4 / 3
- x = Width
- return spline ? BilinearResize(x, y) : Spline64Resize(Width, y).Spline36Resize(x, y)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement