Android Question Fast Array Access

Rainer@B4A

Member
Licensed User
Longtime User
I want to detect in realtime changes between preview frames from the build in camera.
Unfortunately I run into timing problems.
Using the camera library I get about 30 low resulotion frames (120x160) per second as a byte array.
But looping through the array doing a simple calcutation slows it down to < 2fps.

In the forum I found a "Fast array access" for iOS.
Is there somthing similar for B4A ?
Or should I use another technik or library ?
 

agraham

Expert
Licensed User
Longtime User
From post #3 by Erel in the fast access thread
It is specific to B4i. The arrays access is done with C pointers. It is not something that can be done in Java. On the other hand the standard array methods in B4A and B4J are faster so it is less needed any way.

There is no way to speed up array access in B4A. In fact the array access is probably very fast, it is the processing of each value that is probably taking up the time. Try it without the processing and see how long the loop takes by itself.
 
Upvote 0

Rainer@B4A

Member
Licensed User
Longtime User
Hi agraham,
I found an unexpected difference between the Debug- and the Release- (with Bridge Logger) Mode!
Debug: Increment 20000 array bytes = 600ms
Release: = 3ms

Now I will go on with more hope.
Thanks
 
Upvote 0
Top