View Single Post
Old 14th June 2016, 23:40   #56  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Here is what you suggest (it aint good, somewhat jumpy, feel free to improve), [req RT_Stats, GScript, Grunt]

Code:
GSCript("""
    Function Katie(clip c,int n,Int WKill) {
        c
        XMod = c.RT_ColorSpaceXMod
        WKill = (WKill + XMod-1) / XMod * XMod  # Round UP  Will return WRONG SIZE and Error Alert of WKill not multiple of XMod.
        Lft=0   Rgt=0
        While(Lft+Rgt<WKill) {
            LAve=RT_AverageLuma(n=n,x=Lft,y=0,w=XMod,H=0)
            RAve=RT_AverageLuma(n=n,x=Width-XMod-Rgt,y=0,w=XMod,H=0)
            if(LAve<RAve)   {Lft = Lft + XMod}
            else            {Rgt = Rgt + XMod}
        }
        Crop(Lft,0,-Rgt,-0)
        RT_Subtitle("Lft=%d Rgt=%d",Lft,Rgt,Align=5)
        Return Last    
    }
""")

SCRIPT = "return Katie(ORG,current_frame,WKill)"

AvisourcE("CabaretUncropped.avi")
ORG = Last  # Uncropped source (clip2)
WKILL = 16
Crop(WKILL,0,0,0)                       # Scriptclip can ONLY return same size clip as arg
Return ScriptClip(SCRIPT,Args="ORG,WKILL")    # Import ORG clip into Scriptclip (req Grunt)
By the way, you would want to get this working in script before attempting to learn CPP, and implementing.

EDIT: Only left and right implemented.
__________________
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 ???
StainlessS is offline   Reply With Quote