Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 12th March 2015, 14:19   #941  |  Link
chainik_svp
Registered User
 
Join Date: Mar 2012
Location: Saint-Petersburg
Posts: 239
So actually there's still a room for good old 2.5 headers...

Quote:
// Avisynth v2.6. Copyright 2006 Klaus Post.
// Avisynth v2.6. Copyright 2009 Ian Brabham.
What will come first - GRRM will finish "Song of ice and fire" or Avisynth 2.6 will exit RC stage?
__________________
SVPflow motion interpolation
chainik_svp is offline  
Old 12th March 2015, 14:38   #942  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by TheFluff View Post
Especially since almost nobody actually uses 64-bit Avisynth (there was a poll about this a year back or so, IIRC basically nobody claimed to be using 64-bit Avisynth).
Maybe because that thread was created before AviSynth+ came into fruition. Also 64-bit avs was not even an option. I'm sure the number of users has grown since AviSynth+.
Reel.Deel is offline  
Old 12th March 2015, 14:39   #943  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by chainik_svp View Post
So actually there's still a room for good old 2.5 headers...


What will come first - GRRM will finish "Song of ice and fire" or Avisynth 2.6 will exit RC stage?
Of course, this is only a problem if you want to distribute a closed-source application or filter. Closed source binaries must use a header from before Aug 14, 2009.
__________________
AviSynth+

Last edited by ultim; 12th March 2015 at 15:36.
ultim is offline  
Old 12th March 2015, 15:05   #944  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by Reel.Deel View Post
Maybe because that thread was created before AviSynth+ came into fruition. Also 64-bit avs was not even an option. I'm sure the number of users has grown since AviSynth+.
Yeah, it's kind of hard to vote for something if it isn't even an option in the poll. LOL
__________________
AviSynth+
ultim is offline  
Old 12th March 2015, 19:21   #945  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Quote:
Originally Posted by ultim View Post
Oh my gosh, I bet it has to do something with AviSynth's StringDump. This is only a hunch though. Is it reproducible on classic Avisynth, even if only sporadically?
I instrumented the script to report the processing of most lines via DbgView, see embedded code. This script ran several dozen times with 2.6 MT without fail in patched AvsPmod. After I lost patience today and installed Avisynth+ r1576, AvsPmod crashed in several runs and paused (maybe better term than freeze here) in all other runs, between line 124 and 125.
Code:
Try {RT_Version()} catch (msg) {assert(false,"This script requires the RT_Stats plugin.")}
Try {GEval("")} catch (msg) {assert(false,"This script requires the GScript plugin.")}
global ofs=0

#============================================================================
Filename=RT_FSelSaveAs(title="Save Filter list",dir="",filt="Text files|*.txt",fn="_All+Functions_.txt",debug=true)
Assert(FileName.IsString(), "Please provide a file name to save the filter list")

#============================================================================
RT_WriteFile(Filename, VersionString(), Append=false)               Try {assert(false)} catch(err) {Line(err,0)}
WriteInternalFunctionsSyntax(RT_InternalFunctions(), Filename)      Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
BlankClip().subtitle("Function info is complete.",align=5)

