Comment code and some changes
This commit is contained in:
parent
c7891e8e32
commit
c596ffa429
@ -1127,7 +1127,7 @@ void Crop::update (int todo)
|
||||
params.locallab.lumaref = parent->lumarefs[sp];
|
||||
|
||||
|
||||
parent->ipf.Lab_Local (1, sp, (float**)shbuffer, labnCrop, labnCrop, trafx / skip, trafy / skip, cropx / skip, cropy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->fw, parent->fh, locutili, skip, locRETgainCurve, locallutili, lllocalcurve2,
|
||||
parent->ipf.Lab_Local (params.locallab, 1, sp, (float**)shbuffer, labnCrop, labnCrop, trafx / skip, trafy / skip, cropx / skip, cropy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->fw, parent->fh, locutili, skip, locRETgainCurve, locallutili, lllocalcurve2,
|
||||
loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref);
|
||||
lllocalcurve2.clear();
|
||||
cclocalcurve2.clear();
|
||||
@ -1467,7 +1467,7 @@ void Crop::update (int todo)
|
||||
params.locallab.hueref = (parent->huerefs[sp]) / 100.f;
|
||||
params.locallab.chromaref = parent->chromarefs[sp];
|
||||
params.locallab.lumaref = parent->lumarefs[sp];
|
||||
parent->ipf.Lab_Local (1, sp, (float**)shbuffer, labnCrop, labnCrop, trafx / skip, trafy / skip, cropx / skip, cropy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->fw, parent->fh, locutili, skip, locRETgainCurve, locallutili, lllocalcurve2, loclhCurve, lochhCurve,
|
||||
parent->ipf.Lab_Local (params.locallab, 1, sp, (float**)shbuffer, labnCrop, labnCrop, trafx / skip, trafy / skip, cropx / skip, cropy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->fw, parent->fh, locutili, skip, locRETgainCurve, locallutili, lllocalcurve2, loclhCurve, lochhCurve,
|
||||
LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref);
|
||||
|
||||
lllocalcurve2.clear();
|
||||
|
@ -879,9 +879,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
if (fic)
|
||||
|
||||
{
|
||||
//initilize newues when first utilisation of Locallab. Prepare creation of Mip files
|
||||
for (int sp = 1; sp < maxspot; sp++) { // spots default
|
||||
int t_sp = sp;
|
||||
int t_mipversion = 10012;//new value for tone mapping
|
||||
int t_mipversion = 10012;//new value for each change
|
||||
int t_circrad = 18;
|
||||
int t_locX = 250;
|
||||
int t_locY = 250;
|
||||
@ -1104,8 +1105,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
std::string inser;
|
||||
|
||||
dataspot = new int*[maxdata];//67
|
||||
//create data for mip files
|
||||
dataspot = new int*[maxdata];
|
||||
|
||||
//initilize data "0" with params
|
||||
for (int i = 0; i < maxdata; i++) {
|
||||
dataspot[i] = new int[maxspot];
|
||||
}
|
||||
@ -1122,7 +1125,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
{
|
||||
sps[0] = 0;
|
||||
dataspot[2][0] = circrads[0] = params.locallab.circrad;
|
||||
dataspot[2][0] = circrads[0] = params.locallab.circrad;//copy params in dataspot and in LUTi
|
||||
dataspot[3][0] = locx[0] = params.locallab.locX;
|
||||
dataspot[4][0] = locy[0] = params.locallab.locY;
|
||||
dataspot[5][0] = locyt[0] = params.locallab.locYT;
|
||||
@ -1286,10 +1289,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
dataspot[73][0] = cutpasts[0] = 1;
|
||||
}
|
||||
|
||||
// for all curves work around - I do not know how to do with params curves...
|
||||
//curve Reti local
|
||||
int siz = params.locallab.localTgaincurve.size();
|
||||
|
||||
if (siz > 69) {
|
||||
if (siz > 69) {//max due to codage with strcurv_data ()
|
||||
siz = 69; //to avoid crash
|
||||
}
|
||||
|
||||
@ -1333,7 +1337,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
//curve local C chrom
|
||||
int sizc = params.locallab.cccurve.size();
|
||||
|
||||
if (sizc > 69) {
|
||||
if (sizc > 69) {//max
|
||||
sizc = 69;//to avoid crash
|
||||
}
|
||||
|
||||
@ -1496,12 +1500,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
ifstream fich (datal, ios::in);
|
||||
|
||||
//read mip file
|
||||
if (fich) {//may be a file with versionmip = 10000
|
||||
//we must add new fields at the good place
|
||||
std::string line;
|
||||
std::string spotline;
|
||||
int cont = 0;
|
||||
int maxind = maxdata - 3 ; //70;//64
|
||||
int maxind = maxdata - 3 ; //
|
||||
|
||||
if (versionmip == 10000) {
|
||||
maxind = 49;
|
||||
@ -1628,7 +1633,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
fich.close();
|
||||
}
|
||||
|
||||
|
||||
//new filed for each update
|
||||
//new fields for TM
|
||||
if (versionmip == 10000) {
|
||||
for (int sp = 1; sp < maxspot; sp++) { // spots default
|
||||
@ -1733,18 +1738,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (versionmip == 10011) {
|
||||
|
||||
for (int sp = 1; sp < maxspot; sp++) { // spots default
|
||||
dataspot[70][sp] = 0;
|
||||
dataspot[71][sp] = 0;
|
||||
dataspot[72][sp] = 0;
|
||||
dataspot[73][sp] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// printf("ns=%i \n", ns);
|
||||
//here we change the number of spot
|
||||
|
||||
if (ns < (maxspot - 1)) {
|
||||
ofstream fic (datal, ios::out | ios::app); // ouverture en écriture avec effacement du fichier ouvert
|
||||
@ -2027,7 +2021,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
}
|
||||
|
||||
|
||||
//main algorithm for all spots
|
||||
for (int sp = 1; sp < maxspot; sp++) { //spots default
|
||||
params.locallab.hueref = dataspot[maxdata - 3][sp] / 100.;
|
||||
params.locallab.chromaref = dataspot[maxdata - 2][sp];
|
||||
@ -2239,7 +2233,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
s_datc = new int[70];
|
||||
int siz;
|
||||
|
||||
ipf.strcurv_data (retistr[sp], s_datc, siz);
|
||||
ipf.strcurv_data (retistr[sp], s_datc, siz);//convert data in int string with strcurv_data () - it is a work around !
|
||||
|
||||
sizeretics[sp] = siz;
|
||||
|
||||
@ -2455,7 +2449,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
dataspot[maxdata - 2][sp] = chromarefs[sp] = params.locallab.chromaref;
|
||||
dataspot[maxdata - 1][sp] = lumarefs[sp] = params.locallab.lumaref;
|
||||
//printf("sp=%i huerefsp=%f\n", sp, huerefs[sp]);
|
||||
ipf.Lab_Local (3, sp, (float**)shbuffer, nprevl, nprevl, 0, 0, 0, 0, pW, pH, fw, fh, locutili, scale, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve,
|
||||
ipf.Lab_Local (params.locallab, 3, sp, (float**)shbuffer, nprevl, nprevl, 0, 0, 0, 0, pW, pH, fw, fh, locutili, scale, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve,
|
||||
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref);
|
||||
lllocalcurve.clear();
|
||||
cclocalcurve.clear();
|
||||
@ -2467,9 +2461,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
|
||||
int sp ;
|
||||
sp = realspot;
|
||||
//now for current spot
|
||||
int maxreal = 1;
|
||||
|
||||
int maxreal = 1;//do nothing..in case of
|
||||
|
||||
//update GUI and Mip files
|
||||
if (aloListener && realspot != dataspot[16][0]) {
|
||||
//update GUI and MIP
|
||||
aloListener->localChanged (dataspot, retistr[sp], llstr[sp], lhstr[sp], ccstr[sp], hhstr[sp], skinstr[sp], pthstr[sp], exstr[sp], sp, maxreal);
|
||||
@ -2937,13 +2932,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
|
||||
params.locallab.chromaref = chromarefs[sp];
|
||||
params.locallab.lumaref = lumarefs[sp];
|
||||
|
||||
ipf.Lab_Local (3, sp, (float**)shbuffer, nprevl, nprevl, 0, 0, 0, 0, pW, pH, fw, fh, locutili, scale, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve,
|
||||
ipf.Lab_Local (params.locallab, 3, sp, (float**)shbuffer, nprevl, nprevl, 0, 0, 0, 0, pW, pH, fw, fh, locutili, scale, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve,
|
||||
localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref );
|
||||
lllocalcurve.clear();
|
||||
cclocalcurve.clear();
|
||||
sklocalcurve.clear();
|
||||
exlocalcurve.clear();
|
||||
|
||||
//write mip file in real time
|
||||
ofstream fou (datal, ios::out | ios::trunc);
|
||||
|
||||
if (fou)
|
||||
|
@ -55,6 +55,7 @@ using namespace procparams;
|
||||
|
||||
extern const Settings* settings;
|
||||
|
||||
|
||||
ImProcFunctions::~ImProcFunctions ()
|
||||
{
|
||||
|
||||
|
@ -44,6 +44,13 @@ class ImProcFunctions
|
||||
{
|
||||
|
||||
|
||||
|
||||
bool lastcutpast;
|
||||
int lastcxbuf;
|
||||
int lastcybuf;
|
||||
int lastcount;
|
||||
LabImage *spotbuffer;
|
||||
|
||||
cmsHTRANSFORM monitorTransform;
|
||||
cmsHTRANSFORM lab2outputTransform;
|
||||
cmsHTRANSFORM output2monitorTransform;
|
||||
@ -202,9 +209,12 @@ public:
|
||||
double lumimul[3];
|
||||
|
||||
ImProcFunctions (const ProcParams* iparams, bool imultiThread = true)
|
||||
: monitorTransform (nullptr), lab2outputTransform (nullptr), output2monitorTransform (nullptr), params (iparams), scale (1), multiThread (imultiThread), lumimul{} {}
|
||||
: lastcutpast (false), lastcxbuf (0), lastcybuf (0), lastcount (0), spotbuffer (nullptr) , monitorTransform (nullptr), lab2outputTransform (nullptr), output2monitorTransform (nullptr), params (iparams), scale (1), multiThread (imultiThread), lumimul{} {}
|
||||
~ImProcFunctions ();
|
||||
bool needsLuminanceOnly() { return !(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient());}
|
||||
bool needsLuminanceOnly()
|
||||
{
|
||||
return ! (needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP() || needsLensfun()) && (needsVignetting() || needsPCVignetting() || needsGradient());
|
||||
}
|
||||
void setScale (double iscale);
|
||||
|
||||
bool needsTransform ();
|
||||
@ -283,7 +293,9 @@ public:
|
||||
//locallab
|
||||
void MSRLocal (float** luminance, float** templ, const float* const *originalLuminance, const int width, const int height, const LocallabParams &loc, const int skip, const LocretigainCurve &locRETgainCcurve, const int chrome, const int scall, const float krad, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax);
|
||||
void calc_ref (int call, int sp, float** shbuffer, LabImage* original, LabImage* transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, bool locutili, int sk, const LocretigainCurve & locRETgainCcurve, bool locallutili, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, LUTf & cclocalcurve, LUTf & sklocalcurve, double &huere, double &chromare, double &lumare);
|
||||
void Lab_Local (int call, int sp, float** shbuffer, LabImage* original, LabImage* transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, bool locutili, int sk, const LocretigainCurve & locRETgainCcurve, bool locallutili, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve,LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double &hueref, double &chromaref, double &lumaref);
|
||||
void copy_ref (int call, int sp, LabImage* spotbuffer, LabImage* original, LabImage* transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot);
|
||||
void paste_ref (int call, int sp, LabImage* spotbuffer, LabImage* original, LabImage* transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot);
|
||||
void Lab_Local (LocallabParams &loc, int call, int sp, float** shbuffer, LabImage* original, LabImage* transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, bool locutili, int sk, const LocretigainCurve & locRETgainCcurve, bool locallutili, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double &hueref, double &chromaref, double &lumaref);
|
||||
void addGaNoise (LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk);
|
||||
void BlurNoise_Localold (int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
|
||||
void InverseBlurNoise_Local (const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
|
||||
|
@ -83,8 +83,10 @@ using namespace procparams;
|
||||
|
||||
extern const Settings* settings;
|
||||
|
||||
|
||||
struct local_params {
|
||||
float yc, xc;
|
||||
float ycbuf, xcbuf;
|
||||
float lx, ly;
|
||||
float lxL, lyT;
|
||||
float dxx, dyy;
|
||||
@ -128,6 +130,7 @@ struct local_params {
|
||||
bool denoiena;
|
||||
bool expvib;
|
||||
bool exposena;
|
||||
bool cut_past;
|
||||
float past;
|
||||
float satur;
|
||||
int blac;
|
||||
@ -156,6 +159,8 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str
|
||||
double local_yT = locallab.locYT / 2000.0;
|
||||
double local_center_x = locallab.centerX / 2000.0 + 0.5;
|
||||
double local_center_y = locallab.centerY / 2000.0 + 0.5;
|
||||
double local_center_xbuf = locallab.centerXbuf / 2000.0;
|
||||
double local_center_ybuf = locallab.centerYbuf / 2000.0;
|
||||
double local_dxx = locallab.proxi / 8000.0;//for proxi = 2==> # 1 pixel
|
||||
double local_dyy = locallab.proxi / 8000.0;
|
||||
float iterati = (float) locallab.proxi;
|
||||
@ -211,6 +216,7 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str
|
||||
bool inverse = locallab.invers;
|
||||
bool curvacti = locallab.curvactiv;
|
||||
bool acti = locallab.activlum;
|
||||
bool cupas = locallab.cutpast;
|
||||
|
||||
bool inverserad = locallab.inversrad;
|
||||
bool inverseret = locallab.inversret;
|
||||
@ -221,6 +227,9 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str
|
||||
lp.actsp = acti;
|
||||
lp.xc = w * local_center_x;
|
||||
lp.yc = h * local_center_y;
|
||||
lp.xcbuf = w * local_center_xbuf;
|
||||
lp.ycbuf = h * local_center_ybuf;
|
||||
lp.yc = h * local_center_y;
|
||||
lp.lx = w * local_x;
|
||||
lp.ly = h * local_y;
|
||||
lp.lxL = w * local_xL;
|
||||
@ -287,7 +296,7 @@ static void calcLocalParams (int oW, int oH, const LocallabParams& locallab, str
|
||||
lp.satur = chromaSatur;
|
||||
|
||||
lp.exposena = locallab.expexpose;
|
||||
|
||||
lp.cut_past = cupas;
|
||||
lp.blac = locallab.black;
|
||||
lp.shcomp = locallab.shcompr;
|
||||
lp.hlcomp = locallab.hlcompr;
|
||||
@ -4876,6 +4885,10 @@ void ImProcFunctions::calc_ref (int call, int sp, float** shbuffer, LabImage * o
|
||||
//O.88623 = sqrt(PI / 4) ==> sqare equal to circle
|
||||
|
||||
// very small region, don't use omp here
|
||||
// printf("cy=%i cx=%i yc=%f xc=%f circ=%i spot=%i tH=%i tW=%i sk=%i\n", cy, cx, lp.yc, lp.xc, lp.cir, spotSize, transformed->H, transformed->W, sk);
|
||||
// printf("ymin=%i ymax=%i\n", max (cy, (int) (lp.yc - spotSize)),min (transformed->H + cy, (int) (lp.yc + spotSize + 1)) );
|
||||
// printf("xmin=%i xmax=%i\n", max (cx, (int) (lp.xc - spotSize)),min (transformed->W + cx, (int) (lp.xc + spotSize + 1)) );
|
||||
|
||||
for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) {
|
||||
for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) {
|
||||
aveL += original->L[y - cy][x - cx];
|
||||
@ -4901,7 +4914,98 @@ void ImProcFunctions::calc_ref (int call, int sp, float** shbuffer, LabImage * o
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::Lab_Local (int call, int sp, float** shbuffer, LabImage * original, LabImage * transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, bool locutili, int sk,
|
||||
void ImProcFunctions::copy_ref (int call, int sp, LabImage * spotbuffer, LabImage * original, LabImage * transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, int sk, const struct local_params & lp, double & huerefspot, double & chromarefspot, double & lumarefspot)
|
||||
{
|
||||
if (params->locallab.enabled) {
|
||||
|
||||
// double precision for large summations
|
||||
double aveA = 0.;
|
||||
double aveB = 0.;
|
||||
double aveL = 0.;
|
||||
double aveChro = 0.;
|
||||
// int precision for the counters
|
||||
int nab = 0;
|
||||
// single precision for the result
|
||||
float avA, avB, avL;
|
||||
// int spotSize = 0.88623f * max (1, lp.cir / sk); //18
|
||||
int spotSize = max (1, lp.cir / sk);
|
||||
|
||||
//O.88623 = sqrt(PI / 4) ==> sqare equal to circle
|
||||
/*
|
||||
// very small region, don't use omp here
|
||||
printf ("COPYcy=%i cx=%i yc=%f xc=%f circ=%i spot=%i tH=%i tW=%i sk=%i\n", cy, cx, lp.yc, lp.xc, lp.cir, spotSize, transformed->H, transformed->W, sk);
|
||||
printf ("COPYymin=%i ymax=%i\n", max (cy, (int) (lp.yc - spotSize)), min (transformed->H + cy, (int) (lp.yc + spotSize + 1)) );
|
||||
printf ("COPYxmin=%i xmax=%i\n", max (cx, (int) (lp.xc - spotSize)), min (transformed->W + cx, (int) (lp.xc + spotSize + 1)) );
|
||||
*/
|
||||
for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) {
|
||||
for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) {
|
||||
|
||||
int yb = max (cy, (int) (lp.yc - spotSize));
|
||||
// int ye = min (transformed->H + cy, (int) (lp.yc + spotSize + 1));
|
||||
|
||||
int xb = max (cx, (int) (lp.xc - spotSize));
|
||||
// int xe = min (transformed->W + cx, (int) (lp.xc + spotSize + 1));
|
||||
|
||||
aveL += original->L[y - cy][x - cx];
|
||||
int z = y - yb;
|
||||
int u = x - xb;
|
||||
spotbuffer->L[z][u] = original->L[y - cy][x - cx];
|
||||
// printf("spBUFL=%f ", spotbuffer->L[z][u]);
|
||||
spotbuffer->a[z][u] = original->a[y - cy][x - cx];
|
||||
spotbuffer->b[z][u] = original->b[y - cy][x - cx];
|
||||
|
||||
aveA += original->a[y - cy][x - cx];
|
||||
aveB += original->b[y - cy][x - cx];
|
||||
aveChro += sqrtf (SQR (original->b[y - cy][x - cx]) + SQR (original->a[y - cy][x - cx]));
|
||||
|
||||
nab++;
|
||||
}
|
||||
}
|
||||
|
||||
aveL = aveL / nab;
|
||||
aveA = aveA / nab;
|
||||
aveB = aveB / nab;
|
||||
aveChro = aveChro / nab;
|
||||
aveChro /= 327.68f;
|
||||
avA = aveA / 327.68f;
|
||||
avB = aveB / 327.68f;
|
||||
avL = aveL / 327.68f;
|
||||
huerefspot = xatan2f (avB, avA); //mean hue
|
||||
chromarefspot = aveChro;
|
||||
lumarefspot = avL;
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::paste_ref (int call, int sp, LabImage * spotbuffer, LabImage * original, LabImage * transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, int sk, const struct local_params & lp, double & huerefspot, double & chromarefspot, double & lumarefspot)
|
||||
{
|
||||
if (params->locallab.enabled) {
|
||||
|
||||
int nab = 0;
|
||||
int spotSize = max (1, lp.cir / sk);
|
||||
|
||||
for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) {
|
||||
for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) {
|
||||
int yb = max (cy, (int) (lp.yc - spotSize));
|
||||
// int ye = min (transformed->H + cy, (int) (lp.yc + spotSize + 1));
|
||||
|
||||
int xb = max (cx, (int) (lp.xc - spotSize));
|
||||
// int xe = min (transformed->W + cx, (int) (lp.xc + spotSize + 1));
|
||||
|
||||
// aveL += original->L[y - cy][x - cx];
|
||||
int z = y - yb;
|
||||
int u = x - xb;
|
||||
// printf("z=%i u=%i spotbufferL=%f", z, u, spotbuffer->L[z][u]);
|
||||
transformed->L[y - cy][x - cx] = spotbuffer->L[z][u];
|
||||
transformed->a[y - cy][x - cx] = spotbuffer->a[z][u];
|
||||
transformed->b[y - cy][x - cx] = spotbuffer->b[z][u];
|
||||
nab++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ImProcFunctions::Lab_Local (LocallabParams &loc, int call, int sp, float** shbuffer, LabImage * original, LabImage * transformed, int sx, int sy, int cx, int cy, int oW, int oH, int fw, int fh, bool locutili, int sk,
|
||||
const LocretigainCurve & locRETgainCcurve, bool locallutili, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve,
|
||||
bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, double & hueref, double & chromaref, double & lumaref)
|
||||
{
|
||||
@ -5482,7 +5586,32 @@ void ImProcFunctions::Lab_Local (int call, int sp, float** shbuffer, LabImage *
|
||||
}
|
||||
|
||||
//local color and light
|
||||
|
||||
if (!lp.inv && (lp.chro != 0 || lp.ligh != 0.f || lp.qualcurvemet != 0) && lp.colorena) { // || lllocalcurve)) { //interior ellipse renforced lightness and chroma //locallutili
|
||||
// double huerefspot = 0., chromarefspot = 0., lumarefspot = 0.;
|
||||
// int spotSi = 1 + 2 * max (1, lp.cir / sk);
|
||||
/*
|
||||
if (!lastcutpast && loc.cutpast) {
|
||||
spotbuffer = new LabImage (spotSi, spotSi);//buffer for data in zone limit
|
||||
|
||||
|
||||
copy_ref (call, 1, spotbuffer, original, transformed, sx, sy, cx, cy, oW, oH, fw, fh, sk, lp, huerefspot, chromarefspot, lumarefspot);
|
||||
loc.centerXbuf = loc.centerX;
|
||||
loc.centerYbuf = loc.centerY;
|
||||
lastcutpast = true;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (lastcutpast && !loc.cutpast) {
|
||||
|
||||
paste_ref (call, 1, spotbuffer, original, transformed, sx, sy, cx, cy, oW, oH, fw, fh, sk, lp, huerefspot, chromarefspot, lumarefspot);
|
||||
loc.centerXbuf = 0 ;
|
||||
loc.centerYbuf = 0 ;
|
||||
lastcutpast = false;
|
||||
delete spotbuffer;
|
||||
|
||||
}
|
||||
*/
|
||||
float hueplus = hueref + dhue;
|
||||
float huemoins = hueref - dhue;
|
||||
// float ddhue = 0.f;
|
||||
@ -5618,6 +5747,42 @@ void ImProcFunctions::Lab_Local (int call, int sp, float** shbuffer, LabImage *
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
printf("Pastbef \n");
|
||||
|
||||
if (lastcutpast && !loc.cutpast) {
|
||||
|
||||
printf("Past \n");
|
||||
int nab = 0;
|
||||
int spotSize = max (1, lp.cir / sk);
|
||||
|
||||
for (int y = max (cy, (int) (lp.yc - spotSize)); y < min (transformed->H + cy, (int) (lp.yc + spotSize + 1)); y++) {
|
||||
for (int x = max (cx, (int) (lp.xc - spotSize)); x < min (transformed->W + cx, (int) (lp.xc + spotSize + 1)); x++) {
|
||||
int yb = max (cy, (int) (lp.yc - spotSize));
|
||||
int ye = min (transformed->H + cy, (int) (lp.yc + spotSize + 1));
|
||||
int xb = max (cx, (int) (lp.xc - spotSize));
|
||||
int xe = min (transformed->W + cx, (int) (lp.xc + spotSize + 1));
|
||||
int z = y - yb;
|
||||
int u = x - xb;
|
||||
original->L[y - cy][x - cx] = spotbuffer->L[z][u];
|
||||
original->a[y - cy][x - cx] = spotbuffer->a[z][u];
|
||||
original->b[y - cy][x - cx] = spotbuffer->b[z][u];
|
||||
|
||||
nab++;
|
||||
}
|
||||
}
|
||||
|
||||
// loc.centerXbuf = 0 ;
|
||||
// loc.centerYbuf = 0 ;
|
||||
lastcutpast = false;
|
||||
|
||||
delete spotbuffer;
|
||||
}
|
||||
printf("PastAft \n");
|
||||
|
||||
|
||||
int spotSize = max (1, lp.cir / sk);
|
||||
*/
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for schedule(dynamic,16)
|
||||
@ -5627,12 +5792,15 @@ void ImProcFunctions::Lab_Local (int call, int sp, float** shbuffer, LabImage *
|
||||
for (int x = 0; x < transformed->W; x++) {
|
||||
int lox = cx + x;
|
||||
int loy = cy + y;
|
||||
// int yb = max (cy, (int) (lp.yc - spotSize));
|
||||
// int xb = max (cx, (int) (lp.xc - spotSize));
|
||||
// int z = y - yb;
|
||||
// int u = x - xb;
|
||||
|
||||
if (lox >= begx && lox < xEn && loy >= begy && loy < yEn) {
|
||||
bufcolorig->L[loy - begy][lox - begx] = original->L[y][x];//fill square buffer with datas
|
||||
bufcolorig->a[loy - begy][lox - begx] = original->a[y][x];//fill square buffer with datas
|
||||
bufcolorig->b[loy - begy][lox - begx] = original->b[y][x];//fill square buffer with datas
|
||||
|
||||
chprov = 0.f;
|
||||
chpro = 0.f;
|
||||
|
||||
@ -5705,7 +5873,6 @@ void ImProcFunctions::Lab_Local (int call, int sp, float** shbuffer, LabImage *
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ private:
|
||||
params.locallab.chromaref = chromare;
|
||||
params.locallab.lumaref = lumare;
|
||||
|
||||
ipf.Lab_Local (2, sp, (float**)shbuffer, labView, labView, 0, 0, 0, 0, fw, fh, fw, fh, locutili, 1, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve,
|
||||
ipf.Lab_Local (params.locallab, 2, sp, (float**)shbuffer, labView, labView, 0, 0, 0, 0, fw, fh, fw, fh, locutili, 1, locRETgainCurve, locallutili, lllocalcurve, loclhCurve, lochhCurve,
|
||||
LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref);
|
||||
lllocalcurve.clear();
|
||||
cclocalcurve.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user