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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th October 2013, 22:57   #181  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
EDIT: @M53,
Not terribly sensible at the moment, did not like almost any of your previous ideas.
but always willing to listen, and when I'm again alive/awake/not drunk/ shall review again.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th October 2013 at 23:01.
StainlessS is offline   Reply With Quote
Old 1st November 2013, 15:49   #182  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sorry, M53, not ignoring you, will get around to answering. Please be patient.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 2nd November 2013, 23:07   #183  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
New Version RT_Stats v1.28Beta2 here:- LINK REMOVED

Code:
Added to v1.28 Beta-2


RT_IncrGlobal(string GlobalName,int "Init"=1)
 Given the name of a Global Int variable, will increment that Global (ie add 1 to it) and return the result.
 If Global int does not exist, will initialize it to the optional Init arg, default 1.
 So if GlobalInt is already initialized to 1, then RT_IncrGlobal("GlobalInt") sets GlobalInt to 2
 (equiv:- Global GlobalInt = GlobalInt + 1).
 If GlobalName exists in local scope as a local variable, then it will set the same named Global Variable
 to the value of the local variable + 1, local variables 'hide' similarly named Global variables, and a plugin
 cannot tell the difference between local and global variables, so make sure you do not use local variables
 of similar names to global ones.
 Will throw an error if GlobalName exists but variable is not of type Int.

***
***
***

*****************************************************
**********       RT_ARRAY FUNCTIONS       ***********
*****************************************************

The RT_ArrayXXXX type functions are primitives intended to be lightweight. Added to v1.28Beta2 are 16 Attribute int's for
whatever purpose the script writer desires, eg dimensions for multi-dimension arrays (multi to single dimension handled by user script)
or some kind of bit flags. It could also be possible in script to create script functions to eg create a dictionary or database using
separate ARRAY's together, perhaps using a MASTER ARRAY to hold filenames of the subordinate arrays, and in the Attributes, the
subordinate array variable type. Perhaps the first subordinate array could hold the name of a plugin and the 2nd the full file path on
YOUR system (or a path relative to a user_plugin_dir on YOUR system). I am waiting for YOU to amaze me with your creativity.

***
***
***

RT_ArrayAlloc(string FileName,int "Type"=1,int "Nels"=0,int "StringLenMax"=256)
 Creates a file to hold Array elements of type Bool, Int, Float, String, or BIN.
  BIN is a BYTE (8 bit) sized Int where only lowest 8 bits of Int are stored in array as an unsigned 8 bit int, upper 24 bits ignored.
 Filename, Array Filename, no default.
 Type, int, default 1(0 -> 4). 0=Bool, 1=Int, 2 = Float, 3 = String, 4 = BIN.
 Nels, default 0. Number of array elements, initialized to zeros (Bool=False,Float=0.0,String="").
 StringLenMax, default 256(greater than zero). Fixed Maximum string length excluding nul term. Error if string length exceeds.
  Only used for Type=3 (string).
 Returns number of elements in array. All RT_ArrayXXXX() errors produce an error alert.

***
***
***

RT_ArrayGetType(string FileName)
 Filename, Array Filename, no default.
 Returns int, Type as set by RT_ArrayAlloc.

***
***
***

RT_ArrayGetNels(string FileName)
 Filename, Array Filename, no default.
 Returns int, Nels as set by RT_ArrayAlloc, or current Nels if RT_ArrayAppend used to add vars to end of array.

***
***
***

RT_ArrayGetElSize(string FileName)
 Filename, Array Filename, no default.
 Returns int, element size, Type 0(bool)=1, 1(int)=4, 2(float)=4, 3(string)=StringLenMax, 4(BIN)=1, as set by RT_ArrayAlloc.

***
***
***

RT_ArrayGetNelMax(string FileName)
 Filename, Array Filename, no default.
 Returns int, maximum number of elements that could theoretically be stored in array, based on (maximum +ve integer - header size) / ElSize.

***
***
***

RT_ArrayGet(string FileName,int Nel)
 Filename, Array Filename, no default.
 Nel, int, zero relative. Valid range 0 -> RT_ArrayGetNels(FileName) - 1.
 Returns Array(Nel) of variable Type as set in RT_ArrayAlloc.
  Type BIN returns an Int range 0 -> 255.

***
***
***

RT_ArraySet(string FileName,int Nel,Var)
 Filename, Array Filename, no default.
 Nel, int, zero relative. Valid range 0 -> RT_ArrayGetNels(FileName) - 1.
 Var, a variable of Type as set in RT_ArrayAlloc.
 Returns number of elements in array.

***
***
***

RT_ArrayAppend(string FileName,Var)
 Adds a variable to end of array and increments the Nel count.
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc.
 Returns number of elements in array.

***
***
***

RT_ArrayGetAttrib(string FileName,int ix)
 There are 16 avalable int attributes in the Array file header, that can be used for whatever purpose you like,
  perhaps array dimensions where user script handles multiple dimension array.
  RT_ArrayAlloc() initializes all Attributes to 0.
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Returns the value of the user set attribute (or 0 if not yet set).

***
***
***

RT_ArraySetAttrib(string FileName,int ix,int value)
 There are 16 avalable int attributes in the Array file header, that can be used for whatever purpose you like,
  perhaps array dimensions where user script handles multiple dimension array.
  RT_ArrayAlloc() initializes all Attributes to 0.
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Value, int, The value that Attrib(ix) will be set to.
 Returns value.


*****************************************************
**********       OTHER FUNCTIONS          ***********
*****************************************************

RT_Version()
 Returns the Float version number of RT_Stats, but slightly modified for beta versions.
 A non beta version would return a number like 1.28, with two decimal digits of precision.
 A version of v1.28Beta2 shown by RT_Stats() on frame, will return 1.2792 rather than 1.28.
  9 in the 1/1000's position signifies the beta version in the 1/10000's column.
  This allows direct comparison of version numbers including Beta versions

***
***
***

RT_VersionString()
 Return RT_Stats version as a string eg "1.28Beta2".

***
***
***

RT_VersionDll()
 Return RT_Stats(26).dll version as a Float eg 2.6 for Avistynth v2.6, or 2.5 for Avisynth 2.5.

***
***
***

RT_ScriptDir()
 Returns String, Path to Script Directory. Same as ScriptDir in Avisynth v2.6.
 Returns "", if cannot find ScriptDir.

***
***
***

RT_ScriptFile()
 Returns String, filename of Script without path. Same as ScriptFile in Avisynth v2.6.
 Returns "", if cannot find ScriptFile.


***
***
***

RT_ScriptName()
 Returns String, filename of Script including path. Same as ScriptName in Avisynth v2.6.
 Returns "", if cannot find ScriptName.


***
***
***

RT_PluginDir()
 Returns String, path to Avisynth plugins directory.
 Returns "", if plugin dir not found.


***
***
***

RT_InternalFunctions()
 Returns String, SPACE separated list of internal filter and function names.
 Returns "", if cannot find InternalFunctions.
 If you like a good read try this:-
  S=RT_StrReplace(RT_InternalFunctions," ",Chr(10))
  ColorBars.ScriptClip("""RT_Subtitle("%s",S,align=5,y=height+100-current_frame,expx=true,expy=true)""").killaudio

***
***
***

RT_PluginFunctions()
 Returns String, SPACE separated list of external filter and function names.
 Returns "", if cannot find PluginFunctions.
 If you like a good read try this:-
 S=RT_StrReplace(RT_PluginFunctions," ",Chr(10))
 ColorBars.ScriptClip("""RT_Subtitle("%s",S,align=5,y=height+100-current_frame,expx=true,expy=true)""").killaudio

***
***
***

RT_PluginParam(String FunctionName)
 FunctionName, String, name of Avisynth built-in or Plugin filter or function name.
 Returns "", if FunctionName Parameter string not found.
 Returns String, the Avisynth CPP Interface style argument specifier string used by Avisynth to determine argument types and optional names.
  Optional arguments have square brackets surrounding their name as in [name] and are followed by a type specifier character that gives
  the type. Unnamed arguments are not optional. eg "cc[arg1]b[arg2]i" would be two compulsory unnamed clip args, followed by optional
  'arg1' of type bool and optional 'arg2' of type int.
    # Argument type specifier strings.
      c - Video Clip
      i - Integer number
      f - Float number
      s - String
      b - boolean
      . - Any type (dot)
    # Array Specifiers
      i* - Integer Array, zero or more
      i+ - Integer Array, one or more
      .* - Any type Array, zero or more
      .+ - Any type Array, one or more
    #    Etc
   To show params:-
      colorbars().Killaudio()
      S=RT_PluginParam("RT_YStats")
      S=RT_StrReplace(S,"[",Chr(10)+"[")
      RT_Subtitle(s)

***
***
***

Quote:
Originally Posted by martin53 View Post
- When scripts are published, the fixed filename, probably including path, might be an obstacle. I made the observation that depending on opening a script in AvsPmod, VDub via file/open or VDub via contextmenu "open with" or via drag & drop over the app window, the current path is sometimes the script path, sometimes the executable path. Classic file IO allowed a file to have a number, or better, an alias; and only the open command needs the file name. Otherwise many lines need to be adapted, and readability is bad.
- I often have several scripts open at the same time. So I'd need to implement a mechanism with an 'exist' loop to find the next free filename, and use that. Only starting from v2.60, AviSynth provides predefined variables for script path and name, and depending on method how script is opened, these variables are not set properly - see old thread where we discussed all that stuff.
- If the script crashes, no cleanup funcs (RT_FileDelete()) on script level can be called in most cases (can be done with try/catch, but not every script is enclosed in try/catch etc)

So I'd like to propose these changes:
- RT_ArrayAlloc() allows filename to be empty, will then use %Temp%\UniqueFile itself, maybe return this name instead of Nels
- RT_ArrayAlloc() allows an additional string for the 'handle name' or 'variable name' of the array
- other functions then work with the latter instead of the file name: more naming freedom, better readability
- at least if RT_ArrayAlloc() was called with an empty file name, file is automatically deleted in plugin destructor. Alternatively an additional bool parameter to control this.
Dont really like any of the above, sorry.

It is intended that the array function suite be as lightweight as possible (primitives), and that a user can implement eg multi-dimensional
arrays via script functions. Have now implemented 16 int sized array attributes, could be used to store dimensions, or eg bitflags for
whatever usage.
Having to mess with filenames should be in the hands of the client script, perhaps I could implement a unique filename generator or whatever
but best left out of the array routines and auto deletion is a no-go, runtime filters have no destructor.
The ARRAY file is opened and closed on each access, so the name is needed, I would not entertain the idea of using any kind of file handle
and expecting the script user to deal properly with files, also although it may not be impossible to tie the invididual routines together
to use a single memory area, I would not like to try to implement this and have no idea what additional problems (if any) might arise in
eg multi-threaded versions of avisynth.
Having to use a variable holding a handle, is not really any different to using a variable holding a filename.
Perhaps a function to delete filenames on Avisynth exit could be written, but Ive never written an onexit type func and may have additional
complications if more than a single file were required to be deleted, myself I would prefer if half completed files were left in-situ
(after crash), might help in diagnositcs on cause, and dont really like a file being created 'somewhere on some hard drive'.


Quote:
@StainlessS: Is the filename parameter able to expand environment strings like %temp%, or do you suggest to use e.g. the GetSystemEnv plugin for that?
I was curious about that myself so I tried it. Tried ARRAY="%TEMP%\TestArray" which failed.


Addition Requests,
RT_PluginDir() DONE
RT_GetSystemEnv() OK, Coming
RT_GetFileInfo() OK, Coming

Written some time later:-
Am thinking about making primitives multi-dimensional, either 2 or 3 max dimensions, if so, then args to array funcs will change.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 6th November 2013 at 04:21.
StainlessS is offline   Reply With Quote
Old 2nd November 2013, 23:13   #184  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
See previous post for new version RT_Stats v1.28Beta2

RT_Test_Array.Avs
Code:
# RT_Test_Array.Avs

/*
RT_ArrayAlloc(string FileName,int "Type"=1,int "Nels"=0,int "StringLenMax"=256)
RT_ArrayGetType(string FileName)
RT_ArrayGetNels(string FileName)
RT_ArrayGetElSize(string FileName)
RT_ArrayGetNelMax(string FileName)
RT_ArrayGet(string FileName,int nel)
RT_ArraySet(string FileName,int nel,var)
RT_ArrayAppend(string FileName,var)
RT_ArrayGetAttrib(string FileName,int ix)
RT_ArraySetAttrib(string FileName,int ix,int value)
*/

ARRAY="TestArray.ARR"   # ARRAY name
START_TYPE = 0          # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int)
END_TYPE = 4            # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int) ## >= START_TYPE ##
NELS = 100000           # Inital Number of Array elements (init'ed to zero's) [Will be doubled by Append/Get]
STRINGLENMAX = 64       # Excluding Nul Term.
                        # Take care with NELS and STRINGLENMAX when processing Type=String.
                        # Approx string usage greater than (NELS * (STRINGLENMAX+1) * 6)
                        # String memory not released till Avisynth closure, no dead string garbage collection by Avisynth.
DELETE = True           # True = Delete ARRAY file when done

ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ALPHA=ALPHA+ALPHA # Len 260
ALPHA=(STRINGLENMAX<STRLEN(ALPHA)) ? LeftStr(ALPHA,STRINGLENMAX) : ALPHA        # cut down string manips and usage

TYPENAMES=RT_String("BOOL\nINT\nFLOAT\nSTRING\nBIN\n")

