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 9th December 2021, 15:19   #481  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Quote:
Originally Posted by VoodooFX View Post
I wish DBASE could store masks.
Thats always been in the back of my mind.

EDIT: Well not for DBase, but for RT_ Arrays, would likely also have to implement type UShort [maybe as BIN16] in both Array and DBase, for unsigned 16 bit int.
Currently implements non standard types BIN [8 bit unsigned int] and [EDIT: Intended] for internal RT_stats use only, Double [returned to AVS as 32 bit float].
__________________
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; 9th December 2021 at 18:15.
StainlessS is offline   Reply With Quote
Old 9th December 2021, 19:14   #482  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 1,133
For some reason I thought that it supports it and I'll make like logodata storage out of it.
I can store stuff to ebmp but there wouldn't be coords and other settings.
VoodooFX is offline   Reply With Quote
Old 9th December 2021, 19:29   #483  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Roughly whats implemented for array [additional to the array itself] (same for DBase)

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

 RT_Stats ARRAY functions allow fast access to a file based Array of up to 3 dimensions of fixed element 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 the Array
as an unsigned 8 bit Int, upper 24 bits ignored.
 The maximum possible file size is about 1TB, and depends on number and size of dimensions and element type and size, also
depends upon avilable disk space.
Element types Bool and BIN require 1 byte, Int and Float 4 bytes, and String is of fixed maximum length (user chosen) up to
256KB (256 * 1024, no nul terminating character is stored in an Array String).
Maximum possible size of dimension 1 is $7FFFFFFE but depends upon available disk space and also limited to max 1TB. 
 RT_ArrayAlloc, allows you to create an array file with a fixed number of dimensions and where the 2nd and/or 3rd dimensions
of a multi-dimensional array are fixed in size but the size of the first dimension can 'grow', single dimension arrays can
'grow' too. You can create an array where the first dimension is 0 (any other dimensions fixed), ie no elements pre-allocated
in array file, in this case you can use RT_ArrayExtend to 'grow' the first dimension of the array so that it can be used. In addition,
single dimension arrays can also use RT_ArrayAppend to add elements to the end of the array.
 An Array file allows up to 1024 Attributes of types Int or Float, which can be used for whatever a user desires, these
attributes are stored in the Array file header which is 32768 bytes, so the actual data starts at $8000 hex.
 In addition to user attributes, an Array has currently 10 user String Attributes that can be be used for whatever you want, the
string attributes are currently a maximum of 1024 characters in length.
 In addition to user attributes and user string attributes, there are currently 128 ID's (Int of Float) that are intended to be used
by either RT_Stats itself, or script developers, intended function of ID's are to in some way eg link an array to a particular
clip, by storing maybe Width, Height, Framecount and perhaps other values, the stored ID's might be used to Validate an array
against a clip.
 You could use the Array functions to return multiple results from a script function to the caller via a caller supplied Array
filename, perhaps with some kind of status variable returned directly.
EDIT: IIRC, in pre AVS+ [not sure about avs+], Array element and DBase field reads were faster than access to Global Vars. [and that was probably on Core Duo with SATA I drive].
__________________
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; 9th December 2021 at 19:36.
StainlessS is offline   Reply With Quote
Old 26th July 2022, 23:07   #484  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Here a few functions than might be handy. [RT_Stats required]

