Chainik wrote:

Obviously because there's no current clip inside the function. You should either add the context "c" explicitely or add "last=c" as the first line.

But why has the current clip become no longer current?  I specifically wanted it to be current AS I fell into the function call.  Is there documentation somewhere that says calling a function always causes there to be no current clip??

Well, assuming there is some answer to that question, then the next question becomes, how to solve the "invalid arguments to BicubicResize" error.  (Do you think "last=c" will do it?)  Please remember that I did not write this code; I'm merely trying to put it into a function for reusability.  I was going to share it with the community once I got it working.  If you can help me get this going, I feel it will help many, as this dropped/duplicated frame problem happens often.  (More often than I'd like to think.)

So why is this cascade of failures happening?????   (Why does it seem to be acting like there's no "current clip" and blowing up as a result?)

Chainik wrote:

Replace 'width' with 'c.width'?

Thanks, Chainik.  I have further info.

I made a source code mistake in that I deleted some comments in the function .avsi before I left it here, but when I reported the error line number, I gave it exactly as appearing at my end.  I've now deleted those comments at home and the error line is 16 instead of 26.

When I added "c." to line 16 (where the "width" was), the script proceeded, but then bombed at line 18 on the "height" reference.

I don't understand how these two errors can happen.  It's acting like there was no current clip.  My desired input clip WAS the current clip at the point in time where I called my GameDropFix function (as a result of the AudioDub function call).  Why isn't the clip seen so that width and height attributes are easily available without "c."?

When I added "c." to the height, it proceeded to blow up on line 20 with "Invalid arguments to function 'BicubicResize'".

To whoever kind soul reaches out to help me and the above problem, you can try it on the real video in question.  If you have Youtube downloading software, pick this one:
https://www.youtube.com/watch?v=WB5wsZVFpvU
and pick the highest res. one, 720p.

Here's the .avsi I built to include a GameDropFixV4 function.

GameDropFixFuncs.avsi

# GameDropFixFuncs.avsi

function GameDropFixV4(clip c, bool "myGPU", bool "myDebug", int "myErrSize")
{

#myGPU=true
#myDebug=true
#myErrSize=150

super_params_mini = (myGPU==true) ? "{scale:{up:0},gpu:1}" : "{scale:{up:2},gpu:0}"
#super_params_mini="{scale:{up:0},gpu:1}"
#super_params_mini="{scale:{up:2},gpu:0}"

analyse_params_mini="{block:{w:8,h:8}}"

miniW = int(width/64)*32
miniW = (miniW<320) ? 320 : miniW
miniH = int(height/64)*32
miniH = (miniH<160) ? 160 : miniH
mini=BicubicResize(miniW,miniH).TemporalSoften(1, 1, 0, scenechange=1, mode=2)
super_mini=mini.SVSuper(super_params_mini)
vectors_mini=SVAnalyse(super_mini, analyse_params_mini)
vectors_Forward=SVConvert(vectors_mini, false)
HorizontalSpeed_luma=mini.MMask(vectors_Forward, kind=3).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)
VerticalSpeed_luma=mini.MMask(vectors_Forward, kind=4).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)

size=16
luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