GScript("""
    RT_DebugF("RT_Test_Array.avs")
    TOTAL_START=RT_Timer()
    RT_DebugF("")
    For(TYPE=START_TYPE,END_TYPE) {
        RT_DebugF("==============================")
        TYPE_START=RT_Timer()
        RT_ArrayAlloc(ARRAY,Type=TYPE,Nels=NELS,stringlenmax=STRINGLENMAX)
        STOP=RT_Timer()
        RT_DebugF("Type   = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Nels   = %d",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        RT_DebugF("Alloc Time = %.3f secs (Per element %f microsecs)",STOP-TYPE_START,1000000.0*(STOP-TYPE_START)/NELS)
        RT_DebugF("\nCheck Init")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i)) {RT_DebugF("BOOL(%d) Init != False",i)}}
        } Else if(TYPE==1) { # Int
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0) {RT_DebugF("INT(%d) Init != 0",i)}}
        } Else if(TYPE==2) { # Float
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0) {RT_DebugF("FLOAT(%d) Init != 0.0",i)}}
        } Else if(TYPE==3) { # String
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != ""){RT_DebugF("STRING(%d) Init != %c%c",i,34,34)}}
        } Else if(TYPE==4) { # BIN
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0) {RT_DebugF("BIN(%d) Init != 0",i)}}
        }
        Try {RT_ArrayGet(ARRAY,NELS) RT_DebugF("Init END Check FAILED")} catch (err) {RT_DebugF("Init END Check Passed")}
        STOP=RT_Timer()
        RT_DebugF("Check Init Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Attributes Set/Get")
        START=RT_Timer()
        for(i=0,15) {
            vs=i*1000
            RT_ArraySetAttrib(ARRAY,i,vs)
            vg = RT_ArrayGetAttrib(ARRAY,i)
            if(vg != vs) {
                RT_DebugF("%d) TYPE=%d SetAttrib/GetAttrib Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Attributes Set/Get = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Set only Time Test on %d Nels",NELS)
        vs=Select(TYPE,True,42,42.0,RightStr(ALPHA + "_" + String(42),STRINGLENMAX) ,42)
        START=RT_Timer()
        for(i=0,NELS-1) {
            RT_ArraySet(ARRAY,i,vs)
        }
        STOP=RT_Timer()
        RT_DebugF("Check Set Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Get only Time Test on %d Nels",NELS)
        START=RT_Timer()
        for(i=0,NELS-1) {RT_ArrayGet(ARRAY,i)}
        STOP=RT_Timer()
        RT_DebugF("Check Get Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Set/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,NELS-1) {
                vs = RT_BitTST(i,0) RT_ArraySet(ARRAY,i,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,NELS-1) {
                vs = i RT_ArraySet(ARRAY,i,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,NELS-1) {
                vs = Float(i) RT_ArraySet(ARRAY,i,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,NELS-1) {
                vs=RightStr(ALPHA + "_" + String(i),STRINGLENMAX) RT_ArraySet(ARRAY,i,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,NELS-1) {
                vs = RT_BitAnd(i,$FF) RT_ArraySet(ARRAY,i,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Set/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Append/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=NELS,NELS*2-1) {
                vs = RT_BitTST(i,0) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=NELS,NELS*2-1) {
                vs = i RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=NELS,NELS*2-1) {
                vs = Float(i) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==3) { # String
            for(i=NELS,NELS*2-1) {
                vs=RightStr(ALPHA + "_" + String(i),STRINGLENMAX) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=NELS,NELS*2-1) {
                vs = RT_BitAnd(i,$FF) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        }
        if(RT_ArrayGetNels(ARRAY) != NELS * 2) {
            RT_DebugF("Final Check ERROR, RT_ArrayGetNels != NELS *2 (is %d)",RT_ArrayGetNels(ARRAY))
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Append/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("ALL Checks Done\n")
        RT_DebugF("Type   = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Nels   = %d (Should have doubled)",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        STOP=RT_Timer()
        RT_DebugF("Total Time Type=%d (%s) = %.3f secs",Type,RT_TxtGetLine(TYPENAMES,Type),STOP-TYPE_START)
    }
    (DELETE) ? RT_FileDelete(ARRAY) : NOP
    TOTAL_STOP=RT_Timer()
    RT_DebugF("SCRIPT TOTAL TIME = %.3f secs",TOTAL_STOP-TOTAL_START)
""")
return colorbars()
Results Following post (exceeds D9 16kb limit)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 2nd November 2013, 23:13   #185  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
See previous two posts

Results from debugview
Code:
00000001    0.00000000      RT_DebugF: RT_Test_Array.avs
00000002    0.00013451      RT_DebugF:
00000003    0.00022344      RT_DebugF: ==============================
00000004    0.00160964      RT_DebugF: Type   = 0 (BOOL)
00000005    0.00178056      RT_DebugF: Nels   = 100000
00000006    0.00194980      RT_DebugF: ElSize = 1
00000007    0.00219927      RT_DebugF: NelMax = 2147483391 ($7FFFFEFF)
00000008    0.00229950      RT_DebugF: Alloc Time = 0.015 secs (Per element 0.150000 microsecs)
00000009    0.00238137      RT_DebugF:
00000010    0.00240546      RT_DebugF: Check Init
00000011    8.29076195      RT_DebugF: Init END Check Passed
00000012    8.29092121      RT_DebugF: Check Init Time = 8.281 secs (Per element 82.809990 microsecs)
00000013    8.29100418      RT_DebugF: Check Attributes Set/Get
00000014    8.29455185      RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000015    8.29464054      RT_DebugF: Check Set only Time Test on 100000 Nels
00000016    20.87353134     RT_DebugF: Check Set Only Time = 12.579 secs (Per element 125.790001 microsecs)
00000017    20.87361526     RT_DebugF: Check Get only Time Test on 100000 Nels
00000018    29.33578873     RT_DebugF: Check Get Only Time = 8.468 secs (Per element 84.680000 microsecs)
00000019    29.33587074     RT_DebugF: Check Compare Set/Get
00000020    57.12252045     RT_DebugF: Check Compare Set/Get Time = 27.782 secs (Per element 277.820007 microsecs) [Including Data generation]
00000021    57.12260437     RT_DebugF: Check Compare Append/Get
00000022    86.21274567     RT_DebugF: Check Compare Append/Get Time = 29.093 secs (Per element 290.930023 microsecs) [Including Data generation]
00000023    86.21282959     RT_DebugF: ALL Checks Done
00000024    86.21285248     RT_DebugF:
00000025    86.21306610     RT_DebugF: Type   = 0 (BOOL)
00000026    86.21323395     RT_DebugF: Nels   = 200000 (Should have doubled)
00000027    86.21340179     RT_DebugF: ElSize = 1
00000028    86.21364594     RT_DebugF: NelMax = 2147483391 ($7FFFFEFF)
00000029    86.21384430     RT_DebugF: Total Time Type=0 (BOOL) = 86.218 secs
00000030    86.21392822     RT_DebugF: ==============================
00000031    86.21581268     RT_DebugF: Type   = 1 (INT)
00000032    86.21598053     RT_DebugF: Nels   = 100000
00000033    86.21614838     RT_DebugF: ElSize = 4
00000034    86.21640015     RT_DebugF: NelMax = 536870847 ($1FFFFFBF)
00000035    86.21649933     RT_DebugF: Alloc Time = 0.016 secs (Per element 0.159988 microsecs)
00000036    86.21658325     RT_DebugF:
00000037    86.21660614     RT_DebugF: Check Init
00000038    94.72898102     RT_DebugF: Init END Check Passed
00000039    94.72914124     RT_DebugF: Check Init Time = 8.500 secs (Per element 85.000000 microsecs)
00000040    94.72921753     RT_DebugF: Check Attributes Set/Get
00000041    94.73278809     RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.159988 microsecs)
00000042    94.73288727     RT_DebugF: Check Set only Time Test on 100000 Nels
00000043    107.19555664    RT_DebugF: Check Set Only Time = 12.453 secs (Per element 124.530029 microsecs)
00000044    107.19564056    RT_DebugF: Check Get only Time Test on 100000 Nels
00000045    115.66921234    RT_DebugF: Check Get Only Time = 8.484 secs (Per element 84.839943 microsecs)
00000046    115.66929626    RT_DebugF: Check Compare Set/Get
00000047    137.12696838    RT_DebugF: Check Compare Set/Get Time = 21.453 secs (Per element 214.530014 microsecs) [Including Data generation]
00000048    137.12704468    RT_DebugF: Check Compare Append/Get
00000049    159.96316528    RT_DebugF: Check Compare Append/Get Time = 22.844 secs (Per element 228.439941 microsecs) [Including Data generation]
00000050    159.96325684    RT_DebugF: ALL Checks Done
00000051    159.96327209    RT_DebugF:
00000052    159.96348572    RT_DebugF: Type   = 1 (INT)
00000053    159.96365356    RT_DebugF: Nels   = 200000 (Should have doubled)
00000054    159.96382141    RT_DebugF: ElSize = 4
00000055    159.96406555    RT_DebugF: NelMax = 536870847 ($1FFFFFBF)
00000056    159.96424866    RT_DebugF: Total Time Type=1 (INT) = 73.766 secs
00000057    159.96434021    RT_DebugF: ==============================
00000058    159.96620178    RT_DebugF: Type   = 2 (FLOAT)
00000059    159.96636963    RT_DebugF: Nels   = 100000
00000060    159.96653748    RT_DebugF: ElSize = 4
00000061    159.96679688    RT_DebugF: NelMax = 536870847 ($1FFFFFBF)
00000062    159.96688843    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000063    159.96696472    RT_DebugF:
00000064    159.96701050    RT_DebugF: Check Init
00000065    168.78349304    RT_DebugF: Init END Check Passed
00000066    168.78366089    RT_DebugF: Check Init Time = 8.812 secs (Per element 88.120117 microsecs)
00000067    168.78373718    RT_DebugF: Check Attributes Set/Get
00000068    168.78729248    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000069    168.78738403    RT_DebugF: Check Set only Time Test on 100000 Nels
00000070    181.40660095    RT_DebugF: Check Set Only Time = 12.625 secs (Per element 126.250000 microsecs)
00000071    181.40667725    RT_DebugF: Check Get only Time Test on 100000 Nels
00000072    189.87194824    RT_DebugF: Check Get Only Time = 8.469 secs (Per element 84.689941 microsecs)
00000073    189.87202454    RT_DebugF: Check Compare Set/Get
00000074    237.55381775    RT_DebugF: Check Compare Set/Get Time = 47.688 secs (Per element 476.880035 microsecs) [Including Data generation]
00000075    237.55390930    RT_DebugF: Check Compare Append/Get
00000076    286.65341187    RT_DebugF: Check Compare Append/Get Time = 49.093 secs (Per element 490.929871 microsecs) [Including Data generation]
00000077    286.65350342    RT_DebugF: ALL Checks Done
00000078    286.65350342    RT_DebugF:
00000079    286.65371704    RT_DebugF: Type   = 2 (FLOAT)
00000080    286.65390015    RT_DebugF: Nels   = 200000 (Should have doubled)
00000081    286.65405273    RT_DebugF: ElSize = 4
00000082    286.65429688    RT_DebugF: NelMax = 536870847 ($1FFFFFBF)
00000083    286.65451050    RT_DebugF: Total Time Type=2 (FLOAT) = 126.687 secs
00000084    286.65457153    RT_DebugF: ==============================
00000085    286.67214966    RT_DebugF: Type   = 3 (STRING)
00000086    286.67233276    RT_DebugF: Nels   = 100000
00000087    286.67248535    RT_DebugF: ElSize = 64
00000088    286.67276001    RT_DebugF: NelMax = 33554427 ($1FFFFFB)
00000089    286.67288208    RT_DebugF: Alloc Time = 0.016 secs (Per element 0.160217 microsecs)
00000090    286.67297363    RT_DebugF:
00000091    286.67297363    RT_DebugF: Check Init
00000092    295.52035522    RT_DebugF: Init END Check Passed
00000093    295.52050781    RT_DebugF: Check Init Time = 8.859 secs (Per element 88.589783 microsecs)
00000094    295.52059937    RT_DebugF: Check Attributes Set/Get
00000095    295.52416992    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000096    295.52426147    RT_DebugF: Check Set only Time Test on 100000 Nels
00000097    308.34729004    RT_DebugF: Check Set Only Time = 12.829 secs (Per element 128.290100 microsecs)
00000098    308.34735107    RT_DebugF: Check Get only Time Test on 100000 Nels
00000099    316.90744019    RT_DebugF: Check Get Only Time = 8.546 secs (Per element 85.459900 microsecs)
00000100    316.90750122    RT_DebugF: Check Compare Set/Get
00000101    365.86749268    RT_DebugF: Check Compare Set/Get Time = 48.969 secs (Per element 489.690247 microsecs) [Including Data generation]
00000102    365.86758423    RT_DebugF: Check Compare Append/Get
00000103    416.47927856    RT_DebugF: Check Compare Append/Get Time = 50.610 secs (Per element 506.099854 microsecs) [Including Data generation]
00000104    416.47937012    RT_DebugF: ALL Checks Done
00000105    416.47937012    RT_DebugF:
00000106    416.47958374    RT_DebugF: Type   = 3 (STRING)
00000107    416.47976685    RT_DebugF: Nels   = 200000 (Should have doubled)
00000108    416.47991943    RT_DebugF: ElSize = 64
00000109    416.48022461    RT_DebugF: NelMax = 33554427 ($1FFFFFB)
00000110    416.48040771    RT_DebugF: Total Time Type=3 (STRING) = 129.829 secs
00000111    416.48049927    RT_DebugF: ==============================
00000112    416.48214722    RT_DebugF: Type   = 4 (BIN)
00000113    416.48233032    RT_DebugF: Nels   = 100000
00000114    416.48251343    RT_DebugF: ElSize = 1
00000115    416.48278809    RT_DebugF: NelMax = 2147483391 ($7FFFFEFF)
00000116    416.48287964    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000117    416.48297119    RT_DebugF:
00000118    416.48300171    RT_DebugF: Check Init
00000119    425.30059814    RT_DebugF: Init END Check Passed
00000120    425.30075073    RT_DebugF: Check Init Time = 8.813 secs (Per element 88.129883 microsecs)
00000121    425.30084229    RT_DebugF: Check Attributes Set/Get
00000122    425.30444336    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000123    425.30453491    RT_DebugF: Check Set only Time Test on 100000 Nels
00000124    437.77297974    RT_DebugF: Check Set Only Time = 12.468 secs (Per element 124.679871 microsecs)
00000125    437.77307129    RT_DebugF: Check Get only Time Test on 100000 Nels
00000126    446.27523804    RT_DebugF: Check Get Only Time = 8.500 secs (Per element 85.000000 microsecs)
00000127    446.27529907    RT_DebugF: Check Compare Set/Get
00000128    474.72674561    RT_DebugF: Check Compare Set/Get Time = 28.454 secs (Per element 284.540100 microsecs) [Including Data generation]
00000129    474.72683716    RT_DebugF: Check Compare Append/Get
00000130    504.42544556    RT_DebugF: Check Compare Append/Get Time = 29.703 secs (Per element 297.030029 microsecs) [Including Data generation]
00000131    504.42553711    RT_DebugF: ALL Checks Done
00000132    504.42556763    RT_DebugF:
00000133    504.42578125    RT_DebugF: Type   = 4 (BIN)
00000134    504.42593384    RT_DebugF: Nels   = 200000 (Should have doubled)
00000135    504.42611694    RT_DebugF: ElSize = 1
00000136    504.42636108    RT_DebugF: NelMax = 2147483391 ($7FFFFEFF)
00000137    504.42654419    RT_DebugF: Total Time Type=4 (BIN) = 87.953 secs
00000138    504.42694092    RT_DebugF: SCRIPT TOTAL TIME = 504.453 secs
Core Duo Dual Core 2.13GHz, 3GB DDR2, Half full non-system 320 GB SATA2
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th November 2013 at 09:06.
StainlessS is offline   Reply With Quote
Old 4th November 2013, 18:28   #186  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Quote:
Originally Posted by StainlessS View Post
1) perhaps I could implement a unique filename generator or whatever but best left out of the array routines
2) auto deletion is a no-go, runtime filters have no destructor
3) Having to use a variable holding a handle, is not really any different to using a variable holding a filename
1) agree, maybe current system time with sufficient fine resolution is good for that (returned as >6 digit string? NTFS uses a 100ns time resolution afaik)
2) oops - agree, of course
3) agree, Gavino stated that too, variable name can be chosen as to indicate the array purpose

