Removed script functions [ GreyRamp(), MyFunc() ], embed code directly into main level script.
Not much difference. (craps out about 1440 frames)
Code:
/*
Req:
Avs+
SelectPixelByMask
RT_Stats.
requires OUT\ directory in current dir
SelectPixelByMask(clip Data, clip Mask)
Data 256 frames, Y8 or YV24, or RGB24, or RGB32.
Mask Y8
*/
# CONTRAST
StartCont = 0.5 # Mask 0
EndCont = 2.0 # Mask 255
BaseName = ".\OUT\MyPic_"
Matrix = "Rec601"
myName = "SelPix3: "
DEBUG = True
###################
AviSource("D:\SELECTPIXELBYMASK\Parade.avi")
trim(60,0) # trim off static start
BilinearResize(256,256) # Try not to swamp memory too much
ConvertToYV24() # Sat will not work on Y8, And not RGB either (Tweak YUV only)
ORG=Last
FC=ORG.Framecount
Msg=MessageClip("Done") # Create now when mem avilable
###################
black = BlankClip(Length=1,color=$000000, width=1, height=256,Pixel_type="Y8")
white = BlankClip(Length=1,color=$ffffff, width=1, height=256,Pixel_type="Y8")
Mask=StackHorizontal(black,white).BilinearResize(512, 256).Crop(128,0,-128,-0).Loop(FC)
#Mask=Mask.BilinearResize(Width,Height) # Rough ramp, single frame, same size as clip, just for testing
#return Mask.info
BaseName=RT_GetFullPathName(BaseName)
StartTime=RT_TimerHP
For(n=0,FC-1) {
current_frame=n
Data=ORG.Trim(0,-1).Loop(256) # 256 identical frames
Data=Data.Animate (0, 255, "Tweak",
\ [* START Args *]
\ 0.0, [* Hue default 0.0 *]
\ 1.0, [* Sat default 1.0 *]
\ 0.0, [* Bright default 0.0 *]
\ StartCont, [* Cont default 1.0 *]
\ False, [* Coring Default True *]
\ [* END Args *]
\ 0.0, [* Hue default 0.0 *]
\ 1.0, [* Sat default 1.0 *]
\ 0.0, [* Bright default 0.0 *]
\ EndCont, [* Cont default 1.0 *]
\ False [* Coring Default True *]
\ )
Out=Data.SelectPixelByMask(Mask).Loop(FC)
Out=Out.ConvertToRGB32(matrix=Matrix).ImageWriter(file=BaseName, start=n,end=n, type="png")
Out.RT_AverageLuma(w=1,h=1) # Force write image file
if(DEBUG) {
Tim = RT_TimerHP
RT_DebugF("%d] %f%% %.2fFPS",n,(n+1)*100.0/FC,1/(Tim-StartTime),name=myName)
StartTime=Tim
}
Out=0
Data=0
}
Return Msg