View Single Post
Old 24th February 2019, 22:34   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
In the SCSelect_Like thing,

Code:
# Add 1st line inside ScriptClip
        n=current_frame
And change all other current_frame instances to n. Will maybe be a bit faster (n would be Local var, current_frame is Global, and a LOT SLOWER to access than Locals).
[at least in AVS standard, not sure in AVS+, think AVS+ added a hash table for local/global var access, so may make little difference in AVS+]

EDIT: Like so
Code:
# RemoveDirt's SCSelect(clip input, clip scene_begin, clip scene_end, clip global_motion, float dfactor, bool debug, bool planar)

Function SCSelect_Like(clip dclip,clip Start,clip End,clip Motion, float "dfactor",bool "debug") {
    # Start, End, Motion MUST all be same, dclip can be other colorspace/size (unlike SCSelect).
    dfactor=Float(Default(dfactor,4.0))
    debug=Default(debug,false)
    Global SCM_A=0.0 Global SCM_B=0.0 Global SCM_SC=0 Global SCM_Prev=-1
    Motion.ScriptClip("""
        n = current_frame
        NotNext = (n!=SCM_Prev+1)
        Global SCM_A=(NotNext)? RT_LumaDifference(dclip,dclip,n=n-1,n2=n)  : SCM_B
        Global SCM_B=           RT_LumaDifference(dclip,dclip,n=n,n2=n+1)
        # 0 = Start of scene, 1 = End of scene, 2 = Global motion
        Global SCM_SC=(n==FrameCount-1)?1:(SCM_A>dfactor*SCM_B || n==0)?0:(SCM_B>dfactor*SCM_A)?1:2
        (SCM_SC==0) ? Start : (SCM_SC==1) ? End : Last      # Choose Start, End or Motion(ie Last)
        (debug)?RT_Subtitle("%d ] %6.2f %6.2f SC=%d",n,SCM_A,SCM_B,SCM_SC):NOP
        Global SCM_Prev=n
        Return Last
    """,args="dfactor,Start,End,Dclip,debug")          # Needs Grunt for args
    return Last
}
__________________
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; 24th February 2019 at 23:06.
StainlessS is offline   Reply With Quote