Also agree with the aspect that non-deleted file can help with debugging.

If %TEMP% can be resolved one day (outside of array routines is OK for that), then I can clean up that dir from time to time. During script writing, I have *lots* of crashes, :'(
martin53 is offline   Reply With Quote
Old 4th November 2013, 19:39   #187  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Could not keep myself from trying these funny functions
Code:
global PATH = RT_ScriptDir + "\functions.txt"
RT_TxtWriteFile("======== Internal Functions ========", PATH, false)
RT_InternalFunctions.Write
RT_TxtWriteFile("======== Plugin Functions ========", PATH, true)
RT_PluginFunctions.Write
function Write(string s) {
    i = s.FindStr(" ")
    GScript(""" #"
        while(i>0) {
            if (i>1) {
                fu = s.LeftStr(i-1)
                if ((s.MidStr(i)).FindStr(" "+fu+" ") == 0 && (s.MidStr(i)).FindStr("_"+fu+" ") == 0) {
                    RT_TxtWriteFile(fu + " ( " + fu.RT_PluginParam + " )", PATH, true)
                }
            }
            s = s.MidStr(i+1)
            i = s.FindStr(" ")
        }
    """)    #"
}
BlankClip().subtitle("See "+PATH)

Last edited by martin53; 4th November 2013 at 19:44.
martin53 is offline   Reply With Quote
Old 5th November 2013, 03:27   #188  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Nice script m53.
Be aware that the latest string returning functions are bugged, I forgot that the internal CPP functions can release
these strings when eg loading new plugin and so could point at free'ed memory, have fixed but currently testing
RT_GetFileTime(), will release fixes later today.

EDIT:
Quote:
If %TEMP% can be resolved
Done
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th November 2013 at 04:01.
StainlessS is offline   Reply With Quote
Old 6th November 2013, 04:28   #189  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
New version RT_Stats v1.28Beta3 here:- LINK REMOVED
Bugged string returning functions fixed.

Additional:
Code:
RT_GetSystemEnv(String envname)
 Returns a string from the System Environment with the env name of the string arg.
 Returns "", if cannot find environment variable of given name.
 eg, TEMP=RT_GetSystemEnv("TEMP") # to get TEMP folder path.
 and eg
 ComSpec=RT_GetSystemEnv("ComSpec") # might return "C:\WINDOWS\system32\cmd.exe"
 To see the environment variables from command console, type 'set'.
 http://en.wikipedia.org/wiki/Environment_variable

***
***
***

RT_GetFileTime(string filename,int item)
 Returns string, one of three times associated with filename file.
 Error if cannot access file. (debugview for error string).
 Item, int, (0 -> 2). 0=Creation Time, 1=Last Write/Modified time 2=Last Accessed Time,
 The return string is always of format "YYYY-MM-DD HH:MM:SS" and so can be used to
 compare whether one file time is later than another using string comparison.
 The time strings returned are in UTC (Coordinated Universal Time), not local time.
EDIT: Modified RT_Subtitle with additional Int "Esc"=1 arg:-
Code:
RT_Subtitle(clip source,string format,dat1,...,datn,int "align",int "x","y",bool "vcent"=false,bool "expx"=false,bool "expy"=false,int "esc"=1)
 Standard filter function.
 This function is a standard filter graph function, not a runtime/compile time function.
 v2.5 plugin dll limited to v2.58 colorspaces.
 Prints formatted text to clip frame using Avisynth Info.h source font (monospaced) and DDigit font renderer, faster than using
 Subtitle system fonts. The unnamed 'format' string and optional unnamed 'dat' args are used to construct the text string that is
 printed on frame, uses C/CPP printf() style formatting. The args 'align', 'x', and 'y', work in a similar fashion to
 Avisynth Subtitle()
 expx and expy control whether x and y are same as in SubTitle when eg y = -1 (vertical centered) or y=height (bottom aligned),
 or as explicit coords when expy = true.

 esc int, default 1. (0 -> 2). Escape code processing eg '\n' converted to Chr(10).
  0 = No Escape code processing.
  1 = Esc codes processed only in format string. (Default)
  2 = Esc codes processed in both format and data strings.
Previously worked as for Esc=2.

Example to show colors:-
Code:
       Colorbars.KillAudio
        S="""    \a!\\a! DDIGIT_CC_HILITE
        \a-\\a- DDIGIT_CC_DEFAULT
        \a0\\a0 DDIGIT_CC_DARKGRAY
        \a1\\a1 DDIGIT_CC_DODGERBLUE
        \a2\\a2 DDIGIT_CC_ORANGERED
        \a3\\a3 DDIGIT_CC_ORCHID
        \a4\\a4 DDIGIT_CC_LIME
        \a5\\a5 DDIGIT_CC_AQUAMARINE
        \a6\\a6 DDIGIT_CC_YELLOW
        \a7\\a7 DDIGIT_CC_WHITE
        \a8\\a8 DDIGIT_CC_SILVER
        \a9\\a9 DDIGIT_CC_CORNFLOWERBLUE
        \aA\\aA DDIGIT_CC_ORANGE
        \aB\\aB DDIGIT_CC_PLUM
        \aC\\aC DDIGIT_CC_CHARTREUSE
        \aD\\aD DDIGIT_CC_POWDERBLUE
        \aE\\aE DDIGIT_CC_GOLD
        \aF\\aF DDIGIT_CC_GAINSBORO
        \aG\\aG DDIGIT_CC_Y_0
        \aH\\aH DDIGIT_CC_Y_1
        \aI\\aI DDIGIT_CC_Y_2
        \aJ\\aJ DDIGIT_CC_Y_3
        \aK\\aK DDIGIT_CC_Y_4
        \aL\\aL DDIGIT_CC_Y_5
        \aM\\aM DDIGIT_CC_Y_6
        \aN\\aN DDIGIT_CC_Y_7
        \aO\\aO DDIGIT_CC_Y_8
        \aP\\aP DDIGIT_CC_Y_9
        \aQ\\aQ DDIGIT_CC_Y_A
        \aR\\aR DDIGIT_CC_Y_B
        \aS\\aS DDIGIT_CC_Y_C
        \aT\\aT DDIGIT_CC_Y_D
        \aU\\aU DDIGIT_CC_Y_E
        \aV\\aV DDIGIT_CC_Y_F"""
        DELAY=100
        ESC=2  # esc=2, ESC codes allowed in data strings
        Scriptclip("""RT_Subtitle("%s",S,align=1,y=height+DELAY-current_frame,expy=true,esc=ESC)""")
        return last
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th November 2013 at 18:38.
StainlessS is offline   Reply With Quote
Old 7th November 2013, 18:23   #190  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
New version RT_Stats v1.28Beta4 here: LINK REMOVED
Added function
Code:
RT_LocalTimeString(Bool "file"=True)
 Returns current local time as a string.
 Where digits Y=Year, M=Month, D=Day, H=Hour, M=Minute, S=Second, m=millisecond.
 When bool file==False, then string in format "YYYY-MM-DD HH:MM:SS.mmm"
 When bool file==True (Default) string is in format "YYYYMMDD_HHMMSS_mmm"
  Also when file==True, function first waits until the system tick count is incremented (about every 10ms)
  before inquiring system time. This is to prevent 2 consecutive calls returning the same time string.
  Perhaps useful for temporary filename generation.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th November 2013 at 00:22.
StainlessS is offline   Reply With Quote
Old 8th November 2013, 08:20   #191  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Highly appreciate that! Will be unable to use in example until end of next week, but then will implement the new features in one of my RTE scripts, giving multi instance local var scope, true non linear access over frame groups. Wow!
martin53 is offline   Reply With Quote
Old 10th November 2013, 00:25   #192  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #1 of 7

New Version RT_Stats v1.28Beta5, Here:- http://www.mediafire.com/download/4v...5_20131109.zip

Changed:
Code:
RT_GetFileTime(string filename,int item)
 Returns string, one of three times associated with filename file.
 Error if cannot access file. (debugview for error string).
 Item, int, (0 -> 2). 0=Creation Time, 1=Last Write/Modified Time 2=Last Accessed Time,
 The return string is always of format "YYYY-MM-DD HH:MM:SS.mmm" and so can be used to
 compare whether one file time is later than another using string comparison.
 The time strings returned are in UTC (Coordinated Universal Time), not local time.
 v1.28Beta5, added milliseconds to string.
RT_ArrayXXXX Modified for multi-dimensional arrays of 1, 2 and 3 dimensions.

Code:
*****************************************************
**********       RT_ARRAY FUNCTIONS       ***********
*****************************************************

RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,int "Dim3"=0,int "StringLenMax"=256)
 Creates a file to hold Array elements of type Bool, Int, Float, String, or BIN.
  BIN is a BYTE (8 bit) sized Int where only lowest 8 bits of Int are stored in array as an unsigned 8 bit int, upper 24 bits ignored.
 Filename, Array Filename, no default.
 Type, int, default 1(0 -> 4). 0=Bool, 1=Int, 2 = Float, 3 = String, 4 = BIN.
 Dim1, Dim2, Dim3, all default 0. Number of array elements per dimension (max 3 dimensions),
    initialized to zeros (Bool=False,Float=0.0,String="").
   With all defaults of 0, would be single dimension array with zero allocated elements, must use RT_ArrayAppend to add elements to the array.
   With only Dim1 set to eg 1000, would create single dimension array of 1000 elements (0 -> 999), where RT_ArrayAppend can also be used.
   With Dim1 and Dim2 greater than zero, would create a two dimensional array, where RT_ArrayAppend can NOT be used.
   With Dim1, Dim2 and Dim3 greater than zero, would create a three dimensional array, where RT_ArrayAppend can NOT be used.
   Will produce an error if Dim3 is non zero and Dim2 or Dim1 is zero, also error if Dim2 is non zero and Dim1 is zero.
   It may be less efficient if you choose to set a dimension to 1 rather than 0, is eg better to use Dim1=100 than Dim1=100,Dim2=1,
    also, as a two dimension array, you could not use RT_ArrayAppend.
 StringLenMax, default 256(1 or more). Fixed Maximum string length excluding nul term. Error if string length exceeds.
  Only used for Type=3 (string).
 Returns total number of elements in array. All RT_ArrayXXXX() errors produce an error alert.

***
***
***

RT_ArrayGetDim(string FileName,int "Dim"=0)
 Returns number of dimensions in array or the size of any 1 of the dimensions.
 Filename, Array Filename, no default.
 Dim, default 0. (Range 0 -> 3).
  0, returns the number of dimensions in the array.
  Invalid dimensions will return 0, eg RT_ArrayGetDim(FileName,Dim=2) on single dimension array return 0.
  Error if Dim smaller than 0 or greater than 3.

***
***
***

RT_ArrayGetType(string FileName)
 Filename, Array Filename, no default.
 Returns int, Type as set by RT_ArrayAlloc.

***
***
***

RT_ArrayGetNels(string FileName)
 Filename, Array Filename, no default.
 Returns int, total number of elements in array as set by RT_ArrayAlloc, or current number of elements if RT_ArrayAppend used to add
 elements to end of single dimension array.

***
***
***

RT_ArrayGetElSize(string FileName)
 Filename, Array Filename, no default.
 Returns int, element size, Type 0(bool)=1, 1(int)=4, 2(float)=4, 3(string)=StringLenMax, 4(BIN)=1, as set by RT_ArrayAlloc.

***
***
***

RT_ArrayGetNelMax(string FileName)
 Filename, Array Filename, no default.
 Returns int, maximum number of elements that could theoretically be stored in a single dimension array, based on
 (maximum +ve integer - header size) / ElSize.

***
***
***

RT_ArrayGet(string FileName,int ix1,int "ix2",int "ix3")
 Returns array element of variable Type as set in RT_ArrayAlloc. Type BIN returns an Int range 0 -> 255.
 Filename, Array Filename, no default.
 ixl, int, zero relative. 1st subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,1)-1.
 ix2, int, zero relative. 2nd subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,2)-1.
  Only valid if 2 or 3 dimensional array. For single dimension array, can omit, supply RT_Undefined(), or -1.
 ix3, int, zero relative. 3rd subcript of array. Valid range 0 -> RT_ArrayGetDim(FileName,3)-1.
  Only valid if 3 dimensional array. For 1 or 2 dimension array, can omit, supply RT_Undefined(), or -1.

***
***
***

RT_ArraySet(string FileName,Var,int ix1,int "ix2",int "ix3")
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc. (NOTE position in arg list changed)
 ixl, int, zero relative. 1st subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,1)-1.
 ix2, int, zero relative. 2nd subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,2)-1.
  Only valid if 2 or 3 dimensional array. For single dimension array, can omit, supply RT_Undefined(), or -1.
 ix3, int, zero relative. 3rd subcript of array. Valid range 0 -> RT_ArrayGetDim(FileName,3)-1.
  Only valid if 3 dimensional array. For 1 or 2 dimension array, can omit, supply RT_Undefined(), or -1.
 Returns total number of elements in array.

