10

I need to build an Image processing application for Android. Performance is the main requirement and I am looking to use gpu compute. I want to know which of the 3 libraries is best to use.

I know OpenGL is primarily for graphics but also supports computer shaders.

I am not sure how well supported OpenCL is on Android

RenderScript lacks documentation and I think is slower than other libraries.

xSooDx
  • 493
  • 1
  • 5
  • 19
  • 1
    Start with a mini benchmark for a test case like gaussian blur for all three versions gl,cl, rs. Then compare runtime performance, market penetration and development performance. I guess, if it works, opencl will be advantageous as it can also use cpu part concurrently if algorithm is developed right for heterogeneous computing (multi-device). Especially if both gpu and cpu share same global memory. It also can use features like local memory (in-chip, fast) if device supports, so test it. – huseyin tugrul buyukisik May 16 '19 at 20:39
  • For those who are interested, I've published that RenderScript-Vulkan-GLES benchmark we're talking about : https://github.com/RobbWatershed/renderscript-alternatives-benchmark – Paul W May 27 '23 at 07:58

1 Answers1

2

For an Image Processing App, the heaviest part is in the processing (transforming/manipulating) the pixels of images in memory, not rendering images to screens/buffers.

Sure, that kind of processing is general and needs a general-purpose computation API.

Thus, we can eliminate OpenGL ES. It supports shaders, but the OpenGL ES Shading Language is very limited and definitely not suitable for general processing.

RenderScript, according to this:

RenderScript does not use any GPU or DSPs cores. That is a common misconception encouraged by Google's deliberately vague documentation. RenderScript used to have an interface to OpenGL ES, but that has been deprecated and has never been used for much beyond animated wallpapers. RenderScript will use multiple CPU cores, if available, but I suspect RenderScript will be replaced by OpenCL.

I'm working for a big video game company, we don't have any plan to use RenderScript. We think Vulkan is a better choice. I suggest you choose Vulkan too but the problem is that the number of Android devices supporting Vulkan is pretty low now.

Therefore, to answer your question, please go with OpenCL. Although OpenCL is not part of the Android platform, many manufacturers provide drivers or even SDKs to support OpenCL on Android. At least, it is better than Vulkan in terms of number of supported devices.

Nghia Bui
  • 3,694
  • 14
  • 21