12 messages in com.googlegroups.android-developersRe: [android-developers] Slow Bitmap ...| From | Sent On | Attachments |
|---|---|---|
| saurabh | 30 Mar 2008 04:19 | |
| David Given | 30 Mar 2008 07:07 | |
| saurabh | 30 Mar 2008 10:09 | |
| mickrobk | 30 Mar 2008 11:40 | |
| ebs2...@gmail.com | 01 Apr 2008 11:02 | |
| trickybit | 01 Apr 2008 15:01 | |
| tomgibara | 01 Apr 2008 16:02 | |
| saurabh | 02 Apr 2008 00:17 | |
| qvark | 10 Apr 2008 15:30 | |
| Romain Guy | 10 Apr 2008 15:34 | |
| David Given | 10 Apr 2008 16:23 | |
| qvark | 11 Apr 2008 00:10 |
| Subject: | Re: [android-developers] Slow Bitmap operations![]() |
|---|---|
| From: | David Given (d....@cowlark.com) |
| Date: | 03/30/2008 07:07:56 AM |
| List: | com.googlegroups.android-developers |
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
saurabh wrote: [...]
The getPixel function seems to be taking approx 1/100 of a second. Similarly, checking whether each pixel satisfies the condition and then copying it to Bitmap B also takes approx 1/100 second. Therefore, performing these 2 operations for 547*450 = 246150 pixels takes a lot of time. Is there any way to do this faster?
I'd be inclined to copy all the pixel data out of the Bitmap into a int[] array of pixels; process it in-place; and then copy it all back in again. That way the heavy lifting --- the image processing --- occurs using simple array accesses, which should be way faster than doing method calls on Bitmap.
However...
I hope to use this for processing each frame of a video in real-time. So, processing each picture must not take more than a 1/20 of a second.
...not a chance!
Hopefully this will be improved considerably when the JIT goes in, but right now simply filling an array of the right size with zeroes takes over a second.
(I recently had to do something similar; I eventually got around it by pushing all the image processing off into native code via JNI, which of course is not officially supported and probably not a good choice unless you really need it.)
-- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ "I have always wished for my computer to be as easy to use as my │ telephone; my wish has come true because I can no longer figure out │ how to use my telephone." --- Bjarne Stroustrup




