Rawtherapee Working Profile TRC

Hi All,
in the topic about ART I asked to Alberto what was the ART working profile TRC and he replied ART has linear gamma as RT has.
On Rawpedia there’s a statement who says:

During this conversion, an internal gamma is set by RawTherapee that always is “gamma sRGB” i.e. “gamma=2.4 and slope=12.92”

From this I understand RT working profile has a not linear TRC…I miss something??

All the threatment in RT is in linear mode : TRC with gamma=1 slope = 0

But at the end, in such a way that the image is viewable, it’s applied a gamma sRGB (g=2.4 s=12.92)

But there are 2 exceptions:

  1. in “Color” / “Color management” /“Tone response curve” you can change gamma sRGB by a TRC with gamma and slope as you want. This thretament is apply at the beginning of RGB

  2. in “Local adjustements” / shadowsHighlight -Tone equalizer TRC
    If you choose “Tone equalizer TRC” you can change TRC with

  • gamma between 0.25 to 15
  • slope between 1 to 150
    This allows processing of underexposed images or others… (gamma = 1 or BT709)

To note the difference between simple gamma / slope and TRC : TRC take into account primaries

jacques

Hi Jacques,
thanks for the quick response, but I have to bother you again… I have this continuous doubtes about gamma :roll_eyes:

What end?? Working profile /Display profile conversion?

It’s in display profile conversion.

To continue, Color management is not an easy thing many parameters affect the result

  1. input profile - whose construction is complex. in most cases it’s good for Colorchecker 24 color, whose colors are close to srgb : what to think of the extrapolation that we do for a digital camera whose gamut is closer to prophoto ?

  2. white balance : should we use camera results or an automatic mode (see branch autowb). And what to say about multiple WB ?

  3. what about CAT02 or any other Chromatic adaptation when WB is different from D50 ?

  4. working profile : what about Prophoto, ACES…or sRGB

  5. what type of datas for internal calculation : linear or not

  6. what TRC in output to display

  7. what Output profile ?

  8. ???

For all these rubrics, there are as many answers as there are specialists :slight_smile:

Hi, excuse me again :sweat:
therefore the linear light captured by sensor, converted into bits is stored linearly into the RAW file which in turn is loaded linearly into RAM and after gamma coded by the profile conversion we have a viewable image on the monitor??

Our 2 answers got mixed up, but effectively in Rawtherapee, except if you use “TRC” in “Color management” all is linear…(its not exactly true, because the profile generator, for Input profile change the response, otherwise it would be useless)

It’s only at the end, that a TRC is applied

jacques

to add to what Jacques wrote, unless something has changed quite recently (but I doubt it), the srgb TRC mentioned above is applied only if you have no display profile set. otherwise, it’s the display profile that is used to show the image on screen (as it should), with whatever TRC comes with it.

Darktable is going through a revolution right now by switching to linear RGB mode instead of non-linear LAB. Do I understand correctly that RT was always linear? In my limited experience I could easily got halos in DT, but never in RT. They say the halos are result of working in non-linear space.

@agriggio is true…
But generaly the display profile is with something near of a TRC sRGB…

@tankist02
As far as I know…about 8 years, for RT always linear

jacques

Thank to All, hence in summary:

RT works in a linear mode from capture to working profile; It’s only the working/display profile conversion which set a gamma coding to our bits.

But… I’m confused when I tweak working profile TRC in color management module .

If I open my image without modifications; I go to tweak the WP TRC.

If I do not modify nothing I have

immagine

and when I tweak the TRC I have

immagine

which tell lme I have a gamma of 2.4

If I reduce gamma to 2.3

immagine

The image is pretty almost the same , only few darker

From the above I could to think the default working gamma is 2.4.

Do I misunderstand or what??

No all is correct :slight_smile:
When I designed this module, the question arose of what to represent to the user.
And the answer is not so easy to say.

The choice I made:
I started from the principle that the “normal” rendering was that of a TRC whose gamma and slope components : g=2.4 s=12.92
If your profile device display as this TRC, when you change "none to “custom” you may be able to see a small difference, due to the difference between the actual TRC and that displayed (and also due to multiple calculations)

Now, if you act on gamma and slope

  • if you reduce gamma image becomes black
  • if you put gamma = 1, you will have the image as it is processed internally
  • if you increase gamma, the highlights will be changed without affecting the shadows
  • if you increase slope, shadows will be changed without affecting the highlights