Code:
# ChrEatWhite is posted elsewhere, used in Chrxxxxx funcs library.
Function ChrEatWhite(String S)                    {i=1 C=RT_Ord(S,i) While(C==32||C>=8&&C<=13)  {i=i+1 C=RT_Ord(S,i)} return i>1?MidStr(S,i):S}
Function StrSQuote(string S)                      {Return "'" + S + "'" }                      # Surrounded String with Single Quotes.
Function StrDQuote(string S)                      {Return Chr(34) + S + Chr(34) }              # Surrounded String with Double Quotes.
Function StrTrim(String S, Int "Md")              {Md=Default(Md,0) S=((Md!=2)?S.RevStr.ChrEatWhite.RevStr:S) Return((Md!=1)?S.ChrEatWhite():S) }                 # Md=1 Trim WhiteSpace from right : Md=2 Trim WhiteSpace from Left : Md=0(Default) or anything else, Left + Right Trim
Function StrLeftAlign(String S,int "PadLen")      {PadLen=Default(PadLen,S.StrLen) Return S.StrTrim(0).RT_StrPad(PadLen)}                                         # Left Align S, result SPACE padded on Right to at least PadLen(default StrLen(S)) length.
Function StrRightAlign(String S,int "PadLen")     {PadLen=Default(PadLen,S.StrLen) S = S.StrTrim(0) Return RT_StrPad("",PadLen-S.StrLen) + S}                     # Right Align S, result SPACE padded on Left to at least PadLen(default StrLen(S)) length.
Function StrCenterAlign(String S,int "PadLen")    {PadLen=Default(PadLen,S.StrLen) S=S.StrTrim(0) Return(RT_StrPad("",(PadLen-StrLen(S))/2)+S).RT_StrPad(PadLen)} # Center Align S, result SPACE padded evenly on both Left & Right to at least PadLen(default StrLen(S)) length.
Function StrAlign(String S,Int "Md",Int "PadLen") {Md=Default(Md,0) Return(Md==1)?S.StrRightAlign(PadLen):(Md==2)?S.StrLeftAlign(PadLen):S.StrCenterAlign(PadLen)}# Md=1 Right Align : Md=2 Left Align : Md=0(Default) or anything else, Center Align. Result is L/R/Center padded to at least PadLen(default StrLen(S)) Length.
Demo client
Code:
############ DEMO STUFF ###################
#Import(.\SomethingOrOther.avsi")

Src      ="              some test text    "

RT_DebugF("LEN=%d",Src.Strlen)

Global SBUF = StrSQuote(Src).RT_StrPad(48) + "SOURCE STRING        # (len between quotes=32)" + "\n" + Chr(10)

    Add2BUF(Src, "StrTrim(S)           # Left & Right Trim : Default "                       )
    Add2BUF(Src, "StrTrim(S,0)         # Left & Right Trim"                                  )
    Add2BUF(Src, "StrTrim(S,1)         # Right Trim"                                   )
    Add2BUF(Src, "StrTrim(S,2)         # Left Trim"                                    )

    Add2BUF(Src, "StrLeftAlign(S)      # Left Align, Default Pad to original length"   )
    Add2BUF(Src, "StrLeftAlign(S,42)   # Left Align, Pad to 42"                        )
    Add2BUF(Src, "StrLeftAlign(S,20)   # Left Align, Pad to 20"                        )

    Add2BUF(Src, "StrRightAlign(S)     # Right Align, Default Pad to original length"  )
    Add2BUF(Src, "StrRightAlign(S,42)  # Right Align, Pad to 42"                       )
    Add2BUF(Src, "StrRightAlign(S,20)  # Right Align, Pad to 20"                       )

    Add2BUF(Src, "StrCenterAlign(S)    # Center align, Default Pad to original length" )
    Add2BUF(Src, "StrCenterAlign(S,42) # Center Align, pad to 42"                      )
    Add2BUF(Src, "StrCenterAlign(S,20) # Center Align, pad to 20"                      )

    Add2BUF(Src, "StrAlign(S)          # Center Align, Default Pad to original length" )
    Add2BUF(Src, "StrAlign(S,0)        # Center Align, Default Pad to original length" )
    Add2BUF(Src, "StrAlign(S,1)        # Right Align, Default Pad to original length"  )
    Add2BUF(Src, "StrAlign(S,2)        # Left Align, Default Pad to original length"   )

    Add2BUF(Src, "StrAlign(S,0,42)     # Center Align, Pad to 42"                      )
    Add2BUF(Src, "StrAlign(S,1,42)     # Right Align, Pad to 42"                       )
    Add2BUF(Src, "StrAlign(S,2,42)     # Left Align, Pad to 42"                        )

    Add2BUF(Src, "StrAlign(S,0,20)     # Center Align, Pad to 20"                      )
    Add2BUF(Src, "StrAlign(S,1,20)     # Right Align, Pad to 20"                       )
    Add2BUF(Src, "StrAlign(S,2,20)     # Left Align, Pad to 20"                        )

