Beep6581 / RawTherapee

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

Blue Artifacts with Shadows/Highlights and Tone Curve #5094

Open Lawrence37 opened 5 years ago

Lawrence37 commented 5 years ago

I compiled and tested release candidate 2 of version 5.5. When using the Shadows/Highlights tool in L*a*b* mode, there may be blue artifacts in shadow regions.

Steps to reproduce:

  1. Open amsterdam.pef.
  2. Activate the Shadows/Highlights tool.
  3. Set the color space to L*a*b*.
  4. Set the shadows to 100 (or any large number).
  5. In the tone curve, drag the black point about 8% to the right.

You can see the blue artifacts in the bottom-left of the photo. shadows_highlights_tone_curve

The effect is more dramatic using the RGB curves. Here, I've changed the black point in the red and green channels: shadows_highlights_rgb_curves

I tried all the tone curve modes and managed to reproduce the issue with the standard, weighted standard, and film-like modes. PP3s for the two screenshots are here: https://filebin.net/uwpn4u3mleqsuw0d

Version information:

Version: 5.5-rc2
Branch: 5.5-rc2
Commit: d4ba923ff
Commit date: 2018-12-11
Compiler: cc 7.3.0
Processor: x86_64
System: Linux
Bit depth: 64 bits
Gtkmm: V3.22.2
Lensfun: V0.3.2.0
Build type: release
Build flags:  -std=c++11 -march=native -Werror=unused-label -Wall -Wuninitialized -Wno-deprecated-declarations -Wno-unused-result -fopenmp -Werror=unknown-pragmas -O3 -DNDEBUG -ftree-vectorize
Link flags:  -march=native
OpenMP support: ON
MMAP support: ON

System information: Ubuntu 18.04 Intel i7-6500U (2.5 GHz) 12 GB RAM

gaaned92 commented 5 years ago

@Lawrence37 I don't really analyse your examples as showing bugs, only showing extreme adjustments that the sw permits you to apply.

heckflosse commented 5 years ago

This causes it: https://github.com/Beep6581/RawTherapee/blob/dev/rtengine/ipshadowshighlights.cc#L165

Beep6581 commented 5 years ago

I fully agree with @gaaned92 about the RGB curves case. As for the Exposure > Tone Curve 1 case, I don't know why some pixels suddenly decide to shine blue, but it's related to the working profile; sRGB doesn't exhibit it.

Lawrence37 commented 5 years ago

@gaaned92 Your explanation of the curves makes sense. I can only see the effect in areas that are mostly blue after the curve is applied. The intent of the RGB curves example was to artificially create pure, or close to pure, blue pixels. I know I was using extreme values for the shadow slider, but you can still see the problem for moderate values. The blue artifacts just fade away the closer you drag the slider to 0. I don't expect the S/H tool to recover the red and green, but I was surprised to see that, as @Beep6581 puts it, "some pixels suddenly decide to shine blue." @Beep6581 Unless I misunderstand how the working profile works, I think the sRGB profile clips the problematic blue pixels before the S/H tool touches them?