Re: [Gimp-developer] Why the endless background conversions between linear and regular sRGB TRC?

Elle Stone (l elle stone gmail com) wrote:
> The purpose of the constant background converting back and forth
> between two tone curves, sRGB TRC and linear gamma, is not clear at
> all.

Well, it is not on purpose. It is basically a side-effect of trying to
port Gimp to the new infrastructure without e.g. changing the visual
output of e.g. layer modes, while avoiding changing the math (Or do it
in an incremental manner while keeping the results consistent).

> "In service of the noble goal" doesn't explain *why* the conversions
> are done over and over again instead of just once. I really, really,
> really want to know why those relentlessly repeating background
> conversions between sRGB TRC and linear gamma are happening.

Ok, for an example have a look at gimp/app/operations and grep the
string "R'G'B'".

As you can see, a lot of them are designed to work in a R'G'B' mode,
since this was the working assumption in our old 8 bit core. We need
as-identical-as-possible results and the easiest way to port them to
GEGL and adding support for the high-bit-depth modes is to let the
operations work in "R'G'B'A float" and port the math in the most
straightforward way possible.

Now every time some of these operations is involved, the GEGL core needs
to convert the "RGBA u16" data as stored in the image to "R'G'B'A float"
so that the operation can properly work in its expected working format.
And of course before the new data ends up in the pixel storage it needs
conversion back to "RGBA u16".

Of course this is not good and has a massive speed impact, ideally the
operation should be able to work on "RGBA u16" directly, but then the
math becomes nontrivial (we need compatible results). This is
optimization work that we have not even really started tackeling.

I fully expect to have other problems like this on all kinds of
different places and I don't know which of these point it actually is
you're hitting with your test cases.

With your "elimination" of the conversion in util.h you probably have
introduced visually different results for these kind of operations
(because e.g. the "addition" mode now adds up in a linear fashion, while
it earlier worked in Gamma mode). Of course it is debatable how certain
layer modes are supposed to work, but we also need to maintain some
backwards compatibility, so that old XCF files in a new Gimp look the
same as always.

> But I
> will stop asking. And maybe some kind soul will send a private email
> giving an explanation that I can understand.

Please not, keep it on the list. These things are tricky and they
deserve to be pulled into the open  :)

And don't stop asking.


              simon budig de    

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