[Gimp-developer] Update on my Gimp color management coding efforts

I encountered a couple of stumbling blocks while working on Gimp color
management, so I decided to give my brain a rest and work on some
other projects. Sometimes enlightenment happens when you stop thinking
about a coding problem.

Regarding high bit depth color conversions, the stumbling block is
still the background conversions between the sRGB tone response curve
and and the linear gamma tone response curve - all those Babl
conversions I've mentioned before.

I was hoping that by removing all the deprecated functions the problem
with high bit depth color conversion being subverted by the background
TRC conversions would be resolved, but it wasn't. I am unsure how to
procede, although I have pinpointed exactly where in the Gimp code the
Babl functions are called (it's not in the lcms plugin code) and which
particular Babl functions are being called.

So I temporarily put the lcms.c plug-in high bit depth color
conversion code aside and started working on the code that is used to
convert from the image color space to the monitor color space.

In the existing "image color space to monitor color space" code, the
image RGB values are converted to 8 bits *before* the RGB values are
sent to the code that converts from the image color space to the
monitor profile. Which means the monitor display of linear gamma color
space images has severely posterized deep shadow detail (the image
itself isn't damaged, just the monitor display of the image).

In images that don't have much deep shadow detail, the damage isn't
visible. But in images that do have deep shadow detail, the damage is
obvious. I can post pictures if anyone is interested.

Shadows are not posterized, even in a linear gamma color space, if you
convert from the linear gamma color space to the display color space
at 16-bits or higher, and *then* convert from 16-bits to 8-bits to
send to the monitor. But you do get posterization if you convert from
linear gamma 16-bits to linear gamma 8-bits *before* converting to the
monitor display space.

In addition to the monitor display shadow posterization problem, newer
high end monitors are using 10- and 12-bit color depth, and I think
the Cairo developers are also working on the higher bit depth display
code. But at this point Gimp is hard-coded to hand 8-bit values to

I've been tracing the "image color space to monitor color space" code
execution path, looking for a place to intervene to give the
color-space-to-monitor-space lcms profile conversion 16-bit integer or
32-bit floating point values instead of 8-bit values. It turns out
that the relevant "image color space to monitor display space" code is
spread out over quite a few gimp, babl, and gegl c-code files, and
makes heavy use of Cairo-related functions.

I apologize for the long delay in posting an update. Alas, the only
enlightenment I have found during that long delay is that to make
further progress I will need help from someone well-versed in
Gimp/Babl/Gegl/Cairo code.

Kindest regards,
Elle Stone

Articles and tutorials on open source digital imaging and photography

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]