hockeyman
hockeyman

Reputation: 1183

Order Core-Image to process images only on GPU

I found some info in the internet that Core-Image process images on CPU if any of it's size bigger than 2048 (width or height or both). And it looks to be true because applying CIFilter even on 3200x2000 image is very slow. If I do the same on 2000x2000 image it is much faster. Is it possible to tell Core-Image to process all images on GPU always? Or maybe information I found was incorrect?

Upvotes: 0

Views: 405

Answers (2)

Jerry B
Jerry B

Reputation: 453

The maximum size depends on the device you're working on. For iPhone 3GS/4 & iPad 1, it's 2048*2048. For later iPhone/iPad, it's 4096*4096. On OSX, it would depend on your graphic card and/or OS version (2, 4, 8, or 16K²).

One possible way around the limit is to tile your image into pieces below the limit, and process each tile separately. Then you'd have to put the pieces back together after.

Upvotes: 0

Processing on the GPU is not always faster, because your image data first has to be loaded to the GPU memory, processed, and then transferred back.

You can use kCIContextUseSoftwareRenderer to force software rendering (on the CPU) but there is no constant to force rendering on a GPU, I'm afraid. Also, software rendering does not work in the Simulator.

Upvotes: 1

Related Questions