View Single Post
Old 22nd August 2008, 18:22   #8  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
It's probably of little consolation to you, and doesn't solve your main problem, but you could at least make the ConditionalFilter coding more user-friendly by using GRunT's version.

By using the args parameter, you don't need to build up the string dynamically in order to use the values of offset and thresh. For example, you could write
Code:
inc = ConditionalFilter(inc, inc.Crop(0,offset,0,0).AddBorders(0,0,0,offset), inc,
\      "RGBDifference(ConvertToRGB().Crop(0,offset-1,0,offset-240),
\                     ConvertToRGB().Crop(0,offset,0,offset-239)) > thresh",
\     args="offset, thresh")
EDIT: now that I see it written more clearly, I can also see that it can be speeded up by doing the conversions and crops outside the conditional, hence
Code:
incRGB = inc.ConvertToRGB()
c1 = incRGB.Crop(0,offset-1,0,offset-240)
c2 = incRGB.Crop(0,offset,0,offset-239)
inc = ConditionalFilter(inc, inc.Crop(0,offset,0,0).AddBorders(0,0,0,offset), inc,
\            "RGBDifference(c1, c2) > thresh", args="c1, c2, thresh")
something you couldn't do at all easily without GRunT (ever tried converting a clip value to a string?)

Last edited by Gavino; 22nd August 2008 at 18:39. Reason: performance improvement
Gavino is offline   Reply With Quote