#============================================================================
function WriteInternalFunctionsSyntax(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,23)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,23)}
            fu_name = LeftStr(fu_list, i-1)                         Try {assert(false)} catch(err) {Line(err,23)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,23)}
            params = RT_PluginParam(fu_name)                        Try {assert(false)} catch(err) {Line(err,23)}
            if (FindStr(done, fu_name+params)==0) {
                done = done + " "+fu_name+params                    Try {assert(false)} catch(err) {Line(err,23)}
                RT_WriteFile(Filename, "internal %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,23)}
            }
        }
    """)
}
#============================================================================
function WritePluginFunctionsSyntax(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,41)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,41)}
            fu_name = LeftStr(fu_list, i-1)                         Try {assert(false)} catch(err) {Line(err,41)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,41)}
            i = FindStr(fu_name, "_")                               Try {assert(false)} catch(err) {Line(err,41)}
            if (i>0) {
                params = RT_PluginParam(fu_name)                    Try {assert(false)} catch(err) {Line(err,41)}
                if (FindStr(fu_list, "_"+fu_name)==0 && FindStr(done, "_"+fu_name+params)==0) {
                    done = done + " _"+fu_name+params               Try {assert(false)} catch(err) {Line(err,41)}
                    RT_WriteFile(Filename, "plugin   %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,41)}
                }
            }
        }
    """)
}
#============================================================================
function WritePluginFunctionsSyntaxBackward(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,62)}
        fu_list = RevStr(fu_list)                                   Try {assert(false)} catch(err) {Line(err,62)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,62)}
            fu_name = RevStr(LeftStr(fu_list, i-1))                 Try {assert(false)} catch(err) {Line(err,62)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,62)}
            i = FindStr(fu_name, "_")                               Try {assert(false)} catch(err) {Line(err,62)}
            if (i>0) {
                params = RT_PluginParam(fu_name)                    Try {assert(false)} catch(err) {Line(err,62)}
                if (FindStr(fu_list, "_"+fu_name)==0 && FindStr(done, "_"+fu_name+params)==0) {
                    done = done + " _"+fu_name+params               Try {assert(false)} catch(err) {Line(err,62)}
                    RT_WriteFile(Filename, "plugin   %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,62)}
                }
            }
        }
    """)
}
#============================================================================
#function GetReturnType(string fu, string params) { r = "?" }
#============================================================================
function GetReturnType(string fu, string params) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        RT_DebugF("Fu=%s %s", fu, params, name="GetReturnType")     Try {assert(false)} catch(err) {Line(err,86)}
        if (MidStr(fu,3,1)=="+") {fu = LeftStr(fu,2)+MidStr(fu,2)   Try {assert(false)} catch(err) {Line(err,86)}}
        if (MidStr(fu,2,1)=="+") {fu = LeftStr(fu,1)+fu             Try {assert(false)} catch(err) {Line(err,86)}}
        else if (fu=="Assert") {r = "conditional halt"              Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "avss_26_DSS2")>0) {r = "clip"         Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "ImageSeq_")>0) {r = "clip"            Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "LoadCPlugin")>0) {r = "void"          Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "LoadVirtualdubPlugin")>0) {r = "void" Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "MDepan")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "MSCDetection")>0) {r = "clip"         Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "mvtools2_")>0) {r = "clip?"           Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "ResampleAudio")>0) {r = "clip"        Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "Resize")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "RT_Debug")>0) {r = "clip"             Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "RT_FSel")>0) {r = "."                 Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "Source")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else {
            bc = BlankClip(width=8,height=8,length=1,pixel_type="YV12")
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
            fp =   LeftStr(params,2)=="cc" ? "(bc,bc)"
                \ : LeftStr(params,2)=="cf" ? "(bc,0.1)"
                \ : LeftStr(params,3)=="cci" ? "(bc,bc,0)"
                \ : LeftStr(params,5)=="ciiii" ? "(bc,0,0,0,0)"
                \ : LeftStr(params,4)=="ciii" ? "(bc,0,0,0)"
                \ : LeftStr(params,3)=="cii" ? "(bc,0,0)"
                \ : LeftStr(params,2)=="ci" ? "(bc,0)"
                \ : LeftStr(params,1)=="c" ? "(bc)"
                \ : LeftStr(params,2)=="ff" ? "(0.1,0.1)"
                \ : LeftStr(params,1)=="f" ? "(0.1)"
                \ : LeftStr(params,2)=="ii" ? "(0,0)"
                \ : LeftStr(params,1)=="i" ? "(0)"
                \ : LeftStr(params,2)=="ss" ? "("+chr(34)+"1"+chr(34)+","+chr(34)+"1"+chr(34)+")"
                \ : LeftStr(params,2)=="si" ? "("+chr(34)+"1"+chr(34)+",1)"
                \ : LeftStr(params,1)=="s" ? "("+chr(34)+"1"+chr(34)+")"
                \ : "()"                                            Try {assert(false)} catch(err) {Line(err,86)}
            Try {
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                r = Eval("current_frame=0 "+fu+fp)                  Try {assert(false)} catch(err) {Line(err,86)}
                r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int" : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
            } catch (msg) {
                Try {
                    r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int" : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                } catch(msg) {
                    r = "?"                                         Try {assert(false)} catch(err) {Line(err,86)}
                }
            }
            if (r=="?") {
                bc = BlankClip(width=8,height=8,length=1,pixel_type="RGB32")
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                fp =   LeftStr(params,2)=="cc" ? "(bc,bc)"
                    \ : LeftStr(params,2)=="cf" ? "(bc,0.1)"
                    \ : LeftStr(params,3)=="cci" ? "(bc,bc,0)"
                    \ : LeftStr(params,5)=="ciiii" ? "(bc,0,0,-0,-0)"
                    \ : LeftStr(params,4)=="ciii" ? "(bc,0,0,0)"
                    \ : LeftStr(params,3)=="cii" ? "(bc,0,0)"
                    \ : LeftStr(params,2)=="ci" ? "(bc,0)"
                    \ : "(bc)"                                      Try {assert(false)} catch(err) {Line(err,86)}
                Try {
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                    r = Eval("current_frame=0 "+fu+fp) Try {assert(false)} catch(err) {Line(err,86)}
                    r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int " : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                } catch (msg) {
                    r = "?"                                         Try {assert(false)} catch(err) {Line(err,86)}
                }
            }
            if (r=="?" && LeftStr(params,1)=="c") {r="clip?"        Try {assert(false)} catch(err) {Line(err,86)}}
        }
    """)
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    return r
}
#=====================================================================================================================
function Line(string s, int ofs) {ofs=default(ofs,0) s=RightStr(s,FindStr(RevStr(s)," ")-1) s=LeftStr(s,StrLen(s)-1) l=int(value(s)+ofs) RT_DebugF("%d",l,name="@line ")}
#=====================================================================================================================
Script may look complicated first but is easy to understand I think. Best I can do today is provide this 'tool' to provoke the failure.
I do assume that the behavior is machine-dependent, since FFT plugins make it more prone to fail,
When reproducing, note that line numbers are logged after the command in that line.

