Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
- Subject: Re: [NSBitmapImageRep getBitmapDataPlanes] copying data?
- From: Quincey Morris <email@hidden>
- Date: Mon, 21 Feb 2011 16:05:05 -0800
On Feb 21, 2011, at 15:07, Jonathan Taylor wrote:
> So as far as my situation goes, what I'm after is an efficient way of starting from a path to some sort of raster image and obtaining a raw pixel buffer I can read. [Obviously if actually reading from disk then the disk will be the bottleneck, but it's often in the disk cache, in which case the extra data copy associated with [NSBitmapImageRep getBitmapDataPlanes] is a problem. I was rather liking the file-format-agnostic abilities of initWithContentsOfFile. Any thoughts?
Ken already said some of my intended response in his reply, but ...
It's even possible that the underlying CGImage is memory mapped to the original file so that the compressed data may not even have been read into the disk cache yet (or, not all of it), at the time you ask for the pixel data. You have to assume that retrieving the pixel data via 'getBitmapDataPlanes' might well be more efficient than anything you can do at the application level.
You know you're stuck with disk reads at some point in the process, which are going to be as slow as they're going to be. I'm going to go out on a limb and say that if your application can't swallow the additional cost of uncompressing and/or copying inside 'getBitmapDataPlanes' *once* per image**, your application design is broken*** -- or your Mac hardware is too slow for that application. :)
** Assuming you arrange to get rid of the unwanted memory zeroing, if Instruments shows it to be a factor.
*** That is, you probably need to bypass NSBitmapImageRep and go read just the parts of the file you want, which is going to be a huge PITA.
_______________________________________________
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