On Wed, Aug 08, 2012 at 10:28:55AM -0700, RichardC wrote:
> >1) It mentions that an exception is thrown if JNI access to the buffer ...
> Direct ByteBuffers are not supported on all Java VMs. Lucky for us to get
> OpenGL to work at all we need them to work on the Android Platform.
So I CAN create a byte buffer from JNI for exclusive access from JNI
(NO access from Java will be used at all).
> >2) It also mentions an OutOfMemory error....
> This could be thrown when creating the Java ByteBuffer Object (not its
> backing memory). It's only a small object but Java could still be out of
> memory for any Object allocation.
The memory allocation on the Java side, when using even a lowly 5 MP
camera (e.g., on my tablet) is already extremely tight. I've already
been told that Android devices with higher resolution cameras have
larger limits on heap size, but I can't blindly assume that they're
any larger (relatively speaking) than my tablet, for memory vs MP.
So consider it safe to assume that it will be extremely tight in every
case where the user uses the camera's full resolution, and that
therefore, all remaining memory usage in Java should be severely
minimized until the (potentially) HUGE byte array can be released,
which is after this part I'm working on (or rather, will be working
on once the migraine I had yesterday, which has been screaming at
me today every time I even think about looking at code, warning that
it will return if I do, has gone away ... aftermath of cancer #1 again).
> I use this technique to decoding PNG files, in my own Java code, I do this
Keep in mind, I'm not doing any of this in Java---all JNI. I need to be
able to create a memory block (or use some other method other than saving
the files to disk---which I'm doing now---as this is way too slow) that
uses only JNI-side memory, for read/write access from JNI after briefly
returning to Java, getting the latest seekbar value, and then calling
the C++ function again with that value (for the alpha to use when
blending the two images).
Thanks,
--jim
--
THE SCORE: ME: 2 CANCER: 0
73 DE N5IAL (/4) MiSTie #49997 < Running Mac OS X Lion >
spook...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W
"Someone ever tries to kill you, you try to kill 'em right back!"
--Mal (Firefly, 1x03, Our Mrs. Reynolds)