--- SORRY posted in WRONG PLACE ---
Please Move to Visual Basic 6 and earlier
Please Move to Visual Basic 6 and earlier
In the app I am dedicated to (image processing) I make intensive use of 2D arrays of "singles" representing RGB values.
So to prcess them I am used to use 2 "for" loops in X and Y
Code:
For X = 0 to Width
For Y = 0 to Height
1) Instead of having 2 for cycles, would it be faster to have only one and operate like this:?
Single for-loop traversal over 2D/3D arrays
Code:
For I = 0 to (W+1)*(H+1)-1
X = I Mod (W+1)
Y = I \ (W+1)
...
Next I
For example like this ?
Code:
Private Declare Function vbaCopyBytes Lib "msvbvm60.dll" Alias "__vbaCopyBytes" (ByVal Length As Long, Dst As Long, Src As Long) As Long
vbaCopyBytes Size, ByVal VarPtr(Dest(0)), ByVal VarPtr(Src(0, 0))
Src is a 2D array of Singles and
Dest is a 1D array of Singles already correctly resized
and Size is the number of Bytes of the 2D array.
In short, the purpose is to speed up the traversal of 2D arrays.
If that of using a single loop was too little gain in speed maybe I could try transforming it to 1D.