CGImageSourceCreateIncremental: is it possible to have it continually render to its cached image?

15 views
Skip to first unread message

David Hoerl

unread,
Feb 5, 2012, 6:36:31 PM2/5/12
to Quartz Dev List
I'm downloading some huge files to an iOS device from the internet, in
JPEG format. What happens now is I get all the data, decode it into
memory, then show part of it.

It takes several seconds to download (where the iOS device is idling),
then when the whole image arrives, I draw it into a context, which takes
another 1.5 seconds on a iPhone 4.

What I'd dearly love to do is use a CGImageSourceCreateIncremental
imageSource, and somehow prod it into incrementally updating the image,
so when the final chunk arrives the final draw-into-context is simply a
copy operation.

Nothing I do seems to improve the performance. I've tried asking the
incremental source for an image, then drawing those into a context, but
the timing does not improve. Supposidly caching is the default behavior,
but to be sure I am setting it as well.

The only solution I've come up with is to pretile my big image as a
series of jpegs, then put them into simple archive (binary plist?), so
as I get a full tile I can decompress that and load it into memory, so
that when the final tile arrives the time between the last incoming data
chunk and showing the image is a few milliseconds. The archive would a
simple header with a count and the sizes of each image then the image data.

Its killing me that I got this powerful device just idling until I get
the whole image!!!

[I looked at PNGs - the files are just SO much larger even crushed.
JPEG2000 tiles take tens of seconds to decompress.]

David

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (Quart...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quartz-dev/quartz-dev-garchive-50095%40googlegroups.com

This email sent to quartz-dev-g...@googlegroups.com

David Hoerl

unread,
Feb 6, 2012, 4:13:46 PM2/6/12
to Quartz Dev List
Well, I just burned a DTS incident on this. As far as I can see, it does
not start caching images until it gets the final chunk (and the
completed flag set to yes). I'm not hopeful there is a solution (outside
of building and using libjpeg or equiv directly).

I tried everything under the sun so to speak, and cannot find anything
that even remotely speeds it up. In the end, my users will just have to
wait a few extra seconds while the image decodes into memory. If they
use 3G they'll never even notice the delay!

Reply all
Reply to author
Forward
0 new messages