Re: Threaded drawing - JPEG
Re: Threaded drawing - JPEG
- Subject: Re: Threaded drawing - JPEG
- From: Uli Kusterer <email@hidden>
- Date: Thu, 12 Dec 2013 12:55:00 +0100
On 11 Dec 2013, at 18:53, Steve Sisak <email@hidden> wrote:
> At 10:25 AM -0800 12/10/13, Seth Willits wrote:
>> On Dec 10, 2013, at 1:32 AM, Graham Cox <email@hidden> wrote:
>> > But my situation is that I need to draw VECTOR objects up to 25,000% zoom with no pixelization.
>>
>> You're given a CGContext to draw into; What's the difference? The tiled drawing is async, so if the drawing doesn't occur fast enough it'll scale up the low-scale bitmap, but what's evil about that? It's like Apple or Google maps.
>
> Not to hijack the thread, but I'm just getting head into optimizing some code which displays live preview for a number of JPEG streams simultaneously.
>
> Most implementations I've tried result in being CPU bound in JPEG code on the main thread with the 7 other cores idle.
>
> I've tried variants of NSImageView, CGImage and CIImage and all that's needed to render them on alternate threads but Cocoa appears to so good at delaying evaluation as long as possible that it seems to end up calling the JPEG decoder synchronously from -drawRect of whatever view subclass I've chosen on the main thread.
>
> Any suggestions for what technologies to use to run a JPEG through, say CIImage w/o blocking the main thread.
>
> This has turned out to be way more complicated than I thought.
If you want previews, I think ImageIO has dedicated methods for generating previews (MacOS definitely has some somewhere, even if I mis-remember them being in ImageIO). Particularly in the case of JPEG these can be much more efficient because of the way JPEGs are stored. Essentially, JPEGs often contain a few small DCTs at the start that can give you a vague, blurry version of the image, then draw more DCTs on top to add in the detail (I'm criminally simplifying here). So the preview calls can actually just draw the blurry version into a smaller destination and stop there, and don't have to calculate or even load the rest of the image.
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden