Folks,
In my Android application, a video stream from an external source need to be displayed on a Canvas view. From my Java code, I pass in ByteBuffer to an underlying C++ library via JNI. The library decodes the stream and builds an RGB bitmap image in ByteBuffer and returns it back.
Now, in my Java code, I have a ByteBuffer that contains width, height and rows of RGB values. I could now draw this in a for loop:
for(int y=0;y<height;y++) {
for(int x=0;x<width;x++) {
get the right RGB value from ByteBuffer and draw the pixel
}
}
I am wondering if there is a more efficient way to do this? Any ideas would be appreciated.
The layout of ByteBuffer data is under my control. Perhaps I can rearrange it for a better performance.
Thank you in advance for your help.
Regards,
Peter