***
***
***

RT_ArrayAppend(string FileName,Var)
 Adds a variable to end of single dimension array and increments the Nel count.
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc.
 Returns number of elements in single dimension array.
 Error if multi dimensional array.

***
***
***

RT_ArraySetAttrib(string FileName,int ix, Value)
 There are 16 avalable attributes in the Array file header, that can be used for whatever purpose you like,
  RT_ArrayAlloc() initializes all Attributes to type Int, 0.
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Value, Int or Float, The value that Attrib(ix) will be set to.
 Returns Value. Error if type not of type Int or type Float.

***
***
***

RT_ArrayGetAttrib(string FileName,int ix)
 There are 16 avalable attributes in the Array file header, that can be used for whatever purpose you like,
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Returns the value of the user set attribute Int or Float (or type Int 0 if not yet set).
Comments on interface implementation appreciated
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th November 2013 at 05:37.
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:27   #193  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #2 of 7

RT_Test_Array_1_Dim.Avs
Code:
# RT_Test_Array_1_Dim.Avs, 1 Dimensional array

/*
RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,,int "Dim3"=0,int "StringLenMax"=256)
RT_ArrayGetDim(string FileName,int "Dim"=0)
RT_ArrayGetType(string FileName)
RT_ArrayGetNels(string FileName)
RT_ArrayGetElSize(string FileName)
RT_ArrayGetNelMax(string FileName)
RT_ArrayGet(string FileName,int ix1,int "ix2",int "ix3")
RT_ArraySet(string FileName, var ,int ix1,int "ix2",int "ix3")  # Var position in arg list changed
RT_ArrayAppend(string FileName, var)
RT_ArrayGetAttrib(string FileName,int ix)
RT_ArraySetAttrib(string FileName,int ix, value)                # Value can be Int or Float.
*/

ARRAY="TestArray.ARR"   # ARRAY name
START_TYPE = 0          # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int)
END_TYPE = 4            # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int) ## >= START_TYPE ##
NELS = 100000           # Inital Number of Array elements (init'ed to zero's) [Will be doubled by Append/Get]
STRINGLENMAX = 64       # Excluding Nul Term.
                        # Take care with NELS and STRINGLENMAX when processing Type=String.
                        # Approx string usage greater than (NELS * (STRINGLENMAX+1) * 6)
                        # String memory not released till Avisynth closure, no dead string garbage collection by Avisynth.
DELETE = True           # True = Delete ARRAY file when done

ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ALPHA=ALPHA+ALPHA # Len 260
ALPHA=(STRINGLENMAX<STRLEN(ALPHA)) ? LeftStr(ALPHA,STRINGLENMAX) : ALPHA        # cut down string manips and usage

TYPENAMES=RT_String("BOOL\nINT\nFLOAT\nSTRING\nBIN\n")

GScript("""
    RT_DebugF("RT_Test_Arrayt_1_Dim.avs - Single Dimension Array")
    TOTAL_START=RT_Timer()
    RT_DebugF("")
    For(TYPE=START_TYPE,END_TYPE) {
        RT_DebugF("==============================")
        TYPE_START=RT_Timer()
        RT_ArrayAlloc(ARRAY,Type=TYPE,Dim1=NELS,stringlenmax=STRINGLENMAX)
        STOP=RT_Timer()
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Nels       = %d",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        RT_DebugF("Alloc Time = %.3f secs (Per element %f microsecs)",STOP-TYPE_START,1000000.0*(STOP-TYPE_START)/NELS)
        RT_DebugF("\nCheck Init")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i)) {RT_DebugF("BOOL(%d) Init != False",i)}}
        } Else if(TYPE==1) { # Int
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0) {RT_DebugF("INT(%d) Init != 0",i)}}
        } Else if(TYPE==2) { # Float
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0.0) {RT_DebugF("FLOAT(%d) Init != 0.0",i)}}
        } Else if(TYPE==3) { # String
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != ""){RT_DebugF("STRING(%d) Init != %c%c",i,34,34)}}
        } Else if(TYPE==4) { # BIN
            for(i=0,NELS-1) {if(RT_ArrayGet(ARRAY,i) != 0) {RT_DebugF("BIN(%d) Init != 0",i)}}
        }
        Try {RT_ArrayGet(ARRAY,NELS) RT_DebugF("Init END Check FAILED")} catch (err) {RT_DebugF("Init END Check Passed")}
        STOP=RT_Timer()
        RT_DebugF("Check Init Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Attributes Set/Get")
        START=RT_Timer()
        for(i=0,15) {
            vs= (i % 2 == 0) ? i*1000 : i * PI      # Test Int and Float Attributes
            RT_ArraySetAttrib(ARRAY,i,vs)
            vg = RT_ArrayGetAttrib(ARRAY,i)
            if(vg != vs) {
                RT_DebugF("%d) TYPE=%d SetAttrib/GetAttrib Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Attributes Set/Get = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Set only Time Test on %d Nels",NELS)
        vs=Select(TYPE,True,42,42.0,RightStr(ALPHA + "_" + String(42),STRINGLENMAX) ,42)
        START=RT_Timer()
        for(i=0,NELS-1) {
            RT_ArraySet(ARRAY,vs,i)
        }
        STOP=RT_Timer()
        RT_DebugF("Check Set Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Get only Time Test on %d Nels",NELS)
        START=RT_Timer()
        for(i=0,NELS-1) {RT_ArrayGet(ARRAY,i)}
        STOP=RT_Timer()
        RT_DebugF("Check Get Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Set/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,NELS-1) {
                vs = RT_BitTST(i,0) RT_ArraySet(ARRAY,vs,i) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,NELS-1) {
                vs = i RT_ArraySet(ARRAY,vs,i) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,NELS-1) {
                vs = Float(i) RT_ArraySet(ARRAY,vs,i) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,NELS-1) {
                vs=RightStr(ALPHA + "_" + String(i),STRINGLENMAX) RT_ArraySet(ARRAY,vs,i) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,NELS-1) {
                vs = RT_BitAnd(i,$FF) RT_ArraySet(ARRAY,vs,i) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Set/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Append/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=NELS,NELS*2-1) {
                vs = RT_BitTST(i,0) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=NELS,NELS*2-1) {
                vs = i RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=NELS,NELS*2-1) {
                vs = Float(i) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==3) { # String
            for(i=NELS,NELS*2-1) {
                vs=RightStr(ALPHA + "_" + String(i),STRINGLENMAX) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=NELS,NELS*2-1) {
                vs = RT_BitAnd(i,$FF) RT_ArrayAppend(ARRAY,vs) vg=RT_ArrayGet(ARRAY,i)
                if(vs != vg) {
                    RT_DebugF("%d) TYPE=%d Append/Get Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
                }
            }
        }
        if(RT_ArrayGetNels(ARRAY) != NELS * 2) {
            RT_DebugF("Final Check ERROR, RT_ArrayGetNels != NELS *2 (is %d)",RT_ArrayGetNels(ARRAY))
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Append/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("ALL Checks Done\n")
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Nels       = %d (should have doubled)",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        STOP=RT_Timer()
        RT_DebugF("Total Time Type=%d (%s) = %.3f secs",Type,RT_TxtGetLine(TYPENAMES,Type),STOP-TYPE_START)
    }
    (DELETE) ? RT_FileDelete(ARRAY) : NOP
    TOTAL_STOP=RT_Timer()
    RT_DebugF("SCRIPT TOTAL TIME = %.3f secs",TOTAL_STOP-TOTAL_START)
""")
return colorbars()
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th November 2013 at 00:45.
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:28   #194  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #3 of 7

RT_Test_Array_1_Dim.Log
Code:
00000001    0.00000000      RT_DebugF: RT_Test_Array_1_Dim.avs - Single Dimension Array
00000002    0.00013589      RT_DebugF:
00000003    0.00022477      RT_DebugF: ==============================
00000004    0.00121931      RT_DebugF: Type       = 0 (BOOL)
00000005    0.00138569      RT_DebugF: Dimensions = 1
00000006    0.00155160      RT_DebugF: Nels       = 100000
00000007    0.00171441      RT_DebugF: ElSize     = 1
00000008    0.00195542      RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000009    0.00204794      RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000010    0.00213082      RT_DebugF:
00000011    0.00215442      RT_DebugF: Check Init
00000012    7.93041897      RT_DebugF: Init END Check Passed
00000013    7.93057775      RT_DebugF: Check Init Time = 7.937 secs (Per element 79.370003 microsecs)
00000014    7.93066311      RT_DebugF: Check Attributes Set/Get
00000015    7.93823862      RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000016    7.93832684      RT_DebugF: Check Set only Time Test on 100000 Nels
00000017    19.25387573     RT_DebugF: Check Set Only Time = 11.328 secs (Per element 113.279991 microsecs)
00000018    19.25395966     RT_DebugF: Check Get only Time Test on 100000 Nels
00000019    27.35041046     RT_DebugF: Check Get Only Time = 8.094 secs (Per element 80.940002 microsecs)
00000020    27.35049629     RT_DebugF: Check Compare Set/Get
00000021    53.95354843     RT_DebugF: Check Compare Set/Get Time = 26.594 secs (Per element 265.940002 microsecs) [Including Data generation]
00000022    53.95363235     RT_DebugF: Check Compare Append/Get
00000023    81.46318817     RT_DebugF: Check Compare Append/Get Time = 27.515 secs (Per element 275.150055 microsecs) [Including Data generation]
00000024    81.46327209     RT_DebugF: ALL Checks Done
00000025    81.46329498     RT_DebugF:
00000026    81.46350861     RT_DebugF: Type       = 0 (BOOL)
00000027    81.46367645     RT_DebugF: Dimensions = 1
00000028    81.46383667     RT_DebugF: Nels       = 200000 (should have doubled)
00000029    81.46400452     RT_DebugF: ElSize     = 1
00000030    81.46424103     RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000031    81.46443939     RT_DebugF: Total Time Type=0 (BOOL) = 81.468 secs
00000032    81.46452332     RT_DebugF: ==============================
00000033    81.46635437     RT_DebugF: Type       = 1 (INT)
00000034    81.46652985     RT_DebugF: Dimensions = 1
00000035    81.46669769     RT_DebugF: Nels       = 100000
00000036    81.46685791     RT_DebugF: ElSize     = 4
00000037    81.46710205     RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000038    81.46719360     RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000039    81.46727753     RT_DebugF:
00000040    81.46730042     RT_DebugF: Check Init
00000041    89.63143921     RT_DebugF: Init END Check Passed
00000042    89.63159180     RT_DebugF: Check Init Time = 8.172 secs (Per element 81.719971 microsecs)
00000043    89.63167572     RT_DebugF: Check Attributes Set/Get
00000044    89.63928223     RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000045    89.63937378     RT_DebugF: Check Set only Time Test on 100000 Nels
00000046    101.12193298    RT_DebugF: Check Set Only Time = 11.485 secs (Per element 114.850014 microsecs)
00000047    101.12201691    RT_DebugF: Check Get only Time Test on 100000 Nels
00000048    109.27951813    RT_DebugF: Check Get Only Time = 8.156 secs (Per element 81.559982 microsecs)
00000049    109.27960205    RT_DebugF: Check Compare Set/Get
00000050    129.26173401    RT_DebugF: Check Compare Set/Get Time = 19.984 secs (Per element 199.840027 microsecs) [Including Data generation]
00000051    129.26181030    RT_DebugF: Check Compare Append/Get
00000052    150.20997620    RT_DebugF: Check Compare Append/Get Time = 20.953 secs (Per element 209.530014 microsecs) [Including Data generation]
00000053    150.21005249    RT_DebugF: ALL Checks Done
00000054    150.21008301    RT_DebugF:
00000055    150.21029663    RT_DebugF: Type       = 1 (INT)
00000056    150.21044922    RT_DebugF: Dimensions = 1
00000057    150.21061707    RT_DebugF: Nels       = 200000 (should have doubled)
00000058    150.21078491    RT_DebugF: ElSize     = 4
00000059    150.21101379    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000060    150.21121216    RT_DebugF: Total Time Type=1 (INT) = 68.750 secs
00000061    150.21128845    RT_DebugF: ==============================
00000062    150.21311951    RT_DebugF: Type       = 2 (FLOAT)
00000063    150.21328735    RT_DebugF: Dimensions = 1
00000064    150.21343994    RT_DebugF: Nels       = 100000
00000065    150.21360779    RT_DebugF: ElSize     = 4
00000066    150.21386719    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000067    150.21395874    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000068    150.21403503    RT_DebugF:
00000069    150.21406555    RT_DebugF: Check Init
00000070    158.67863464    RT_DebugF: Init END Check Passed
00000071    158.67880249    RT_DebugF: Check Init Time = 8.469 secs (Per element 84.689941 microsecs)
00000072    158.67887878    RT_DebugF: Check Attributes Set/Get
00000073    158.68649292    RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.160065 microsecs)
00000074    158.68656921    RT_DebugF: Check Set only Time Test on 100000 Nels
00000075    170.10278320    RT_DebugF: Check Set Only Time = 11.406 secs (Per element 114.059914 microsecs)
00000076    170.10287476    RT_DebugF: Check Get only Time Test on 100000 Nels
00000077    178.25221252    RT_DebugF: Check Get Only Time = 8.156 secs (Per element 81.560059 microsecs)
00000078    178.25228882    RT_DebugF: Check Compare Set/Get
00000079    226.23529053    RT_DebugF: Check Compare Set/Get Time = 47.985 secs (Per element 479.850006 microsecs) [Including Data generation]
00000080    226.23538208    RT_DebugF: Check Compare Append/Get
00000081    275.02413940    RT_DebugF: Check Compare Append/Get Time = 48.796 secs (Per element 487.959869 microsecs) [Including Data generation]
00000082    275.02423096    RT_DebugF: ALL Checks Done
00000083    275.02423096    RT_DebugF:
00000084    275.02444458    RT_DebugF: Type       = 2 (FLOAT)
00000085    275.02462769    RT_DebugF: Dimensions = 1
00000086    275.02478027    RT_DebugF: Nels       = 200000 (should have doubled)
00000087    275.02493286    RT_DebugF: ElSize     = 4
00000088    275.02517700    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000089    275.02536011    RT_DebugF: Total Time Type=2 (FLOAT) = 124.828 secs
00000090    275.02545166    RT_DebugF: ==============================
00000091    275.04098511    RT_DebugF: Type       = 3 (STRING)
00000092    275.04116821    RT_DebugF: Dimensions = 1
00000093    275.04132080    RT_DebugF: Nels       = 100000
00000094    275.04150391    RT_DebugF: ElSize     = 64
00000095    275.04174805    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000096    275.04183960    RT_DebugF: Alloc Time = 0.016 secs (Per element 0.160217 microsecs)
00000097    275.04193115    RT_DebugF:
00000098    275.04193115    RT_DebugF: Check Init
00000099    283.48788452    RT_DebugF: Init END Check Passed
00000100    283.48803711    RT_DebugF: Check Init Time = 8.438 secs (Per element 84.379883 microsecs)
00000101    283.48812866    RT_DebugF: Check Attributes Set/Get
00000102    283.49581909    RT_DebugF: Check Attributes Set/Get = 0.015 secs (Per element 0.150146 microsecs)
00000103    283.49588013    RT_DebugF: Check Set only Time Test on 100000 Nels
00000104    295.08233643    RT_DebugF: Check Set Only Time = 11.578 secs (Per element 115.779716 microsecs)
00000105    295.08242798    RT_DebugF: Check Get only Time Test on 100000 Nels
00000106    303.34625244    RT_DebugF: Check Get Only Time = 8.266 secs (Per element 82.660217 microsecs)
00000107    303.34634399    RT_DebugF: Check Compare Set/Get
00000108    351.96871948    RT_DebugF: Check Compare Set/Get Time = 48.625 secs (Per element 486.250000 microsecs) [Including Data generation]
00000109    351.96878052    RT_DebugF: Check Compare Append/Get
00000110    401.32009888    RT_DebugF: Check Compare Append/Get Time = 49.359 secs (Per element 493.589813 microsecs) [Including Data generation]
00000111    401.32015991    RT_DebugF: ALL Checks Done
00000112    401.32019043    RT_DebugF:
00000113    401.32040405    RT_DebugF: Type       = 3 (STRING)
00000114    401.32058716    RT_DebugF: Dimensions = 1
00000115    401.32073975    RT_DebugF: Nels       = 200000 (should have doubled)
00000116    401.32089233    RT_DebugF: ElSize     = 64
00000117    401.32113647    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000118    401.32131958    RT_DebugF: Total Time Type=3 (STRING) = 126.297 secs
00000119    401.32141113    RT_DebugF: ==============================
00000120    401.32302856    RT_DebugF: Type       = 4 (BIN)
00000121    401.32318115    RT_DebugF: Dimensions = 1
00000122    401.32336426    RT_DebugF: Nels       = 100000
00000123    401.32351685    RT_DebugF: ElSize     = 1
00000124    401.32379150    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000125    401.32388306    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000126    401.32400513    RT_DebugF:
00000127    401.32403564    RT_DebugF: Check Init
00000128    409.84115601    RT_DebugF: Init END Check Passed
00000129    409.84130859    RT_DebugF: Check Init Time = 8.516 secs (Per element 85.160217 microsecs)
00000130    409.84136963    RT_DebugF: Check Attributes Set/Get
00000131    409.84899902    RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.159912 microsecs)
00000132    409.84909058    RT_DebugF: Check Set only Time Test on 100000 Nels
00000133    421.16717529    RT_DebugF: Check Set Only Time = 11.312 secs (Per element 113.120117 microsecs)
00000134    421.16723633    RT_DebugF: Check Get only Time Test on 100000 Nels
00000135    429.34780884    RT_DebugF: Check Get Only Time = 8.188 secs (Per element 81.879883 microsecs)
00000136    429.34786987    RT_DebugF: Check Compare Set/Get
00000137    456.60794067    RT_DebugF: Check Compare Set/Get Time = 27.250 secs (Per element 272.500000 microsecs) [Including Data generation]
00000138    456.60800171    RT_DebugF: Check Compare Append/Get
00000139    484.82464600    RT_DebugF: Check Compare Append/Get Time = 28.218 secs (Per element 282.179871 microsecs) [Including Data generation]
00000140    484.82470703    RT_DebugF: ALL Checks Done
00000141    484.82473755    RT_DebugF:
00000142    484.82495117    RT_DebugF: Type       = 4 (BIN)
00000143    484.82510376    RT_DebugF: Dimensions = 1
00000144    484.82528687    RT_DebugF: Nels       = 200000 (should have doubled)
00000145    484.82543945    RT_DebugF: ElSize     = 1
00000146    484.82568359    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000147    484.82586670    RT_DebugF: Total Time Type=4 (BIN) = 83.500 secs
00000148    484.82611084    RT_DebugF: SCRIPT TOTAL TIME = 484.843 secs
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th November 2013 at 00:46.
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:29   #195  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #4 of 7