move_idx=5
y_idx=3
min_move=0.2
max_stop=0.5
drop_clip=luma_drop.ScriptClip("
    AvgLuma_lft=128-luma_lft.AverageLuma
    AvgLuma_rgh=128-luma_rgh.AverageLuma
    AvgLuma_lft_prev=128-(luma_lft.trim(1,1)+luma_lft).AverageLuma
    AvgLuma_rgh_prev=128-(luma_rgh.trim(1,1)+luma_rgh).AverageLuma
    AvgLuma_lft_next=128-luma_lft.trim(1,0).AverageLuma
    AvgLuma_rgh_next=128-luma_rgh.trim(1,0).AverageLuma

    AvgLuma_top=128-luma_top.AverageLuma
    AvgLuma_btm=128-luma_btm.AverageLuma
    AvgLuma_top_prev=128-(luma_top.trim(1,1)+luma_top).AverageLuma
    AvgLuma_btm_prev=128-(luma_btm.trim(1,1)+luma_btm).AverageLuma
    AvgLuma_top_next=128-luma_top.trim(1,0).AverageLuma
    AvgLuma_btm_next=128-luma_btm.trim(1,0).AverageLuma

    Max_lft=max(abs(AvgLuma_lft_prev),abs(AvgLuma_lft),abs(AvgLuma_lft_next))
    Max_rgh=max(abs(AvgLuma_rgh_prev),abs(AvgLuma_rgh),abs(AvgLuma_rgh_next))
    Max_top=max(abs(AvgLuma_top_prev),abs(AvgLuma_top),abs(AvgLuma_top_next))
    Max_btm=max(abs(AvgLuma_btm_prev),abs(AvgLuma_btm),abs(AvgLuma_btm_next))
    Max_all=max(Max_lft,Max_rgh,Max_top,Max_btm)
    
    MaxLuma=max(abs(AvgLuma_lft),abs(AvgLuma_rgh),abs(AvgLuma_top),abs(AvgLuma_btm))
    MaxLuma_prev=max(abs(AvgLuma_lft_prev),abs(AvgLuma_rgh_prev),abs(AvgLuma_top_prev),abs(AvgLuma_btm_prev))
    MaxLuma_next=max(abs(AvgLuma_lft_next),abs(AvgLuma_rgh_next),abs(AvgLuma_top_next),abs(AvgLuma_btm_next))
    dif=mini.YDifferenceFromPrevious
    dif_next=mini.trim(1,0).YDifferenceFromPrevious
    dif_prev=(mini.trim(1,1)+mini).YDifferenceFromPrevious
    
    GoodContrast = (max(mini.YPlaneMinMaxDifference,mini.trim(1,0).YPlaneMinMaxDifference)>20) ? 1 : 0

    drop = (MaxLuma<0.1 && MaxLuma*2<Max(MaxLuma_prev,MaxLuma_next) && dif*y_idx<max(dif_prev,dif_next)) ? 1 : 0

    drop_lft = (AvgLuma_lft_prev*AvgLuma_lft_next>0 && abs(AvgLuma_lft*move_idx)<Max_lft && abs(AvgLuma_lft)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 2 : 0
    drop_rgh = (AvgLuma_rgh_prev*AvgLuma_rgh_next>0 && abs(AvgLuma_rgh*move_idx)<Max_rgh && abs(AvgLuma_rgh)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 3 : 0
    drop_top = (AvgLuma_top_prev*AvgLuma_top_next>0 && abs(AvgLuma_top*move_idx)<Max_top && abs(AvgLuma_top)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 4 : 0
    drop_btm = (AvgLuma_btm_prev*AvgLuma_btm_next>0 && abs(AvgLuma_btm*move_idx)<Max_btm && abs(AvgLuma_btm)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 5 : 0
   
    drop = (drop==0 && MaxLuma<Max_stop && Max_lft==Max_all) ? drop_lft : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_rgh==Max_all) ? drop_rgh : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_top==Max_all) ? drop_top : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_btm==Max_all) ? drop_btm : drop
    drop_dif = (dif<0.4 && MaxLuma<min_move) ? 6 : 0
    drop = (drop==0 && drop_dif>0) ? drop_dif : drop
    drop = (drop>0 && Max_all<0.1) ? 0 : drop
    drop = (drop>0 && GoodContrast==0) ? 0 : drop

    luma=mini.AverageLuma
    luma_next=mini.trim(1,0).AverageLuma
    max_luma=max(luma,luma_next)

    drop = (drop>0 && max_luma<16.5) ? 0 : drop

    (drop>0) ? luma_drop : \
     (Max_lft==Max_all) ? luma_lft : \
      (Max_rgh==Max_all) ? luma_rgh : \
       (Max_top==Max_all) ? luma_top : luma_btm
")

fix_r50=luma_lft.mt_lut(y=-1, u=128, v=128)
fix_lr33=luma_lft.mt_lut(y=-2, u=128, v=128)
fix_l50=luma_lft.mt_lut(y=-3, u=128, v=128)
fix_r133=luma_lft.mt_lut(y=-4, u=128, v=128)
fix_r66=luma_lft.mt_lut(y=-5, u=128, v=128)

AvgDrop=127
MaxMulty=10
dblMulti=1.3
fix_clip=luma_drop.ScriptClip("
    drop=drop_clip.AverageLuma
    AvgLuma=abs(128-drop_clip.AverageLuma)
    AvgLuma_prev=abs(128-(drop_clip.trim(1,1)+drop_clip).AverageLuma)
    AvgLuma_prev_= (AvgLuma_prev==AvgDrop) ? 0 : AvgLuma_prev
    AvgLuma_prev2=abs(128-(drop_clip.trim(1,2)+drop_clip).AverageLuma)
    AvgLuma_next=abs(128-drop_clip.trim(1,0).AverageLuma)
    AvgLuma_next_= (AvgLuma_next==AvgDrop) ? 0 : AvgLuma_next
    AvgLuma_next2=abs(128-drop_clip.trim(2,0).AverageLuma)

    RightZero = (AvgLuma_prev_*MaxMulty<AvgLuma_next_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0
    LeftZero = (AvgLuma_next_*MaxMulty<AvgLuma_prev_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0

    drop = (AvgLuma==AvgDrop && AvgLuma_next==AvgDrop) ? -50 : 0
    drop = (AvgLuma==AvgDrop && AvgLuma_prev==AvgDrop) ? 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && RightZero==0) ? \
     AvgLuma_prev_>AvgLuma_next_*dblMulti ? -50 : \
      AvgLuma_prev_*dblMulti>=AvgLuma_next_ ? AvgLuma_next2==AvgDrop ? 50 : 33 : 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && RightZero==0 && AvgLuma_next2==AvgDrop) ? -50 : drop
    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && AvgLuma_prev2==AvgDrop) ? 66 : drop

    (drop==50) ? fix_r50 : \
     (drop==33) ? fix_lr33 : \
      (drop==-50) ? fix_l50 : \
       (drop==133) ? fix_r133 : \
        (drop==66) ? fix_r66 : drop_clip
")

r50=1
lr33=2
l50=3
r133=4
r66=5

super_params = (myGPU==true) ? "{scale:{up:0},gpu:1}" : "{scale:{up:2},gpu:0}"
#super_params="{scale:{up:0},gpu:1}"
#super_params="{scale:{up:2},gpu:0}"

analyse_params="{main:{search:{coarse:{distance:4,bad:{sad:2000}},type:2,distance:4},penalty:{lambda:1,pglobal:10000}},refine:[{thsad:65000}]}"
smoothfps_params="{rate:{num:12,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix_all = SVSmoothFps(super, vectors, smoothfps_params, mt=threads, url="www.svp-team.com")

dummy = myDebug ? Eval("""
# These are for visual debugging (the "Subtitle" clauses)
fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=myErrSize)
fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=myErrSize)
fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=myErrSize)
fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=myErrSize)
fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=myErrSize)
fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=myErrSize)
fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=myErrSize)
fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=myErrSize)
""") : Eval("""
fix50 = fix_all.SelectEvery(12,6)
fix33 = fix_all.SelectEvery(12,4)
fix66 = fix_all.SelectEvery(12,8)
fix66p = fix_all.SelectEvery(12,8)
fix75 = fix_all.SelectEvery(12,9)
fix50n = fix_all.SelectEvery(12,6)
fix133 = fix_all.SelectEvery(12,4)
fix125 = fix_all.SelectEvery(12,3)
""")

SetMTMode(5)
ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma

    (AvgFix==r50) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix33 : fix50 : \
    (AvgFix==lr33) ? fix33 : \
    (AvgFix_next==lr33) \
     ? (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix66.trim(1,1)+fix66 : \
    (AvgFix_next==l50) \
      ? (AvgFix_prev==lr33 || AvgFix_prev==r50) ? fix66.trim(1,1)+fix66 \
      : (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix50n.trim(1,1)+fix50n : \
    (AvgFix==r66) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix50 : fix66p : \
    (AvgFix_next==r66) \
      ? (AvgFix_next3==lr33 || AvgFix_next3==l50) ? fix125.trim(1,0) : fix133.trim(1,0) : \
    last
")
#trim(0,framecount-10)
#Distributor()
#
# end of GameDropFix (clip is returned)
}

And then here is the top level script which CALLS GameDropFixV4.

SetMemoryMax(1024)
global svp_scheduler=true
global threads=2
global svp_cache_fwd=threads+10

SetMTMode(3,threads)
video = LWLibavVideoSource("2014-09.Double-Agent-Nutrients-for-Longevity.(original).mp4")
audio = LWLibavAudioSource("2014-09.Double-Agent-Nutrients-for-Longevity.(original).mp4")
AudioDub(video, audio)

SetMTMode(2)


GameDropFixV4(myGPU=true,myDebug=true,myErrSize=150)


__END__

# do 60fps generation
ConvertToYV12()
SetMTMode(2)
#InterFrame(Cores=4,Tuning="Film",NewNum=60000,NewDen=1001,GPU=true)
#SR(1920,1080,4)
#Normalize()

main=last
MyBlank=BlankClip(main,120)
main ++ MyBlank

#Encode to x264, q=20, pcm audio.
#Then extract audio for Audacity improvements.

I get this crazy error message which makes no sense:

Avisynth open failure:
I don't know what "width" means
(GampeDropFixFuncs.avsi, line 26)
(C:\....(filename).avs, line 14)

The width-of-clip function presumes that there is a current clip.  There IS a current clip.  What the heck's wrong, please???

I've enjoyed GameDropFixV4 several times.  Thank you whoever developed it.  I have been wanting to enhance it to allow more flexible usage.  Parameters to control GPU, debug text and debug text size are helpful.  I've been able to implement *pseudo* parameters, as long as all of the GameDropFixV4 logic stays "in-line" in my script.  But this means I have to copy/paste the whole thing into every script.  Why not make it into a function and store it in a file with extension .avsi so that I can insert a simply one-line function call into each script?  Here are my efforts so far.

This script, with the logic in-line, works perfectly:

SetMemoryMax(1024)
global svp_scheduler=true
global threads=2
global svp_cache_fwd=threads+10

SetMTMode(3,threads)
video = LWLibavVideoSource("2014-09.Double-Agent-Nutrients-for-Longevity.(original).mp4")
audio = LWLibavAudioSource("2014-09.Double-Agent-Nutrients-for-Longevity.(original).mp4")
AudioDub(video, audio)

SetMTMode(2)


#GameDropFixV4 logic

# Set pseudo arguments
myGPU=true
myDebug=true
myErrSize=150

super_params_mini = (myGPU==true) ? "{scale:{up:0},gpu:1}" : "{scale:{up:2},gpu:0}"
#super_params_mini="{scale:{up:0},gpu:1}"
#super_params_mini="{scale:{up:2},gpu:0}"

analyse_params_mini="{block:{w:8,h:8}}"

miniW = int(width/64)*32
miniW = (miniW<320) ? 320 : miniW
miniH = int(height/64)*32
miniH = (miniH<160) ? 160 : miniH
mini=BicubicResize(miniW,miniH).TemporalSoften(1, 1, 0, scenechange=1, mode=2)
super_mini=mini.SVSuper(super_params_mini)
vectors_mini=SVAnalyse(super_mini, analyse_params_mini)
vectors_Forward=SVConvert(vectors_mini, false)
HorizontalSpeed_luma=mini.MMask(vectors_Forward, kind=3).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)
VerticalSpeed_luma=mini.MMask(vectors_Forward, kind=4).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)

size=16
luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

move_idx=5
y_idx=3
min_move=0.2
max_stop=0.5
drop_clip=luma_drop.ScriptClip("
    AvgLuma_lft=128-luma_lft.AverageLuma
    AvgLuma_rgh=128-luma_rgh.AverageLuma
    AvgLuma_lft_prev=128-(luma_lft.trim(1,1)+luma_lft).AverageLuma
    AvgLuma_rgh_prev=128-(luma_rgh.trim(1,1)+luma_rgh).AverageLuma
    AvgLuma_lft_next=128-luma_lft.trim(1,0).AverageLuma
    AvgLuma_rgh_next=128-luma_rgh.trim(1,0).AverageLuma

    AvgLuma_top=128-luma_top.AverageLuma
    AvgLuma_btm=128-luma_btm.AverageLuma
    AvgLuma_top_prev=128-(luma_top.trim(1,1)+luma_top).AverageLuma
    AvgLuma_btm_prev=128-(luma_btm.trim(1,1)+luma_btm).AverageLuma
    AvgLuma_top_next=128-luma_top.trim(1,0).AverageLuma
    AvgLuma_btm_next=128-luma_btm.trim(1,0).AverageLuma

    Max_lft=max(abs(AvgLuma_lft_prev),abs(AvgLuma_lft),abs(AvgLuma_lft_next))
    Max_rgh=max(abs(AvgLuma_rgh_prev),abs(AvgLuma_rgh),abs(AvgLuma_rgh_next))
    Max_top=max(abs(AvgLuma_top_prev),abs(AvgLuma_top),abs(AvgLuma_top_next))
    Max_btm=max(abs(AvgLuma_btm_prev),abs(AvgLuma_btm),abs(AvgLuma_btm_next))
    Max_all=max(Max_lft,Max_rgh,Max_top,Max_btm)
    
    MaxLuma=max(abs(AvgLuma_lft),abs(AvgLuma_rgh),abs(AvgLuma_top),abs(AvgLuma_btm))
    MaxLuma_prev=max(abs(AvgLuma_lft_prev),abs(AvgLuma_rgh_prev),abs(AvgLuma_top_prev),abs(AvgLuma_btm_prev))
    MaxLuma_next=max(abs(AvgLuma_lft_next),abs(AvgLuma_rgh_next),abs(AvgLuma_top_next),abs(AvgLuma_btm_next))
    dif=mini.YDifferenceFromPrevious
    dif_next=mini.trim(1,0).YDifferenceFromPrevious
    dif_prev=(mini.trim(1,1)+mini).YDifferenceFromPrevious
    
    GoodContrast = (max(mini.YPlaneMinMaxDifference,mini.trim(1,0).YPlaneMinMaxDifference)>20) ? 1 : 0

    drop = (MaxLuma<0.1 && MaxLuma*2<Max(MaxLuma_prev,MaxLuma_next) && dif*y_idx<max(dif_prev,dif_next)) ? 1 : 0

    drop_lft = (AvgLuma_lft_prev*AvgLuma_lft_next>0 && abs(AvgLuma_lft*move_idx)<Max_lft && abs(AvgLuma_lft)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 2 : 0
    drop_rgh = (AvgLuma_rgh_prev*AvgLuma_rgh_next>0 && abs(AvgLuma_rgh*move_idx)<Max_rgh && abs(AvgLuma_rgh)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 3 : 0
    drop_top = (AvgLuma_top_prev*AvgLuma_top_next>0 && abs(AvgLuma_top*move_idx)<Max_top && abs(AvgLuma_top)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 4 : 0
    drop_btm = (AvgLuma_btm_prev*AvgLuma_btm_next>0 && abs(AvgLuma_btm*move_idx)<Max_btm && abs(AvgLuma_btm)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 5 : 0
   
    drop = (drop==0 && MaxLuma<Max_stop && Max_lft==Max_all) ? drop_lft : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_rgh==Max_all) ? drop_rgh : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_top==Max_all) ? drop_top : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_btm==Max_all) ? drop_btm : drop
    drop_dif = (dif<0.4 && MaxLuma<min_move) ? 6 : 0
    drop = (drop==0 && drop_dif>0) ? drop_dif : drop
    drop = (drop>0 && Max_all<0.1) ? 0 : drop
    drop = (drop>0 && GoodContrast==0) ? 0 : drop

    luma=mini.AverageLuma
    luma_next=mini.trim(1,0).AverageLuma
    max_luma=max(luma,luma_next)

    drop = (drop>0 && max_luma<16.5) ? 0 : drop

    (drop>0) ? luma_drop : \
     (Max_lft==Max_all) ? luma_lft : \
      (Max_rgh==Max_all) ? luma_rgh : \
       (Max_top==Max_all) ? luma_top : luma_btm
")

fix_r50=luma_lft.mt_lut(y=-1, u=128, v=128)
fix_lr33=luma_lft.mt_lut(y=-2, u=128, v=128)
fix_l50=luma_lft.mt_lut(y=-3, u=128, v=128)
fix_r133=luma_lft.mt_lut(y=-4, u=128, v=128)
fix_r66=luma_lft.mt_lut(y=-5, u=128, v=128)

AvgDrop=127
MaxMulty=10
dblMulti=1.3
fix_clip=luma_drop.ScriptClip("
    drop=drop_clip.AverageLuma
    AvgLuma=abs(128-drop_clip.AverageLuma)
    AvgLuma_prev=abs(128-(drop_clip.trim(1,1)+drop_clip).AverageLuma)
    AvgLuma_prev_= (AvgLuma_prev==AvgDrop) ? 0 : AvgLuma_prev
    AvgLuma_prev2=abs(128-(drop_clip.trim(1,2)+drop_clip).AverageLuma)
    AvgLuma_next=abs(128-drop_clip.trim(1,0).AverageLuma)
    AvgLuma_next_= (AvgLuma_next==AvgDrop) ? 0 : AvgLuma_next
    AvgLuma_next2=abs(128-drop_clip.trim(2,0).AverageLuma)

    RightZero = (AvgLuma_prev_*MaxMulty<AvgLuma_next_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0
    LeftZero = (AvgLuma_next_*MaxMulty<AvgLuma_prev_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0

    drop = (AvgLuma==AvgDrop && AvgLuma_next==AvgDrop) ? -50 : 0
    drop = (AvgLuma==AvgDrop && AvgLuma_prev==AvgDrop) ? 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && RightZero==0) ? \
     AvgLuma_prev_>AvgLuma_next_*dblMulti ? -50 : \
      AvgLuma_prev_*dblMulti>=AvgLuma_next_ ? AvgLuma_next2==AvgDrop ? 50 : 33 : 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && RightZero==0 && AvgLuma_next2==AvgDrop) ? -50 : drop
    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && AvgLuma_prev2==AvgDrop) ? 66 : drop

    (drop==50) ? fix_r50 : \
     (drop==33) ? fix_lr33 : \
      (drop==-50) ? fix_l50 : \
       (drop==133) ? fix_r133 : \
        (drop==66) ? fix_r66 : drop_clip
")

r50=1
lr33=2
l50=3
r133=4
r66=5

super_params = (myGPU==true) ? "{scale:{up:0},gpu:1}" : "{scale:{up:2},gpu:0}"
#super_params="{scale:{up:0},gpu:1}"
#super_params="{scale:{up:2},gpu:0}"

analyse_params="{main:{search:{coarse:{distance:4,bad:{sad:2000}},type:2,distance:4},penalty:{lambda:1,pglobal:10000}},refine:[{thsad:65000}]}"
smoothfps_params="{rate:{num:12,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix_all = SVSmoothFps(super, vectors, smoothfps_params, mt=threads, url="www.svp-team.com")

dummy = myDebug ? Eval("""
# These are for visual debugging (the "Subtitle" clauses)
fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=myErrSize)
fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=myErrSize)
fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=myErrSize)
fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=myErrSize)
fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=myErrSize)
fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=myErrSize)
fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=myErrSize)
fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=myErrSize)
""") : Eval("""
fix50 = fix_all.SelectEvery(12,6)
fix33 = fix_all.SelectEvery(12,4)
fix66 = fix_all.SelectEvery(12,8)
fix66p = fix_all.SelectEvery(12,8)
fix75 = fix_all.SelectEvery(12,9)
fix50n = fix_all.SelectEvery(12,6)
fix133 = fix_all.SelectEvery(12,4)
fix125 = fix_all.SelectEvery(12,3)
""")

SetMTMode(5)
ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma

    (AvgFix==r50) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix33 : fix50 : \
    (AvgFix==lr33) ? fix33 : \
    (AvgFix_next==lr33) \
     ? (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix66.trim(1,1)+fix66 : \
    (AvgFix_next==l50) \
      ? (AvgFix_prev==lr33 || AvgFix_prev==r50) ? fix66.trim(1,1)+fix66 \
      : (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix50n.trim(1,1)+fix50n : \
    (AvgFix==r66) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix50 : fix66p : \
    (AvgFix_next==r66) \
      ? (AvgFix_next3==lr33 || AvgFix_next3==l50) ? fix125.trim(1,0) : fix133.trim(1,0) : \
    last
")
#trim(0,framecount-10)
#Distributor()
#
# end of GameDropFix (clip is returned)

__END__

# do 60fps generation
ConvertToYV12()
SetMTMode(2)
#InterFrame(Cores=4,Tuning="Film",NewNum=60000,NewDen=1001,GPU=true)
#SR(1920,1080,4)
#Normalize()

main=last
MyBlank=BlankClip(main,120)
main ++ MyBlank

#Encode to x264, q=20, pcm audio.
#Then extract audio for Audacity improvements.

I'll put the function-ized version in next post.

I decided it was appropriate to proceed to ignore the issue I raised in my last post.  I've gone forward with using GameDropFix.
(I'm putting together an altogether different problem report, and I'll be including source code.)

Back on Mar. 9th on SubJunk's Doom9 thread
http://forum.doom9.org/showthread.php?t … mp;page=41
(in which I was advised to move the discussion over to THIS forum), raffriff42 made this post:

The ball is probably moving too fast for the given search radius. It's also quite small and moving behind foreground objects. A very difficult problem.
Quote:
http://www.svp-team.com/wiki/SVP:Profile#Search_radius
Limits the maximum length of motion vectors. Large radius is not always better than small, because the found "far" motion vector may be incorrect, resulting in more artifacts.

I visited that link.  Can someone please point me to how I go about setting (experimenting) with the several possible settings for "search radius"?  I see no reference to "radius" in the code for InterFrame.  I really want to go forward on this.  Not a lengthy whiteboard discussion in Russian, but rather empirical experimentation that I can see the results of and set what I feel would be the best parameter for me.  What would I do to change the value of "search radius"?

(And it would also be nice if we could do this in the context of GameDrop4 as well.)

Now that GameDrop4 is working again AND now that I have a working graphics card (with GPU resources available), I'm eager to use it on a pile-up of files.  (And I'll be getting more such files needing GameDrop badly in the future.)  But there's defects I'd like to see if they can be solved first.  Here's where I've come:

Sometimes the generated frames, whether 1 or 2, are not nearly as good as I'd expect.  This reminds me of the problem I dealt with in depth with SubJunk here:
http://forum.doom9.org/showthread.php?t … mp;page=37

He explained (and demonstrated) that the GPU usage in InterFrame wasn't merely to speed up some calculations, but was to DO some calcs that couldn't at present be done (or at least are not being done).  So to get the best effect, one HAS to use the GPU, no matter how patient one might be.

Now that I can do GPU on my main video PC, I looked around in InterFrame code for GPU related stuff and found these:

    GPU == true ? Eval("""
        SuperString = SuperString + "scale:{up:0,down:4},gpu:1,rc:false}"
    """) : Eval("""
        SuperString = SuperString + "scale:{up:2,down:4},gpu:0,rc:false}"
    """)

aHAAA, this "scale" thing, whatever it is, is being told to use or not use the gpu.  So in GameDrop4, I find 2 lines with a similar scale clause:  (I add both gpu true and false in my code.)

#
# Pick line for appropriate gpu setting, 0 or 1
# (1st of 2 locations)
#
super_params_mini="{scale:{up:0},gpu:1}"
#super_params_mini="{scale:{up:2},gpu:0}"
#
# Pick line for appropriate gpu setting, 0 or 1
# (2nd of 2 locations)
#
super_params="{scale:{up:0},gpu:1}"
#super_params="{scale:{up:2},gpu:0}"

So when I pick the lines with gpu:1, it DOES use my GPU.  But after reviewing several problem segments involving both single frame generation and 2-frames generated, it doesn't appear to be improving anything (except probably speed of render).

THEN I realized that the artifact was not exactly what I had observed in the problem I reported to SubJunk (the difference between gpu and no gpu).  It was a problem I observed earlier when I was experimenting with the various "Tuning" settings in InterFrame.  (Sorry I never bothered to report this.)  It seems that every time I tried something other than "Film", the items in motion were NOT placed halfway between the item in prior frame and same item in next frame.  No, the generated frame had it VERY close to it's position in the prior frame.  Why anyone wanted to call this "smooth", I couldn't figure.  To me it seemed like duplicating each frame and doubling the frame rate; i.e., useless.  So I've used "Film" for everything I do.  (Which so far is a sport, much of it fast-moving.)

But I have now sifted as best I can (which isn't very deep I admit) into the InterFrame code again, and I cannot find anything with regard to "Film" that would help me tweak GameDrop4 to solve this.  GameDrop is working well in many cases, and certainly even in the bad cases, it works great on the panning background.

Can this be tweaked more with someone's kind help??  I'd really like to make the interpolated motion look interpolated physically, rather than merely echoing the prior frame.

Thanks for these, Chainik.  It appears the docs built in to Avisynth distributions are very non-current.  But there was no evidence (that I noticed) in the built in docs that we must seek out more current docs online.  At least now I know.

James D wrote:

Except for every other man it is needed to go deep into knowledge about memory requirements for every type of script where i heard many times "why did you put so big value", "well, try to put bigger value now" etc.
It's much easier to use 2 scenarios instead: 1 - just do not write anything about memory if you use single thread and save your time; and 2 - Write SetMemoryMax(1024) if you use multiple threads.
Much safer for anyone who doesn't consider himself as Pro in AVS scriptbuilding and you let AVS to do its own memory allocating job in Single Tread scenarious.

Well said, James.  It rather echoes my sentiments.  Another way to say might be, basic usage no need to use or worry about; advanced usage, learn it and tweak it.

Chainik wrote:

SetMemoryMax() is a almost-mandatory part of AVS memory management subsystem.
I really don't get why someone would remove this call?

I've written dozens of scripts over several years, and never heard of it or it's alleged mandatoriness until getting into SVP things.

Let me add that in the current documentation that comes with Avisynth, there's no "set" anything under "S".

Chainik wrote:

James D
setmemorymax is not a "MT function" and it should exist in every script.

It's working with my setmemorymax commented out.  I commented it out weeks ago on the advice of I don't remember who.

But are you saying should exist in every Avisynth script or every Avisynth script that involves SVP?

James D wrote:

Distributor function is a part of MT. You should delete it too if you delete MT functions like setmemorymax ans setmtode.

James, that appears to have done it!  (That is, it no longer says "I don't know what 'fixclip' means".)  However, I DO still two "SetMTMode" commands in there, even though setmemorymax is gone.  (Not that *I* put them there, but it was there when all was given to me.

Thoughts?

I just upgraded my two svpflow dlls to the current 1.1.14.  This GameDrop script is still bombing.  It's been 6+ weeks and no one has replied.  Won't someone please take a look and help me proceed to get it to work?  I don't know if it's a bug in svp or if I've somehow damaged my GameDropv4 script here.

I need this to work, both for a number of videos I have now, and also for future ones that I'll be creating that will need it.

Chainik wrote:

TCmullet
this's a very small ball  big_smile
while "promo graphic" demonstrates a car about 1/4 of a video frame

True.  But please explain why size has much to do with it.  If *I* can see the ball, why can't software?  Or maybe you all can figure out a way to accommodate it.  Please express all knowledge about this.  I need to come to a point where we solve it or have full mutual knowledge that it is impossible.  (I have lots of video to process, and I'd hate to spend weeks or months doing it all, then have to come back and do it all again, simple due to not having known of this or that tweak that might have fixed it from the start.)

Nintendo Maniac 64 wrote:

Please use PNG rather than BMP since it gives identical lossless quality with a smaller filesize (sometimes much smaller).

Thank you.  You have just pushed my knowledge of PNG into the 21st century!  I knew they were there, but never bothered much with them.  My graphic program DOES allow saving to PNG.  When I picked 0=no compression, the file was BIGGER.  Then on Wikipedia I learn that all PNG files are lossless!  So I will go with "9" (compression level "best").

Edit:  They were much smaller, but still too big to attach.  So I've added 3 more links to my initial post.

Would you please look at these? I've created and uploaded 2 short AVIs encoded losslessly with the x264vfw codec. Though short, they're still too big to be attachments, so they are on my own server.

http://www.tomsgoodfiles.com/Test-ba...-q0.504p30.avi
http://www.tomsgoodfiles.com/Test-ba...-q0.504p60.avi


The foreground has two talking heads; ignore them as it's the action behind them that is of interest. (This is a good clip to study this problem.)

The first clip (p30) was input to InterFrame, and yes GPU was true.

In the 2nd one (60fps output from InterFrame), please observe the "double" ball near the middle in frame 45.

OR if you'd rather simply see images, here are the 2 frames surrounding the generated frame:
http://www.tomsgoodfiles.com/p30-frame24.bmp
http://www.tomsgoodfiles.com/p30-frame25.bmp
http://www.tomsgoodfiles.com/p60-frame4 … rated).bmp
(also on my server as the .bmp files are each too big for the forum--I did not convert to jpg as I figured you need "real" content)

OR as PNG files:
http://www.tomsgoodfiles.com/p30-frame24.png
http://www.tomsgoodfiles.com/p30-frame25.png
http://www.tomsgoodfiles.com/p60-frame4 … rated).png
(Even as maximally compressed .png they are too big to attach.)

Why am I not able to generate a frame that positions the ball at the spot between those two balls (ONE ball which has made a "local shift" through space), but instead makes a "double exposure"? Especially in light of this promo graphic:
http://www.svp-team.com/wiki/File:Memc.jpg

As to why it's frame 45 and not 49 is unimportant at this point.  (That may have something to do with the x264 codec.)  As it is so ubiquitous (at least for me), this moving ball problem has been one of the biggest problems for me since I started using InterFrame.  (Not that I'll stop using it if we can't solve it.)

And here's my script:

SetMemoryMax(512)
SetMTMode(3,4)
Avisource("Test-ball-motion.x264v-q0.504p30.avi")
ConvertToYV12()
SetMTMode(2)
InterFrame(Cores=4,Tuning="Film",GPU=true)
#SR(1280,720,4)

I've installed Chain's new svpflow1.dll and svpflow2.dll (even though one of them has date 1/27/2015 which is earlier than date of last one 1/28/2015), and it does not blow up on SVConvert.  But I'm back to "I don't know what 'fix_clip' means (ScriptClip line 2)".  I've undeleted lines that James told me to remove and here is my entire script as it currently stands:

#SetMemoryMax(1024)
global svp_scheduler=true
global threads=2
global svp_cache_fwd=threads+10

#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow1.dll")
#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow2.dll")

SetMTMode(3,threads)
AviSource("D:\Video-Work\MyVideoNeedingGameDrop.avi").ConvertToYV12()
SetMTMode(2)

src=last
super_params_mini="{scale:{up:2},gpu:0}"
analyse_params_mini="{block:{w:8,h:8}}"
miniW = int(width/64)*32
miniW = (miniW<320) ? 320 : miniW
miniH = int(height/64)*32
miniH = (miniH<160) ? 160 : miniH
mini=BicubicResize(miniW,miniH).TemporalSoften(1, 1, 0, scenechange=1, mode=2)
super_mini=mini.SVSuper(super_params_mini)
vectors_mini=SVAnalyse(super_mini, analyse_params_mini)
vectors_Forward=SVConvert(vectors_mini, false)
HorizontalSpeed_luma=mini.MMask(vectors_Forward, kind=3).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)
VerticalSpeed_luma=mini.MMask(vectors_Forward, kind=4).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)

size=16
luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

move_idx=5
y_idx=3
min_move=0.2
max_stop=0.5
drop_clip=luma_drop.ScriptClip("
    AvgLuma_lft=128-luma_lft.AverageLuma
    AvgLuma_rgh=128-luma_rgh.AverageLuma
    AvgLuma_lft_prev=128-(luma_lft.trim(1,1)+luma_lft).AverageLuma
    AvgLuma_rgh_prev=128-(luma_rgh.trim(1,1)+luma_rgh).AverageLuma
    AvgLuma_lft_next=128-luma_lft.trim(1,0).AverageLuma
    AvgLuma_rgh_next=128-luma_rgh.trim(1,0).AverageLuma

    AvgLuma_top=128-luma_top.AverageLuma
    AvgLuma_btm=128-luma_btm.AverageLuma
    AvgLuma_top_prev=128-(luma_top.trim(1,1)+luma_top).AverageLuma
    AvgLuma_btm_prev=128-(luma_btm.trim(1,1)+luma_btm).AverageLuma
    AvgLuma_top_next=128-luma_top.trim(1,0).AverageLuma
    AvgLuma_btm_next=128-luma_btm.trim(1,0).AverageLuma

    Max_lft=max(abs(AvgLuma_lft_prev),abs(AvgLuma_lft),abs(AvgLuma_lft_next))
    Max_rgh=max(abs(AvgLuma_rgh_prev),abs(AvgLuma_rgh),abs(AvgLuma_rgh_next))
    Max_top=max(abs(AvgLuma_top_prev),abs(AvgLuma_top),abs(AvgLuma_top_next))
    Max_btm=max(abs(AvgLuma_btm_prev),abs(AvgLuma_btm),abs(AvgLuma_btm_next))
    Max_all=max(Max_lft,Max_rgh,Max_top,Max_btm)
    
    MaxLuma=max(abs(AvgLuma_lft),abs(AvgLuma_rgh),abs(AvgLuma_top),abs(AvgLuma_btm))
    MaxLuma_prev=max(abs(AvgLuma_lft_prev),abs(AvgLuma_rgh_prev),abs(AvgLuma_top_prev),abs(AvgLuma_btm_prev))
    MaxLuma_next=max(abs(AvgLuma_lft_next),abs(AvgLuma_rgh_next),abs(AvgLuma_top_next),abs(AvgLuma_btm_next))
    dif=mini.YDifferenceFromPrevious
    dif_next=mini.trim(1,0).YDifferenceFromPrevious
    dif_prev=(mini.trim(1,1)+mini).YDifferenceFromPrevious
    
    GoodContrast = (max(mini.YPlaneMinMaxDifference,mini.trim(1,0).YPlaneMinMaxDifference)>20) ? 1 : 0

    drop = (MaxLuma<0.1 && MaxLuma*2<Max(MaxLuma_prev,MaxLuma_next) && dif*y_idx<max(dif_prev,dif_next)) ? 1 : 0

    drop_lft = (AvgLuma_lft_prev*AvgLuma_lft_next>0 && abs(AvgLuma_lft*move_idx)<Max_lft && abs(AvgLuma_lft)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 2 : 0
    drop_rgh = (AvgLuma_rgh_prev*AvgLuma_rgh_next>0 && abs(AvgLuma_rgh*move_idx)<Max_rgh && abs(AvgLuma_rgh)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 3 : 0
    drop_top = (AvgLuma_top_prev*AvgLuma_top_next>0 && abs(AvgLuma_top*move_idx)<Max_top && abs(AvgLuma_top)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 4 : 0
    drop_btm = (AvgLuma_btm_prev*AvgLuma_btm_next>0 && abs(AvgLuma_btm*move_idx)<Max_btm && abs(AvgLuma_btm)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 5 : 0
   
    drop = (drop==0 && MaxLuma<Max_stop && Max_lft==Max_all) ? drop_lft : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_rgh==Max_all) ? drop_rgh : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_top==Max_all) ? drop_top : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_btm==Max_all) ? drop_btm : drop
    drop_dif = (dif<0.4 && MaxLuma<min_move) ? 6 : 0
    drop = (drop==0 && drop_dif>0) ? drop_dif : drop
    drop = (drop>0 && Max_all<0.1) ? 0 : drop
    drop = (drop>0 && GoodContrast==0) ? 0 : drop

    luma=mini.AverageLuma
    luma_next=mini.trim(1,0).AverageLuma
    max_luma=max(luma,luma_next)

    drop = (drop>0 && max_luma<16.5) ? 0 : drop

    (drop>0) ? luma_drop : \
     (Max_lft==Max_all) ? luma_lft : \
      (Max_rgh==Max_all) ? luma_rgh : \
       (Max_top==Max_all) ? luma_top : luma_btm
")

fix_r50=luma_lft.mt_lut(y=-1, u=128, v=128)
fix_lr33=luma_lft.mt_lut(y=-2, u=128, v=128)
fix_l50=luma_lft.mt_lut(y=-3, u=128, v=128)
fix_r133=luma_lft.mt_lut(y=-4, u=128, v=128)
fix_r66=luma_lft.mt_lut(y=-5, u=128, v=128)

AvgDrop=127
MaxMulty=10
dblMulti=1.3
fix_clip=luma_drop.ScriptClip("
    drop=drop_clip.AverageLuma
    AvgLuma=abs(128-drop_clip.AverageLuma)
    AvgLuma_prev=abs(128-(drop_clip.trim(1,1)+drop_clip).AverageLuma)
    AvgLuma_prev_= (AvgLuma_prev==AvgDrop) ? 0 : AvgLuma_prev
    AvgLuma_prev2=abs(128-(drop_clip.trim(1,2)+drop_clip).AverageLuma)
    AvgLuma_next=abs(128-drop_clip.trim(1,0).AverageLuma)
    AvgLuma_next_= (AvgLuma_next==AvgDrop) ? 0 : AvgLuma_next
    AvgLuma_next2=abs(128-drop_clip.trim(2,0).AverageLuma)

    RightZero = (AvgLuma_prev_*MaxMulty<AvgLuma_next_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0
    LeftZero = (AvgLuma_next_*MaxMulty<AvgLuma_prev_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0

    drop = (AvgLuma==AvgDrop && AvgLuma_next==AvgDrop) ? -50 : 0
    drop = (AvgLuma==AvgDrop && AvgLuma_prev==AvgDrop) ? 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && RightZero==0) ? \
     AvgLuma_prev_>AvgLuma_next_*dblMulti ? -50 : \
      AvgLuma_prev_*dblMulti>=AvgLuma_next_ ? AvgLuma_next2==AvgDrop ? 50 : 33 : 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && RightZero==0 && AvgLuma_next2==AvgDrop) ? -50 : drop
    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && AvgLuma_prev2==AvgDrop) ? 66 : drop

    (drop==50) ? fix_r50 : \
     (drop==33) ? fix_lr33 : \
      (drop==-50) ? fix_l50 : \
       (drop==133) ? fix_r133 : \
        (drop==66) ? fix_r66 : drop_clip
")

r50=1
lr33=2
l50=3
r133=4
r66=5

super_params="{scale:{up:2},gpu:0}"
analyse_params="{main:{search:{coarse:{distance:4,bad:{sad:2000}},type:2,distance:4},penalty:{lambda:1,pglobal:10000}},refine:[{thsad:65000}]}"
smoothfps_params="{rate:{num:12,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix_all = SVSmoothFps(super, vectors, smoothfps_params, mt=threads, url="www.svp-team.com")
#----------------
#These are for visual debugging (the "Subtitle" clauses)
fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=120)
fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=120)
fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=120)
fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=120)
fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=120)
fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=120)
fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=120)
fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=120)
#-----------------
#fix50 = fix_all.SelectEvery(12,6)
#fix33 = fix_all.SelectEvery(12,4)
#fix66 = fix_all.SelectEvery(12,8)
#fix66p = fix_all.SelectEvery(12,8)
#fix75 = fix_all.SelectEvery(12,9)
#fix50n = fix_all.SelectEvery(12,6)
#fix133 = fix_all.SelectEvery(12,4)
#fix125 = fix_all.SelectEvery(12,3)

