Cbdl before b&w, fix ciecam02 issue and clean the code a bit
This commit is contained in:
parent
c2c93faa35
commit
a15fe1de3e
@ -714,71 +714,50 @@ void Crop::update (int todo)
|
|||||||
|
|
||||||
if ((todo & (M_TRANSFORM)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
if ((todo & (M_TRANSFORM)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
||||||
|
|
||||||
if( (!params.colorappearance.enabled )) {
|
TMatrix wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
||||||
TMatrix wprof, wiprof;
|
const float wp[3][3] = {
|
||||||
wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
{static_cast<float>(wprof[0][0]), static_cast<float>(wprof[0][1]), static_cast<float>(wprof[0][2])},
|
||||||
wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
{static_cast<float>(wprof[1][0]), static_cast<float>(wprof[1][1]), static_cast<float>(wprof[1][2])},
|
||||||
double wip[3][3] = {
|
{static_cast<float>(wprof[2][0]), static_cast<float>(wprof[2][1]), static_cast<float>(wprof[2][2])}
|
||||||
{wiprof[0][0], wiprof[0][1], wiprof[0][2]},
|
|
||||||
{wiprof[1][0], wiprof[1][1], wiprof[1][2]},
|
|
||||||
{wiprof[2][0], wiprof[2][1], wiprof[2][2]}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
double wp[3][3] = {
|
const int W = baseCrop->getWidth();
|
||||||
{wprof[0][0], wprof[0][1], wprof[0][2]},
|
const int H = baseCrop->getHeight();
|
||||||
{wprof[1][0], wprof[1][1], wprof[1][2]},
|
LabImage labcbdl(W, H);
|
||||||
{wprof[2][0], wprof[2][1], wprof[2][2]}
|
#ifdef _OPENMP
|
||||||
};
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
|
|
||||||
int W = baseCrop->getWidth();
|
|
||||||
int H = baseCrop->getHeight();
|
|
||||||
LabImage * labcbdl;
|
|
||||||
labcbdl = new LabImage(W, H);
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//convert RGB => Lab
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float r = baseCrop->r(i, j);
|
|
||||||
float g = baseCrop->g(i, j);
|
|
||||||
float b = baseCrop->b(i, j);
|
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
float L, aa, bb;
|
Color::rgbxyz(baseCrop->r(i, j), baseCrop->g(i, j), baseCrop->b(i, j), X, Y, Z, wp);
|
||||||
Color::rgbxyz(r, g, b, X, Y, Z, wp);
|
Color::XYZ2Lab(X, Y, Z, labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j]);
|
||||||
//convert Lab
|
|
||||||
Color::XYZ2Lab(X, Y, Z, L, aa, bb);
|
|
||||||
labcbdl->L[i][j] = L;
|
|
||||||
labcbdl->a[i][j] = aa;
|
|
||||||
labcbdl->b[i][j] = bb;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->ipf.dirpyrequalizer (labcbdl, skip, 0);
|
parent->ipf.dirpyrequalizer (&labcbdl, skip, 0);
|
||||||
|
|
||||||
|
TMatrix wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
||||||
|
const float wip[3][3] = {
|
||||||
|
{static_cast<float>(wiprof[0][0]), static_cast<float>(wiprof[0][1]), static_cast<float>(wiprof[0][2])},
|
||||||
|
{static_cast<float>(wiprof[1][0]), static_cast<float>(wiprof[1][1]), static_cast<float>(wiprof[1][2])},
|
||||||
|
{static_cast<float>(wiprof[2][0]), static_cast<float>(wiprof[2][1]), static_cast<float>(wiprof[2][2])}
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef _DEBUG
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//convert Lab => RGB
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float L = labcbdl->L[i][j];
|
float X, Y, Z;
|
||||||
float a = labcbdl->a[i][j];
|
Color::Lab2XYZ(labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j], X, Y, Z);
|
||||||
float b = labcbdl->b[i][j];
|
Color::xyz2rgb(X, Y, Z, baseCrop->r(i, j), baseCrop->g(i, j), baseCrop->b(i, j), wip);
|
||||||
float x1, y1, z1;
|
|
||||||
float R, G, B;
|
|
||||||
Color::Lab2XYZ(L, a, b, x1, y1, z1);
|
|
||||||
Color::xyz2rgb(x1, y1, z1, R, G, B, wip);
|
|
||||||
baseCrop->r(i, j) = R;
|
|
||||||
baseCrop->g(i, j) = G;
|
|
||||||
baseCrop->b(i, j) = B;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete labcbdl;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// blurmap for shadow & highlights
|
// blurmap for shadow & highlights
|
||||||
|
@ -388,76 +388,57 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
|||||||
ipf.transform (orig_prev, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, imgsrc->getMetaData()->getFocalLen(),
|
ipf.transform (orig_prev, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, imgsrc->getMetaData()->getFocalLen(),
|
||||||
imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), imgsrc->getRotateDegree(), false);
|
imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), imgsrc->getRotateDegree(), false);
|
||||||
|
|
||||||
readyphase++;
|
|
||||||
|
|
||||||
progress ("Preparing shadow/highlight map...", 100 * readyphase / numofphases);
|
|
||||||
|
|
||||||
if ((todo & (M_TRANSFORM)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
if ((todo & (M_TRANSFORM)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
||||||
if(((!params.colorappearance.enabled))) {
|
TMatrix wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
||||||
TMatrix wprof, wiprof;
|
const float wp[3][3] = {
|
||||||
wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
{static_cast<float>(wprof[0][0]), static_cast<float>(wprof[0][1]), static_cast<float>(wprof[0][2])},
|
||||||
wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
{static_cast<float>(wprof[1][0]), static_cast<float>(wprof[1][1]), static_cast<float>(wprof[1][2])},
|
||||||
double wip[3][3] = {
|
{static_cast<float>(wprof[2][0]), static_cast<float>(wprof[2][1]), static_cast<float>(wprof[2][2])}
|
||||||
{wiprof[0][0], wiprof[0][1], wiprof[0][2]},
|
|
||||||
{wiprof[1][0], wiprof[1][1], wiprof[1][2]},
|
|
||||||
{wiprof[2][0], wiprof[2][1], wiprof[2][2]}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
double wp[3][3] = {
|
const int W = oprevi->getWidth();
|
||||||
{wprof[0][0], wprof[0][1], wprof[0][2]},
|
const int H = oprevi->getHeight();
|
||||||
{wprof[1][0], wprof[1][1], wprof[1][2]},
|
LabImage labcbdl(W, H);
|
||||||
{wprof[2][0], wprof[2][1], wprof[2][2]}
|
#ifdef _OPENMP
|
||||||
};
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
|
|
||||||
int W = oprevi->getWidth();
|
|
||||||
int H = oprevi->getHeight();
|
|
||||||
LabImage * labcbdl;
|
|
||||||
labcbdl = new LabImage(W, H);
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//convert RGB => Lab
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float r = oprevi->r(i, j);
|
|
||||||
float g = oprevi->g(i, j);
|
|
||||||
float b = oprevi->b(i, j);
|
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
float L, aa, bb;
|
Color::rgbxyz(oprevi->r(i, j), oprevi->g(i, j), oprevi->b(i, j), X, Y, Z, wp);
|
||||||
Color::rgbxyz(r, g, b, X, Y, Z, wp);
|
Color::XYZ2Lab(X, Y, Z, labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j]);
|
||||||
//convert Lab
|
|
||||||
Color::XYZ2Lab(X, Y, Z, L, aa, bb);
|
|
||||||
labcbdl->L[i][j] = L;
|
|
||||||
labcbdl->a[i][j] = aa;
|
|
||||||
labcbdl->b[i][j] = bb;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ipf.dirpyrequalizer (labcbdl, scale, 0);
|
ipf.dirpyrequalizer (&labcbdl, scale, 0);
|
||||||
|
|
||||||
#ifndef _DEBUG
|
TMatrix wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
const float wip[3][3] = {
|
||||||
|
{static_cast<float>(wiprof[0][0]), static_cast<float>(wiprof[0][1]), static_cast<float>(wiprof[0][2])},
|
||||||
|
{static_cast<float>(wiprof[1][0]), static_cast<float>(wiprof[1][1]), static_cast<float>(wiprof[1][2])},
|
||||||
|
{static_cast<float>(wiprof[2][0]), static_cast<float>(wiprof[2][1]), static_cast<float>(wiprof[2][2])}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float L = labcbdl->L[i][j];
|
float X, Y, Z;
|
||||||
float a = labcbdl->a[i][j];
|
Color::Lab2XYZ(labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j], X, Y, Z);
|
||||||
float b = labcbdl->b[i][j];
|
Color::xyz2rgb(X, Y, Z, oprevi->r(i, j), oprevi->g(i, j), oprevi->b(i, j), wip);
|
||||||
float x1, y1, z1;
|
}
|
||||||
float R, G, B;
|
|
||||||
Color::Lab2XYZ(L, a, b, x1, y1, z1);
|
|
||||||
Color::xyz2rgb(x1, y1, z1, R, G, B, wip);
|
|
||||||
oprevi->r(i, j) = R;
|
|
||||||
oprevi->g(i, j) = G;
|
|
||||||
oprevi->b(i, j) = B;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete labcbdl;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
readyphase++;
|
||||||
|
progress ("Preparing shadow/highlight map...", 100 * readyphase / numofphases);
|
||||||
|
|
||||||
if ((todo & M_BLURMAP) && params.sh.enabled) {
|
if ((todo & M_BLURMAP) && params.sh.enabled) {
|
||||||
double radius = sqrt (double(pW * pW + pH * pH)) / 2.0;
|
double radius = sqrt (double(pW * pW + pH * pH)) / 2.0;
|
||||||
|
@ -6539,8 +6539,6 @@ void ImProcFunctions::badpixlab(LabImage* lab, double rad, int thr, int mode, fl
|
|||||||
|
|
||||||
void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale, int mode)
|
void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale, int mode)
|
||||||
{
|
{
|
||||||
printf("mode=%d\n", mode);
|
|
||||||
|
|
||||||
if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) {
|
if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) {
|
||||||
float b_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[0]) / 100.0f;
|
float b_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[0]) / 100.0f;
|
||||||
float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[1]) / 100.0f;
|
float t_l = static_cast<float>(params->dirpyrequalizer.hueskin.value[1]) / 100.0f;
|
||||||
|
@ -741,70 +741,50 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
|||||||
|
|
||||||
|
|
||||||
if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled) {
|
||||||
if(((!params.colorappearance.enabled))) {
|
TMatrix wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
||||||
TMatrix wprof, wiprof;
|
const float wp[3][3] = {
|
||||||
wprof = iccStore->workingSpaceMatrix( params.icm.working );
|
{static_cast<float>(wprof[0][0]), static_cast<float>(wprof[0][1]), static_cast<float>(wprof[0][2])},
|
||||||
wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
{static_cast<float>(wprof[1][0]), static_cast<float>(wprof[1][1]), static_cast<float>(wprof[1][2])},
|
||||||
double wip[3][3] = {
|
{static_cast<float>(wprof[2][0]), static_cast<float>(wprof[2][1]), static_cast<float>(wprof[2][2])}
|
||||||
{wiprof[0][0], wiprof[0][1], wiprof[0][2]},
|
|
||||||
{wiprof[1][0], wiprof[1][1], wiprof[1][2]},
|
|
||||||
{wiprof[2][0], wiprof[2][1], wiprof[2][2]}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
double wp[3][3] = {
|
const int W = baseImg->getWidth();
|
||||||
{wprof[0][0], wprof[0][1], wprof[0][2]},
|
const int H = baseImg->getHeight();
|
||||||
{wprof[1][0], wprof[1][1], wprof[1][2]},
|
LabImage labcbdl(W, H);
|
||||||
{wprof[2][0], wprof[2][1], wprof[2][2]}
|
|
||||||
};
|
|
||||||
|
|
||||||
int W = baseImg->getWidth();
|
#ifdef _OPENMP
|
||||||
int H = baseImg->getHeight();
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
LabImage * labcbdl;
|
|
||||||
labcbdl = new LabImage(W, H);
|
|
||||||
#ifndef _DEBUG
|
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float r = baseImg->r(i, j);
|
|
||||||
float g = baseImg->g(i, j);
|
|
||||||
float b = baseImg->b(i, j);
|
|
||||||
float X, Y, Z;
|
float X, Y, Z;
|
||||||
float L, aa, bb;
|
Color::rgbxyz(baseImg->r(i, j), baseImg->g(i, j), baseImg->b(i, j), X, Y, Z, wp);
|
||||||
Color::rgbxyz(r, g, b, X, Y, Z, wp);
|
|
||||||
//convert Lab
|
//convert Lab
|
||||||
Color::XYZ2Lab(X, Y, Z, L, aa, bb);
|
Color::XYZ2Lab(X, Y, Z, labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j]);
|
||||||
labcbdl->L[i][j] = L;
|
|
||||||
labcbdl->a[i][j] = aa;
|
|
||||||
labcbdl->b[i][j] = bb;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ipf.dirpyrequalizer (labcbdl, 1, 0);
|
ipf.dirpyrequalizer (&labcbdl, 1, 0);
|
||||||
|
|
||||||
#ifndef _DEBUG
|
TMatrix wiprof = iccStore->workingSpaceInverseMatrix( params.icm.working );
|
||||||
#pragma omp parallel for schedule(dynamic, 10)
|
const float wip[3][3] = {
|
||||||
|
{static_cast<float>(wiprof[0][0]), static_cast<float>(wiprof[0][1]), static_cast<float>(wiprof[0][2])},
|
||||||
|
{static_cast<float>(wiprof[1][0]), static_cast<float>(wiprof[1][1]), static_cast<float>(wiprof[1][2])},
|
||||||
|
{static_cast<float>(wiprof[2][0]), static_cast<float>(wiprof[2][1]), static_cast<float>(wiprof[2][2])}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
|
#pragma omp parallel for schedule(dynamic,16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i = 0; i < H; i++) {
|
for(int i = 0; i < H; i++) {
|
||||||
for(int j = 0; j < W; j++) {
|
for(int j = 0; j < W; j++) {
|
||||||
float L = labcbdl->L[i][j];
|
float X, Y, Z;
|
||||||
float a = labcbdl->a[i][j];
|
Color::Lab2XYZ(labcbdl.L[i][j], labcbdl.a[i][j], labcbdl.b[i][j], X, Y, Z);
|
||||||
float b = labcbdl->b[i][j];
|
Color::xyz2rgb(X, Y, Z, baseImg->r(i, j), baseImg->g(i, j), baseImg->b(i, j), wip);
|
||||||
float x1, y1, z1;
|
|
||||||
float R, G, B;
|
|
||||||
Color::Lab2XYZ(L, a, b, x1, y1, z1);
|
|
||||||
Color::xyz2rgb(x1, y1, z1, R, G, B, wip);
|
|
||||||
baseImg->r(i, j) = R;
|
|
||||||
baseImg->g(i, j) = G;
|
|
||||||
baseImg->b(i, j) = B;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete labcbdl;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update blurmap
|
// update blurmap
|
||||||
|
Loading…
x
Reference in New Issue
Block a user