BlankClip(width=1152,Height=640)

Subtitle(SBUF,Font="Courier New",lsp=0)

Return Last

Function Add2BUF(String S, String FnS) {
    s3 = Eval(Fns)
    Global SBUF = SBUF + StrSQuote(s3).RT_StrPad(48) + FnS + "\n" + Chr(10)
}
Result


EDIT: There are String Trim type functions implemented in AVS+, this does not use them. {TrimLeft, TrimRight, TrimAll}
EDIT: You can also use PadLen=0 with some, to not pad at all.
__________________
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; 26th July 2022 at 23:18.
StainlessS is offline   Reply With Quote
Old 9th April 2025, 12:20   #485  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Hi.
How big of an array can RT_ArrayAlloc hold?
Avisynth works for a few tens of thousands, but for a few hundred thousand it crashes
rgr is offline   Reply With Quote
Old 9th April 2025, 15:13   #486  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 569
Are you sure you didn't hit your memory limit? In this case also RT_ArrayAlloc will crash/fail.
StvG is offline   Reply With Quote
Old 9th April 2025, 22:04   #487  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
RT_Array's are file based, nothing to do with Avs+ arrays.
Same for RT_DBase's.

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

 RT_Stats ARRAY functions allow fast access to a file based Array of up to 3 dimensions of fixed element 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 the Array
as an unsigned 8 bit Int, upper 24 bits ignored.
 The maximum possible file size is about 1TB, and depends on number and size of dimensions and element type and size, also
depends upon avilable disk space.
Element types Bool and BIN require 1 byte, Int and Float 4 bytes, and String is of fixed maximum length (user chosen) up to
256KB (256 * 1024, no nul terminating character is stored in an Array String).
Maximum possible size of dimension 1 is $7FFFFFFE but depends upon available disk space and also limited to max 1TB. 
 RT_ArrayAlloc, allows you to create an array file with a fixed number of dimensions and where the 2nd and/or 3rd dimensions
of a multi-dimensional array are fixed in size but the size of the first dimension can 'grow', single dimension arrays can
'grow' too. You can create an array where the first dimension is 0 (any other dimensions fixed), ie no elements pre-allocated
in array file, in this case you can use RT_ArrayExtend to 'grow' the first dimension of the array so that it can be used. In addition,
single dimension arrays can also use RT_ArrayAppend to add elements to the end of the array.
 An Array file allows up to 1024 Attributes of types Int or Float, which can be used for whatever a user desires, these
attributes are stored in the Array file header which is 32768 bytes, so the actual data starts at $8000 hex.
 In addition to user attributes, an Array has currently 10 user String Attributes that can be be used for whatever you want, the
string attributes are currently a maximum of 1024 characters in length.
 In addition to user attributes and user string attributes, there are currently 128 ID's (Int of Float) that are intended to be used
by either RT_Stats itself, or script developers, intended function of ID's are to in some way eg link an array to a particular
clip, by storing maybe Width, Height, Framecount and perhaps other values, the stored ID's might be used to Validate an array
against a clip.
 You could use the Array functions to return multiple results from a script function to the caller via a caller supplied Array
filename, perhaps with some kind of status variable returned directly.

***
***
***

RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,int "Dim3"=0,int "StringLenMax"=256)

 Creates a file to hold a one, two or three dimensional Array of 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. Type of the array elements, fixed for lifetime of array.
   v1.40, NOTE, There is also a type 5 (double) which is not of use to the user, although a type 5 array will accept Float
   (as double is not an Avisynth type). Type 5 is implemented for use by RT_Stats internal functions to store higher precision results.
   Array type double (5) will be returned as Float to Avisynth script.

 Dim1, Dim2, Dim3, all Default 0, range 0 or greater. Number of array elements per dimension (max 3 dimensions).
  Where Dim1 & Dim2 & Dim3 all at default 0, will be 1 dimensional unallocated Array.
  Dim1 governs the pre-allocated size of the array first dimension.
    The first dimension can 'grow' for 1, 2 or 3 dimensional arrays. (RT_ArrayExtend, or for single dimension only RT_ArrayAppend)
  Dim2 and Dim3 fix the number of array dimensions for the lifetime of the array, and also the size of dimensions 2 and 3.

   Dim1 Dim2 Dim3   Dimension 1 is [EDIT: default] 0, NO elements allocated, can use RT_ArrayExtend to 'grow' size of first dimension for use.
    0    0    0     SINGLE dimension array. Can ALSO use RT_ArrayAppend to add elements to end of the single dimension array
    0    0   >0     ILLEGAL, Throws error condition.
    0   >0    0     TWO dimension array, Dim2 fixes size of 2nd dimension. CANNOT use RT_ArrayAppend.
    0   >0   >0     THREE dimension array, Dim2 & Dim3 fix size of 2nd & 3rd dimensions. CANNOT use RT_ArrayAppend.

   Dim1 Dim2 Dim3   Dimension 1 is Dim1 in size, elements ARE pre-allocated, initialized to zeros and can be used. Can also 'grow'.
   >0    0    0     SINGLE dimension array. Can ALSO use RT_ArrayAppend as well as RT_ArrayExtend.
   >0    0   >0     ILLEGAL, Throws error condition.
   >0   >0    0     TWO dimension array, Dim2 fixes size of 2nd dimension. Can ALSO use RT_ArrayExtend.
   >0   >0   >0     THREE dimension array, Dim2 & Dim3 fix size of 2nd & 3rd dimensions. Can ALSO use RT_ArrayExtend.
                    (initialized to zeros, Bool=False,Float=0.0,String="").

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

 Returns maximum size of dim1 dimension given current flesystem and disk space available to the user.
 All RT_ArrayXXXX() errors produce an error alert.

 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 will take slightly longer to calculate the
 linear array offset.
There are quite a few additional RT_Array functions.

Also, RT_DBase,
Code:
*****************************************************
**********       DBASE FUNCTIONS          ***********
*****************************************************

RT_Stats DBASE functions allow fast access to a file based DataBase where each record can have up to 1024 fields of variable 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 the DBase field
as an unsigned 8 bit Int, upper 24 bits ignored. there is also a type double used in DBase, this is only of use to internal RT_Stats
functions, setting or getting type double takes or returns type Float (as Avisynth cannot handle double precision float).
The maximum possible DBase file size is about 1TB, and the number of records is restricted to $7FFFFFFE, about 2 Billion.
Field types Bool and BIN require 1 byte, Int and Float 4 bytes, and String is of fixed maximum length (user chosen) up to
256KB ((256 * 1024), no nul terminating character is stored in a DBase String). The private type Double requires 8 bytes.
 A DBase file allows up to 1024 Attributes of types Int or Float, which can be used for whatever a user desires, these
attributes are stored in the DBase file header which is 32768 bytes, so the actual data starts at $8000 hex.
 In addition to user attributes, a DBase has currently 10 user String Attributes that can be be used for whatever you want, the
string attributes are currently a maximum of 1024 characters in length.
 In addition to user attributes and user string attributes, there are currently 128 ID's (Int of Float) that are intended to be used
by either RT_Stats itself, or script developers, intended function of ID's are to in some way eg link a DBase to a particular
clip, by storing maybe Width, Height, Framecount and perhaps other values, the stored ID's might be used to Validate a DBase
against a clip.
 You could use the DBase functions to return multiple results from a script function to the caller via a caller supplied DBase
filename. The DBase functions also make it more likely that script functions could be written to eg find where edits between
two clips have been made, or previously impossible/implausible tasks performed.

***
***
***