Last edited by martin53; 12th March 2015 at 21:17. Reason: supplement
martin53 is offline  
Old 12th March 2015, 20:34   #946  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
With the recent changes to how the version information is generated internally, was it intentional that the output of Version() itself doesn't use AVS_FULLVERSION now, but only AVS_PROJECT and AVS_COPYRIGHT?
qyot27 is offline  
Old 12th March 2015, 21:02   #947  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by qyot27 View Post
With the recent changes to how the version information is generated internally, was it intentional that the output of Version() itself doesn't use AVS_FULLVERSION now, but only AVS_PROJECT and AVS_COPYRIGHT?
Of course not. Fixed
__________________
AviSynth+
ultim is offline  
Old 13th March 2015, 10:34   #948  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
@Ultim
I've updated as you adviced my avisynth.h to your's last version.
I've been obliged to make the following changes :
Replace all the
Code:
<avs/xxx.h>
with
Code:
"./avs/xxx.h"
For a redistribuable header for creating pluggins, i think it would be better to use "" version instead of <>.

My real question indeed, is : When i tried to recompile my filters, i have one which use "CACHE_25_RANGE". I guess remplacement should be "CACHE_GET_RANGE", but i want to be sure. Thanks.

The exact code is :
Code:
child->SetCacheHints(CACHE_25_RANGE,3);
.....
v.AsClip()->SetCacheHints(CACHE_25_RANGE,2);

Last edited by jpsdr; 13th March 2015 at 10:37.
jpsdr is offline  
Old 13th March 2015, 10:50   #949  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
I think it was decided (for Avs+), that you should include $AVISYNTH_INSTALL_DIR/include to your project include directory inatead of copy them everywhere.
__________________
AviSynth+
innocenat is offline  
Old 13th March 2015, 12:14   #950  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
That's work only if you have avs+ installed, maybe not if you have avs2.6.
Well... it realy doesn't matter, this issue is not a big deal.
jpsdr is offline  
Old 13th March 2015, 14:10   #951  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by jpsdr View Post
My real question indeed, is : When i tried to recompile my filters, i have one which use "CACHE_25_RANGE". I guess remplacement should be "CACHE_GET_RANGE", but i want to be sure. Thanks.

The exact code is :
Code:
child->SetCacheHints(CACHE_25_RANGE,3);
.....
v.AsClip()->SetCacheHints(CACHE_25_RANGE,2);
No, that is actually the wrong fix. The old CACHE_25_* constants got removed by IanB. No plugin should use them anymore. For replacement, you can use one of the first four members of the CachePolicyHint enum. He has documented his new semantics in this post. According to his explanations, the correct replacement in your case should be CACHE_WINDOW, but please also read his post.
__________________
AviSynth+
ultim is offline  
Old 13th March 2015, 14:16   #952  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by innocenat View Post
I think it was decided (for Avs+), that you should include $AVISYNTH_INSTALL_DIR/include to your project include directory inatead of copy them everywhere.
It is $(AVISYNTH_SDK_PATH)\include that should be in your project. And if you don't have Avisynth+'s FilterSDK installed, you can add the path that you manually copied the headers to.

