0

I need to rotate a full size photo (about 8MB) as fast as possible on an iPhone (4s and up), an arbitrary angle. The code to do so with CoreImage is easy enough, but not fast. It takes about 1.5 seconds on a 4s. Please note that the purpose of this rotate is for further image processing in memory, NOT for display on the screen.

Is there any kind of hope that we can get this down to sub-second given, perhaps, the DSP (using the Accelerate framework) or OpenGL (and keeping in mind that we have to copy the bits in and out of whatever buffer we using. If this is hopeless then we have other (but more complicated) ways to tackle the job. I have not written OpenGL code before and want some assurance that this will actually work before I spend significant time on it!

Thank you, Ken

user938797
  • 167
  • 3
  • 15

1 Answers1

1

Since you have it running at 1.5s with no hardware acceleration I'd say it's safe to assume you can get it under a second with OpenGL.

DubiousPusher
  • 1,132
  • 2
  • 8
  • 19
  • Thanks, do you know if CoreImage uses the GPU at all? – user938797 Jun 08 '13 at 03:40
  • This article indicates that core graphics DOES use the hardware in which case going to GL won't buy me anything. http://stackoverflow.com/questions/7558636/ios-is-core-graphics-implemented-on-top-of-opengl – user938797 Jun 09 '13 at 00:07
  • Sorry for the delayed response. I hope you figured this out. I don't have any experience with CoreImage. I just have a lot of GPU experience so I'm only really certain that if you were not using the GPU before and you switched to it you'd get quite a boost. Just read a little on Wikipedia and it seems CoreImage does depend on OpenGL and does hit graphics hardware. That doesn't mean using raw GL can't give you a speed up. Who knows how well Apple is using GL in that library. Then again, it ships in their image editing software so it's probably not terrible. Sorry I can't help more. – DubiousPusher Jul 20 '13 at 04:58
  • I have just succeeded in doing the rotation in OpenGl and it is a little faster, So either coreimage does not use the hardware or doesn't use it as effectively. However, it is still not fast enough for me. I opened a question with the OpenGl code. http://stackoverflow.com/questions/17799250/optimizing-opengl-rotation-of-a-2d-grayscale-image-on-iphone – user938797 Jul 22 '13 at 23:43