RT_DBaseAlloc(String Filename,Int Records,String TypeString,Int "StringLenMax"=256)
 Creates a file to hold DataBase records. Each record can have up to 1024 fields of varying 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 DBase field as an unsigned 8 bit int, upper 24 bits ignored.
    v1.40,  NOTE, There is also a type double which is not of use to the user, although a type double field will accept Float
  (as double is not an Avisynth type). Type double is implemented for use by RT_Stats internal functions to store higher precision results.
  Type double will be returned as Float to Avisynth script.

 Filename, DBASE Filename, no default.

 Records, int zero or more. Number of records to create, initalized to zeros (initialized to zeros, Bool=False,Float=0.0,String="").
     If you dont know the final size of your DBase, you can create a DBase with 0 records, and thereafter use RT_DBaseAppend to add 
     records to the end of the DBase.

 TypeString, string holding record construction data. One character for each field, valid characters are "bifsn" or Uppercase.
  'b' = BOOL, 'i' = INT, 'f' = FLOAT, 's' = STRING, 'n' = BIN. (the private type double uses 'e' or 'E' in the TypeString)
  The 's' STRING construction character can be followed by numeric digits describing fixed maximum string length (excluding
    any nul term character), otherwise StringLenMax is used by default instead.
    For no particular reason, I have limited the maximum string length to 256K, ie 256 * 1024, throws an error if greater.

 StringLenMax Default=256. Default length of String fields if no explicit string length defined following TypeString S constructor char.

 Example TypeString:-
   "ifffs1024bsn", 1st field Int, 3 Float fields, 1 string field of length=1024, 1 Bool field, 1 string field using length of
   StringLenMax, and 1 BIN field. 8 Fields in all (0->7).

 Returns number of records created.
 All RT_DBaseXXXX() errors produce an error alert.
RT_ARRAY_Functions:- http://avisynth.nl/index.php/RT_Stat...RRAY_Functions
DBASE_Functions:- http://avisynth.nl/index.php/RT_Stats#DBASE_Functions

EDIT: RT_ Arrays and DBase files cannot store clip variables; but as file based, can be re-used via another script (if not deleted).
__________________
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; 9th April 2025 at 22:13.
StainlessS is offline   Reply With Quote
Old 15th April 2025, 23:21   #488  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Thanks -- 1TB should be enough.
What will be faster -- RT_Stats ARRAY or DBASE?
rgr is offline   Reply With Quote
Old 16th April 2025, 12:23   #489  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
About the same.
Dont know why, but I nearly always prefer to use DBase. [unless 3 dimensional array]

EDIT:
Timings on earlier version RT_Stats, AVS 2.6 Std, and on Core 2 machine (Q9550 CPU) with SATA 2,
Was quicker to access DBase record/field than to access same type var as AVS Global variable.
(but slower than access AVS Local var)
__________________
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; 16th April 2025 at 13:15.
StainlessS is offline   Reply With Quote
Old 16th April 2025, 16:13   #490  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Quote:
RT_ArrayAlloc(string FileName,int "Type"=1,int "Dim1"=0,int "Dim2"=0,int "Dim3"=0,int "StringLenMax"=256)

Dim1 governs the pre-allocated size of the array first dimension.
The first dimension can 'grow' for 1, 2 or 3 dimensional arrays. (RT_ArrayExtend, or for single dimension only RT_ArrayAppend)
After "RT_ArrayAlloc(arrname,2,1000)" array size (RT_ArrayGetDim(arrname)) will be 0 or 1000? (If 1000, then they will be filled with zeros?)

Edit: OK, I see: "Dimension 1 is Dim1 in size, elements ARE pre-allocated, initialized to zeros and can be used."