Try for example BT709 (standard for TV HD)
g = 2.22
s= 4.5
BT709 is an alternative to sRGB

If you try this “TRC” in “local adjustements” (or here in main) it’s a good way to process images (shadows, midtones, …)

To note : TRC is different from apply a gamma and slope, you take into account primaries (so the workspace, here working profile)

It’s incredible but still not clear to me this damned gamma :pensive:.
Let’s try to bring another way…

I’m in the world and see this scene.

immagine

I take a photo with my camera and that scene is stored in the memory card.
In realty what is stored in the memory card is an image which resemble to

immagine
because our eyes work as gamma coded and therefore the image is stored in the memory card is pull down more on shadows than on lights.

Up to here am I right?? I hope :slightly_smiling_face:

When I post process the image, what is loaded into ram is second images values converted to the working profile: if the working profile has a linear gamma the image is “the same”, if the working profile has a gamma as 2.4 the values are converted (coded by 2.4 gamma ) and the shadows are push up more then lights.

For now I stop here, because I don’t know if I’m right until here…:neutral_face:

The working profile as no gamma (of course by changing code we could)
But with this TRC we change the code at the beginng of “rgb” process

But your result is good

There is gamma + slope + primaries in:

  • output profile ex RT4_sRGB : gamma 2.4 s=12.92 with primaries sRGB
  • any other output profile
  • display profile : currently with g=2.4 s=12.92

But don’t worry…when you use sharpening do you think of the Fourier transform ? Or Debauchies when you use wavelets ? So try and adapt

Bingo!! I wouldn’t have bothered you if I I had read Rawpedia :cry::

Note that the working profile will only specify the red, green and blue primaries, gamma will not change as RawTherapee's processing pipeline is floating point with no gamma encoding (that is gamma = 1.0).

Could it be better put it not near the working profile choose ??

At the end of debayering and white balance ?? Before working profile conversion??

@dafrasaga

For the place in ‘rgb’ I chose to put it just before “exposure” after “auto-matched tone curved”

So many process in the pipeline are concerned as channel-mixer, L * a * b * process, etc.

For “local adjustements” it’s in the middle of the process “locallab” which is at the start of the L * a * b * process

In the real world, a shadow are perhaps has light values of 10 to 20, while a sunlit area has a light values of 1000-2000. We actually see the 10 steps between 10-20 as similar to the steps 1000, 1100, 1200, …1900, 2000. This menas in the bright area, many more steps are available than needed.
A camera sensor is linear. It records the light value, so to speak. This means you need a 12 or 14 bit value to store an image.
Computers used to be 8 bit - values from 0 to 255. ‘Gamma’ is a useful mapping that makes sure each step is just noticeable on screen and no steps are wasted coding differences that can never be noticed. (Actually gamma was useful for alalog TV - noise is a constant error in the signal, and by having a gamma, light and dark areas are evenly affected by noise. Without gamma the dark areas would be very noisy.

Now, calculating in linear space means calculations are done with ‘real light’. If a spot is in focus, a single pixel may have value 2000. If the spot is out of focus and evenly covers 4 pixels now, each pixel will have 500 as value. If sharpening is applied, it can recover the 2000 for the single pixel.

If the calculation is done in a non-linear space, the in focus value might have been 200. Now spread it over 4 pixels by defocusing the lens - and there are likely 4 pixels with value 100. Now do a mathematical blur, and there would be 4 pixels with value 50 (which would be too dark).
This means that calculations do not come out right.

Note that for displaying, the values in the calculation are transformed into screen values. If the image is in linear space, the gamma curve will be applied to display the image correctly on the monitor. Thus you have correct calculations and correct display.

If the image is non-linear, the calculations will be incorrect. The image will be correctly displayed of course, by sending it directly to the monitor.

Hi Everyone

Newbie here so please be gentle. I also have an open question related to the Working Profile TRC so I thought it was appropriate to reply to this topic. Please let me know if I should open a new topic.

So far, I’ve learnt that RT applies the display profile TRC (or a default TRC with g=2.4 and s=12.92 when no display profile is set) near the end of the processing toolchain. Nevertheless, the “processing pipeline is floating point with no gamma encoding (that is gamma = 1.0)” [taken from: https://rawpedia.rawtherapee.com/Color_Management]. A custom TRC, when set in the Working Profile, will override the display profile TRC (or the default sRGB TRC). In addition, the custom TRC is applied earlier in the processing pipeline so a linear workflow is no longer guaranteed (makes sense). Hopefully, I have understood the workflow correctly.

Now to my question. What impact does the custom TRC have on the Output Profile set in the Color Management module? I did the following experiment in RT 5.8:

(a) Load RAW(DNG) image with “neutral” processing profile -> Color Management (Input Profile: Camera Standard; Working Profile: ProPhoto, TRC: None); Output Profile: RTv4_sRGB) -> Export to JPEG (8-bit) -> view JPEG with Xviewer.
(b) Load same RAW(DNG) image with “neutral” processing profile -> Color Management (Input Profile: Camera Standard; Working Profile: ProPhoto, TRC: Custom(g=1, s=0)); Output Profile: RTv4_sRGB) -> Export to JPEG (8-bit) -> view JPEG with Xviewer.

