On 08 Mar 2014, at 04:38, Trygve Inda <cocoa...@xericdesign.com> wrote:
> I need to composite/tile about 20 images in a 4x5 grid to one image.

 What for? Knowing that might help finding a way to speed it up. I.e. why are 
the images separate, where are they supposed to go in the end? Display on 
screen? Writing to a standard image file format? Something else?

 In general, whenever you have the words “draw” and “too slow” in one thought, 
you should think of the GPU. Mac OS X these days is really good at loading 
images onto the GPU and keeping them there while they’re used. Quartz on the 
other hand is effectively shorthand for “move work off the GPU back onto the 
CPU and in the process perform the slow agonizing copy from VRAM to RAM”.

 So I’d try every GPU-resident imaging API I can find. In particular, CoreImage 
and CALayer sound like good candidates. I’ve only done in-place transformations 
(effects etc.) with CI, not anything that generates a larger image from several 
smaller ones, so can’t really help there, but I’d expect it to be possible and 
fast.

 As for CALayer, have you tried creating a layer for each image, setting its 
contents property to that image and then drawing them all into a CGContext? 
Depending on what your bottleneck is, it may be that your CGImageRefs are 
already on the GPU (or the GPU up/download is not your bottleneck, but rather 
the actual merging of images), and so CALayer might do the generating of the 
big bitmap on the GPU and only then download from there again.

 Also, as a final thought because you’ve likely already done this first thing: 
What does Instruments tell you? Where are you spending your time? If most of 
these 2 seconds are actually CoreImage lazy-decoding the CGImageRefs from 
whatever on-disk format they originally were, we can try speeding up 
compositing here until we’re blue, after all :-)

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to