Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.83k stars 321 forks source link

Implied shadow contrast for DNG and NOT for TIFF #2640

Open Beep6581 opened 9 years ago

Beep6581 commented 9 years ago

Originally reported on Google Code with ID 2657

I was recently asking about per-channel curves result difference compared to common
curve result.

Now another question. What is the reason for this bumped shadow contrast? Same curve
applied to TIF file gives different result.

This issue is not severe but it might affect me because I often underexpose heavily.

My actions:
1) write 0-65535 values to DNG file.
2) open in RT, select all neutral settings and gamma 1 input profile;
3) export;
4) change curve (move black point);
5) export;
6) write 0-65535 values to 16bit TIFF file.
7) open in RT, select all neutral settings and gamma 1 input profile (exactly same
as for DNG);
8) export;
9) change curve (move black point);
10) export;
11) visualize tonal shift between exports 3,5 and 8,10 which should look like the curve
in RAWTherapee dialog.

Reported by pinhuer on 2015-02-04 16:52:16


Beep6581 commented 9 years ago
Also: when I move black point to the right, the shadow contrast is reduced.

Reported by pinhuer on 2015-02-04 16:53:46


Beep6581 commented 9 years ago
I expirience this on 4.2.0. I believe that it is common behaviour for most versions.

It is the same in changeset a3a3cbc1a977.

This altering cannot be called "gamma" as a term of power function, it is something
different.

Reported by pinhuer on 2015-02-04 23:46:24

Beep6581 commented 9 years ago
It makes me think that data scale does not match curve scale in certain circumstances.

Reported by pinhuer on 2015-02-04 23:58:54

Beep6581 commented 9 years ago
>This altering cannot be called "gamma" as a term of power function, it is something
different.

Indeed, it is a matter of some gamma function, I changed my mind.

Reported by pinhuer on 2015-02-05 12:39:15

Beep6581 commented 9 years ago
This is an interesting find and I hope someone looks into it.
pinhuer how do you make those curve diagrams?

ps. "2) open in RT, select all neutral settings and gamma 1 input profile;"
At neutral settings, black=0 and shadow compression=50 but grayed-out. When you change
black so black!=0, shadow compression should be 50, not 0. Can you confirm?

Reported by entertheyoni on 2015-02-05 12:48:27

Beep6581 commented 9 years ago
>pinhuer how do you make those curve diagrams?

You will like it. Just open the PSD.

http://filebin.net/5a9ms7ge4d

>Can you confirm?

Yes, my .pp3 corresponds to that. You may check it yourself, I attached it.

Reported by pinhuer on 2015-02-05 15:31:07

Beep6581 commented 9 years ago
I am trying to dig the code right now but I am not able to find the data array which
corresponds to Custom Tone Curve 1. Could you point at it?

Reported by pinhuer on 2015-02-05 15:33:56

Beep6581 commented 9 years ago
pinhuer: Do you need a hint where the Custom Tone Curve 1 is applied or a hint where
its data is stored?

Ingo

Reported by heckflosse@i-weyrich.de on 2015-02-05 15:58:39

Beep6581 commented 9 years ago
pinhuer: q&a will be much faster if you join #rawtherapee on IRC

Reported by heckflosse@i-weyrich.de on 2015-02-05 16:03:21

Beep6581 commented 9 years ago
OK

Reported by pinhuer on 2015-02-05 16:05:10

Beep6581 commented 9 years ago
I found out that LUT data arrays are the same for TIF and DNG.

Must go deeper.

Reported by pinhuer on 2015-02-05 18:11:08

Beep6581 commented 9 years ago
For an illustration one should take a photo with deep shadows, let everything neutral
and set gamma 1 profile as input (however, camera-matched profile gives the same result),
export to TIF and then set same curve for both TIF and DNG file - just rise the black
point. The output will differ, most visibly in shadows.

Reported by pinhuer on 2015-02-05 18:36:05

Beep6581 commented 9 years ago
All 4 curve modes produce equally unequal result of DNG export compared to TIF export.

Reported by pinhuer on 2015-02-05 20:40:53

Beep6581 commented 9 years ago
Tone curve 1 and 2 yield same result.

Reported by pinhuer on 2015-02-05 20:44:01

Beep6581 commented 9 years ago
pinhuer, I can give you a hint in irc

Reported by heckflosse@i-weyrich.de on 2015-02-05 20:48:56

Beep6581 commented 9 years ago
Latest comment from heckflo was that there is inverse gamma in Improcfun.cc which linearises
the image data and that image data from rawimagesource and from stdimagesource have
different gamma (scale).

Custom tone curves were applied before iGamma and thus had different effect on TIFs
and DNGs.

Reported by pinhuer on 2015-02-06 16:18:37

Beep6581 commented 9 years ago
For non raw images the inverse gamma in rgbproc() is completely skipped.

Reported by heckflosse@i-weyrich.de on 2015-02-06 16:36:31

Beep6581 commented 9 years ago
Will it be tolerable to make current profiles for TIF files incompatible?

Or: is it critical to check for type of imagesource (raw vs std) and adjust behavior
accordingly?

Reported by pinhuer on 2015-04-03 14:49:08

Beep6581 commented 9 years ago
You can check the PP3 version tag and keep the old behavior for old PP3s, and new behavior
for new ones. I would suggest you first submit a patch with the new behavior and explain
why it's better, and then proceed to code support for the old behavior when using old
PP3s only if the team agrees that the new behavior is an improvement and is usable.

Reported by entertheyoni on 2015-04-03 21:54:24

Beep6581 commented 9 years ago
The plot is in that curves are currently linear for TIF files (and for RGB curves of
Bayer files) and gamma-scaled for Bayer files (because of the position of iGamma).

It makes sense to make tone and RGB curves to behave in the same way, it is expected
(by me at least).

Keeping old behaviour for old PP3s does not seem good to me - because there is no way
of escaping it and proceeding to new processing version.

I think that I will code the check for type of imagesource and set the curves scale
accordingly if the curves scale is not written to pp3 already.

Reported by pinhuer on 2015-04-03 22:10:38

Beep6581 commented 9 years ago
Some weeks ago you were working on curve modes - gamma-corrected X, Y, or both. The
details escape me. If you finish that patch, the user will have a combobox with a choice
of curve scaling, correct? If so, then that would help here: if the PP3 version is
old and the image is non-raw, set the curve scaling to linear when opening the image,
and gamma-corrected when raw. If the PP3 version is newer than foo, set the curve scaling
to whatever the new default will be. I think that would be clear to the user and be
backwards-compatible.

Reported by entertheyoni on 2015-04-03 22:39:31

Beep6581 commented 9 years ago
Pinhuer, to get used to backwards compatibility, search for ppVersion in procparams.cc
and also have a look at ppversion.h!

Ingo

Reported by heckflosse@i-weyrich.de on 2015-04-03 22:50:56

Beep6581 commented 9 years ago
>If you finish that patch, the user will have a combobox with a choice of curve scaling,
correct?

Yes.

>Pinhuer, to get used to backwards compatibility, search for ppVersion in procparams.cc
and also have a look at ppversion.h!

That is another way.

But: is version information included in partial profiles and in RTC files?

Reported by pinhuer on 2015-04-04 13:28:17

Beep6581 commented 9 years ago
Started by Pinhuer.

Reported by entertheyoni on 2015-04-04 18:38:19