While discussing this on the IRC just recently, it was noticed the installer isn't setting AVISYNTH_SDK_PATH at all. Something that slipped through the cracks. This will be fixed in the next installer on our side.
__________________
AviSynth+
ultim is offline  
Old 13th March 2015, 14:21   #953  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
I think i'll keep what i've done. At least, i'm sure if someone get my project from github :
- He can compile it whatever avisynth version is installed.
- I'm sure it will compile with the same files as me, thing not sure with the way you describe.

Anyway, thanks for your return and these informations.
jpsdr is offline  
Old 13th March 2015, 14:41   #954  |  Link
innocenat
Registered User
 
innocenat's Avatar
 
Join Date: Dec 2011
Posts: 77
It was also discussed that if each plugin keeps its own avisynth.h, when people are compiling it they need to know what version of avisynth.h it is: 2.5? 2.6-a3? 2.6a5? 2.6rc1? 2.6-64bit? Avs+? Even though Avs+ header is compatible with 2.6a5, 2.6rc1 and 2.6MT, in future if breaking change happen (like 2.6rc1 64bit interface), people who are recompiling your plugin need to manually look what version of avisynth.h you are using.

Though personally I also find bundling avisynth.h much easier
__________________
AviSynth+
innocenat is offline  
Old 13th March 2015, 15:46   #955  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
There is, from my point of view, no perfect solution. If people have 2.6rc1, if they build 64 bit version, compatibility is broken. If they have 2.5 installed or a too old 2.6, it will (or may) not compile at all...
After, personnal taste, i'm not big fan of "Getting my project is not enough, you have also to install X,Y,Z,W, etc... if you want to build it" (in fact, i realy don't like these kind of situations, but unfortunately sometimes it's realy unavoiable), this is why, i personnaly choose the "No need to install anything" solution package.
So, for me, both solutions have pro and cons. I choose what i personnaly prefer, because, i like less the other option.
After, i'm absolutely not trying to argue to change anything. Things have been explained, for valid reasons, it's totaly Ok for me.
jpsdr is offline  
Old 13th March 2015, 19:53   #956  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by martin53 View Post
I instrumented the script to report the processing of most lines via DbgView, see embedded code. This script ran several dozen times with 2.6 MT without fail in patched AvsPmod. After I lost patience today and installed Avisynth+ r1576, AvsPmod crashed in several runs and paused (maybe better term than freeze here) in all other runs, between line 124 and 125.
Code:
Try {RT_Version()} catch (msg) {assert(false,"This script requires the RT_Stats plugin.")}
Try {GEval("")} catch (msg) {assert(false,"This script requires the GScript plugin.")}
global ofs=0

#============================================================================
Filename=RT_FSelSaveAs(title="Save Filter list",dir="",filt="Text files|*.txt",fn="_All+Functions_.txt",debug=true)
Assert(FileName.IsString(), "Please provide a file name to save the filter list")

#============================================================================
RT_WriteFile(Filename, VersionString(), Append=false)               Try {assert(false)} catch(err) {Line(err,0)}
WriteInternalFunctionsSyntax(RT_InternalFunctions(), Filename)      Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntax(RT_PluginFunctions(), Filename)          Try {assert(false)} catch(err) {Line(err,0)}
WritePluginFunctionsSyntaxBackward(RT_PluginFunctions(), Filename)  Try {assert(false)} catch(err) {Line(err,0)}
BlankClip().subtitle("Function info is complete.",align=5)

