locallab: dedup dehaze code

This commit is contained in:
heckflosse
2019-04-08 14:44:02 +02:00
parent d2f7db7182
commit 7970afa400
7 changed files with 28 additions and 143 deletions

View File

@@ -6044,14 +6044,16 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
Imagefloat *tmpImage = nullptr;
if (lp.dehaze > 0) {
const float depthcombi = 0.3f * params->locallab.spots.at(sp).neigh + 0.15f * (500.f - params->locallab.spots.at(sp).vart);
DehazeParams dehazeParams;
dehazeParams.enabled = true;
dehazeParams.strength = 0.9f * lp.dehaze + 0.3f * lp.str;
dehazeParams.showDepthMap = false;
dehazeParams.depth = LIM(depthcombi, 0.f, 100.f);
tmpImage = new Imagefloat(bfw, bfh);
lab2rgb(*bufreti, *tmpImage, params->icm.workingProfile);
float deha = LIM01(float(0.9f * lp.dehaze + 0.3f * lp.str) / 100.f * 0.9f);
float depthcombi = 0.3f * params->locallab.spots.at(sp).neigh + 0.15f * (500.f - params->locallab.spots.at(sp).vart);
float depth = -LIM01(depthcombi / 100.f);
dehazeloc(tmpImage, deha, depth);
dehaze(tmpImage, dehazeParams);
rgb2lab(*tmpImage, *bufreti, params->icm.workingProfile);
delete tmpImage;
@@ -6096,14 +6098,16 @@ void ImProcFunctions::Lab_Local(int call, int sp, float** shbuffer, LabImage * o
bufreti = new LabImage(Wd, Hd);
if (lp.dehaze > 0) {
const float depthcombi = 0.3f * params->locallab.spots.at(sp).neigh + 0.15f * (500.f - params->locallab.spots.at(sp).vart);
DehazeParams dehazeParams;
dehazeParams.enabled = true;
dehazeParams.strength = 0.9f * lp.dehaze + 0.3f * lp.str;
dehazeParams.showDepthMap = false;
dehazeParams.depth = LIM(depthcombi, 0.f, 100.f);
tmpImage = new Imagefloat(Wd, Hd);
lab2rgb(*original, *tmpImage, params->icm.workingProfile);
float deha = LIM01(float(0.9f * lp.dehaze + 0.3f * lp.str) / 100.f * 0.9f);
float depthcombi = 0.3f * params->locallab.spots.at(sp).neigh + 0.15f * (500.f - params->locallab.spots.at(sp).vart);
float depth = -LIM01(depthcombi / 100.f);
dehazeloc(tmpImage, deha, depth);
dehaze(tmpImage, dehazeParams);
rgb2lab(*tmpImage, *bufreti, params->icm.workingProfile);
delete tmpImage;