GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Unnecessary memory allocation

Open nocaseguy opened this issue 14 years ago • 4 comments

in - initWithCGImage of GPUImagePicture.m (line 48) It should be: BOOL shouldRedrawUsingCoreGraphics = NO; Instead of: BOOL shouldRedrawUsingCoreGraphics = YES;

Now I know where the memory warning came from

nocaseguy avatar Oct 20 '12 17:10 nocaseguy

There's a reason for that. In my benchmarks, the other path was slower than the redrawing approach, and it doesn't work with all image formats. I've left that code in there for reference, but I've disabled it for that reason.

There should be no memory differences between the two paths, so I don't think this is the source of any memory-related issues for you.

BradLarson avatar Oct 22 '12 16:10 BradLarson

i use photoshop to compress a jpeg image,if you redraw the image , it will larger than before. so i think it should be: BOOL shouldRedrawUsingCoreGraphics = NO;

ghost avatar Jun 18 '13 06:06 ghost

Andy: No, actually you have to bind raw bitmap to GPU memory anyway. It doesn't matter how small the file is, but the pixel does.

nocaseguy avatar Jun 18 '13 06:06 nocaseguy

@AndyWallace - No, that has nothing to do with this. All images have to be uncompressed into memory to work with them. No matter the source, the size in memory of your image will be width x height x 4 bytes (RGBA). Each additional framebuffer adds another uncompressed image. If you look at the actual code for this method, you will see that there is no memory difference between the two branches. It's purely a decoding performance issue.

BradLarson avatar Jun 18 '13 15:06 BradLarson