RT_Test_Array_2_Dim.Avs
Code:
# RT_Test_Array_2_Dim.Avs, 2 Dimensional array

/*
RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,,int "Dim3"=0,int "StringLenMax"=256)
RT_ArrayGetDim(string FileName,int "Dim"=0)
RT_ArrayGetType(string FileName)
RT_ArrayGetNels(string FileName)
RT_ArrayGetElSize(string FileName)
RT_ArrayGetNelMax(string FileName)
RT_ArrayGet(string FileName,int ix1,int "ix2",int "ix3")
RT_ArraySet(string FileName, var ,int ix1,int "ix2",int "ix3")  # Var position in arg list changed
RT_ArrayAppend(string FileName, var)
RT_ArrayGetAttrib(string FileName,int ix)
RT_ArraySetAttrib(string FileName,int ix, value)                # Value can be Int or Float.
*/

ARRAY="TestArray.ARR"   # ARRAY name
START_TYPE = 0          # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int)
END_TYPE = 4            # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int) ## >= START_TYPE ##
DIM1 = 10000            # Dim 1, Inital Number of Array elements
DIM2 = 10               # Dim 2
STRINGLENMAX = 64       # Excluding Nul Term.
DELETE = True           # True = Delete ARRAY file when done

ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ALPHA=ALPHA+ALPHA # Len 260
ALPHA=(STRINGLENMAX<STRLEN(ALPHA)) ? LeftStr(ALPHA,STRINGLENMAX) : ALPHA        # cut down string manips and usage

TYPENAMES=RT_String("BOOL\nINT\nFLOAT\nSTRING\nBIN\n")
NELS = DIM1 * DIM2

GScript("""
    RT_DebugF("RT_Test_Array_2_Dim.avs - Two Dimension Array")
    TOTAL_START=RT_Timer()
    RT_DebugF("")
    For(TYPE=START_TYPE,END_TYPE) {
        RT_DebugF("==============================")
        TYPE_START=RT_Timer()
        RT_ArrayAlloc(ARRAY,Type=TYPE,Dim1=DIM1,Dim2=DIM2,stringlenmax=STRINGLENMAX)
        STOP=RT_Timer()
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Dim1       = %d",RT_ArrayGetDim(ARRAY,1))
        RT_DebugF("Dim2       = %d",RT_ArrayGetDim(ARRAY,2))
        RT_DebugF("Nels       = %d",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        RT_DebugF("Alloc Time = %.3f secs (Per element %f microsecs)",STOP-TYPE_START,1000000.0*(STOP-TYPE_START)/NELS)
        RT_DebugF("\nCheck Init")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    if(RT_ArrayGet(ARRAY,i,j)) {RT_DebugF("BOOL(%d,%d) Init != False",i,j)}
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    if(RT_ArrayGet(ARRAY,i,j) != 0) {RT_DebugF("INT(%d,%d) Init != 0",i,j)}
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    if(RT_ArrayGet(ARRAY,i,j) != 0.0) {RT_DebugF("FLOAT(%d,%d) Init != 0.0",i,j)}
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    if(RT_ArrayGet(ARRAY,i,j) != ""){RT_DebugF("STRING(%d,%d) Init != %c%c",i,j,34,34)}
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    if(RT_ArrayGet(ARRAY,i,j) != 0) {RT_DebugF("BIN(%d,%d) Init != 0",i,j)}
                }
            }
        }
        Try {RT_ArrayGet(ARRAY,DIM1-1,DIM2) RT_DebugF("Init END Check1 FAILED")} catch (err) {RT_DebugF("Init END Check1 Passed")}
        Try {RT_ArrayGet(ARRAY,DIM1,0) RT_DebugF("Init END Check2 FAILED")} catch (err) {RT_DebugF("Init END Check2 Passed")}
        STOP=RT_Timer()
        RT_DebugF("Check Init Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Attributes Set/Get")
        START=RT_Timer()
        for(i=0,15) {
            vs= (i % 2 == 0) ? i*1000 : i * PI      # Test Int and Float Attributes
            RT_ArraySetAttrib(ARRAY,i,vs)
            vg = RT_ArrayGetAttrib(ARRAY,i)
            if(vg != vs) {
                RT_DebugF("%d) TYPE=%d SetAttrib/GetAttrib Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Attributes Set/Get = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Set only Time Test on %d Nels",NELS)
        vs=Select(TYPE,True,42,42.0,RightStr(ALPHA + "_" + String(42),STRINGLENMAX) ,42)
        START=RT_Timer()
        for(i=0,DIM1-1) {
            for(j=0,DIM2-1) {
                RT_ArraySet(ARRAY,vs,i,j)
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Set Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Get only Time Test on %d Nels",NELS)
        START=RT_Timer()
        for(i=0,DIM1-1) {
            for(j=0,DIM2-1) {
                RT_ArrayGet(ARRAY,i,j)
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Get Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Set/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    vs = RT_BitTST(i*DIM2+j,0) RT_ArraySet(ARRAY,vs,i,j) vg=RT_ArrayGet(ARRAY,i,j)
                    if(vs != vg) {
                        RT_DebugF("%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,TYPE,String(vs),String(vg))
                    }
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    vs = i*DIM2+j RT_ArraySet(ARRAY,vs,i,j) vg=RT_ArrayGet(ARRAY,i,j)
                    if(vs != vg) {
                        RT_DebugF("%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,TYPE,String(vs),String(vg))
                    }
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    vs = Float(i*DIM2+j) RT_ArraySet(ARRAY,vs,i,j) vg=RT_ArrayGet(ARRAY,i,j)
                    if(vs != vg) {
                        RT_DebugF("%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,TYPE,String(vs),String(vg))
                    }
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    vs=RightStr(ALPHA + "_" + String(i*DIM2+j),STRINGLENMAX) RT_ArraySet(ARRAY,vs,i,j) vg=RT_ArrayGet(ARRAY,i,j)
                    if(vs != vg) {
                        RT_DebugF("%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,TYPE,String(vs),String(vg))
                    }
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    vs = RT_BitAnd(i*DIM2+j,$FF) RT_ArraySet(ARRAY,vs,i,j) vg=RT_ArrayGet(ARRAY,i,j)
                    if(vs != vg) {
                        RT_DebugF("%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,TYPE,String(vs),String(vg))
                    }
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Set/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("ALL Checks Done\n")
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Dim1       = %d",RT_ArrayGetDim(ARRAY,1))
        RT_DebugF("Dim2       = %d",RT_ArrayGetDim(ARRAY,2))
        RT_DebugF("Nels       = %d (Not doubled, Cannot append to multi-dim array)",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        STOP=RT_Timer()
        RT_DebugF("Total Time Type=%d (%s) = %.3f secs",Type,RT_TxtGetLine(TYPENAMES,Type),STOP-TYPE_START)
    }
    (DELETE) ? RT_FileDelete(ARRAY) : NOP
    TOTAL_STOP=RT_Timer()
    RT_DebugF("SCRIPT TOTAL TIME = %.3f secs",TOTAL_STOP-TOTAL_START)
""")
return colorbars()
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:30   #196  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #5 of 7

