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 ?
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.
B4i v5.0 adds several methods to the Bit object that provide very fast access to arrays. In most cases there is no reason to use these methods as they are more cumbersome and less safe than the standard way to access arrays. If your performance critical code does many reads or writes to arrays...
www.b4x.com
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.
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