SetMTMode(5)
ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma

    (AvgFix==r50) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix33 : fix50 : \
    (AvgFix==lr33) ? fix33 : \
    (AvgFix_next==lr33) \
     ? (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix66.trim(1,1)+fix66 : \
    (AvgFix_next==l50) \
      ? (AvgFix_prev==lr33 || AvgFix_prev==r50) ? fix66.trim(1,1)+fix66 \
      : (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix50n.trim(1,1)+fix50n : \
    (AvgFix==r66) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix50 : fix66p : \
    (AvgFix_next==r66) \
      ? (AvgFix_next3==lr33 || AvgFix_next3==l50) ? fix125.trim(1,0) : fix133.trim(1,0) : \
    last
")

#trim(0,framecount-10)

Distributor()

What is wrong that this error is happening?

While no one who is in any way involved with a bug found right after a release takes pleasure in it, I have to say that I find it an HONOR to have been the one to find this one.  You guys are great.  Thank you for developing this stuff.  It's so fun to see videos "come alive" in ways never expected.  GameDrop, though imperfect, makes a "lost" video worth saving, and InterFrame (also imperfect) is SLICK!

I'll await the results of your (already) diligent expertise(s).

I was a programmer for years before I became obsolete.  I know the value of user feedback.  Even now, I'm wrestling with php problems at my website via user feedback even though I thought I had EVERY possible scenario tested!

I got it working!

Musta been the taking out of "Distributor" and "Setmemorymax".

But then I got bold and replaced the dlls (svpflow1.dll and svpflow2.dll) with the new ones via the InterFrame 2.8.0 dependencies folder (figuring it might run even better), and now it bombs:

Avisynth open failure:
SVConvert: invalid vectors stream

Then it says it's from line 23, which is:

vectors_Forward=SVConvert(vectors_mini, false)
James D wrote:

I believe you should delete Distributor too roll And Setmemorymax is not needed in ST mode I guess.

I'm happy to try your suggestions, but I'm running kinda blind as I don't know most of these items.  Take "distributor".  Have searched quite awhile and cannot find any clear documentation as to what it does.  That's okay, as I'll proceed with you (or you all) as my guide.  I get impression it has something to do with making something multithreaded.  Heck, I'll be glad to get this going with 1 thread, as my tasks (video files) needing this are not many.

I use latest svp dlls from latest svp update archieve. I thought they didn't change after Interframe 2.7.0 but never checked.

They must have changed, as InterFrame 2.8.0 just came out today (by coincidence) and uses newer svp dlls.

P.S. I prefer Subtle size 120 instead of 12 for visual debugging (the "Subtitle" clauses).

Yes, my eyes are weak, too.  (Good idea.)  But as you can see, I comment all that out anyway.

P.P.S. It wasn't too hard to give full script, was it?:) tongue

But I hate (translate that, "feel a little guilty") cluttering up so much vertical space when only a snippet of context will do.

James D wrote:

Just delete all SetMTModes, set global threads to 1 and live happy.

Happy to try.  Sad that it failed with "Softwire: caught an access violation at 0x022c4d20(code+332), attempting to read from 0x00000000 ([ScriptClip], line 2)

I guess it's time for my entire and exact script:

SetMemoryMax(1024)
global svp_scheduler=true
global threads=1
global svp_cache_fwd=threads+10

#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow1.dll")
#LoadPlugin("C:\Program Files (x86)\SVP\plugins\svpflow2.dll")

#SetMTMode(3,threads)
AviSource("D:\Video-Work\2014-NCAA-wv\2014-11-07.wv.KsSt-v-TX.x264v-q0.ac3-320.dups.avi").ConvertToYV12()
#SetMTMode(2)

src=last
super_params_mini="{scale:{up:2},gpu:0}"
analyse_params_mini="{block:{w:8,h:8}}"
miniW = int(width/64)*32
miniW = (miniW<320) ? 320 : miniW
miniH = int(height/64)*32
miniH = (miniH<160) ? 160 : miniH
mini=BicubicResize(miniW,miniH).TemporalSoften(1, 1, 0, scenechange=1, mode=2)
super_mini=mini.SVSuper(super_params_mini)
vectors_mini=SVAnalyse(super_mini, analyse_params_mini)
vectors_Forward=SVConvert(vectors_mini, false)
HorizontalSpeed_luma=mini.MMask(vectors_Forward, kind=3).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)
VerticalSpeed_luma=mini.MMask(vectors_Forward, kind=4).convertToRGB32().PointResize(miniW/8, miniH/8).PointResize(miniW/4, miniH/4).ConvertToYV12().mt_lut(y=2, u=128, v=128)

size=16
luma_lft=HorizontalSpeed_luma.crop(0,0,miniW/16,0).BicubicResize(size,size)
luma_rgh=HorizontalSpeed_luma.crop(miniW/16+miniW/8,0,0,0).BicubicResize(size,size)
luma_top=VerticalSpeed_luma.crop(0,0,0,miniH/16).BicubicResize(size,size)
luma_btm=VerticalSpeed_luma.crop(0,miniH/16+miniH/8,0,0).BicubicResize(size,size)
luma_drop=luma_lft.mt_lut(y=-1, u=128, v=128)

move_idx=5
y_idx=3
min_move=0.2
max_stop=0.5
drop_clip=luma_drop.ScriptClip("
    AvgLuma_lft=128-luma_lft.AverageLuma
    AvgLuma_rgh=128-luma_rgh.AverageLuma
    AvgLuma_lft_prev=128-(luma_lft.trim(1,1)+luma_lft).AverageLuma
    AvgLuma_rgh_prev=128-(luma_rgh.trim(1,1)+luma_rgh).AverageLuma
    AvgLuma_lft_next=128-luma_lft.trim(1,0).AverageLuma
    AvgLuma_rgh_next=128-luma_rgh.trim(1,0).AverageLuma

    AvgLuma_top=128-luma_top.AverageLuma
    AvgLuma_btm=128-luma_btm.AverageLuma
    AvgLuma_top_prev=128-(luma_top.trim(1,1)+luma_top).AverageLuma
    AvgLuma_btm_prev=128-(luma_btm.trim(1,1)+luma_btm).AverageLuma
    AvgLuma_top_next=128-luma_top.trim(1,0).AverageLuma
    AvgLuma_btm_next=128-luma_btm.trim(1,0).AverageLuma

    Max_lft=max(abs(AvgLuma_lft_prev),abs(AvgLuma_lft),abs(AvgLuma_lft_next))
    Max_rgh=max(abs(AvgLuma_rgh_prev),abs(AvgLuma_rgh),abs(AvgLuma_rgh_next))
    Max_top=max(abs(AvgLuma_top_prev),abs(AvgLuma_top),abs(AvgLuma_top_next))
    Max_btm=max(abs(AvgLuma_btm_prev),abs(AvgLuma_btm),abs(AvgLuma_btm_next))
    Max_all=max(Max_lft,Max_rgh,Max_top,Max_btm)
    
    MaxLuma=max(abs(AvgLuma_lft),abs(AvgLuma_rgh),abs(AvgLuma_top),abs(AvgLuma_btm))
    MaxLuma_prev=max(abs(AvgLuma_lft_prev),abs(AvgLuma_rgh_prev),abs(AvgLuma_top_prev),abs(AvgLuma_btm_prev))
    MaxLuma_next=max(abs(AvgLuma_lft_next),abs(AvgLuma_rgh_next),abs(AvgLuma_top_next),abs(AvgLuma_btm_next))
    dif=mini.YDifferenceFromPrevious
    dif_next=mini.trim(1,0).YDifferenceFromPrevious
    dif_prev=(mini.trim(1,1)+mini).YDifferenceFromPrevious
    
    GoodContrast = (max(mini.YPlaneMinMaxDifference,mini.trim(1,0).YPlaneMinMaxDifference)>20) ? 1 : 0

    drop = (MaxLuma<0.1 && MaxLuma*2<Max(MaxLuma_prev,MaxLuma_next) && dif*y_idx<max(dif_prev,dif_next)) ? 1 : 0

    drop_lft = (AvgLuma_lft_prev*AvgLuma_lft_next>0 && abs(AvgLuma_lft*move_idx)<Max_lft && abs(AvgLuma_lft)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 2 : 0
    drop_rgh = (AvgLuma_rgh_prev*AvgLuma_rgh_next>0 && abs(AvgLuma_rgh*move_idx)<Max_rgh && abs(AvgLuma_rgh)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 3 : 0
    drop_top = (AvgLuma_top_prev*AvgLuma_top_next>0 && abs(AvgLuma_top*move_idx)<Max_top && abs(AvgLuma_top)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 4 : 0
    drop_btm = (AvgLuma_btm_prev*AvgLuma_btm_next>0 && abs(AvgLuma_btm*move_idx)<Max_btm && abs(AvgLuma_btm)<=min_move && dif*y_idx<max(dif_prev,dif_next)) ? 5 : 0
   
    drop = (drop==0 && MaxLuma<Max_stop && Max_lft==Max_all) ? drop_lft : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_rgh==Max_all) ? drop_rgh : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_top==Max_all) ? drop_top : drop
    drop = (drop==0 && MaxLuma<Max_stop && Max_btm==Max_all) ? drop_btm : drop
    drop_dif = (dif<0.4 && MaxLuma<min_move) ? 6 : 0
    drop = (drop==0 && drop_dif>0) ? drop_dif : drop
    drop = (drop>0 && Max_all<0.1) ? 0 : drop
    drop = (drop>0 && GoodContrast==0) ? 0 : drop

    luma=mini.AverageLuma
    luma_next=mini.trim(1,0).AverageLuma
    max_luma=max(luma,luma_next)

    drop = (drop>0 && max_luma<16.5) ? 0 : drop

    (drop>0) ? luma_drop : \
     (Max_lft==Max_all) ? luma_lft : \
      (Max_rgh==Max_all) ? luma_rgh : \
       (Max_top==Max_all) ? luma_top : luma_btm
")

fix_r50=luma_lft.mt_lut(y=-1, u=128, v=128)
fix_lr33=luma_lft.mt_lut(y=-2, u=128, v=128)
fix_l50=luma_lft.mt_lut(y=-3, u=128, v=128)
fix_r133=luma_lft.mt_lut(y=-4, u=128, v=128)
fix_r66=luma_lft.mt_lut(y=-5, u=128, v=128)

AvgDrop=127
MaxMulty=10
dblMulti=1.3
fix_clip=luma_drop.ScriptClip("
    drop=drop_clip.AverageLuma
    AvgLuma=abs(128-drop_clip.AverageLuma)
    AvgLuma_prev=abs(128-(drop_clip.trim(1,1)+drop_clip).AverageLuma)
    AvgLuma_prev_= (AvgLuma_prev==AvgDrop) ? 0 : AvgLuma_prev
    AvgLuma_prev2=abs(128-(drop_clip.trim(1,2)+drop_clip).AverageLuma)
    AvgLuma_next=abs(128-drop_clip.trim(1,0).AverageLuma)
    AvgLuma_next_= (AvgLuma_next==AvgDrop) ? 0 : AvgLuma_next
    AvgLuma_next2=abs(128-drop_clip.trim(2,0).AverageLuma)

    RightZero = (AvgLuma_prev_*MaxMulty<AvgLuma_next_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0
    LeftZero = (AvgLuma_next_*MaxMulty<AvgLuma_prev_) ? (AvgLuma_prev_>max_stop || AvgLuma_next_>max_stop) ? 1 : 0 : 0

    drop = (AvgLuma==AvgDrop && AvgLuma_next==AvgDrop) ? -50 : 0
    drop = (AvgLuma==AvgDrop && AvgLuma_prev==AvgDrop) ? 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && RightZero==0) ? \
     AvgLuma_prev_>AvgLuma_next_*dblMulti ? -50 : \
      AvgLuma_prev_*dblMulti>=AvgLuma_next_ ? AvgLuma_next2==AvgDrop ? 50 : 33 : 50 : drop

    drop = (drop==0 && AvgLuma==AvgDrop && RightZero==0 && AvgLuma_next2==AvgDrop) ? -50 : drop
    drop = (drop==0 && AvgLuma==AvgDrop && LeftZero==0 && AvgLuma_prev2==AvgDrop) ? 66 : drop

    (drop==50) ? fix_r50 : \
     (drop==33) ? fix_lr33 : \
      (drop==-50) ? fix_l50 : \
       (drop==133) ? fix_r133 : \
        (drop==66) ? fix_r66 : drop_clip
")

r50=1
lr33=2
l50=3
r133=4
r66=5

super_params="{scale:{up:2},gpu:0}"
analyse_params="{main:{search:{coarse:{distance:4,bad:{sad:2000}},type:2,distance:4},penalty:{lambda:1,pglobal:10000}},refine:[{thsad:65000}]}"
smoothfps_params="{rate:{num:12,den:1},algo:13,scene:{blend:true}}"

super=SVSuper(super_params)
vectors=SVAnalyse(super, analyse_params)
fix_all = SVSmoothFps(super, vectors, smoothfps_params, mt=threads, url="www.svp-team.com")
#----------------
#These are for visual debugging (the "Subtitle" clauses)
#fix50 = fix_all.SelectEvery(12,6).Subtitle("fix50", align=3, size=12)
#fix33 = fix_all.SelectEvery(12,4).Subtitle("fix33", align=3, size=12)
#fix66 = fix_all.SelectEvery(12,8).Subtitle("-fix33", align=3, size=12)
#fix66p = fix_all.SelectEvery(12,8).Subtitle("fix66", align=3, size=12)
#fix75 = fix_all.SelectEvery(12,9).Subtitle("-fix25", align=3, size=12)
#fix50n = fix_all.SelectEvery(12,6).Subtitle("-fix50", align=3, size=12)
#fix133 = fix_all.SelectEvery(12,4).Subtitle("fix133", align=3, size=12)
#fix125 = fix_all.SelectEvery(12,3).Subtitle("fix125", align=3, size=12)
#-----------------
fix50 = fix_all.SelectEvery(12,6)
fix33 = fix_all.SelectEvery(12,4)
fix66 = fix_all.SelectEvery(12,8)
fix66p = fix_all.SelectEvery(12,8)
fix75 = fix_all.SelectEvery(12,9)
fix50n = fix_all.SelectEvery(12,6)
fix133 = fix_all.SelectEvery(12,4)
fix125 = fix_all.SelectEvery(12,3)

#SetMTMode(5)
ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma

    (AvgFix==r50) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix33 : fix50 : \
    (AvgFix==lr33) ? fix33 : \
    (AvgFix_next==lr33) \
     ? (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix66.trim(1,1)+fix66 : \
    (AvgFix_next==l50) \
      ? (AvgFix_prev==lr33 || AvgFix_prev==r50) ? fix66.trim(1,1)+fix66 \
      : (AvgFix_prev==r66) ? fix75.trim(1,1)+fix75 : fix50n.trim(1,1)+fix50n : \
    (AvgFix==r66) \
      ? (AvgFix_next2==lr33 || AvgFix_next2==l50) ? fix50 : fix66p : \
    (AvgFix_next==r66) \
      ? (AvgFix_next3==lr33 || AvgFix_next3==l50) ? fix125.trim(1,0) : fix133.trim(1,0) : \
    last
")

#trim(0,framecount-10)

Distributor()

Just had an additional thought.  Maybe I should upgrade the two svp dlls to the new ones that SubJunk provided with the new 2.8.0 Interframe.  Your thoughts?

Here's the immediate context showing where I inserted the line:

fix133 = fix_all.SelectEvery(12,4)
fix125 = fix_all.SelectEvery(12,3)

SetMTMode(5)
ScriptClip("
    AvgFix=fix_clip.AverageLuma
    AvgFix_next=fix_clip.trim(1,0).AverageLuma
    AvgFix_next2=fix_clip.trim(2,0).AverageLuma
    AvgFix_next3=fix_clip.trim(3,0).AverageLuma
    AvgFix_prev=(fix_clip.trim(1,1)+fix_clip).AverageLuma