Update on LCH layer modes
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
1283800665.16584.9.camel@be... | 07 Oct 20:28 | |
Update on LCH layer modes | Rupert Weber | 07 Sep 13:00 |
Update on LCH layer modes | Rupert Weber | 11 Sep 19:51 |
Update on LCH layer modes | Rupert Weber | 12 Sep 11:37 |
Update on LCH layer modes | Rupert Weber | 13 Sep 00:04 |
Update on LCH layer modes | yahvuu | 13 Sep 13:05 |
Update on LCH layer modes | Rupert Weber | 13 Sep 15:28 |
Update on LCH layer modes | yahvuu | 14 Sep 21:23 |
Update on LCH layer modes | Rupert Weber | 15 Sep 17:45 |
Update on LCH layer modes | David Gowers (kampu) | 04 Oct 04:17 |
Update on LCH layer modes | Rupert Weber | 04 Oct 20:07 |
Update on LCH layer modes | David Gowers (kampu) | 05 Oct 01:20 |
Update on LCH layer modes | Rupert Weber | 05 Oct 01:53 |
4C850BED.30703@leguanease.org | 07 Oct 20:28 |
Update on LCH layer modes
On 09/06/2010 09:17 PM, Sven Neumann wrote:
I am not so happy about the choice of the term "obsolete". The old layer modes are not obsolete. I'd suggest to use the term "legacy" instead.
I'm ok with either.
The obsoleteness is what I tried to find out earlier. Right now GEGL
doesn't support the old HSV/HSL modes. Is it supposed to?
A reminder of Martin's suggestions:
> I think the names needs to suggest that new files should avoid using
> those layer modes.
>
> Other alternatives:
>
> "(compat.)"
> "(legacy)"
> "(obsolete)"
> "(broken")
> "(old)"
I'd consider legacy/obsolete/old defendable. 'old' is nice for its shortness, 'legacy' doesn't sound as negative. The old modes aren't broken (just different and maybe less useful) and 'compat.' is, well, somehow ugly.
But I'll let you guys bang each others' heads over that. ;)
Rupert
Update on LCH layer modes
About bablizing the layer modes: I spent a little time with babl and all
I can say right now is that it will definitely take a while to get that
done.
So far it's been like a set of Russian puppets, and I don't think I've
even reached the innermost yet.
I wouldn't dare to give an estimate, but given that there are so many
questions not even asked yet, let alone answered, I'm pretty sure that
it won't be in 2010.
Regards
Rupert
Update on LCH layer modes
Just discovered that the clipping in the new layer modes needs more work.
It's not a problem with colors that originated in sRGB, but the layer
modes can easily construct colors outside sRGB, or even
invisible/virtual colors.
The current behavior is different from floating point/GEGL implementation.
Especially when composing e.g. in Color mode onto a white layer, results differ. A red onto white will become yellow (which isn't necessarily worse than the red from floating point, as it seems to be closer to correct lightness -- but it's different.)
The problem is that I have to clip twice in integer mode: once from Lab to XYZ, then again from XYZ to RGB.
Widening the lab-to-xyz LUT solved the problem for red, but created strange color bandings for blue, so it probably leads to integer overflow somewhere.
In other words: I'll have to work on the lab-to-rgb conversions...
Rupert
Update on LCH layer modes
On 09/12/2010 11:37 AM, Rupert Weber wrote:
Just discovered that the clipping in the new layer modes needs more work.
Problem solved.
Not reposting the patch for now to keep the noise down, as I'm sure
there will be other small issues.
Rupert
Update on LCH layer modes
On 12.09.2010 11:37, Rupert Weber wrote:
Just discovered that the clipping in the new layer modes needs more work.
It's not a problem with colors that originated in sRGB, but the layer modes can easily construct colors outside sRGB, or even invisible/virtual colors.
The current behavior is different from floating point/GEGL implementation.Especially when composing e.g. in Color mode onto a white layer, results differ. A red onto white will become yellow (which isn't necessarily worse than the red from floating point, as it seems to be closer to correct lightness -- but it's different.)
btw, the red returned from the current GEGL implementation is too dark: the projection eventually converts to linear light "RGB u8" [1] and these values get fed directly to the screen, which in contrast expects gamma-corrected values -- that is, at least when color management is turned off.
By numbers: sRGB 1 0 0 red (color mode) over sRGB 1 1 1 white
gives LCH(ab) (D65): LCH 53.24 104.55 40 red LCH 100 0 % white
the result color is certainly out of gamut: LCH 100 104.55 40 super-bright red = RGB 3.11 0.45 0.21 linear light [2] = R'G'B' 1.64 0.70 0.50 gamma-encoded [2]
with the GEGL projection enabled, GIMP currently delivers (1.0 0.45 0.21) * 255 = 255 115 55
using proper gamma handling the result, truncated to sRGB, will be: (1.0 0.70 0.50) * 255 = 255 179 128
hopefully i'm not needlessly complicating things, yahvuu
[1] to quick'n'dirty test the gamma-correct conversion,
gegl/gimp-gegl-utils.c:61 can be modified to:
case 3:
return babl_format ("R'G'B' u8"); /* former ("RGB u8") */
case 4:
return babl_format ("R'G'B'A u8"); /* former ("RGBA u8") */
[2] babl clamps the results of LCH->RGB conversions to the [0 ..1] interval: extensions/CIE.c:1286
Update on LCH layer modes
On 09/13/2010 01:05 PM, yahvuu wrote:
btw, the red returned from the current GEGL implementation is too dark: the projection eventually converts to linear light "RGB u8" [1] and these values get fed directly to the screen, which in contrast expects gamma-corrected values -- that is, at least when color management is turned off. [...]
hopefully i'm not needlessly complicating things, yahvuu
The way I understand it is that GEGL intentionally uses the non-gamma-corrected pixels in order to render like the current modes. (As Øyvind had explained somewhere earlier on the list).
But for the LCH layer modes that is just wrong without being necessary, as there are no legacy LCH modes, and Lab/LCH is whole different thing from doing RGB arithmetic anyway.
I am proposing the attached tiny patch to correct that (Actually I believe someone else described that solution here on the list somewhere, but I maybe confusing it with Øyvind's post).
Handling other modes is an opp and thus completely invisible to me ;o)
There is a very interesting article about operations on non-linear RGB which I think I found linked on bugzilla: http://www.4p8.com/eric.brasseur/gamma.html
Rupert
Update on LCH layer modes
On 13.09.2010 15:28, Rupert Weber wrote:
On 09/13/2010 01:05 PM, yahvuu wrote:
btw, the red returned from the current GEGL implementation is too dark:
[..]
I am proposing the attached tiny patch to correct that
yep, that yields the desired RGB triple 255, 179, 128 for the example under discussion (i.e. blending red over white using 'color mode').
However, after reading some more code, i'm less than shure it does so for the right reasons. Same goes with my previous explanation of gamma mismatch...
For the record, the relevant thread is here: https://lists.xcf.berkeley.edu/lists/gimp-developer/2008-November/021182.html
regards, yahvuu
Update on LCH layer modes
On 09/14/2010 09:23 PM, yahvuu wrote:
yep, that yields the desired RGB triple 255, 179, 128 for the example under discussion (i.e. blending red over white using 'color mode').
However, after reading some more code, i'm less than shure it does so for the right reasons. Same goes with my previous explanation of gamma mismatch...
But if GIMP is feeding non-linear sRGB to GEGL, isn't that the right reason for GEGL to treat it as what it is?
The discussion in the link you sent seems to support that.
Of course, for all the RGB layer modes (i.e. everything but Hue/Sat/Color/Value) backwards compatibility makes it a different story.
Rupert
Update on LCH layer modes
On Thu, Sep 16, 2010 at 2:15 AM, Rupert Weber wrote:
On 09/14/2010 09:23 PM, yahvuu wrote:
yep, that yields the desired RGB triple 255, 179, 128 for the example under discussion (i.e. blending red over white using 'color mode').
However, after reading some more code, i'm less than shure it does so for the right reasons. Same goes with my previous explanation of gamma mismatch...
But if GIMP is feeding non-linear sRGB to GEGL, isn't that the right reason for GEGL to treat it as what it is?
The discussion in the link you sent seems to support that.
Of course, for all the RGB layer modes (i.e. everything but Hue/Sat/Color/Value) backwards compatibility makes it a different story.
Rupert
Hi, I have a bug report.
Saturation handling seems to effect brightness.
In Saturation or Color draw/layer modes, this shows up as repeated or
overlaid paint making the result distinctly brighter.
Try making a flat region of color #2a7e23, selecting Pencil tool,
choosing Color mode and a large brush, and painting #11e500 repeatedly
over the same area.
This is using the latest patch, and independant of whether the
0001-app-gegl-Let-GEGL-assume-sRGB-for-layer-modes.patch is applied.
In general, you can manifest this bug by picking a dark color,
making a region of it, and painting over with a HSV value-increased
version of same color.
Ideally, this would possibly change Hue or Chromaticity, but shouldn't
change Lightness significantly. Looking at the LCH color selector, L
rises ~2 points for each paint application in my example.
This mainly appears when applying a brighter color which has a significantly increased C value, but not always, IMO -- for example #4eda3c on #004500 (avg 3-4 L diff / application)
I'll happily test any further patches for this. IMO if this issue is fixed, then it should be ready for integration into git master.
Update on LCH layer modes
On 10/04/2010 04:17 AM, David Gowers (kampu) wrote:
Try making a flat region of color #2a7e23, selecting Pencil tool, choosing Color mode and a large brush, and painting #11e500 repeatedly over the same area.
[...]
In general, you can manifest this bug by picking a dark color, making a region of it, and painting over with a HSV value-increased version of same color.
Ideally, this would possibly change Hue or Chromaticity, but shouldn't change Lightness significantly. Looking at the LCH color selector, L rises ~2 points for each paint application in my example.
Unfortunately, that's not fixable but a result of the too small gamut of
the sRGB working space.
Combining the lightness of #2a7e23 with hue/saturation of #11e500
results in (linear) sRGB values which are negative for red and blue.
Clipping those to 0-255 yields the result you observed (the color
becomes lighter than it should be).
Whenever you observe this misbehavior, at least one of the resulting RGB components should be at 0 or 255 -- otherwise it really would be a bug.
The only fix is to use a larger working space, like scRGB.
Regards
Rupert
Update on LCH layer modes
On Tue, Oct 5, 2010 at 4:37 AM, Rupert Weber wrote:
On 10/04/2010 04:17 AM, David Gowers (kampu) wrote:
Try making a flat region of color #2a7e23, selecting Pencil tool, choosing Color mode and a large brush, and painting #11e500 repeatedly over the same area.
[...]
In general, you can manifest this bug by picking a dark color, making a region of it, and painting over with a HSV value-increased version of same color.
Ideally, this would possibly change Hue or Chromaticity, but shouldn't change Lightness significantly. Looking at the LCH color selector, L rises ~2 points for each paint application in my example.Unfortunately, that's not fixable but a result of the too small gamut of the sRGB working space.
Combining the lightness of #2a7e23 with hue/saturation of #11e500 results in (linear) sRGB values which are negative for red and blue. Clipping those to 0-255 yields the result you observed (the color becomes lighter than it should be).Whenever you observe this misbehavior, at least one of the resulting RGB components should be at 0 or 255 -- otherwise it really would be a bug.
Thanks for responding promptly, Rupert. In that case it really is a bug. Neither the input colors or output colors contain 255.
The output color series is: 008700 008d00 009300 009800 009d00 00a200 00a700 00ab00 00af00 00b300 00b600 ...
Update on LCH layer modes
On 10/05/2010 01:20 AM, David Gowers (kampu) wrote:
In that case it really is a bug. Neither the input colors or output colors contain 255.
The output color series is: 008700 008d00 009300 009800 009d00 00a200 00a700 00ab00 00af00 00b300 00b600 ...
But the outputs contain 0's. And that's not because they happened to come out to exactly 0, but actually they should be t found a way to get perfect round-trips without being much slower.
I currently have a floating point version which is at least 4 times slower. It gives perfect Lab roundtrips, and almost-perfect for LCH (off by one for 0.00006% of RGB values). It still needs quite a bit of work, but I am hoping to turn that into a viable babl candidate.
Regards
Rupert