RT_Test_Array_2_Dim.Log
Code:
00000001    0.00000000  RT_DebugF: RT_Test_Array_2_Dim.avs - Two Dimension Array
00000002    0.00013633  RT_DebugF:
00000003    0.00022618  RT_DebugF: ==============================
00000004    0.00136300  RT_DebugF: Type       = 0 (BOOL)
00000005    0.00152955  RT_DebugF: Dimensions = 2
00000006    0.00169800  RT_DebugF: Dim1       = 10000
00000007    0.00189691  RT_DebugF: Dim2       = 10
00000008    0.00206046  RT_DebugF: Nels       = 100000
00000009    0.00222277  RT_DebugF: ElSize     = 1
00000010    0.00246191  RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000011    0.00255518  RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000012    0.00263816  RT_DebugF:
00000013    0.00266201  RT_DebugF: Check Init
00000014    8.12602615  RT_DebugF: Init END Check1 Passed
00000015    8.12623787  RT_DebugF: Init END Check2 Passed
00000016    8.12639523  RT_DebugF: Check Init Time = 8.125 secs (Per element 81.250000 microsecs)
00000017    8.12647915  RT_DebugF: Check Attributes Set/Get
00000018    8.13418102  RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000019    8.13426781  RT_DebugF: Check Set only Time Test on 100000 Nels
00000020    20.33507538 RT_DebugF: Check Set Only Time = 12.203 secs (Per element 122.029991 microsecs)
00000021    20.33515930 RT_DebugF: Check Get only Time Test on 100000 Nels
00000022    28.66847420 RT_DebugF: Check Get Only Time = 8.343 secs (Per element 83.430008 microsecs)
00000023    28.66855431 RT_DebugF: Check Compare Set/Get
00000024    57.08416367 RT_DebugF: Check Compare Set/Get Time = 28.407 secs (Per element 284.070007 microsecs) [Including Data generation]
00000025    57.08424377 RT_DebugF: ALL Checks Done
00000026    57.08427048 RT_DebugF:
00000027    57.08448792 RT_DebugF: Type       = 0 (BOOL)
00000028    57.08465195 RT_DebugF: Dimensions = 2
00000029    57.08481979 RT_DebugF: Dim1       = 10000
00000030    57.08498383 RT_DebugF: Dim2       = 10
00000031    57.08514786 RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000032    57.08531570 RT_DebugF: ElSize     = 1
00000033    57.08555603 RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000034    57.08574295 RT_DebugF: Total Time Type=0 (BOOL) = 57.078 secs
00000035    57.08583450 RT_DebugF: ==============================
00000036    57.08751297 RT_DebugF: Type       = 1 (INT)
00000037    57.08768082 RT_DebugF: Dimensions = 2
00000038    57.08785248 RT_DebugF: Dim1       = 10000
00000039    57.08801651 RT_DebugF: Dim2       = 10
00000040    57.08818817 RT_DebugF: Nels       = 100000
00000041    57.08837891 RT_DebugF: ElSize     = 4
00000042    57.08861923 RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000043    57.08871460 RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000044    57.08880234 RT_DebugF:
00000045    57.08882523 RT_DebugF: Check Init
00000046    65.49828339 RT_DebugF: Init END Check1 Passed
00000047    65.49848938 RT_DebugF: Init END Check2 Passed
00000048    65.49865723 RT_DebugF: Check Init Time = 8.407 secs (Per element 84.070007 microsecs)
00000049    65.49874115 RT_DebugF: Check Attributes Set/Get
00000050    65.50650787 RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000051    65.50659180 RT_DebugF: Check Set only Time Test on 100000 Nels
00000052    77.87017822 RT_DebugF: Check Set Only Time = 12.375 secs (Per element 123.750000 microsecs)
00000053    77.87026215 RT_DebugF: Check Get only Time Test on 100000 Nels
00000054    86.22363281 RT_DebugF: Check Get Only Time = 8.343 secs (Per element 83.430023 microsecs)
00000055    86.22371674 RT_DebugF: Check Compare Set/Get
00000056    107.68625641    RT_DebugF: Check Compare Set/Get Time = 21.469 secs (Per element 214.689941 microsecs) [Including Data generation]
00000057    107.68633270    RT_DebugF: ALL Checks Done
00000058    107.68635559    RT_DebugF:
00000059    107.68656921    RT_DebugF: Type       = 1 (INT)
00000060    107.68673706    RT_DebugF: Dimensions = 2
00000061    107.68689728    RT_DebugF: Dim1       = 10000
00000062    107.68707275    RT_DebugF: Dim2       = 10
00000063    107.68723297    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000064    107.68740082    RT_DebugF: ElSize     = 4
00000065    107.68763733    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000066    107.68782806    RT_DebugF: Total Time Type=1 (INT) = 50.609 secs
00000067    107.68791962    RT_DebugF: ==============================
00000068    107.68959045    RT_DebugF: Type       = 2 (FLOAT)
00000069    107.68975830    RT_DebugF: Dimensions = 2
00000070    107.68992615    RT_DebugF: Dim1       = 10000
00000071    107.69011688    RT_DebugF: Dim2       = 10
00000072    107.69028473    RT_DebugF: Nels       = 100000
00000073    107.69044495    RT_DebugF: ElSize     = 4
00000074    107.69068909    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000075    107.69078064    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000076    107.69086456    RT_DebugF:
00000077    107.69088745    RT_DebugF: Check Init
00000078    116.36470032    RT_DebugF: Init END Check1 Passed
00000079    116.36490631    RT_DebugF: Init END Check2 Passed
00000080    116.36506653    RT_DebugF: Check Init Time = 8.672 secs (Per element 86.720047 microsecs)
00000081    116.36515045    RT_DebugF: Check Attributes Set/Get
00000082    116.37288666    RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.159988 microsecs)
00000083    116.37297058    RT_DebugF: Check Set only Time Test on 100000 Nels
00000084    128.71505737    RT_DebugF: Check Set Only Time = 12.343 secs (Per element 123.430023 microsecs)
00000085    128.71514893    RT_DebugF: Check Get only Time Test on 100000 Nels
00000086    137.08207703    RT_DebugF: Check Get Only Time = 8.360 secs (Per element 83.600006 microsecs)
00000087    137.08215332    RT_DebugF: Check Compare Set/Get
00000088    186.00663757    RT_DebugF: Check Compare Set/Get Time = 48.937 secs (Per element 489.369965 microsecs) [Including Data generation]
00000089    186.00671387    RT_DebugF: ALL Checks Done
00000090    186.00672913    RT_DebugF:
00000091    186.00694275    RT_DebugF: Type       = 2 (FLOAT)
00000092    186.00711060    RT_DebugF: Dimensions = 2
00000093    186.00727844    RT_DebugF: Dim1       = 10000
00000094    186.00744629    RT_DebugF: Dim2       = 10
00000095    186.00761414    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000096    186.00776672    RT_DebugF: ElSize     = 4
00000097    186.00801086    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000098    186.00819397    RT_DebugF: Total Time Type=2 (FLOAT) = 78.328 secs
00000099    186.00828552    RT_DebugF: ==============================
00000100    186.02537537    RT_DebugF: Type       = 3 (STRING)
00000101    186.02552795    RT_DebugF: Dimensions = 2
00000102    186.02571106    RT_DebugF: Dim1       = 10000
00000103    186.02586365    RT_DebugF: Dim2       = 10
00000104    186.02603149    RT_DebugF: Nels       = 100000
00000105    186.02619934    RT_DebugF: ElSize     = 64
00000106    186.02644348    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000107    186.02655029    RT_DebugF: Alloc Time = 0.016 secs (Per element 0.160065 microsecs)
00000108    186.02664185    RT_DebugF:
00000109    186.02667236    RT_DebugF: Check Init
00000110    194.68681335    RT_DebugF: Init END Check1 Passed
00000111    194.68702698    RT_DebugF: Init END Check2 Passed
00000112    194.68717957    RT_DebugF: Check Init Time = 8.656 secs (Per element 86.559914 microsecs)
00000113    194.68727112    RT_DebugF: Check Attributes Set/Get
00000114    194.69503784    RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.160065 microsecs)
00000115    194.69512939    RT_DebugF: Check Set only Time Test on 100000 Nels
00000116    207.24955750    RT_DebugF: Check Set Only Time = 12.547 secs (Per element 125.469971 microsecs)
00000117    207.24963379    RT_DebugF: Check Get only Time Test on 100000 Nels
00000118    215.72695923    RT_DebugF: Check Get Only Time = 8.484 secs (Per element 84.839943 microsecs)
00000119    215.72705078    RT_DebugF: Check Compare Set/Get
00000120    265.41159058    RT_DebugF: Check Compare Set/Get Time = 49.687 secs (Per element 496.869965 microsecs) [Including Data generation]
00000121    265.41171265    RT_DebugF: ALL Checks Done
00000122    265.41174316    RT_DebugF:
00000123    265.41195679    RT_DebugF: Type       = 3 (STRING)
00000124    265.41210938    RT_DebugF: Dimensions = 2
00000125    265.41226196    RT_DebugF: Dim1       = 10000
00000126    265.41244507    RT_DebugF: Dim2       = 10
00000127    265.41259766    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000128    265.41278076    RT_DebugF: ElSize     = 64
00000129    265.41302490    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000130    265.41320801    RT_DebugF: Total Time Type=3 (STRING) = 79.406 secs
00000131    265.41329956    RT_DebugF: ==============================
00000132    265.41476440    RT_DebugF: Type       = 4 (BIN)
00000133    265.41491699    RT_DebugF: Dimensions = 2
00000134    265.41510010    RT_DebugF: Dim1       = 10000
00000135    265.41528320    RT_DebugF: Dim2       = 10
00000136    265.41546631    RT_DebugF: Nels       = 100000
00000137    265.41567993    RT_DebugF: ElSize     = 1
00000138    265.41592407    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000139    265.41601563    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000140    265.41610718    RT_DebugF:
00000141    265.41613770    RT_DebugF: Check Init
00000142    274.11859131    RT_DebugF: Init END Check1 Passed
00000143    274.11880493    RT_DebugF: Init END Check2 Passed
00000144    274.11895752    RT_DebugF: Check Init Time = 8.704 secs (Per element 87.040100 microsecs)
00000145    274.11901855    RT_DebugF: Check Attributes Set/Get
00000146    274.12680054    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000147    274.12689209    RT_DebugF: Check Set only Time Test on 100000 Nels
00000148    286.32312012    RT_DebugF: Check Set Only Time = 12.188 secs (Per element 121.879883 microsecs)
00000149    286.32318115    RT_DebugF: Check Get only Time Test on 100000 Nels
00000150    294.69894409    RT_DebugF: Check Get Only Time = 8.375 secs (Per element 83.750000 microsecs)
00000151    294.69900513    RT_DebugF: Check Compare Set/Get
00000152    323.51010132    RT_DebugF: Check Compare Set/Get Time = 28.812 secs (Per element 288.120117 microsecs) [Including Data generation]
00000153    323.51019287    RT_DebugF: ALL Checks Done
00000154    323.51022339    RT_DebugF:
00000155    323.51043701    RT_DebugF: Type       = 4 (BIN)
00000156    323.51058960    RT_DebugF: Dimensions = 2
00000157    323.51074219    RT_DebugF: Dim1       = 10000
00000158    323.51092529    RT_DebugF: Dim2       = 10
00000159    323.51107788    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000160    323.51126099    RT_DebugF: ElSize     = 1
00000161    323.51150513    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000162    323.51168823    RT_DebugF: Total Time Type=4 (BIN) = 58.094 secs
00000163    323.51190186    RT_DebugF: SCRIPT TOTAL TIME = 323.515 secs
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:32   #197  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #6 of 7

RT_Test_Array_3_Dim.Avs
Code:
# RT_Test_Array_3_Dim.Avs, 3 Dimensional array

/*
RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,,int "Dim3"=0,int "StringLenMax"=256)
RT_ArrayGetDim(string FileName,int "Dim"=0)
RT_ArrayGetType(string FileName)
RT_ArrayGetNels(string FileName)
RT_ArrayGetElSize(string FileName)
RT_ArrayGetNelMax(string FileName)
RT_ArrayGet(string FileName,int ix1,int "ix2",int "ix3")
RT_ArraySet(string FileName, var ,int ix1,int "ix2",int "ix3")  # Var position in arg list changed
RT_ArrayAppend(string FileName, var)
RT_ArrayGetAttrib(string FileName,int ix)
RT_ArraySetAttrib(string FileName,int ix, value)                # Value can be Int or Float.
*/

ARRAY="TestArray.ARR"   # ARRAY name
START_TYPE = 0          # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int)
END_TYPE = 4            # 0=Bool,1=Int,2=Float,3=String,4=BIN(BYTE sized int) ## >= START_TYPE ##
DIM1 = 500              # Dim 1, Inital Number of Array elements
DIM2 = 20               # Dim 2
DIM3 = 10               # Dim 3
STRINGLENMAX = 64       # Excluding Nul Term.
DELETE = True           # True = Delete ARRAY file when done

ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ALPHA=ALPHA+ALPHA # Len 260
ALPHA=(STRINGLENMAX<STRLEN(ALPHA)) ? LeftStr(ALPHA,STRINGLENMAX) : ALPHA        # cut down string manips and usage

TYPENAMES=RT_String("BOOL\nINT\nFLOAT\nSTRING\nBIN\n")
NELS = DIM1 * DIM2 * DIM3