Last edited by rgr; 16th April 2025 at 16:17.
rgr is offline   Reply With Quote
Old 17th April 2025, 06:38   #491  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Quote:
Edit: OK, I see: "Dimension 1 is Dim1 in size, elements ARE pre-allocated, initialized to zeros and can be used."
Right on brother.
"initialized to zeros", for float <type=2> init to 0.0. (int=0, string="").
__________________
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 22nd April 2025, 19:26   #492  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Quote:
Originally Posted by StainlessS View Post
Right on brother.
"initialized to zeros", for float <type=2> init to 0.0. (int=0, string="").
It would be nice to be able to choose what element it should be filled with, because for an array of ~100k elements it takes 22mins
rgr is offline   Reply With Quote
Old 22nd April 2025, 20:52   #493  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Quote:
because for an array of ~100k elements it takes 22mins
Not for me, for array took ~1:51 and for DB ~1:52.
ArrayTest.avs
Code:
ARR="D:\Z\Test.Arr"
SZ=100*1000
F=42.0
RT_ArrayAlloc(ARR,2,SZ)
Start=RT_TimerHP()
for(i=0,SZ-1) { RT_ArraySet(ARR,F,i) }
End=RT_TimerHP()
Tim = End-Start
M=int(Tim/60) S=Tim-(m*60)
Msg=RT_String("Done: Time=%d:%02.3f",M,S)
MessageClip(Msg)
DBaseTest.avs
Code:
DB="D:\Z\Test.DB"
SZ=100*1000
F=42.0
TypeString="f"
RT_DBaseAlloc(DB,SZ,TypeString)
Start=RT_TimerHP()
for(i=0,SZ-1) { RT_DBaseSet(DB,i,F) }
End=RT_TimerHP()
Tim = End-Start
M=int(Tim/60) S=Tim-(m*60)
Msg=RT_String("Done: Time=%d:%02.3f",M,S)
MessageClip(Msg)
Mine, on i7-8700 CPU. <not that fast on single core, Base Freq 3.2GHz, Max Turbo Frequency 4.6GHz>

But I shall keep your comment in mind on next update (but dont hold your breath, last update was 2018, I think)

EDIT: Storage on Gen 3 NVMe. [EDIT: Due to <EDIT: OS and physical drive> disk caching, spinning drive should not be much different]

Code:
RT_ArraySet(string FileName,var Var,int ix1,int "ix2",int "ix3")
 Filename, Array Filename, no default.
 Var, a variable of Type as set in RT_ArrayAlloc.
 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.
If single dimension array, only specifiy the 1st dimension ix1, dont supply ix2 and ix3 as 0. {for 2 dim array, only supply ix1 and ix2}
EDIT: From Array docs for RT_ArrayAlloc,
Quote:
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 will take slightly longer to calculate the
linear array offset.
EDIT: Also, if you hard code F as 42.0 instead of using Var F, then will not have to read F local variable at every iteration setting the array element <or DB field>.

EDIT: Output single dim array to a text file [quite slow, tested only on Float array]
Code:
ARR="D:\Z\Test.Arr"
FILE="D:\Z\TestArr.txt"
NDIMS = RT_ArrayGetDim(ARR,Dim=0) # Number of dimensions in array
Assert(NDIMS==1, "Error, single dimension array only please")
SZ = RT_ArrayGetDim(ARR,Dim=1) # Num Array elements in single dimension array
TYPE=RT_ArrayGetType(ARR) # 0=Bool, 1=Int, 2 = Float, 3 = String, 4 = BIN. # NOTE, There is also a type 5 (double)
Fmt = "%d ] %" + Select(TYPE, "b","d","f","s","d","f") + "\n"
RT_FileDelete(FILE)
Start=RT_TimerHP()
for(i=0,SZ-1) { RT_WriteFile(FILE,Fmt, i,  RT_ArrayGet(ARR,i), Append=True) }
End=RT_TimerHP()
Tim = End-Start
M=int(Tim/60) S=Tim-(m*60)
TYPE_S = RT_ArrayTypeName(Type) # Name of type
Msg=RT_String("Written:- Time=%d:%02.3f single Dim array[%d] of type='%s' to file='%s'",M,S,SZ,TYPE_S,FILE)
MessageClip(Msg)
eg Produces msg clip, "Written:- Time=29:11.995 single Dim array[100000] of type='Float' to file='D:\Z\TestArr.txt'"
Code:
0 ] 42.000000
1 ] 42.000000
2 ] 42.000000
3 ] 42.000000
4 ] 42.000000
5 ] 42.000000
6 ] 42.000000
7 ] 42.000000
8 ] 42.000000
9 ] 42.000000
10 ] 42.000000
11 ] 42.000000
12 ] 42.000000
13 ] 42.000000
# etc
A bit on the slow side, maybe the formatted string production is what takes the time.
About 57 elements per second written to file.
Result text file, 1,845KB in size.
__________________
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; 23rd April 2025 at 12:33.
StainlessS is offline   Reply With Quote
Old 23rd April 2025, 12:35   #494  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Quote:
Originally Posted by StainlessS View Post
Not for me, for array took ~1:51 and for DB ~1:52.
ArrayTest.avs
Code:
ARR="D:\Z\Test.Arr"
SZ=100*1000
F=42.0
RT_ArrayAlloc(ARR,2,SZ)
Start=RT_TimerHP()
for(i=0,SZ-1) { RT_ArraySet(ARR,F,i) }
End=RT_TimerHP()
Tim = End-Start
M=int(Tim/60) S=Tim-(m*60)
Msg=RT_String("Done: Time=%d:%02.3f",M,S)
MessageClip(Msg)
Hmmm....

