Difference between revisions of "Hacking:Porting filters to GEGL"

From GIMP Developer Wiki
Jump to: navigation, search
(Update file-raw GEGL port)
(File loaders/exporters)
Line 345: Line 345:
 
|-
 
|-
 
| file-cel ||  {{unknown| }} ||{{wip}} ||{{unknown|untested}}||
 
| file-cel ||  {{unknown| }} ||{{wip}} ||{{unknown|untested}}||
 +
|-
 +
| <strike>file-compressor</strike> ||  {{unknown| }} || {{unknown}} ||{{unknown| }} || No GEGL port needed
 
|-
 
|-
 
| file-csource ||  {{unknown| }} ||{{wip}} ||{{unknown|untested}}||
 
| file-csource ||  {{unknown| }} ||{{wip}} ||{{unknown|untested}}||

Revision as of 15:10, 1 September 2013

Last updated: 01.09.2013

How to port

GEGL part

This is the general process to write a new GEGL operation:

  1. Gather information.
    1. Read the plugin you want to port, understand the algorithm hidden in it.
    2. Read carefully the GEGL website. There is lot of information here.
    3. Read the Babl website and understand the difference between color models.
    4. You may want to find a similar existing operation and get inspiration from it.
  2. Choose a base class. This is the general structure of your operation, the number of input/output, what kind of optimization GEGL can do.
  3. Create a new file for your operation. No need to register it in some Makefile, the build system will build every C file present in the operations directory. The exact directory where you should put your file is explained in the GEGL website.
  4. Copy another operation with the same base class and clean it to have your operation skeleton. GEGL use a macro system called GEGL chant, that avoid you to write all the GObject boilerplate, and register easily parameters for your op. Look other operation to see how it works.
  5. Use the prepare function to indicate what color model your op will operate, for each input/output.
  6. Create your op's parameter using the chant system. You can have integer, floats, string, color, curve, enum ... There is some predefined enum in the GEGL core, for instance GeglSamplerType. You can register your own, like in the ripple op.
  7. Write your operation in the process function. Some tips here:
    1. GEGL store data in tile, so it impose some restriction, especially for transform op. You usually need to write your algorithm backward, ie iterate over the output, compute where the data come from, use a sampler to get it and affect the output.
    2. ROI mean region of interest, it's the area your are currently working on.
    3. Sometimes you need to know the size of the full input, not just the roi. You can have it using gegl_operation_source_get_bounding_box.
    4. Rather than carry a lot of parameter in you different functions, you can register a custom structure in the chant system, like the WarpPrivate structure in the warp op.
    5. When you fetch data outside of the input buffer (in it's abyss) you get by default zeroed memory. The abyss policy allow you to chose what you want here, and in particular, you can choose to clamp to the border, loop in the buffer extent ... It allows to write more clever algorithm. For instance, see the ripple op. Setting the abyss policy to GEGL_ABYSS_LOOP add the tileability to the op for free.
  8. Test your operation. You can use the gegl binary to run an xml file, or use the GEGL tool in GIMP.

GIMP part

Alternative 1: Use a GeglBuffer to work on. For instance see /plug-ins/common/file-aa.c.

Alternative 2: In your program create a GEGL graph and let call gegl_node_process on it. See the column 'GEGL operation' below to see what has already been done in GEGL. For instance see /plug-ins/common/file-gegl.c.

For more inspiration see the other files that are already ported.

Porting matrix

Legend

Neither ported nor tested
Already (some) development work is done, but without succeeding unit test.
Port finished, unit test succeeds

You can sort the following tables by clicking the little arrow symbol in the column headers. If that doesn't work out of the box, please activate Javascript for this page.

GIMP core (Layer modes, Transformation and Color Adjustment Tools)

The GIMP core is already migrated to GEGL. See Michael Natterers blogposting and an article at libgregraphicsworld.org.

Processing, color grading and effects

GIMP filter GEGL operation GEGL port Test result OpenCL version Test result Comment
Alien Map alien-map work in progress untested No untested
Align Visible Layers Doesn't need porting
Antialias antialias work in progress untested No untested
Apply Canvas No untested No untested
Apply Lens No untested No untested
Assign Color Profile No untested No untested
Autocrop Image work in progress untested No untested Done in core
Autocrop Layer work in progress untested No untested Done in core
Border Average work in progress untested No untested
Bump Map bump-map work in progress untested No untested
Cartoon cartoon work in progress untested No untested It doesn't honor GeglOperationAreaFilter's area, among other things.
Channel Mixer channel-mixer work in progress untested No untested
Checkerboard checker-board work in progress untested No untested Missing Psychobilly Option
CML Explorer No untested No untested
Color Enhance No untested No untested
Color Exchange No untested No untested
Color to Alpha color-to-alpha work in progress untested work in progress untested
Colorcube Analysis No untested No untested
Compose work in progress untested No untested Compatibility with 2.8 is currently not maintained : An image decomposed in 2.8 won't be recomposed correctly in 2.10. Also it's inconsistant with gimp's gamma policy. Nobody know who is right currently.
Convert to Color Profile No untested No untested
Convolution Matrix convolution-matrix No untested No untested
CSS stylesheet No untested No untested
Cubism cubism work in progress untested No untested
Curve Bend No untested No untested
Decompose work in progress untested No untested Inconsistant with gimp's gamma policy currently. Nobody know who is right currently. See also Compose
Deinterlace deinterlace work in progress untested No untested
Depth Merge No untested No untested
Despeckle No untested No untested
Destripe No untested No untested
Difference of Gaussians difference-of-gaussians work in progress untested No untested The port is missing Normalize and Invert options
Diffraction Patterns No untested No untested
Dilate No untested No untested
Displace No untested No untested
Drop Shadow dropshadow work in progress untested No untested The GEGL port doesn't seem to work in the Mac build.
Edge... No untested No untested
Emboss emboss work in progress untested No untested
Engrave No untested No untested
Erode No untested No untested
Filmstrip No untested No untested
Filterpack No untested No untested
Flame No untested No untested
Fractal Explorer fractal-explorer work in progress untested No untested
Fractal Trace fractal-trace work in progress untested No untested
From Webpage untested Doesn't need porting
Gaussian blur gaussian-blur work in progress untested work in progress untested Needs abyss policy. GIMP and GEGL parameters differ (Radius vs. Size, Algorithm RLE vs. FIR)
Gfig Doesn't need porting
GIMPressionist No untested No untested
Glass Tile No untested No untested
Gradient Flare No untested No untested
Gradient Map work in progress untested No untested
Grey grey No untested work in progress untested Similar to the Desaturation tool, but without its options
Grid grid work in progress untested No untested Missing intersection option, is it needed ?
Hot No untested No untested
HSV Noise noise-hsv work in progress untested No untested
Hurl noise-hurl work in progress untested No untested
IFS Fractal work in progress untested No untested
Illusion No untested No untested
Image Map No untested No untested Probably doesn't need porting
Invert invert-gamma No untested work in progress untested
iWarp To be replaced with Warp Transform tool
Java map No untested No untested Probably doesn't need porting
Jigsaw No untested No untested
Laplace edge-laplace work in progress untested No untested
Lens Distortion lens-distortion work in progress untested No untested
Lens Flare No untested No untested
Lighting Effects No untested No untested
Make Seamless tile-seamless work in progress untested No untested
Maximum RGB Will be removed without replacement
Maze No untested No untested
Mosaic No untested No untested
Motion Blur (circular) motion-blur-circular work in progress untested No untested
Motion Blur (linear) motion-blur-linear work in progress untested work in progress untested
Motion Blur (zoom) motion-blur-zoom work in progress untested No untested
Neon No untested No untested
Newsprint No untested No untested
NL Filter No untested No untested
Normalize No untested No untested
Oilify oilify work in progress untested work in progress untested
Optimize (Difference) No untested No untested
Optimize (for GIF) No untested No untested
Pagecurl No untested No untested
Palette Map work in progress untested No untested
Paper Tile No untested No untested
Photocopy photocopy work in progress untested No untested
Pick noise-pick work in progress untested No untested
Pixelize pixelize work in progress untested work in progress untested Needs abyss policy
Plasma plasma No untested No untested
Playback work in progress untested No untested
Polar Coordinates polar-coordinates work in progress untested No untested
Qbist No untested No untested
Recompose work in progress untested No untested See compose
Red Eye Removal red-eye-removal work in progress untested No untested
Retinex No untested No untested
RGB Noise noise-rgb work in progress untested No untested
Ripple ripple work in progress untested No untested Complete in abyss branch
Rotate Colors color-rotate No untested No untested
Sample Colorize No untested No untested
Selective Gaussian Blur No untested No untested
Shift shift work in progress untested No untested
Sinus No untested No untested
Slur noise-slur work in progress untested No untested
Smooth Palette No untested No untested
Sobel edge-sobel work in progress untested work in progress untested
Softglow softglow work in progress untested No untested It uses a different intensity function (Y' instead of (max(R', G', B') + min (R', G', B')) / 2). I suggest the new behaviour is better.
Solid Noise No untested No untested
Sparkle No untested No untested
Sphere Designer No untested No untested
Spread noise-spread work in progress untested No untested
Stretch Contrast stretch-contrast work in progress untested No untested Not sure we need that with GEGL being the core of GIMP
Stretch HSV No untested No untested
Supernova No untested No untested
Tile tile No untested No untested
Unoptimize No untested No untested
Unsharp Mask unsharp-mask work in progress untested No untested
Value Invert value-invert work in progress untested work in progress untested
Value Propagate No untested No untested
Van Gogh (LIC) No untested No untested The filter has nothing to do with van-Gogh-style art and has no obvious function. We should remove it.
Video No untested No untested
Waves waves work in progress untested No untested Missing reflective option that produce strange result, I suggest dropping that.
Whirl and Pinch whirl-pinch work in progress untested No untested
Wind wind work in progress untested No untested GEGL op parameters differ from GIMP filter.
Zealous Crop No untested No untested

Display filters

Display filter GEGL port Test result OpenCL version Test result Comment
Color deficient vision work in progress untested No untested
Color management work in progress untested No untested
Color proof work in progress untested No untested
Contrast work in progress untested No untested
Gamma work in progress untested No untested

File loaders/exporters

For porting to the GIO file access library see here.

GIMP filter GEGL operation GEGL port Test result Comment
file-aa work in progress untested
file-bmp work in progress untested
file-cel work in progress untested
file-compressor unknown No GEGL port needed
file-csource work in progress untested
file-desktop-link No GEGL port needed
file-dicom work in progress untested
file-exr-load exr-load work in progress untested
file-exr-save exr-save work in progress untested
file-faxg3 work in progress untested
file-fits work in progress untested
file-fli work in progress untested
file-gbr work in progress untested
file-gif-load work in progress untested
file-gif-save work in progress untested
file-gih work in progress untested
file-glob No GEGL port needed
file-header work in progress untested
file-html-table work in progress untested
file-ico work in progress untested
file-jp2-load jp2-load work in progress untested
file-jpeg jpg-load, jpg-save Yes OK
file-mng work in progress untested
file-pat work in progress untested
file-pcx work in progress untested
file-pdf-load No untested
file-pdf-save work in progress untested
file-pix work in progress untested
file-png png-load, png-save Yes OK
file-pnm ppm-load, ppm-save work in progress untested
file-ps work in progress work in progress
file-psd No untested
file-psp work in progress untested
file-raw raw-load work in progress untested GIMP uses generic GeglBuffer approach instead of gegl:raw-load
file-sgi work in progress untested
file-sunras No untested
file-svg svg-load No untested
file-tga work in progress untested
file-tiff-load work in progress Failing GIMP doesn't respect layer order of multi-layer TIFFs.
file-tiff-save work in progress Failing GIMP flattens multi-layer TIFFs.
file-wmf work in progress untested
file-xbm work in progress untested
file-xmc No untested
file-xpm work in progress untested
file-xwd work in progress untested

New File loaders/exporters

These file loaders/savers are implemented in GEGL, but may not be part of GIMP (yet). Currently they are listed here for completeness.

For porting to the GIO file access library see here.

GEGL filter GIMP filter Test result Comment
ff-load No untested FFmpeg video frame importer
ff-save No untested FFmpeg video frame output sink. GEGL op is work in progress.
npy-save No untested Numerical Python (NumPy) file saver.
rawbayer-load No untested RAWBAYER and RAWBAYERS format. GEGL op is work in progress
rgbe-load No untested for Radiance HDR format with extensions HDR and PIC
rgbe-save No untested for Radiance HDR format with extensions HDR and PIC
webp-load work in progress untested for WebP image format
webp-save work in progress untested for WebP image format

Port of new GEGL ops to OpenCL

GEGL operation OpenCL version Test result Comment
Bilateral filter Yes untested
Box blur Yes untested
Box max work in progress untested GEGL op is work in progress.
Box min work in progress untested GEGL op is work in progress.
Box percentile No untested GEGL op is work in progress.
Brightness and Contrast Yes untested
Buffer cache No untested GEGL op is work in progress. Does this need an OpenCL port?
C2g Yes untested HDR related
Cielch Noise No untested
Color No untested
Color Reduction No untested
Color Temperature Yes untested
Contrast Curve work in progress untested
Demosaic (bimedian) No untested GEGL op is work in progress.
Demosaic (simple) No untested GEGL op is work in progress.
Disc percentile No untested GEGL op is work in progress.
Display No untested Does this need an OpenCL port?
Ditto No untested GEGL op is work in progress. Test op - does this need an OpenCL port?
Dot No untested
Exp combine No untested HDR related
Exposure No untested HDR related
Fattal02 No untested HDR related
gluas No untested GEGL op is work in progress. Does this need an OpenCL port?
HStack No untested GEGL op is work in progress.
Image compare No untested
Introspect No untested Does this need an OpenCL port?
Kuwahara No untested GEGL op is work in progress.
Lens correction No untested GEGL op is work in progress.
Line profile No untested GEGL op is work in progress.
Linear gradient No untested GEGL op is work in progress.
Mandelbrot No untested GEGL op is work in progress.
Mantiuk06 No untested HDR related
Mirrors No untested
Mono mixer Yes untested
Noise No untested Perlin noise generator
Noise Reduction Yes untested
Over No untested Porter Duff operation over (d = cA + cB * (1 - aA))
Radial gradient No untested GEGL op is work in progress.
Reinhard05 Yes untested HDR related
Remap No untested
SNN (mean) Yes untested
SNN (percentile) No untested GEGL op is work in progress.
SVG Hue rotate No untested
SVG Luminance to Alpha No untested
SVG Matrix No untested
SVG Saturate No untested
Unpremul No untested GEGL op is work in progress.
Vignette Yes untested
Weighted Blend work in progress untested