GScript("""
    RT_DebugF("RT_Test_Array_3_Dim.avs - Three Dimension Array")
    TOTAL_START=RT_Timer()
    RT_DebugF("")
    For(TYPE=START_TYPE,END_TYPE) {
        RT_DebugF("==============================")
        TYPE_START=RT_Timer()
        RT_ArrayAlloc(ARRAY,Type=TYPE,Dim1=DIM1,Dim2=DIM2,Dim3=DIM3,stringlenmax=STRINGLENMAX)
        STOP=RT_Timer()
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Dim1       = %d",RT_ArrayGetDim(ARRAY,1))
        RT_DebugF("Dim2       = %d",RT_ArrayGetDim(ARRAY,2))
        RT_DebugF("Dim3       = %d",RT_ArrayGetDim(ARRAY,3))
        RT_DebugF("Nels       = %d",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        RT_DebugF("Alloc Time = %.3f secs (Per element %f microsecs)",STOP-TYPE_START,1000000.0*(STOP-TYPE_START)/NELS)
        RT_DebugF("\nCheck Init")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        if(RT_ArrayGet(ARRAY,i,j,k)) {RT_DebugF("BOOL(%d,%d,%d) Init != False",i,j,k)}
                    }
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        if(RT_ArrayGet(ARRAY,i,j,k) != 0) {RT_DebugF("INT(%d,%d,%d) Init != 0",i,j,k)}
                    }
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        if(RT_ArrayGet(ARRAY,i,j,k) != 0.0) {RT_DebugF("FLOAT(%d,%d,%d) Init != 0.0",i,j,k)}
                    }
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        if(RT_ArrayGet(ARRAY,i,j,k) != ""){RT_DebugF("STRING(%d,%d,%d) Init != %c%c",i,j,k,34,34)}
                    }
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        if(RT_ArrayGet(ARRAY,i,j,k) != 0) {RT_DebugF("BIN(%d,%d,%d) Init != 0",i,j,k)}
                    }
                }
            }
        }
        Try {RT_ArrayGet(ARRAY,DIM1-1,DIM2-1,DIM3) RT_DebugF("Init END Check1 FAILED")} catch (err) {RT_DebugF("Init END Check1 Passed")}
        Try {RT_ArrayGet(ARRAY,DIM1-1,DIM2,0) RT_DebugF("Init END Check2 FAILED")} catch (err) {RT_DebugF("Init END Check2 Passed")}
        Try {RT_ArrayGet(ARRAY,DIM1,0,0) RT_DebugF("Init END Check3 FAILED")} catch (err) {RT_DebugF("Init END Check3 Passed")}
        STOP=RT_Timer()
        RT_DebugF("Check Init Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Attributes Set/Get")
        START=RT_Timer()
        for(i=0,15) {
            vs= (i % 2 == 0) ? i*1000 : i * PI      # Test Int and Float Attributes
            RT_ArraySetAttrib(ARRAY,i,vs)
            vg = RT_ArrayGetAttrib(ARRAY,i)
            if(vg != vs) {
                RT_DebugF("%d) TYPE=%d SetAttrib/GetAttrib Error, Set = %s Get = %s",i,TYPE,String(vs),String(vg))
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Attributes Set/Get = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Set only Time Test on %d Nels",NELS)
        vs=Select(TYPE,True,42,42.0,RightStr(ALPHA + "_" + String(42),STRINGLENMAX) ,42)
        START=RT_Timer()
        for(i=0,DIM1-1) {
            for(j=0,DIM2-1) {
                for(k=0,DIM3-1) {
                    RT_ArraySet(ARRAY,vs,i,j,k)
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Set Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Get only Time Test on %d Nels",NELS)
        START=RT_Timer()
        for(i=0,DIM1-1) {
            for(j=0,DIM2-1) {
                for(k=0,DIM3-1) {
                    RT_ArrayGet(ARRAY,i,j,k)
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Get Only Time = %.3f secs (Per element %f microsecs)",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("Check Compare Set/Get")
        START=RT_Timer()
        if(TYPE==0) {        # Bool
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        vs = RT_BitTST((i*DIM2+j)*DIM3+k,0) RT_ArraySet(ARRAY,vs,i,j,k) vg=RT_ArrayGet(ARRAY,i,j,k)
                        if(vs != vg) {
                            RT_DebugF("%d,%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,k,TYPE,String(vs),String(vg))
                        }
                    }
                }
            }
        } Else if(TYPE==1) { # Int
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        vs = (i*DIM2+j)*DIM3+k RT_ArraySet(ARRAY,vs,i,j,k) vg=RT_ArrayGet(ARRAY,i,j,k)
                        if(vs != vg) {
                            RT_DebugF("%d,%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,k,TYPE,String(vs),String(vg))
                        }
                    }
                }
            }
        } Else if(TYPE==2) { # Float
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        vs = Float((i*DIM2+j)*DIM3+k) RT_ArraySet(ARRAY,vs,i,j,k) vg=RT_ArrayGet(ARRAY,i,j,k)
                        if(vs != vg) {
                            RT_DebugF("%d,%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,k,TYPE,String(vs),String(vg))
                        }
                    }
                }
            }
        } Else if(TYPE==3) { # String
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        vs=RightStr(ALPHA + "_" + String((i*DIM2+j)*DIM3+k),STRINGLENMAX) RT_ArraySet(ARRAY,vs,i,j,k) vg=RT_ArrayGet(ARRAY,i,j,k)
                        if(vs != vg) {
                            RT_DebugF("%d,%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,k,TYPE,String(vs),String(vg))
                        }
                    }
                }
            }
        } Else if(TYPE==4) { # BIN
            for(i=0,DIM1-1) {
                for(j=0,DIM2-1) {
                    for(k=0,DIM3-1) {
                        vs = RT_BitAnd((i*DIM2+j)*DIM3+k,$FF) RT_ArraySet(ARRAY,vs,i,j,k) vg=RT_ArrayGet(ARRAY,i,j,k)
                        if(vs != vg) {
                            RT_DebugF("%d,%d,%d) TYPE=%d Set/Get Error, Set = %s Get = %s",i,j,k,TYPE,String(vs),String(vg))
                        }
                    }
                }
            }
        }
        STOP=RT_Timer()
        RT_DebugF("Check Compare Set/Get Time = %.3f secs (Per element %f microsecs) [Including Data generation]",STOP-START,1000000.0*(STOP-START)/NELS)
        RT_DebugF("ALL Checks Done\n")
        RT_DebugF("Type       = %d (%s)",RT_ArrayGetType(ARRAY),RT_TxtGetLine(TYPENAMES,Type))
        RT_DebugF("Dimensions = %d",RT_ArrayGetDim(ARRAY))
        RT_DebugF("Dim1       = %d",RT_ArrayGetDim(ARRAY,1))
        RT_DebugF("Dim2       = %d",RT_ArrayGetDim(ARRAY,2))
        RT_DebugF("Dim3       = %d",RT_ArrayGetDim(ARRAY,3))
        RT_DebugF("Nels       = %d (Not doubled, Cannot append to multi-dim array)",RT_ArrayGetNels(ARRAY))
        RT_DebugF("ElSize     = %d",RT_ArrayGetElSize(ARRAY))
        RT_DebugF("NelMax     = %d ($%X)",RT_ArrayGetNelMax(ARRAY),RT_ArrayGetNelMax(ARRAY))
        STOP=RT_Timer()
        RT_DebugF("Total Time Type=%d (%s) = %.3f secs",Type,RT_TxtGetLine(TYPENAMES,Type),STOP-TYPE_START)
    }
    (DELETE) ? RT_FileDelete(ARRAY) : NOP
    TOTAL_STOP=RT_Timer()
    RT_DebugF("SCRIPT TOTAL TIME = %.3f secs",TOTAL_STOP-TOTAL_START)
""")
return colorbars()
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th November 2013 at 03:33.
StainlessS is offline   Reply With Quote
Old 10th November 2013, 00:33   #198  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Post #7 of 7

RT_Test_Array_3_Dim.Log
Code:
00000001    0.00000000  RT_DebugF: RT_Test_Array_3_Dim.avs - Three Dimension Array
00000002    0.00014211  RT_DebugF:
00000003    0.00023225  RT_DebugF: ==============================
00000004    0.00131004  RT_DebugF: Type       = 0 (BOOL)
00000005    0.00147912  RT_DebugF: Dimensions = 3
00000006    0.00164855  RT_DebugF: Dim1       = 500
00000007    0.00181547  RT_DebugF: Dim2       = 20
00000008    0.00198199  RT_DebugF: Dim3       = 10
00000009    0.00218009  RT_DebugF: Nels       = 100000
00000010    0.00234457  RT_DebugF: ElSize     = 1
00000011    0.00258637  RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000012    0.00267946  RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000013    0.00276241  RT_DebugF:
00000014    0.00278579  RT_DebugF: Check Init
00000015    8.27883625  RT_DebugF: Init END Check1 Passed
00000016    8.27904987  RT_DebugF: Init END Check2 Passed
00000017    8.27925873  RT_DebugF: Init END Check3 Passed
00000018    8.27941895  RT_DebugF: Check Init Time = 8.281 secs (Per element 82.809998 microsecs)
00000019    8.27950382  RT_DebugF: Check Attributes Set/Get
00000020    8.28724003  RT_DebugF: Check Attributes Set/Get = 0.015 secs (Per element 0.149994 microsecs)
00000021    8.28732872  RT_DebugF: Check Set only Time Test on 100000 Nels
00000022    20.20360184 RT_DebugF: Check Set Only Time = 11.907 secs (Per element 119.070000 microsecs)
00000023    20.20368767 RT_DebugF: Check Get only Time Test on 100000 Nels
00000024    28.68160629 RT_DebugF: Check Get Only Time = 8.484 secs (Per element 84.840012 microsecs)
00000025    28.68168640 RT_DebugF: Check Compare Set/Get
00000026    56.60816193 RT_DebugF: Check Compare Set/Get Time = 27.922 secs (Per element 279.220001 microsecs) [Including Data generation]
00000027    56.60824585 RT_DebugF: ALL Checks Done
00000028    56.60826874 RT_DebugF:
00000029    56.60848236 RT_DebugF: Type       = 0 (BOOL)
00000030    56.60865021 RT_DebugF: Dimensions = 3
00000031    56.60882187 RT_DebugF: Dim1       = 500
00000032    56.60898590 RT_DebugF: Dim2       = 20
00000033    56.60914993 RT_DebugF: Dim3       = 10
00000034    56.60932159 RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000035    56.60948563 RT_DebugF: ElSize     = 1
00000036    56.60972977 RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000037    56.60992432 RT_DebugF: Total Time Type=0 (BOOL) = 56.609 secs
00000038    56.61000824 RT_DebugF: ==============================
00000039    56.61172485 RT_DebugF: Type       = 1 (INT)
00000040    56.61191177 RT_DebugF: Dimensions = 3
00000041    56.61207962 RT_DebugF: Dim1       = 500
00000042    56.61225128 RT_DebugF: Dim2       = 20
00000043    56.61241913 RT_DebugF: Dim3       = 10
00000044    56.61258316 RT_DebugF: Nels       = 100000
00000045    56.61275101 RT_DebugF: ElSize     = 4
00000046    56.61299133 RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000047    56.61309433 RT_DebugF: Alloc Time = 0.016 secs (Per element 0.159988 microsecs)
00000048    56.61317444 RT_DebugF:
00000049    56.61319733 RT_DebugF: Check Init
00000050    65.18122864 RT_DebugF: Init END Check1 Passed
00000051    65.18144226 RT_DebugF: Init END Check2 Passed
00000052    65.18164825 RT_DebugF: Init END Check3 Passed
00000053    65.18180847 RT_DebugF: Check Init Time = 8.562 secs (Per element 85.619957 microsecs)
00000054    65.18190002 RT_DebugF: Check Attributes Set/Get
00000055    65.18953705 RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.160065 microsecs)
00000056    65.18962860 RT_DebugF: Check Set only Time Test on 100000 Nels
00000057    77.02680206 RT_DebugF: Check Set Only Time = 11.828 secs (Per element 118.279953 microsecs)
00000058    77.02688599 RT_DebugF: Check Get only Time Test on 100000 Nels
00000059    85.54342651 RT_DebugF: Check Get Only Time = 8.515 secs (Per element 85.149986 microsecs)
00000060    85.54350281 RT_DebugF: Check Compare Set/Get
00000061    107.05323029    RT_DebugF: Check Compare Set/Get Time = 21.516 secs (Per element 215.159973 microsecs) [Including Data generation]
00000062    107.05330658    RT_DebugF: ALL Checks Done
00000063    107.05332947    RT_DebugF:
00000064    107.05354309    RT_DebugF: Type       = 1 (INT)
00000065    107.05371857    RT_DebugF: Dimensions = 3
00000066    107.05387878    RT_DebugF: Dim1       = 500
00000067    107.05404663    RT_DebugF: Dim2       = 20
00000068    107.05421448    RT_DebugF: Dim3       = 10
00000069    107.05437469    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000070    107.05453491    RT_DebugF: ElSize     = 4
00000071    107.05478668    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000072    107.05496979    RT_DebugF: Total Time Type=1 (INT) = 50.453 secs
00000073    107.05506134    RT_DebugF: ==============================
00000074    107.05671692    RT_DebugF: Type       = 2 (FLOAT)
00000075    107.05688477    RT_DebugF: Dimensions = 3
00000076    107.05705261    RT_DebugF: Dim1       = 500
00000077    107.05722046    RT_DebugF: Dim2       = 20
00000078    107.05738068    RT_DebugF: Dim3       = 10
00000079    107.05754852    RT_DebugF: Nels       = 100000
00000080    107.05771637    RT_DebugF: ElSize     = 4
00000081    107.05796051    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000082    107.05805969    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000083    107.05814362    RT_DebugF:
00000084    107.05816650    RT_DebugF: Check Init
00000085    115.89083862    RT_DebugF: Init END Check1 Passed
00000086    115.89105225    RT_DebugF: Init END Check2 Passed
00000087    115.89126587    RT_DebugF: Init END Check3 Passed
00000088    115.89143372    RT_DebugF: Check Init Time = 8.844 secs (Per element 88.440018 microsecs)
00000089    115.89151001    RT_DebugF: Check Attributes Set/Get
00000090    115.89917755    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000091    115.89926147    RT_DebugF: Check Set only Time Test on 100000 Nels
00000092    127.76137543    RT_DebugF: Check Set Only Time = 11.859 secs (Per element 118.590012 microsecs)
00000093    127.76145935    RT_DebugF: Check Get only Time Test on 100000 Nels
00000094    136.27801514    RT_DebugF: Check Get Only Time = 8.516 secs (Per element 85.160057 microsecs)
00000095    136.27810669    RT_DebugF: Check Compare Set/Get
00000096    185.36102295    RT_DebugF: Check Compare Set/Get Time = 49.094 secs (Per element 490.939972 microsecs) [Including Data generation]
00000097    185.36109924    RT_DebugF: ALL Checks Done
00000098    185.36112976    RT_DebugF:
00000099    185.36134338    RT_DebugF: Type       = 2 (FLOAT)
00000100    185.36149597    RT_DebugF: Dimensions = 3
00000101    185.36167908    RT_DebugF: Dim1       = 500
00000102    185.36184692    RT_DebugF: Dim2       = 20
00000103    185.36201477    RT_DebugF: Dim3       = 10
00000104    185.36218262    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000105    185.36233521    RT_DebugF: ElSize     = 4
00000106    185.36257935    RT_DebugF: NelMax     = 536870847 ($1FFFFFBF)
00000107    185.36276245    RT_DebugF: Total Time Type=2 (FLOAT) = 78.313 secs
00000108    185.36285400    RT_DebugF: ==============================
00000109    185.38035583    RT_DebugF: Type       = 3 (STRING)
00000110    185.38052368    RT_DebugF: Dimensions = 3
00000111    185.38069153    RT_DebugF: Dim1       = 500
00000112    185.38085938    RT_DebugF: Dim2       = 20
00000113    185.38102722    RT_DebugF: Dim3       = 10
00000114    185.38119507    RT_DebugF: Nels       = 100000
00000115    185.38136292    RT_DebugF: ElSize     = 64
00000116    185.38160706    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000117    185.38171387    RT_DebugF: Alloc Time = 0.015 secs (Per element 0.149994 microsecs)
00000118    185.38179016    RT_DebugF:
00000119    185.38182068    RT_DebugF: Check Init
00000120    194.16348267    RT_DebugF: Init END Check1 Passed
00000121    194.16371155    RT_DebugF: Init END Check2 Passed
00000122    194.16390991    RT_DebugF: Init END Check3 Passed
00000123    194.16407776    RT_DebugF: Check Init Time = 8.781 secs (Per element 87.810059 microsecs)
00000124    194.16415405    RT_DebugF: Check Attributes Set/Get
00000125    194.17181396    RT_DebugF: Check Attributes Set/Get = 0.016 secs (Per element 0.159912 microsecs)
00000126    194.17190552    RT_DebugF: Check Set only Time Test on 100000 Nels
00000127    206.27981567    RT_DebugF: Check Set Only Time = 12.109 secs (Per element 121.090088 microsecs)
00000128    206.27989197    RT_DebugF: Check Get only Time Test on 100000 Nels
00000129    214.92962646    RT_DebugF: Check Get Only Time = 8.641 secs (Per element 86.409912 microsecs)
00000130    214.92970276    RT_DebugF: Check Compare Set/Get
00000131    264.40823364    RT_DebugF: Check Compare Set/Get Time = 49.484 secs (Per element 494.839905 microsecs) [Including Data generation]
00000132    264.40829468    RT_DebugF: ALL Checks Done
00000133    264.40832520    RT_DebugF:
00000134    264.40853882    RT_DebugF: Type       = 3 (STRING)
00000135    264.40869141    RT_DebugF: Dimensions = 3
00000136    264.40887451    RT_DebugF: Dim1       = 500
00000137    264.40902710    RT_DebugF: Dim2       = 20
00000138    264.40921021    RT_DebugF: Dim3       = 10
00000139    264.40936279    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000140    264.40954590    RT_DebugF: ElSize     = 64
00000141    264.40975952    RT_DebugF: NelMax     = 33554427 ($1FFFFFB)
00000142    264.40997314    RT_DebugF: Total Time Type=3 (STRING) = 79.046 secs
00000143    264.41006470    RT_DebugF: ==============================
00000144    264.41146851    RT_DebugF: Type       = 4 (BIN)
00000145    264.41165161    RT_DebugF: Dimensions = 3
00000146    264.41183472    RT_DebugF: Dim1       = 500
00000147    264.41198730    RT_DebugF: Dim2       = 20
00000148    264.41217041    RT_DebugF: Dim3       = 10
00000149    264.41235352    RT_DebugF: Nels       = 100000
00000150    264.41250610    RT_DebugF: ElSize     = 1
00000151    264.41278076    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000152    264.41287231    RT_DebugF: Alloc Time = 0.000 secs (Per element 0.000000 microsecs)
00000153    264.41296387    RT_DebugF:
00000154    264.41296387    RT_DebugF: Check Init
00000155    273.27609253    RT_DebugF: Init END Check1 Passed
00000156    273.27630615    RT_DebugF: Init END Check2 Passed
00000157    273.27651978    RT_DebugF: Init END Check3 Passed
00000158    273.27667236    RT_DebugF: Check Init Time = 8.875 secs (Per element 88.750000 microsecs)
00000159    273.27676392    RT_DebugF: Check Attributes Set/Get
00000160    273.28442383    RT_DebugF: Check Attributes Set/Get = 0.000 secs (Per element 0.000000 microsecs)
00000161    273.28451538    RT_DebugF: Check Set only Time Test on 100000 Nels
00000162    285.04803467    RT_DebugF: Check Set Only Time = 11.766 secs (Per element 117.660217 microsecs)
00000163    285.04812622    RT_DebugF: Check Get only Time Test on 100000 Nels
00000164    293.58193970    RT_DebugF: Check Get Only Time = 8.531 secs (Per element 85.309753 microsecs)
00000165    293.58203125    RT_DebugF: Check Compare Set/Get
00000166    322.62448120    RT_DebugF: Check Compare Set/Get Time = 29.047 secs (Per element 290.470276 microsecs) [Including Data generation]
00000167    322.62457275    RT_DebugF: ALL Checks Done
00000168    322.62460327    RT_DebugF:
00000169    322.62481689    RT_DebugF: Type       = 4 (BIN)
00000170    322.62496948    RT_DebugF: Dimensions = 3
00000171    322.62515259    RT_DebugF: Dim1       = 500
00000172    322.62530518    RT_DebugF: Dim2       = 20
00000173    322.62548828    RT_DebugF: Dim3       = 10
00000174    322.62564087    RT_DebugF: Nels       = 100000 (Not doubled, Cannot append to multi-dim array)
00000175    322.62582397    RT_DebugF: ElSize     = 1
00000176    322.62606812    RT_DebugF: NelMax     = 2147483391 ($7FFFFEFF)
00000177    322.62628174    RT_DebugF: Total Time Type=4 (BIN) = 58.219 secs
00000178    322.62649536    RT_DebugF: SCRIPT TOTAL TIME = 322.640 secs
Results on Core Duo Dual Core 2.13GHz, 3GB DDR2, Half full non-system 320 GB SATA2
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th November 2013 at 01:30.
StainlessS is offline   Reply With Quote
Old 12th November 2013, 00:37   #199  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
New version RT_Stats v1.28Beta51 Here:- LINK REMOVED

