View Full Version : How to make it work Multi Threading in Avisynth+ with TweakHist?
benzio
20th March 2020, 00:13
Hi!
I have this script:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
A1 = avisource("JVC1.avi")
A2 = avisource("JVC2.avi")
B2 = ScriptClip(A2, "A2.TweakHist(type=2,mclip=A1.Trim(current_frame,-1))")
B2
Prefetch(4)
I followed the guides... I've put SetFilterMTMode() at the beginning and prefetch() at the end, but...
if I don't try to use MT (and I comment SetFilterMTModeand prefetch), everything works, but if use those commands on the video appears this error:
Script error: Invalid arguments to function 'TweakHist'. ([ScriptClip], line 1)
What he don't likes is to read A1 from the runtime environment.
If I put there a dummy clip everything works.
I've also tried to set the filters-MT-modes singolarly for avisource, tweakhist and whatever. Same result.
What's going on here?
Thanks to everyone will answer!
StainlessS
20th March 2020, 10:31
Dont know reason for problem, same with Avs+ r2772 and v3.4
LoadPlugin(".\x86\Modplus.dll")
#SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("TweakHist", MT_NICE_FILTER)
#A1 = avisource("d:\Parade.avi")
Global A1 = avisource("d:\Parade.avi")
A2 = avisource("d:\Parade.avi")
SSS=""" # Scriptclip line 1
n=current_frame # Scriptclip line 2
# TweakHist(mclip=A1) # Scriptclip line 3 # Uncomment this and comment out below line, no error
Last.TweakHist(type=2,mclip=A1,mf=n) # Scriptclip line 4 # Script error: Invalid arguments to function 'TweakHist'. ([Scriptclip Line 4])
"""
ScriptClip(A2,SSS)
Prefetch(4)
Return Last
Prob disappears if mclip=A1, removed from Scriptclip line 4.
I've made A1 Global, still problem.
Addfunction Call
env->AddFunction("TweakHist", "ci*[type]i[mclip]c[mf]i[limit]i[rgb]i", Create_TweakHist, 0);
Remove Prefetch(4) works ok, else not.
Not a clue why this is happening.
EDIT: Below does not produce error
LoadPlugin(".\x86\Modplus.dll")
#SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("TweakHist", MT_NICE_FILTER)
#A1 = avisource("d:\Parade.avi")
Global A1 = avisource("d:\Parade.avi")
A2 = avisource("d:\Parade.avi")
SSS=""" # Scriptclip line 1
n=current_frame # Scriptclip line 2
# TweakHist(mclip=A1) # Scriptclip line 3
# Last.TweakHist(type=2,mclip=A1,mf=n) # Scriptclip line 4 # Script error: Invalid arguments to function 'TweakHist'. ([Scriptclip Line 4])
return A1
"""
ScriptClip(A2,SSS)
Prefetch(4)
Return Last
EDIT: "ci*[type]i[mclip]c[mf]i[limit]i[rgb]i"
Perhaps down to the "Array of Zero Or More vars of type int (i*), followed by "type" arg ALSO of type int ([type]i), dont know if avs+ borked, or TweakHist borked [less likely],
probably better if Type arg (of var type int) did not immediately follow a variable length array of type int.
EDIT:
Prob disappears if mclip=A1, removed from Scriptclip line 4."
Above is a bit puzzling if prob down to array of int followed by 'type' int.
EDIT: The error message is produced by Avisynth, not TweakHist (so would seem to be an avs+ prob).
benzio
20th March 2020, 14:36
EDIT: "ci*[type]i[mclip]c[mf]i[limit]i[rgb]i"
Perhaps down to the "Array of Zero Or More vars of type int, followed by "type" arg ALSO of type int, dont know if avs+ borked, or TweakHist borked,
probably better if Type arg (of var type int) did not immediately follow a variable length array of type int.
EDIT:
Above is a bit puzzling if prob down to array of int followed by 'type' int.
I'm afraid I'm not Pro enough to understand this... :(
StainlessS
20th March 2020, 15:23
I think Pinterf needs to take a look at this thread, he should happen by at some point,
but there are recently things happening in the world external to D9 that demand serious attention [ie he could be busy].
EDIT: Because of the Prefetch() thing, I dont think it can be tested on v2.60 standard [dont think Prefetch is available in v2.60 std].
pinterf
20th March 2020, 17:08
I'm here, I'm there. Well, this is a known bug (if it has the same root as the code below) which is hard fix (for me), probably was fixed in Neo but then there came other side-effects.
I'll check it later in my life, I have bookmarked those commits but since they were applied on an already very different code, it was hard to backport (hard = took more time to understand than I had at those times)
BlankClip(width=320,height=200,length=100000,pixel_type="YV24")
ScriptClip(last, "Subtitle(String(UDifferenceFromPrevious()))") # UDifferenceFromPrevious() cannot see "current frame"
Prefetch(2)
benzio
20th March 2020, 18:34
Even if this bug cannot be fixed quickly thank you for all the work you are doing to develop this wonderful tool :-)
wonkey_monkey
20th March 2020, 18:48
Yup, a great job is being done maintaining Avisynth. Thanks to all who do.
pinterf
22nd March 2020, 10:46
Even if this bug cannot be fixed quickly thank you for all the work you are doing to develop this wonderful tool :-)
I have a new build, see Avisynth+ forum for changes and download link. Please test it if it works.
StainlessS
22nd March 2020, 16:40
see Avisynth+ forum for changes and download link.
Well wadya know, Avisynth+ is gonna get its own forum, not available just yet, gotta get it from the Avisynth+ thread in Avs Devs forum:- https://forum.doom9.org/showthread.php?p=1904672#post1904672
:)
EDIT: New Avs+ works fine, above prob is no prob.
benzio
25th March 2020, 00:36
Thanks a lot! :-D
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.