Re: Question on handling very large images
Re: Question on handling very large images
- Subject: Re: Question on handling very large images
- From: Marco Tabini <email@hidden>
- Date: Sat, 03 Mar 2012 15:38:30 -0500
> The problem is that if you do this in a naive way, with a single huge pixmap, you will have poor locality of reference. Once you get to 1024 RGBA pixels across, every scan-line will occupy its own memory page. So any operation that crosses lots of scan lines but only uses a small fraction of each one (like drawing a vertical line) may involve a lot of paging.
>
> The usual workaround to that is to instead break the image up into rectangular tiles, and store each as a separate pixmap. That way most localized graphics operations will only involve a fraction of the total number of tiles. (You can see Photoshop do this, if you run a slow operation or if it’s had to page part of the image out to disk.) I think this will also help with the GPU, because CoreGraphics likes to copy pixmaps to GPU memory so they can be rendered and manipulated faster.
Thanks for the helpful tips! That's pretty much how I ended up organizing things, and it seems to work OK so far.
—Mt.
_______________________________________________
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