ogles_gpgpu: GPGPU for mobile devices and embedded systems using OpenGL ES 2.0

2015-01-01 • gpgpu, imageproc, mobile development, embedded systems, ios, android, opengl

Based on the results of my master’s thesis, I created a small library for GPGPU on mobile and embedded systems, such as Android and iOS. It enables fast, GPU-powered image processing by using OpenGL ES 2.0 shaders.

Since transferring data to and from the GPU is often a bottleneck for GPU processing, platform-specific fast texture access is also implemented. The library is written in well documented, clear C++ code. An interface for Android systems via JNI is provided. Example applications show how to use this library. All code is Apache 2 licensed.

There are several scenarios on how to use this library: You can for example pass image data (or arbitrary byte data) to ogles_gpgpu, which creates an OpenGL texture from it. You can then process it on the GPU by applying a series of filters (OpenGL shaders) on it. This kind of rendering happens off-screen. Afterwards, you can lock the result data and obtain a pointer to it. You can then copy this data for future processing or directly analyze or modify it. Another possible scenario is to directly pass an OpenGL texture ID as input for ogles_gpgpu. This is for example beneficial if you can obtain camera frames as OpenGL texture from the camera API of your target platform (both Android and iOS allow this and example projects or provided for this). Now ogles_gpgpu can directly run the filters on this camera frame texture. This can happen off-screen or optionally on-screen, which means that the result image is also displayed to a render surface. After processing on the GPU side, you can access the result data again as described in the first scenario. By this, you can do further CPU-based processing of the result data. This is for example necessary, if certain algorithms can not (efficiently) be implemented as OpenGL shaders.

The following figures show a flowchart of these two scenarios:

Example use-case 1

Example use-case 2

The ogles_gpgpu project is available on github.com.

Back