small medium large xlarge

Wedding photobooth_pragsmall
11 Feb 2009, 08:42
Tony Arnold (11 posts)

I’m slightly surprised that I haven’t seen talked about too much elsewhere, but what sort of memory usage should I be seeing in the following scenario?

I have a CALayer the size of my screen (1920 x 1200), in which I set the contents to a CGImageRef loaded directly from a 1.8Mb JPEG image (4056 x 2699 @ 240 ppi). I’d expect a little overhead, but I’m seeing memory usage instantly balloon to around 55Mb in my sample application.

Is this normal? Can I reduce this significantly, or is this just the price of entry into Core Animation land?

Biopic_100x100_pragsmall
11 Feb 2009, 12:19
Bill Dudney (917 posts)

Hi Tony,

I’m not sure, I’ve never profiled large images like this. My guess is that moving from JPEG to a texture (remember all layer’s content ends up as OpenGL textures) just takes that much memory for a 4056x2699 image.

Before I gave up though I’d do some research on some native compressed formates for OpenGL and see if you can convert your image to one of those formats. You might see some gains from that.

Good luck, and please let us know what you find.

Wedding photobooth_pragsmall
13 Aug 2009, 09:49
Tony Arnold (11 posts)

Hi Bill, sorry it took so long to post back to this thread - are there any good tutorials or documentation around converting to compressed texture formats on the mac? I haven’t given this a go yet, but it does sound like it’s a good idea - I’m hopeful you’re right, and that if I cache a reference to the compressed texture and reuse that, it will be more efficient than the CGImageRef/JPEG I have now.

Biopic_100x100_pragsmall
13 Aug 2009, 15:47
Bill Dudney (917 posts)

Hi Tony,

Sorry but I’ve not really dug into compressing images for textures on the mac. I’m sure the OpenGL docs have something on it though.

Good luck!

You must be logged in to comment