View Single Post
Old 27th September 2017, 06:03   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hope this will do.

Corners.avsi (for Plugins dir)
Code:
# Corners.avsi, http://forum.doom9.org/showthread.ph...81#post1819881
# Crops all 4 corners of input and outputs stack4 window clip of those corners, allows viewing of corners without scrolling large input clip.
# Giving W=Width(default width/4) and H=Height(default Height/4) of corners. (Default output dim half of input dim, ie 2*Width/4, 2*Height/4).
# (Max W=c.Width, H=c.Height, where output 4 window stack of double dimensions to input).
Function Corners(clip c, Int "W", Int "H") {
    c
    W = Default(W,Width/4)          H = Default(H,Height/4)             # Default corners quarter of dimensions
    W=W/4*4                         H=H/4*4                             # W Mod4 (YV411 compat), H Mod4 (YV12 Interlaced compat)
    Assert(0 < W <= Width , "Corners: Invalid W"+String(W,"(%.0f)"))
    Assert(0 < H <= Height, "Corners: Invalid H"+String(H,"(%.0f)"))
    tl=crop(0,0,W,H)                tr=crop(Width-W,0,W,H)
    bl=crop(0,Height-H,W,H)         br=crop(Width-W,Height-H,W,H)
    Top=StackHorizontal(tl,tr)      bot=StackHorizontal(bl,br)
    Return StackVertical(Top,Bot)
}

# Alternate function, Giving W=Width and H=Height of output clip (should be W=Mod8 for YV411 and H=Mod8 for Interlaced YV12)
# (Max W=c.Width*2, H=c.Height*2, where output 4 window stack of double dimensions to input).
Function Corners2(clip c, Int "W", Int "H") { return c.Corners( Default(W,c.Width/2)/8*4, Default(H,c.Height/2)/8*4) }

# Return stack4 window, double dim of input clip. (Maybe of use if some plugin metrics are too big for the input clip [some metrics missing])
Function CornersX4(clip c) { return c.Corners(c.Width,c.Height) }
Client script
Code:
# FFMS2("D:\btn\something.mkv")
Colorbars.KillAudio # My Test

#Corners()                    # Output = half input dim
#Corners(Width/4,Height/4)    # Output = half input dim
#Corners(Width,Height)        # Output = double input dim (stack4 window, maybe if frame metrics too big for small input clip).

#Corners2()                   # Output = half input dim
#Corners2(Width/2,Height/2)   # Output = half input dim
#Corners2(Width*2,Height*2)   # Output = double input dim (stack4 window, maybe if frame metrics too big for small input clip).
Corners2(480,360)            # Output = specific size

#CornersX4                    # Output = double input dim (stack4 window, maybe if frame metrics too big for small input clip).

Info
Return Last
EDIT: Added Corners2() Function, can choose whatever one you like.
EDIT: Relaxed max W,H, limited at output dim to twice input dim. (may be of use to some)
EDIT: Added DoubleDim().
EDIT: Renamed DoubleDim() to CornersX4().
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th September 2017 at 15:31. Reason: Minor mods
StainlessS is offline   Reply With Quote