moved softlight later in the pipeline
Gives a better result, more suitable to the final fine-tuning
This commit is contained in:
parent
18f812d96a
commit
fce2d61b0c
@ -1011,6 +1011,8 @@ void Crop::update(int todo)
|
||||
parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip);
|
||||
}
|
||||
|
||||
parent->ipf.softLight(labnCrop);
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
|
@ -782,6 +782,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
||||
|
||||
}
|
||||
|
||||
ipf.softLight(nprevl);
|
||||
|
||||
if (params.colorappearance.enabled) {
|
||||
//L histo and Chroma histo for ciecam
|
||||
|
@ -3186,7 +3186,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer
|
||||
}
|
||||
}
|
||||
|
||||
softLight(rtemp, gtemp, btemp, istart, jstart, tW, tH, TS);
|
||||
//softLight(rtemp, gtemp, btemp, istart, jstart, tW, tH, TS);
|
||||
|
||||
if (!blackwhite) {
|
||||
if (editImgFloat || editWhatever) {
|
||||
|
@ -343,7 +343,7 @@ public:
|
||||
void localContrast(LabImage *lab);
|
||||
void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread);
|
||||
void shadowsHighlights(LabImage *lab);
|
||||
void softLight(float *red, float *green, float *blue, int istart, int jstart, int tW, int tH, int TS);
|
||||
void softLight(LabImage *lab);
|
||||
|
||||
Image8* lab2rgb(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm, bool consider_histogram_settings = true);
|
||||
Imagefloat* lab2rgbOut(LabImage* lab, int cx, int cy, int cw, int ch, const procparams::ColorManagementParams &icm);
|
||||
|
@ -26,19 +26,12 @@
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
void ImProcFunctions::softLight(float *red, float *green, float *blue, int istart, int jstart, int tW, int tH, int TS)
|
||||
namespace {
|
||||
|
||||
inline float sl(float blend, float x)
|
||||
{
|
||||
if (!params->softlight.enabled || !params->softlight.strength) {
|
||||
return;
|
||||
}
|
||||
|
||||
const float blend = params->softlight.strength / 100.f;
|
||||
const float orig = 1.f - blend;
|
||||
|
||||
const auto apply =
|
||||
[=](float x) -> float
|
||||
{
|
||||
if (!OOG(x)) {
|
||||
const float orig = 1.f - blend;
|
||||
float v = Color::gamma_srgb(x) / MAXVALF;
|
||||
// Pegtop's formula from
|
||||
// https://en.wikipedia.org/wiki/Blend_modes#Soft_Light
|
||||
@ -48,26 +41,34 @@ void ImProcFunctions::softLight(float *red, float *green, float *blue, int istar
|
||||
x = blend * Color::igamma_srgb(v * MAXVALF) + orig * x;
|
||||
}
|
||||
return x;
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
void ImProcFunctions::softLight(LabImage *lab)
|
||||
{
|
||||
if (!params->softlight.enabled || !params->softlight.strength) {
|
||||
return;
|
||||
}
|
||||
|
||||
Imagefloat working(lab->W, lab->H);
|
||||
lab2rgb(*lab, working, params->icm.workingProfile);
|
||||
|
||||
const float blend = params->softlight.strength / 100.f;
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel if (multiThread)
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
{
|
||||
int ti = 0;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (int i = istart; i < tH; i++) {
|
||||
for (int j = jstart, tj = 0; j < tW; j++, tj++) {
|
||||
const int idx = ti * TS + tj;
|
||||
red[idx] = apply(red[idx]);
|
||||
green[idx] = apply(green[idx]);
|
||||
blue[idx] = apply(blue[idx]);
|
||||
}
|
||||
++ti;
|
||||
for (int y = 0; y < working.getHeight(); ++y) {
|
||||
for (int x = 0; x < working.getWidth(); ++x) {
|
||||
working.r(y, x) = sl(blend, working.r(y, x));
|
||||
working.g(y, x) = sl(blend, working.g(y, x));
|
||||
working.b(y, x) = sl(blend, working.b(y, x));
|
||||
}
|
||||
}
|
||||
|
||||
rgb2lab(working, *lab, params->icm.workingProfile);
|
||||
}
|
||||
|
||||
} // namespace rtengine
|
||||
|
@ -1368,6 +1368,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
|
||||
ipf.EPDToneMap (labView, 5, 6);
|
||||
}
|
||||
|
||||
ipf.softLight(labView);
|
||||
|
||||
if (params.colorappearance.enabled) {
|
||||
CurveFactory::curveLightBrightColor (
|
||||
params.colorappearance.curve,
|
||||
|
@ -1133,6 +1133,8 @@ private:
|
||||
|
||||
wavCLVCurve.Reset();
|
||||
|
||||
ipf.softLight(labView);
|
||||
|
||||
//Colorappearance and tone-mapping associated
|
||||
|
||||
int f_w = 1, f_h = 1;
|
||||
|
@ -28,8 +28,8 @@ using namespace rtengine::procparams;
|
||||
SoftLight::SoftLight(): FoldableToolPanel(this, "softlight", M("TP_SOFTLIGHT_LABEL"), false, true)
|
||||
{
|
||||
auto m = ProcEventMapper::getInstance();
|
||||
EvSoftLightEnabled = m->newEvent(RGBCURVE, "HISTORY_MSG_SOFTLIGHT_ENABLED");
|
||||
EvSoftLightStrength = m->newEvent(RGBCURVE, "HISTORY_MSG_SOFTLIGHT_STRENGTH");
|
||||
EvSoftLightEnabled = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_SOFTLIGHT_ENABLED");
|
||||
EvSoftLightStrength = m->newEvent(LUMINANCECURVE, "HISTORY_MSG_SOFTLIGHT_STRENGTH");
|
||||
|
||||
strength = Gtk::manage(new Adjuster(M("TP_SOFTLIGHT_STRENGTH"), 0., 100., 1., 30.));
|
||||
strength->setAdjusterListener(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user