babl primaries and TRC API breakthrough
A multi year stumbling block has been coming up with an API for expressing custom TRCs and RGB primaries for babl pixel-formats. Many hundreds of hours have been spent on the pre-coding stages of software development, discussing, planning and failing stages, trying to find an approach fitting in with the existing babl architecture without breaking existing code and architecture - one global set of primaries/TRC would not be enough to solve this for babl. The existing architecture of babl and GEGL has assumed code using babl or GEGL does its own color space conversions going to and from (unbounded) sRGB formats; being unbounded has made this less trouble than it would have been if babl or GEGL clipped colors to gamut.

To create a pre-multiplied/associated alpha pixel format with half-precision (16bit) floating point numbers (with the sRGB primaries and sRGB transfer response cruves) one used to do: babl_format("RaGaBaA half")

There now is a new function, babl_format_new_with_space (const char *format_str, const Babl *rgb_space), that can be used like this: babl_format_new_with_space ("RaGaBaA float", babl_space("ProPhoto"));

The resulting format can be used like any other babl format, doing conversions between in-memory buffers, thus being passed for construction with a GeglBuffer which uses babl for defining pixel formats and in API to read and write data.

One can also create such babl spaces from CIE xy primaries + whitepoint, from provided a RGBtoXYZ matrix as they exist in ICC profiles as well as const Babl *babl_space_from_icc (const char *icc, int icc_length, char **error); that retrieves this information from an in-memory matrix RGB ICC profile.

The API and implementation are works in progress, development is happening in git master nevertheless - since it consists only of API additions and minimal interference with inner mechanics of the existing mechanics of babl. Math is derived from Bruce Lindbloom's website and comparing numbers with Elle Stone's article sRGB color space to profile. Such fresh code is bound to have mistakes, but logic and constants will receive further attention towards correctness, performance and accuracy.

The first place GIMP is likely to experiment with making use of this, is for handling the conversion between the projection, the resulting buffer of an image, and display, but that wont happen or be enabled until the babl methods for making/choosing fast-paths that are accurate in babl also has made this fast.

In other news unrelated to the API breakthrough, a fresh GEGL-0.3.18 release has been made, see http://gegl.org/NEWS.html, in time for an anticipated GIMP-2.9.6 development release.