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
Read the document above for more information, or refer to the links below for the respective 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
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."),
NULL);
}
static gboolean
cl_process (GeglOperation *operation,
GeglBuffer *input,
GeglBuffer *output,
const GeglRectangle *result)
if (gegl_operation_use_opencl (operation))
if (cl_process (operation, input, output, result))
return TRUE;
#include "opencl/gegl-cl.h"
#include "buffer/gegl-buffer-cl-iterator.h"
#include "opencl/box-blur.cl.h"
<?xml version='1.0' encoding='UTF-8'?>
<gegl>
<node operation='gegl:box-blur'>
<params>
<param name='radius'>25</param>
</params>
</node>
<node operation='gegl:load'>
<params>
<param name='path'>../compositions/data/car-stack.png</param>
</params>
</node>
</gegl>
$ gegl box-blur.xml -o test.jpg GEGL_USE_OPENCL=yes
$ gegl box-blur.xml -o test2.jpg GEGL_USE_OPENCL=no
$ gegl-imgcmp test2.jpg test.jpg
$ cd tests/compositions
$ python run-compositions.py alien-map.xml
$ python run-compositions.py alien-map.xml --without-opencl
$ cpan
cpan[1]> install "XML::Twig";
$ cd tests/opencl
$ perl benchmark.pl box-blur.xml no 1
$ perl benchmark.pl box-blur.xml gpu 1
$ perl benchmark.pl box-blur.xml cpu 1