"Done: Time=15:5.778"

Ryzen5700G+Win10+NVME
CPU usage was around 0%
rgr is offline   Reply With Quote
Old 23rd April 2025, 12:48   #495  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Done it again, this time only 1:39, with Comodo Antivirus running.

image sharing
AVS running 100% on single core, other stuff file writing [Drive D: 1%] + other system stuff.

EDIT: I used W10, + Vdub2 as app.

Does your Ryzen5700G thingy have similar to 12 gen intel i7,
performance cores + efficiency cores ?
Is it perhaps running on efficiency core ?

EDIT: In performace graph, right click "change graph to logical cores".
EDIT: I think with mine, every 2nd graph is a logical core, the physical cores are the ones doing something.

EDIT: With 12th gen intel i7, 16 performance cores [EDIT: half of those being logical] shown on upper graph, bottom 4 cores [EDIT: half of those being logical] are efficiency thingies.

EDIT: On your Task Manager Details TAB, is your RightClick Player_appName/Set_Priority set to anything other than Normal ?
__________________
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; 23rd April 2025 at 20:04.
StainlessS is offline   Reply With Quote
Old 23rd April 2025, 13:35   #496  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176

Using VDub changes nothing.
My Ryzen has all the performance cores
rgr is offline   Reply With Quote
Old 23rd April 2025, 14:34   #497  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
After raising priority to high:
"Done: Time=9:56.085"
rgr is offline   Reply With Quote
Old 23rd April 2025, 14:37   #498  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
No idea what you are showing me there (ffmpeg.exe ???).
Show the CPU cores graph.

Also,
Quote:
EDIT: On your Task Manager Details TAB, is your RightClick Player_appName/Set_Priority set to anything other than Normal ?
answer above.

EDIT: Gone t' pub.
__________________
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 23rd April 2025, 15:56   #499  |  Link
rgr
Registered User
 
Join Date: Jun 2022
Posts: 176
Yes, I'm running the script through ffmpeg.
Now I've running compression, so I'll paste it later. But don't expect 0% to be visible there

Quote:
EDIT: On your Task Manager Details TAB, is your RightClick Player_appName/Set_Priority set to anything other than Normal ?
After raising priority to high:
"Done: Time=9:56.085"
rgr is offline   Reply With Quote
Old 23rd April 2025, 20:09   #500  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,164
Quote:
Now I've running compression, so I'll paste it later. But don't expect 0% to be visible there
I expect your AVS instance to be running on a single graph core, your CPU % will be for total ALL cores.
[Mine was 100% on single core [top left core graph], but 16% total CPU]

Quote:
Yes, I'm running the script through ffmpeg.
Cant for the life of me figure out why.
__________________
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; 23rd April 2025 at 20:17.
StainlessS 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 17:02.


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