Gimp-GEGL is the first official OpenCL Porting Project of
C C++ M4 Makefile Ruby Python Other
Switch branches/tags
Nothing to show
Clone or download
VincentSC Merge pull request #72 from ex-rzr/cl
OpenCL implementations of noise-hsv, gaussian-blur-selective, motion-blur-linear, diffraction-patterns
Latest commit d5e8cd3 May 17, 2017
Failed to load latest commit information.
bin serialize: add support for resolving relative paths May 2, 2017
build/buildbot build/buildbot: Complete jas_config.h warning suppression Oct 3, 2010
docs release 0.3.16 May 15, 2017
examples .gitignore: Add missing files Jan 29, 2017
gegl operation: validate source bounding box before returning it May 15, 2017
libs npd: Link against needed libraries. Mar 3, 2015
m4 Update introspection.m4, default value is now auto Jun 5, 2013
opencl diffraction-patterns: Add CL implementation May 17, 2017
operations diffraction-patterns: Add CL implementation May 17, 2017
perf .gitignore: Add missing files Jan 29, 2017
po Update Polish translation May 14, 2017
seamless-clone seamless-clone: max-refine-steps is not used. Jul 12, 2015
tests noise-hsv: Add CL implementation and tests May 17, 2017
tools tools/operations_html: some dead code removed May 5, 2017
.gitignore gitignore: add tags file in the ignore list Mar 6, 2016
.kateconfig Add .kateconfig with modelines for Kate Aug 20, 2016
AUTHORS Update AUTHORS, NEWS Jan 22, 2017
CNAME Create CNAME Apr 6, 2017
COPYING Upgraded GEGL from (L)GPLv2 to (L)GPLv3. The library itself and the Nov 10, 2007
COPYING.LESSER Upgraded GEGL from (L)GPLv2 to (L)GPLv3. The library itself and the Nov 10, 2007
HACKING require automake >= 1.9.6 and libtool >= 1.5 Jul 3, 2009
MAINTAINERS Add myself to MAINTAINERS Feb 25, 2014 build: build operations dirs later Mar 29, 2017 Update Apr 7, 2017 fix a typo Apr 26, 2015 post release version bump May 15, 2017 pkg-config: request linking with math library fixing bug #755131 Sep 16, 2015
gegl.doap Remove extra programming languages from the doap file. Aug 7, 2014 pkg-config: request linking with math library fixing bug #755131 Sep 16, 2015


First official OPP (OpenCL Porting Project) of

GEGL (Generic Graphics Library) is a graph based image processing framework.

With GEGL you chain together image processing operations represented by nodes into a graph. GEGL provides such operations for loading and storing images, adjusting colors, filtering in different ways, transforming and compositing images.

GEGL also depends on BABL to translate pixel formats. BABL allows converting between different methods of storing pixels known as pixel formats that have with different bitdepths and other data representations, color models and component permutations. A vocabulary to formulate new pixel formats from existing primitives is provided as well as the framework to add new color models and data types.

For a brief explanation on how GEGL works, read this document


  1. Installing
  2. Development
  3. Contributing
  4. How to Port an Operation
  5. How to Test Output
  6. How to Benchmark Performance


Read the document above for more information, or refer to the links below for the respective platforms

On Windows

On Linux Platforms

Ensure that BABL is installed first before GEGL.


The code for GEGL-OpenCL can be found at GEGL-OpenCL Github.

There already exists OpenCL integration into GEGL and some operations have already been ported to run on OpenCL. However, there is still a lot of operations that need porting as listed in the Google Sheet below.

Task List for GEGL-OpenCL (Excel)

Task List for GEGL-OpenCL (Github)

Likewise, we have a slack channel for discussions pertaining to development and issues here, GEGL-OpenCL Slack


It is recommended that you fork this repository and create your branches there. After every discussion, if your kernel has the fastest speed for the vendor, you can create a pull request to have your changes merged. Please include the test results (correctness and timing), and name the pull request according to the operation you're working on and the vendor you're optimizing for, eg. box-blur_kernel_nv

Please ensure that make clean is executed before requesting a pull request

How to Port an Operation
  • Find an operation you'd like to work on under /operations/, eg. box-blur which can be found under /operations/common/
  • In box-blur.c, add the following line in the gegl_op_class_init function:
static void
gegl_op_class_init (GeglOpClass *klass)
  GeglOperationClass       *operation_class;
  GeglOperationFilterClass *filter_class;

  operation_class = GEGL_OPERATION_CLASS (klass);
  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);

  filter_class->process    = process;
  operation_class->prepare = prepare;
  // insert this line below
  operation_class->opencl_support = TRUE;
  gegl_operation_class_set_keys (operation_class,
      "name",        "gegl:box-blur",
      "title",       _("Box Blur"),
      "categories",  "blur",
      "description", _("Blur resulting from averaging the colors of a square neighbourhood."),
  • Create a cl_process function (which contains the host-code implementation) with the following parameters in the same file
static gboolean
cl_process (GeglOperation       *operation,
            GeglBuffer          *input,
            GeglBuffer          *output,
            const GeglRectangle *result)
  • Add a function call in the main process function before the cpu implementation
if (gegl_operation_use_opencl (operation))
    if (cl_process (operation, input, output, result))
      return TRUE;
  • Both kernel and kernel header file (.cl and .cl.h) should be stored in the /opencl/ folder.
  • Include both files, and any other necessary gegl-cl header in the operation's source code (eg. box-blur.c)
#include "opencl/gegl-cl.h"
#include "buffer/gegl-buffer-cl-iterator.h"
#include "opencl/"
How to Test Output
  • create an xml file (eg. box-blur.xml) containing the following code
<?xml version='1.0' encoding='UTF-8'?>
  <node operation='gegl:box-blur'>
      <param name='radius'>25</param>
  <node operation='gegl:load'>
      <param name='path'>../compositions/data/car-stack.png</param>
  • run the following shell command to generate an output
$ gegl box-blur.xml -o test.jpg GEGL_USE_OPENCL=yes
  • to check correctness of the image generated, run a command with OpenCL disabled first
$ gegl box-blur.xml -o test2.jpg GEGL_USE_OPENCL=no
  • and run the below to get a measure of correctness
$ gegl-imgcmp test2.jpg test.jpg
  • there is also a script in /tests/compositions that can be used to verify that the OpenCL operation works
$ cd tests/compositions
$ python alien-map.xml
$ python alien-map.xml --without-opencl
How to Benchmark Performance
  • create an xml file similar to the above in /tests/opencl
  • before running the shell script ensure that the perl module below is installed
$ cpan
cpan[1]> install "XML::Twig";
  • to run the benchmark script
$ cd tests/opencl
$ perl box-blur.xml no 1
$ perl box-blur.xml gpu 1
$ perl box-blur.xml cpu 1
  • note that 'gpu'/'cpu' denotes that OpenCL is enabled, while 'no' denotes that OpenCL is disabled
  • the number at the end denotes the number of iterations to run, after which the average time for the operation is returned