#============================================================================
function WriteInternalFunctionsSyntax(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,23)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,23)}
            fu_name = LeftStr(fu_list, i-1)                         Try {assert(false)} catch(err) {Line(err,23)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,23)}
            params = RT_PluginParam(fu_name)                        Try {assert(false)} catch(err) {Line(err,23)}
            if (FindStr(done, fu_name+params)==0) {
                done = done + " "+fu_name+params                    Try {assert(false)} catch(err) {Line(err,23)}
                RT_WriteFile(Filename, "internal %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,23)}
            }
        }
    """)
}
#============================================================================
function WritePluginFunctionsSyntax(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,41)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,41)}
            fu_name = LeftStr(fu_list, i-1)                         Try {assert(false)} catch(err) {Line(err,41)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,41)}
            i = FindStr(fu_name, "_")                               Try {assert(false)} catch(err) {Line(err,41)}
            if (i>0) {
                params = RT_PluginParam(fu_name)                    Try {assert(false)} catch(err) {Line(err,41)}
                if (FindStr(fu_list, "_"+fu_name)==0 && FindStr(done, "_"+fu_name+params)==0) {
                    done = done + " _"+fu_name+params               Try {assert(false)} catch(err) {Line(err,41)}
                    RT_WriteFile(Filename, "plugin   %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,41)}
                }
            }
        }
    """)
}
#============================================================================
function WritePluginFunctionsSyntaxBackward(string fu_list, string Filename) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        done=""                                                     Try {assert(false)} catch(err) {Line(err,62)}
        fu_list = RevStr(fu_list)                                   Try {assert(false)} catch(err) {Line(err,62)}
        while(fu_list != "") {
            i = FindStr(fu_list+" ", " ")                           Try {assert(false)} catch(err) {Line(err,62)}
            fu_name = RevStr(LeftStr(fu_list, i-1))                 Try {assert(false)} catch(err) {Line(err,62)}
            fu_list = MidStr(fu_list, i+1)                          Try {assert(false)} catch(err) {Line(err,62)}
            i = FindStr(fu_name, "_")                               Try {assert(false)} catch(err) {Line(err,62)}
            if (i>0) {
                params = RT_PluginParam(fu_name)                    Try {assert(false)} catch(err) {Line(err,62)}
                if (FindStr(fu_list, "_"+fu_name)==0 && FindStr(done, "_"+fu_name+params)==0) {
                    done = done + " _"+fu_name+params               Try {assert(false)} catch(err) {Line(err,62)}
                    RT_WriteFile(Filename, "plugin   %s ( %s ) -> %s", fu_name, params, GetReturnType(fu_name, params), Append=true)
                                                                    Try {assert(false)} catch(err) {Line(err,62)}
                }
            }
        }
    """)
}
#============================================================================
#function GetReturnType(string fu, string params) { r = "?" }
#============================================================================
function GetReturnType(string fu, string params) {
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    GScript("""
        RT_DebugF("Fu=%s %s", fu, params, name="GetReturnType")     Try {assert(false)} catch(err) {Line(err,86)}
        if (MidStr(fu,3,1)=="+") {fu = LeftStr(fu,2)+MidStr(fu,2)   Try {assert(false)} catch(err) {Line(err,86)}}
        if (MidStr(fu,2,1)=="+") {fu = LeftStr(fu,1)+fu             Try {assert(false)} catch(err) {Line(err,86)}}
        else if (fu=="Assert") {r = "conditional halt"              Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "avss_26_DSS2")>0) {r = "clip"         Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "ImageSeq_")>0) {r = "clip"            Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "LoadCPlugin")>0) {r = "void"          Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "LoadVirtualdubPlugin")>0) {r = "void" Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "MDepan")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "MSCDetection")>0) {r = "clip"         Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "mvtools2_")>0) {r = "clip?"           Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "ResampleAudio")>0) {r = "clip"        Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "Resize")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "RT_Debug")>0) {r = "clip"             Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "RT_FSel")>0) {r = "."                 Try {assert(false)} catch(err) {Line(err,86)}}
        else if (FindStr(fu, "Source")>0) {r = "clip"               Try {assert(false)} catch(err) {Line(err,86)}}
        else {
            bc = BlankClip(width=8,height=8,length=1,pixel_type="YV12")
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
            fp =   LeftStr(params,2)=="cc" ? "(bc,bc)"
                \ : LeftStr(params,2)=="cf" ? "(bc,0.1)"
                \ : LeftStr(params,3)=="cci" ? "(bc,bc,0)"
                \ : LeftStr(params,5)=="ciiii" ? "(bc,0,0,0,0)"
                \ : LeftStr(params,4)=="ciii" ? "(bc,0,0,0)"
                \ : LeftStr(params,3)=="cii" ? "(bc,0,0)"
                \ : LeftStr(params,2)=="ci" ? "(bc,0)"
                \ : LeftStr(params,1)=="c" ? "(bc)"
                \ : LeftStr(params,2)=="ff" ? "(0.1,0.1)"
                \ : LeftStr(params,1)=="f" ? "(0.1)"
                \ : LeftStr(params,2)=="ii" ? "(0,0)"
                \ : LeftStr(params,1)=="i" ? "(0)"
                \ : LeftStr(params,2)=="ss" ? "("+chr(34)+"1"+chr(34)+","+chr(34)+"1"+chr(34)+")"
                \ : LeftStr(params,2)=="si" ? "("+chr(34)+"1"+chr(34)+",1)"
                \ : LeftStr(params,1)=="s" ? "("+chr(34)+"1"+chr(34)+")"
                \ : "()"                                            Try {assert(false)} catch(err) {Line(err,86)}
            Try {
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                r = Eval("current_frame=0 "+fu+fp)                  Try {assert(false)} catch(err) {Line(err,86)}
                r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int" : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
            } catch (msg) {
                Try {
                    r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int" : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                } catch(msg) {
                    r = "?"                                         Try {assert(false)} catch(err) {Line(err,86)}
                }
            }
            if (r=="?") {
                bc = BlankClip(width=8,height=8,length=1,pixel_type="RGB32")
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                fp =   LeftStr(params,2)=="cc" ? "(bc,bc)"
                    \ : LeftStr(params,2)=="cf" ? "(bc,0.1)"
                    \ : LeftStr(params,3)=="cci" ? "(bc,bc,0)"
                    \ : LeftStr(params,5)=="ciiii" ? "(bc,0,0,-0,-0)"
                    \ : LeftStr(params,4)=="ciii" ? "(bc,0,0,0)"
                    \ : LeftStr(params,3)=="cii" ? "(bc,0,0)"
                    \ : LeftStr(params,2)=="ci" ? "(bc,0)"
                    \ : "(bc)"                                      Try {assert(false)} catch(err) {Line(err,86)}
                Try {
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                    r = Eval("current_frame=0 "+fu+fp) Try {assert(false)} catch(err) {Line(err,86)}
                    r = r.IsBool ? "bool" : r.IsClip ? "clip" : r.IsInt ? "int " : r.IsFloat ? "float" : r.IsString ? "string" : "?"
                                                                    Try {assert(false)} catch(err) {Line(err,86)}
                } catch (msg) {
                    r = "?"                                         Try {assert(false)} catch(err) {Line(err,86)}
                }
            }
            if (r=="?" && LeftStr(params,1)=="c") {r="clip?"        Try {assert(false)} catch(err) {Line(err,86)}}
        }
    """)
                                                                    Try {assert(false)} catch(err) {Line(err,0)}
    return r
}
#=====================================================================================================================
function Line(string s, int ofs) {ofs=default(ofs,0) s=RightStr(s,FindStr(RevStr(s)," ")-1) s=LeftStr(s,StrLen(s)-1) l=int(value(s)+ofs) RT_DebugF("%d",l,name="@line ")}
#=====================================================================================================================
Script may look complicated first but is easy to understand I think. Best I can do today is provide this 'tool' to provoke the failure.
I do assume that the behavior is machine-dependent, since FFT plugins make it more prone to fail,
When reproducing, note that line numbers are logged after the command in that line.
Hi m53!

I've looked at what's happening in detail, and there are three different things going on.
  1. TIVTC.dll cannot handle your clip with a size of 8 pixels. It is crashing in its hand-written assembly routines due to an access violation. This can be solved in your script by increasing the size of your BlankClip to at least 16 pixels.
  2. Average.dll, DePan.dll, and mvtools2.dll are causing access violations all over the place, and multiple times in a single run. They pretty probably don't like the parameters your script is calling them with. This seems irrespective of the clip size they get. Once I've moved them out of my plugins directory (and increased the clip size to 16 for TIVTC), your script executed to the end without errors.
  3. There also seems to be a memory leak that I haven't tracked down yet. This is not what is causing the crashes though, that's going to be the previous two points for almost sure.
Points 1-2 are obviously optimally fixed in the plugins. If no one is going to fix them, your script can at least work around point 1), and as for point 2)... well, you decide what's the best course of action. Note that you might also have additional plugins on your machine that I don't and are causing similar issues.

As for point 3), I'm still investigating it. It might be something inside AviSynth+. But due to your script calling all possible plugin functions and many plugins being buggy (see previous point) by not doing nearly enough parameter validations, this too might as well be a result of an erronous plugin. Even probably.

Anyway, the crash itself wasn't due to AviSynth+.
__________________
AviSynth+

Last edited by ultim; 13th March 2015 at 19:58.
ultim is offline  
Old 13th March 2015, 22:28   #957  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Ultim,
thank you for the detailed analysis! Especially that you took the time to assign the plugin crashes to the particular plugins. Be sure I estimate this right!
It is still worrying me that the same buggy plugins started from Avisynth 2.6 MT and Avisynth+ make the system as a whole react so differently. And more than the fact it reproduceably crashes after call of certain plugins - which I probably best can solve by explicitly checking in my script and provide a prepared return value - this extreme pausing is weird.
Can Avisynth+ itself do anything more to control/manage plugin crashes even better than now?
martin53 is offline  
Old 13th March 2015, 22:43   #958  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by martin53 View Post
Ultim,
thank you for the detailed analysis! Especially that you took the time to assign the plugin crashes to the particular plugins. Be sure I estimate this right!
It is still worrying me that the same buggy plugins started from Avisynth 2.6 MT and Avisynth+ make the system as a whole react so differently. And more than the fact it reproduceably crashes after call of certain plugins - which I probably best can solve by explicitly checking in my script and provide a prepared return value - this extreme pausing is weird.
Can Avisynth+ itself do anything more to control/manage plugin crashes even better than now?
You should also consider that there are DLLs that are needed for some plugins that cause havoc by just loitering in the auto-load directory. Do a search for "AVSFilterNet.dll", for example.
Groucho2004 is offline  
Old 13th March 2015, 23:13   #959  |  Link
ultim
AVS+ Dev
 
ultim's Avatar
 
Join Date: Aug 2013
Posts: 359
Quote:
Originally Posted by martin53 View Post
Ultim,
thank you for the detailed analysis! Especially that you took the time to assign the plugin crashes to the particular plugins. Be sure I estimate this right!
It is still worrying me that the same buggy plugins started from Avisynth 2.6 MT and Avisynth+ make the system as a whole react so differently. And more than the fact it reproduceably crashes after call of certain plugins - which I probably best can solve by explicitly checking in my script and provide a prepared return value - this extreme pausing is weird.
Can Avisynth+ itself do anything more to control/manage plugin crashes even better than now?
By the nature of access violations, they will have different effects based on what code is loaded, how much memory was allocated and in what order, what is stored in the memory etc. The point in time where the OS starts screaming about these errors is typically just the tip of the iceberg, and there's a really good chance that memory got corrupted a lot earlier than that. Not every memory corruption manifests itself as an access violation error: when that happens, it merely means - in laymen terms - that the corruption has spread so much that even the OS recognized it. If a video encoding process doesn't crash (which is by pure chance) when an access violation happens in a plugin, that's worse than crashing, because then most probably your encode will be corrupted, and you won't notice it.

All the above means that trying to recover from an access violation is pretty much the worst thing you can do. It might seem odd for a user, but in such a case it really is best practice to just terminate loudly, as soon and fast as you can. Any attempt to recover might make things much worse. Hiding it won't do you any good, because even though you can hide it from the user, it is impossible to negate the corruption it has caused.

My point is: If a plugin is crashing due to an access violation, I'm glad if the whole process crashes. You should be too. I certainly won't try to manage it any "better". I am already performing sub-optimal by turning it into a C++ exception, but that is to have similar behavior to AviSynth 2.6.
__________________
AviSynth+

Last edited by ultim; 13th March 2015 at 23:17.
ultim is offline  
Old 13th March 2015, 23:31   #960  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Maybe it's not worth to put toooo much work into dealing with touchy plugins.

Why did I write this odd script? Because for writing on the Avisynth+ documentation pages I was just interested in an inventory of all available functions (unrecognized plugin funcs too, out of pure curiosity), and if they were clip or non-clip functions.
Maybe there is a much better way for that than this dumb script?

Of course once the script was in the world, I was also unsettled by the more obvious malfunction in combination with Avisynth+. Yet I agree that malfunctions should either be contained properly, and if they can't - which will sure be mostly the case with access violations - a hidden damage is no better than an obvious one.

Last edited by martin53; 13th March 2015 at 23:36. Reason: read above post after writing this one
martin53 is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.