foxyshadis
23rd October 2005, 16:26
I'm sorry about how long this will be, I cut it down as much as possible. I found that it only occurs when these four function calls in a row are made, removing any of them leaves a working script.
SetMemoryMax(280)
#x=directshowSource("cb_cache.avi")
x=aviSource("cb_cache.avi")
x=x.fx_unblend(16,43).fx_unblend(127,189)\
.fx_unblend(258,275).fx_unblend2(311,316)
return x
# call with frame1 being 3 before first double-blend
function fx_unblend(clip c, int frame1, int frame2) {
clip1 = c.trim(0,frame1-1)
clip2 = c.trim(frame2+1,0)
main = c.trim(frame1,frame2)
keep = main.selectevery(5,0,1,2)
tomask = main.selectevery(5,0,2).deleteframe(0)
deblend = main.selectevery(5,3,4)
# refers to where in the cycle frame falls,
#first is 1, 4 & 5 are the blends
frame4 = deblend
frame5 = deblend.trim(1,0)
sframe3 = tomask
sframe6 = tomask.trim(1,0)
# experimental crap
subframe1 = yv12subtract(sframe3,frame4,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
subframe2 = yv12subtract(sframe6,frame5,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
frame1add = frame4.yv12subtract(subframe1,u=3,v=3)
frame2add = frame5.yv12subtract(subframe2,u=3,v=3)
# ERROR Uncomment last "deblended" to see strange
# behavior, comment it out to go back to normal
deblended = sxs(frame1add,frame2add,2).selectevery(2)
deblended = sxs(frame1add,subframe2,2).selectevery(2)
deblended = sxs(frame1add,subframe1,2).selectevery(2)
final = interleave(keep.selectevery(3,0), \
keep.selectevery(3,1),keep.selectevery(3,2), \
deblended,deblended)
return clip1 + final + clip2
}
# Added ONLY for ease of debugging, call can be \
replaced with fx_unblend() and artifacts still show.
function fx_unblend2(clip c, int frame1, int frame2) {
clip1 = c.trim(0,310)
clip2 = c.trim(317,0)
main = c.trim(311,316)
keep = main.selectevery(5,0,1,2)
tomask = main.selectevery(5,0,2).deleteframe(0)
deblend = main.selectevery(5,3,4)
# refers to where in the cycle frame falls,
#first is 1, 4 & 5 are the blends
frame4 = deblend
frame5 = deblend.trim(1,0)
sframe3 = tomask
sframe6 = tomask.trim(1,0)
# experimental crap
subframe1 = yv12subtract(sframe3,frame4,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
subframe2 = yv12subtract(sframe6,frame5,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
frame1add = frame4.yv12subtract(subframe1,u=3,v=3)
frame2add = frame5.yv12subtract(subframe2,u=3,v=3)
# ERROR Uncomment last "deblended" to see strange behavior,
#comment it out to go back to normal
deblended = sxs(frame1add,frame2add,2).selectevery(2)
deblended = sxs(frame1add,subframe2,2).selectevery(2)
deblended = sxs(frame1add,subframe1,2).selectevery(2)
final = interleave(keep.selectevery(3,0), \
keep.selectevery(3,1),keep.selectevery(3,2), \
deblended,deblended)
# final shows errors, clip2 includes frames it should not when
# first fn's deblended is uncommented (this one's does change it)
return final
return clip2
#return clip1 + final + clip2
}
# view two clips side-by-side, 3rd parameter defines window:
# 0: left 1: center (default) 2: right
function SXS (clip "_c1", clip "_c2", int "_scale") {
_scale = default(_scale,1)
_w1 = select(_scale,0,Width(_c1)/4,Width(_c1)/2)
_w2 = width(_c1) / 2
return Stackhorizontal(_c1.crop(_w1,0,_w2,0), \
_c2.crop(_w1,0,_w2,0))
}
Download clip. (http://foxyshadis.slightlydark.com/random/cb_cache.avi)
You go to frame 3 (614 without the trim), you'll see the white artifacts, and if you output clip2 instead of final, it has extra frames that it shouldn't. Add hashes in front of the last 'deblended' definition in the first function, and the output of the second is then entirely as it should be. All it's doing is changing what gets viewed. I feel like I'm working with Schrodinger's Cat trying to debug this, I don't have the tools to go any further.
Of interest: You can add function calls with other random frame ranges in between the ones in there, doesn't seem to make a difference. (Unless you hit one that does.) You can delete any of the calls, and the last one will be perfect. You can take the second function (fx_deblend2) out if you want to see all frames. It happens somewhat randomly, mostly I notice it happen just like this, sometimes it's with frame2add/subframe2, and sometimes frame1add/frame2add (=the output, thus broken function).
Oh yeah: I can't get the most obvious artifact to show with directshowsource. Probably shifts frames around a bit. But the extra clip2 frames are there. I originally hit it with dgdecode so it's likely input agnostic.
I'm going to go take some advil now.
SetMemoryMax(280)
#x=directshowSource("cb_cache.avi")
x=aviSource("cb_cache.avi")
x=x.fx_unblend(16,43).fx_unblend(127,189)\
.fx_unblend(258,275).fx_unblend2(311,316)
return x
# call with frame1 being 3 before first double-blend
function fx_unblend(clip c, int frame1, int frame2) {
clip1 = c.trim(0,frame1-1)
clip2 = c.trim(frame2+1,0)
main = c.trim(frame1,frame2)
keep = main.selectevery(5,0,1,2)
tomask = main.selectevery(5,0,2).deleteframe(0)
deblend = main.selectevery(5,3,4)
# refers to where in the cycle frame falls,
#first is 1, 4 & 5 are the blends
frame4 = deblend
frame5 = deblend.trim(1,0)
sframe3 = tomask
sframe6 = tomask.trim(1,0)
# experimental crap
subframe1 = yv12subtract(sframe3,frame4,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
subframe2 = yv12subtract(sframe6,frame5,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
frame1add = frame4.yv12subtract(subframe1,u=3,v=3)
frame2add = frame5.yv12subtract(subframe2,u=3,v=3)
# ERROR Uncomment last "deblended" to see strange
# behavior, comment it out to go back to normal
deblended = sxs(frame1add,frame2add,2).selectevery(2)
deblended = sxs(frame1add,subframe2,2).selectevery(2)
deblended = sxs(frame1add,subframe1,2).selectevery(2)
final = interleave(keep.selectevery(3,0), \
keep.selectevery(3,1),keep.selectevery(3,2), \
deblended,deblended)
return clip1 + final + clip2
}
# Added ONLY for ease of debugging, call can be \
replaced with fx_unblend() and artifacts still show.
function fx_unblend2(clip c, int frame1, int frame2) {
clip1 = c.trim(0,310)
clip2 = c.trim(317,0)
main = c.trim(311,316)
keep = main.selectevery(5,0,1,2)
tomask = main.selectevery(5,0,2).deleteframe(0)
deblend = main.selectevery(5,3,4)
# refers to where in the cycle frame falls,
#first is 1, 4 & 5 are the blends
frame4 = deblend
frame5 = deblend.trim(1,0)
sframe3 = tomask
sframe6 = tomask.trim(1,0)
# experimental crap
subframe1 = yv12subtract(sframe3,frame4,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
subframe2 = yv12subtract(sframe6,frame5,u=3,v=3) \
.coloryuv(off_y=2,off_u=0,off_v=0)
frame1add = frame4.yv12subtract(subframe1,u=3,v=3)
frame2add = frame5.yv12subtract(subframe2,u=3,v=3)
# ERROR Uncomment last "deblended" to see strange behavior,
#comment it out to go back to normal
deblended = sxs(frame1add,frame2add,2).selectevery(2)
deblended = sxs(frame1add,subframe2,2).selectevery(2)
deblended = sxs(frame1add,subframe1,2).selectevery(2)
final = interleave(keep.selectevery(3,0), \
keep.selectevery(3,1),keep.selectevery(3,2), \
deblended,deblended)
# final shows errors, clip2 includes frames it should not when
# first fn's deblended is uncommented (this one's does change it)
return final
return clip2
#return clip1 + final + clip2
}
# view two clips side-by-side, 3rd parameter defines window:
# 0: left 1: center (default) 2: right
function SXS (clip "_c1", clip "_c2", int "_scale") {
_scale = default(_scale,1)
_w1 = select(_scale,0,Width(_c1)/4,Width(_c1)/2)
_w2 = width(_c1) / 2
return Stackhorizontal(_c1.crop(_w1,0,_w2,0), \
_c2.crop(_w1,0,_w2,0))
}
Download clip. (http://foxyshadis.slightlydark.com/random/cb_cache.avi)
You go to frame 3 (614 without the trim), you'll see the white artifacts, and if you output clip2 instead of final, it has extra frames that it shouldn't. Add hashes in front of the last 'deblended' definition in the first function, and the output of the second is then entirely as it should be. All it's doing is changing what gets viewed. I feel like I'm working with Schrodinger's Cat trying to debug this, I don't have the tools to go any further.
Of interest: You can add function calls with other random frame ranges in between the ones in there, doesn't seem to make a difference. (Unless you hit one that does.) You can delete any of the calls, and the last one will be perfect. You can take the second function (fx_deblend2) out if you want to see all frames. It happens somewhat randomly, mostly I notice it happen just like this, sometimes it's with frame2add/subframe2, and sometimes frame1add/frame2add (=the output, thus broken function).
Oh yeah: I can't get the most obvious artifact to show with directshowsource. Probably shifts frames around a bit. But the extra clip2 frames are there. I originally hit it with dgdecode so it's likely input agnostic.
I'm going to go take some advil now.