Tone Equalizer Pivot darkens image

Issue #253 resolved
Lawrence Lee created an issue

To reproduce,

  1. Enable Tone Equalizer
  2. Set Regularization to 0 (optional, but makes the effect more visible)
  3. Set Pivot to -4 or lower

The pivot itself is not the cause. In extreme luminances, the contributions of the five bands drops to zero. Changing the pivot shifts parts of the image into the extreme ranges and causes the darkening in those areas.

I’m porting the tone equalizer back to RawTherapee and would like some input on the fix for this issue so there will be consistency between ART and RT. These are the solutions I have considered so far:

  1. Add more Gaussian windows to the Blacks and Whites bands depending on the pivot. This is somewhat cumbersome and can significantly affect performance.
  2. Extend the Blacks and Whites bands with an approximation of infinite windows. The function I have in mind is efficient to compute and is a very close approximation. It’s not perfect, but looks unnoticeable in practice.
  3. Add a sufficient number of windows to the Blacks and Whites and clamp luminance values when calculating the adjustment. For good results, I think the clamping range should be at least -12 to +4 EV (to avoid affecting extreme luminances with Shadows, Midtones, and Highlights) and the bands should extend to -14 and +6 EV or beyond. This means adding an extra window to Whites, but two from Blacks can be removed. Judging from graphs of this method, it is comparable to the approximated infinite windows (or even better if the ranges are extended).

I made a model to visualize the log-space tone curves for the different approaches. The initial graph is the current implementation. You can adjust the values to see the effect of solutions 2 and 3.

Comments (6)

  1. agriggio repo owner


    Thanks for the detailed analysis! I need to better understand what is going on, and what exactly your solution #3 does, but at the moment it seems solution #2 is the way to go. I will play with the graphs and think a bit more about it, but so far it seems the most principled one.

  2. Lawrence Lee reporter

    Regarding 3, the basic idea is to clamp the values within a “safe” range, i.e. the luminance range under the control of the five bands. The min/max values should be sufficiently large enough so any clamped values will not be affected by any of the middle bands. The Whites and Blacks bands should then be large enough to put the clamped values in the safe range.

  3. agriggio repo owner

    Ah, I see now what you meant. Yes, that makes sense and it’s even simpler to implement. I’ll give it a try.

    Thanks again!

  4. Lawrence Lee reporter

    Looks good. There is still a slight shift down in the histogram/waveform, but it’s visibly undetectable.

  5. Log in to comment