locallab: dedup softlight code

This commit is contained in:
heckflosse
2019-04-08 15:08:26 +02:00
parent 7970afa400
commit 7f3fdb8f6c
7 changed files with 15 additions and 41 deletions

View File

@@ -48,16 +48,16 @@ inline float sl(float blend, float x)
} // namespace
void ImProcFunctions::softLight(LabImage *lab)
void ImProcFunctions::softLight(LabImage *lab, const SoftLightParams &softLightParams)
{
if (!params->softlight.enabled || !params->softlight.strength) {
if (!softLightParams.enabled || !softLightParams.strength) {
return;
}
Imagefloat working(lab->W, lab->H);
lab2rgb(*lab, working, params->icm.workingProfile);
const float blend = params->softlight.strength / 100.f;
const float blend = softLightParams.strength / 100.f;
#ifdef _OPENMP
#pragma omp parallel for
@@ -73,30 +73,4 @@ void ImProcFunctions::softLight(LabImage *lab)
rgb2lab(working, *lab, params->icm.workingProfile);
}
void ImProcFunctions::softLightloc(LabImage *lab, LabImage *dst, float blend)
{
// if (!params->softlight.enabled || !params->softlight.strength) {
// return;
// }
Imagefloat working(lab->W, lab->H);
lab2rgb(*lab, working, params->icm.workingProfile);
// const float blend = stre / 100.f;
#ifdef _OPENMP
#pragma omp parallel for
#endif
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, *dst, params->icm.workingProfile);
}
} // namespace rtengine