On 8 Mar 2014, at 06:55, Trygve Inda <cocoa...@xericdesign.com> wrote:
>> 
>> On 8 Mar 2014, at 5:02 pm, Trygve Inda <cocoa...@xericdesign.com> wrote:
>> 
>>> This is slower by about 15%.   :(
> 
> Interestingly if I call:
> 
> CGContextSetInterpolationQuality ([context graphicsPort],
> kCGInterpolationNone);
> 
> It results in 10% slower processing. The antialiasing setting does not
> affect speed at all.
> 
> Doing multiple threads will require quite a bit of work - I may give that a
> try too. The destination is both screen and a file so I don't think Core
> Animation will work.
> 
> I might be near the limits of what I can do speed-wise here.  :(

I think Graham's point about using multiple threads, or better yet multiple 
queues is a good one and depending on the computer (how many cores) will likely 
get you significant speed improvements and a more responsive main thread.

You can move all downscaling and creation of new downscaled CGImage's using 
dispatch_apply. Then do a dispatch_async to the main queue for the  reply block 
to draw the newly downscaled images to your cgcontext.

I was thinking that CoreImage and CIFilters might help but I'm not so sure, as 
with the large images, you have to push all the data into GPU memory which I 
think will take any speed benefit. But rather than applying that assumption it 
would be better to get the different approaches profiled.

The WWDC session from 2011 Blocks and Grand Central Dispatch in Practice 308 
talks about the use of dispatch_apply. I've written notes about that session 
here: 
http://blog.yvs.eu.com/2013/07/blocks-and-grand-central-dispatch-in-practice/

The 2012 WWDC session 712: Asynchronous design patterns with blocks, gcd and 
xpc is also worth looking at. 
http://blog.yvs.eu.com/2013/07/asynchronous-design-patterns-with-blocks-gcd-and-xpc/

Kevin

_______________________________________________

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