Thank you for the fast answer!
I just could manage to do the lib and also working with the NDK, but I am not an expert, so I just know how to do calls, but no idea about how to spawn in Java and other issues...
The exact situation is:
The app uses the camera. I have a continuous camera_preview event which I want to treat in order to do some real-time effects.
When I get the preview event, and its associated data:
Inside the Camera_preview event, (just to not block this event) I do a callSubDelayed to a SubRoutine which
- Converts from NV21 to ARGB (--> using my library --> which makes a call to another subroutine using the NDK)
- Do some stuff with this data (--> using my library)
- when it is done, already back to B4A program, draw it on another layer which is over the preview image
The problems:
- I get aprox 10fps on a HTC one (acceptable), but only about 5fps on a Galaxy II, and less than three on my old chinese Tablet
- In the two later ones, the UI is also much less responsive
So, I guess I have to work in two directions
- Keep optimizing the processing of the image, but I think there will be a limit on this
- If I understood well, by throwing this processing from a diffrent thread, I will leave the UI from the main one more responsive, and this will improve the result for problem (2). Is it right?
There are two different types of calculations performed at different moments (but very often), which take, let's say, 40msec and 20msec. But as I throw them very often, i wonder if
Does the threading approach give a significant overhead?
About efficiency....
do you know of tips (or where can I find) about making "java subroutine calling" more efficient? I think sometime I read that parameter passing (and I do pass a lo of parameters) has a significant overhead (but I am not sure at all about it, just have it in my mind). It would not be a concern in functions which take about 1 second, but very significant on other scenarios in which the function is called repeatedly. Perhaps if the java library had a reference to those objects it would be easier? Just a thought...
Thanks a lot. I don't use to write in the forum but I do highly appreciate the help that you and other experts give to the others!