Changes:-

Changed Beta version in RT_VersionString to show two digits of Beta eg "1.28Beta51".

Several changes to RT_Array type funcs.
Code:
*****************************************************
**********       RT_ARRAY FUNCTIONS       ***********
*****************************************************

RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,int "Dim3"=0,int "StringLenMax"=256)
 Creates a file to hold Array elements of type Bool, Int, Float, String, or BIN.
  BIN is a BYTE (8 bit) sized Int where only lowest 8 bits of Int are stored in array as an unsigned 8 bit int, upper 24 bits ignored.

 Filename, Array Filename, no default.

 Type, int, default 1(0 -> 4). 0=Bool, 1=Int, 2 = Float, 3 = String, 4 = BIN.

 Dim1, Dim2, Dim3, all Default 0, range 0 or greater. Number of array elements per dimension (max 3 dimensions).
  It makes little sense to set either Dim2 or Dim3 to 1 although this will not cause an error condition, just be less efficient,
  a 3 dimensional array with all dimensions 1, refers only to a single element but but will take slightly longer to calculate the
  linear array offset.

  Dim2 and Dim3 fix the number of array dimensions for the lifetime of the array, and also the size of dimensions 2 and 3.

     Dim2         Dim3
      0            0             Single dimension array
      0           >0             Illegal, Throws error condition.
     >0            0             Two dimension array, Dim2 fixes size of 2nd dimension.
     >0           >0             Three dimension array, Dim2 and Dim3 fix size of 2nd and 3rd dimensions.

  Dim1 governs whether array elements are allocated or not. If Dim1=0, then no elements of the array are preallocated and you must call
   either RT_ArrayExtend or RT_ArrayAppend (single dimension array ONLY) to use the array. The size of the first dimension can grow whether
   it is a 1, 2 or 3 dimension array, the size of the 2nd and 3rd dimensions (if any) are fixed.
   With all defaults of 0, would be fixed to a single dimension array with zero allocated elements, must use RT_ArrayAppend to add
   elements to the array or RT_ArrayExtend to allocate additional elements and initalize them to zeros
    (initialized to zeros, Bool=False,Float=0.0,String="").

   With only Dim1 set to eg 1000, would create single dimension array of 1000 elements (0 -> 999), where RT_ArrayAppend and RT_ArrayExtend
   can also be used.
   With Dim1 and Dim2 greater than zero, would create a two dimensional array, where RT_ArrayAppend can NOT be used, but RT_ArrayExtend
   can be used to allocate and add initialized elements to the Dim1 dimension, intialized to zero.
   With Dim1, Dim2 and Dim3 greater than zero, would create a three dimensional array, where RT_ArrayAppend can NOT be used, but
   RT_ArrayExtend can be used to allocate and add initialized elements to the Dim1 dimension.
   Will produce an error if Dim3 is non zero and Dim2 is zero.

 StringLenMax, default 256(1 or more). Fixed Maximum string length excluding nul term. Error if string length exceeds.
  Only used for Type=3 (string).

 Returns total number of elements in array.
 All RT_ArrayXXXX() errors produce an error alert.

***
***
***

RT_ArrayGetDim(string FileName,int "Dim"=0)
 Returns number of dimensions in array or the size of any 1 of the dimensions.
 Filename, Array Filename, no default.
 Dim, default 0. (Range 0 -> 3).
  0, returns the number of dimensions in the array.
  Invalid dimensions will return 0, eg RT_ArrayGetDim(FileName,Dim=2) on single dimension array return 0.
  Error if Dim smaller than 0 or greater than 3.

***
***
***

RT_ArrayGetType(string FileName)
 Filename, Array Filename, no default.
 Returns int, Type as set by RT_ArrayAlloc. 0=Bool, 1=Int, 2 = Float, 3 = String, 4 = BIN.

***
***
***

RT_ArrayGetElSize(string FileName)
 Filename, Array Filename, no default.
 Returns int, element size, Type 0(bool)=1, 1(int)=4, 2(float)=4, 3(string)=StringLenMax, 4(BIN)=1, as set by RT_ArrayAlloc.

***
***
***

RT_ArrayGetNels(string FileName)
 Filename, Array Filename, no default.
 Returns int, total number of elements in array as set by RT_ArrayAlloc, or current number of elements if RT_ArrayAppend used to add
 elements to end of single dimension array, or RT_ArrayExtend used to increase Dim1 dimension.
 For a 3 dimensional array where Dim1=10, Dim2=20,Dim3=30 would return 10*20*30 ie 6000.

***
***
***

RT_ArrayGetDim1Max(string FileName)
 Filename, Array Filename, no default.
 Returns int, maximum theoretical Dim1 dimension for the current array with current fixed size Dim2 and Dim3 dimensions.
 For 1 dimension Array: (maximum +ve integer - header size) / ElSize.
 For 2 dimension Array: (maximum +ve integer - header size) / (ElSize * Dim2).
 For 3 dimension Array: (maximum +ve integer - header size) / (ElSize * Dim2 * Dim3).

***
***
***

RT_ArrayGetNelMax(string FileName)
 Filename, Array Filename, no default.
 Returns int, maximum number of elements that could theoretically be stored in current array, taking into account the
 current number of dimensions and the size of dimensions 2 and 3.

***
***
***

RT_ArrayGet(string FileName,int ix1,int "ix2",int "ix3")
 Returns array element of variable Type as set in RT_ArrayAlloc. Type BIN returns an Int range 0 -> 255.
 Filename, Array Filename, no default.
 ixl, int, zero relative. 1st subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,1)-1.
 ix2, int, zero relative. 2nd subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,2)-1.
  Only valid if 2 or 3 dimensional array. For single dimension array, can omit, supply RT_Undefined(), or -1.
 ix3, int, zero relative. 3rd subcript of array. Valid range 0 -> RT_ArrayGetDim(FileName,3)-1.
  Only valid if 3 dimensional array. For 1 or 2 dimension array, can omit, supply RT_Undefined(), or -1.

***
***
***

RT_ArraySet(string FileName,Var,int ix1,int "ix2",int "ix3")
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc. (NOTE position in arg list changed)
 ixl, int, zero relative. 1st subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,1)-1.
 ix2, int, zero relative. 2nd subscript of array. Valid range 0 -> RT_ArrayGetDim(FileName,2)-1.
  Only valid if 2 or 3 dimensional array. For single dimension array, can omit, supply RT_Undefined(), or -1.
 ix3, int, zero relative. 3rd subcript of array. Valid range 0 -> RT_ArrayGetDim(FileName,3)-1.
  Only valid if 3 dimensional array. For 1 or 2 dimension array, can omit, supply RT_Undefined(), or -1.
 Returns total number of elements in array.

***
***
***

RT_ArrayExtend(string FileName,int "Add"=1)
 Extends first dimension of 1, 2 and 3 dimension arrays and initializes additional elements to zero.
    (initialized to zeros, Bool=False,Float=0.0,String="").
 Filename, Array Filename, no default.
 Add, Int default 1. How much to increase size of 1st dimension.
 Returns new size of 1st dimension.

***
***
***

RT_ArrayAppend(string FileName,Var)
 Adds a variable to end of single dimension array and increments the Nel count.
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc.
 Returns number of elements in single dimension array.
 Error if multi dimensional array.

***
***
***

RT_ArraySetAttrib(string FileName,int ix, Value)
 There are 16 available attributes in the Array file header, that can be used for whatever purpose you like,
  RT_ArrayAlloc() initializes all Attributes to type Int, 0.
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Value, Int or Float, The value that Attrib(ix) will be set to.
 Returns Value. Error if type not of type Int or type Float.

***
***
***

RT_ArrayGetAttrib(string FileName,int ix)
 There are 16 available attributes in the Array file header, that can be used for whatever purpose you like,
 Filename, Array Filename, no default.
 Ix, Attribute array element index range 0 -> 15.
 Returns the value of the user set attribute Int or Float (or type Int 0 if not yet set).
Unless suggestions for change, will likely remain as is.

EDIT: Array files are not deleted after use, but can use eg RT_FileDelete(ARRAY) if required.
Can use an existing ARRAY file to store eg plugin path and filenames, or as storage for a library of avs scripts
or many other possible uses.

EDIT: The elements in the currently highest dimension are physically closest to each other in file, so if you say wanted
to eg store a byte value for RGB red channel pixel in an array for a 100 frame clip of dimensions 640x480 then it would
perhaps be best set up with 1st dimension the frame number 0 -> 99, 2nd dimension the Y position 0 ->479,
and the X position 0 -> 639. eg RT_ArrayAlloc(ARRAY,type=4,dim1=100,dim2=480,dim3=640). # Type=4=BIN=8 bit BYTE
Due to filesystem disk caching, this would allow fastest scanning when, for each frame (least often changing), then for each
Y position (next least often changing), then for each X position (most often changing, innermost in nested for/next loops).
Above also most closely matches how pixel data is arranged in memory and so memory cache would also be most
efficiently used.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th November 2013 at 17:34.
StainlessS is offline   Reply With Quote
Old 14th November 2013, 19:46   #200  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
StainlessS,
I started to implement the array feature in the AWB script. Please review if this meets the intended usage:
Code:
	TEMP = RT_GetSystemEnv("TEMP")
	NOW = RT_LocalTimeString()
...
	GScript(RT_StrReplace("""	#"
        #######################################
        # 1) Unique Global Variables Initialization
        #######################################
		#name of the file to hold the RTE array contents
		global AWB_Array%%% = TEMP+"\AWB_Array_%%%_"+NOW+".tmp"	
		#Dim2: [0]=SceneStart, [1]=Red, [2]=Grn, [3]=Blu
		RT_ArrayAlloc(AWB_Array%%%, Type=2, Dim1=cRGB.FrameCount, Dim2=4)
		#'file destructor'
		cRGB.CallCmd("CMD /C del "+AWB_Array%%%, "-3", Hide=true)

Last edited by martin53; 14th November 2013 at 19:48.
martin53 is offline   Reply With Quote
Reply

Tags
averageluma, correlation, lumadifference, runtime

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 04:50.


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