The custom linear TRC (g=1, s=0) is the only difference between (a) and (b). Even so, the linear TRC effectively does nothing apart from overriding the default sRGB TRC normally applied at the end of the processing toolchain for the image preview. Therefore, I expected that image (b) displayed in the RT preview would be darker than (a) because the transfer function no longer matches the monitor’s gamma profile – and it was. On the other hand, I expected the exported JPEGs for (a) and (b) to be identical since I thought RT will use the gamma transfer function from the Output Profile (sRGB in both cases) to encode the images. But to my surprise, JPEG (b) was darker than JPEG (a) just like in the RT preview window.

What am I missing?

First-off, welcome to the forum!

Okay, you’re on the right track, but you’re working on an assumption that vexed me until I came to the following understanding: the TRC assigned to an image reflects the state of the “energy” expressed by the image. The TRC is really ‘metadata’ describing the image, not a thing that, by itself, transforms the image.

So, when you open the raw with the Camera Standard profile, you’re telling the software that the raw color and tone are described by the primaries and TRC contained in the Camera Standard DCP. Then, when the working profile is selected, the image is converted from Camera Standard color/tone to the working profile color and tone. After that, the image color and tone are described by the working profile. At the display end of the pipe, the working profile and tone are used to convert the image to the display color and tone.

I think this is where you’re tripped up. At the camera-to-working conversion, the input and output TRCs are both linear, so the image tone is not changed. And then, at the working-to-display conversion, the image goes in linear and comes out in the display profile tone. And, “None” as a working profile TRC is effectively the same as g=1.

Really, all this didn’t make sense to me until I came to understand that a color/tone profile should be thought of as metadata, not a transform operator. The transform happens when an input profile is used to change the data from that tone/color to the tone/color of the output profile.

Thank you so much for your answer. Your eloquent description corresponds with my initial understanding of the RT color management workflow. However, I’m still perplexed. Let me phrase my question in a different way. Why does setting a custom linear TRC (g=1, s=0) in the Working Profile change the preview image and the exported image compared to the default TRC None given that None effectively implies a linear TRC with g=1? I hope that exposing my own stupidity will benefit others who are also struggling with this (I hope complex) topic.

That’s a good question. Rawpedia seems to present conflicting information:

This:

http://rawpedia.rawtherapee.com/Color_Management_addon

From 1.3 rgb ==> RGB conversion - Working space “Working Profile”

"These working spaces are 8 of them (which sounds more than enough, or even too much…): sRGB, AdobeRGB, Prophoto, Widegamut, BruceRGB, BetaRGB, BestRGB, Rec2020. amongst these 8 profiles, 5 have a wide gamut: BetaRGB (origin B.Lindbllom), BestRGB, Rec2020, WideGamut and Prophoto.

During this conversion, an internal gamma is set by RawTherapee that always is “gamma sRGB” i.e. “gamma=2.4 and slope=12.92” (like Lightroom, see later on)"

Versus:

http://rawpedia.rawtherapee.com/Color_Management#Working_Profile:

“Note that the working profile will only specify the red, green and blue primaries, gamma will not change as RawTherapee’s processing pipeline is floating point with no gamma encoding (that is gamma = 1.0). Some tools (like curves and histograms) will still display with a gamma (usually sRGB gamma) which is hard-coded for the tool and stays the same regardless of working profile.”