Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL ES vs OpenCL vs RenderScript for Android Image Processing

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.

like image 906
xSooDx Avatar asked May 13 '19 07:05

xSooDx


People also ask

Is OpenGL better than OpenCL?

Conclusion. The main difference between OpenGL and OpenCL is that OpenGL is used for graphics programming while OpenCL is used for heterogeneous computing. OpenGL is used in video game designing, simulation, etc. OpenGL helps to increase the performance of the system and allows parallel computing.

Do Android games use OpenGL?

Here mostly the same as on iOS applies - You don't need to use opengl but if you do you do have more possibilities in complexity, graphics and flexibility. Till Android 3.0 (API 11) you are able to enable hardware acceleration even for 2d canvas graphics.

What is RenderScript and when should we really use it?

RenderScript is especially useful for applications performing image processing, computational photography, or computer vision. To begin with RenderScript, there are two main concepts you should understand: The language itself is a C99-derived language for writing high-performance compute code.

What is OpenGL android studio?

Android includes support for high performance 2D and 3D graphics with the Open Graphics Library (OpenGL®), specifically, the OpenGL ES API. OpenGL is a cross-platform graphics API that specifies a standard software interface for 3D graphics processing hardware.


1 Answers

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.

like image 188
Nghia Bui Avatar answered Sep 21 '22 09:09

Nghia Bui