replace type_rgb_16 by type_rgb_flt and change some settings

This commit is contained in:
Desmis
2018-04-30 17:41:04 +02:00
parent 3ebbbdf139
commit 2bfc41fd03
7 changed files with 35 additions and 37 deletions

View File

@@ -817,8 +817,7 @@ void Crop::update(int todo)
//first put gamma TRC to 1
int cw = baseCrop->getWidth();
int ch = baseCrop->getHeight();
Image16* readyImg0 = NULL;
// I used Image16 because Imagefloat does not work
Imagefloat* readyImg0 = NULL;
double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
int mul = -5;
@@ -838,7 +837,7 @@ void Crop::update(int todo)
delete readyImg0;
//adjust gamma TRC
Image16* readyImg = NULL;
Imagefloat* readyImg = NULL;
gga = params.icm.gamm, ssl = params.icm.slop;
mul = 5;
readyImg = parent->ipf.workingtrc(baseCrop, cw, ch, mul, params.icm.working, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);

View File

@@ -524,9 +524,9 @@ void Imagefloat::ExecCMSTransform(cmsHTRANSFORM hTransform)
float *p = pBuf.data, *pR = r(y), *pG = g(y), *pB = b(y);
for (int x = 0; x < width; x++) {
*(p++) = *(pR++);
*(p++) = *(pG++);
*(p++) = *(pB++);
*(p++) = *(pR++)/ 65535.f;
*(p++) = *(pG++)/ 65535.f;
*(p++) = *(pB++)/ 65535.f;
}
cmsDoTransform (hTransform, pBuf.data, pBuf.data, width);

View File

@@ -494,8 +494,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
int cw = oprevi->getWidth();
int ch = oprevi->getHeight();
// put gamma TRC to 1
Image16* readyImg0 = NULL;
// I used Image16 because Imagefloat does not work
Imagefloat* readyImg0 = NULL;
double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
int mul = -5;
double gga = 2.4, ssl = 12.92;
@@ -513,7 +512,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
delete readyImg0;
//adjust TRC
Image16* readyImg = NULL;
Imagefloat* readyImg = NULL;
gga = params.icm.gamm, ssl = params.icm.slop;
mul = 5;
readyImg = ipf.workingtrc(oprevi, cw, ch, mul, params.icm.working, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);

View File

@@ -352,7 +352,7 @@ public:
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, GammaValues *ga = nullptr);
// CieImage *ciec;
Image16* workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profi, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6);
Imagefloat* workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profi, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6);
bool transCoord(int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr);
bool transCoord(int W, int H, const std::vector<Coord2D> &src, std::vector<Coord2D> &red, std::vector<Coord2D> &green, std::vector<Coord2D> &blue, double ascaleDef = -1, const LensCorrection *pLCPMap = nullptr);

View File

@@ -427,8 +427,7 @@ Imagefloat* ImProcFunctions::lab2rgbOut(LabImage* lab, int cx, int cy, int cw, i
}
// I don't know why, but with Imagefloat process does not work...It is probably due to my bad skill !
Image16* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profi, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6)
Imagefloat* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mul, Glib::ustring profi, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6)
{
TMatrix wprof;
@@ -455,7 +454,7 @@ Image16* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mu
}
};
Image16* image = new Image16(cw, ch);
Imagefloat* image = new Imagefloat(cw, ch);
double pwr;
double ts;
@@ -565,14 +564,14 @@ Image16* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mu
p[4] = 0.0366;
p[5] = 0.0001;
} else {
/*
p[0] = 0.7347; //default primaries
p[0] = 0.7347; //default primaries always unused
p[1] = 0.2653;
p[2] = 0.1596;
p[3] = 0.8404;
p[4] = 0.0366;
p[5] = 0.0001;
*/
}
if (slpos == 0) {
@@ -623,9 +622,10 @@ Image16* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mu
float* rg = working->g(i);
float* rb = working->b(i);
short* xa = (short*)image->r(i);
short* ya = (short*)image->g(i);
short* za = (short*)image->b(i);
float* xa = (float*)image->r(i);
float* ya = (float*)image->g(i);
float* za = (float*)image->b(i);
for (int j = 0; j < cw; j++) {
float r1 = rr[j];
@@ -637,26 +637,27 @@ Image16* ImProcFunctions::workingtrc(Imagefloat* working, int cw, int ch, int mu
float y_ = toxyz[1][0] * r1 + toxyz[1][1] * g1 + toxyz[1][2] * b1;
float z_ = toxyz[2][0] * r1 + toxyz[2][1] * g1 + toxyz[2][2] * b1;
xa[j] = CLIP((int) round(x_)) ;
ya[j] = CLIP((int) round(y_));
za[j] = CLIP((int) round(z_));
xa[j] = ( x_) ;
ya[j] = ( y_);
za[j] = ( z_);
}
}
cmsUInt32Number flags = cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE;
cmsHPROFILE iprof = ICCStore::getInstance()->getXYZProfile();
lcmsMutex->lock();
cmsHTRANSFORM hTransform = cmsCreateTransform(iprof, TYPE_RGB_16, oprofdef, TYPE_RGB_16, params->icm.outputIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
// cmsHTRANSFORM hTransform = cmsCreateTransform(iprof, TYPE_RGB_FLT, oprofdef, TYPE_RGB_FLT, params->icm.outputIntent, flags);
lcmsMutex->lock();
cmsHPROFILE iprof = ICCStore::getInstance()->getXYZProfile();
// cmsHTRANSFORM hTransform = cmsCreateTransform(iprof, TYPE_RGB_16, oprofdef, TYPE_RGB_16, params->icm.outputIntent, cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE);
cmsHTRANSFORM hTransform = cmsCreateTransform(iprof, TYPE_RGB_FLT, oprofdef, TYPE_RGB_FLT, params->icm.outputIntent, flags);
lcmsMutex->unlock();
image->ExecCMSTransform(hTransform);
cmsDeleteTransform(hTransform);
image->normalizeFloatTo65535();
}

View File

@@ -892,8 +892,7 @@ private:
int cw = baseImg->getWidth();
int ch = baseImg->getHeight();
// put gamma TRC to 1
Image16* readyImg0 = NULL;
//Imagefloat does not work
Imagefloat* readyImg0 = NULL;
double ga0, ga1, ga2, ga3, ga4, ga5, ga6;
int mul = -5;
double gga = 2.4, ssl = 12.92;
@@ -911,7 +910,7 @@ private:
delete readyImg0;
//adjust TRC
Image16* readyImg = NULL;
Imagefloat* readyImg = NULL;
gga = params.icm.gamm, ssl = params.icm.slop;
mul = 5;
readyImg = ipf.workingtrc(baseImg, cw, ch, mul, params.icm.working, gga, ssl, ga0, ga1, ga2, ga3, ga4, ga5, ga6);

View File

@@ -205,8 +205,8 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha
Gtk::VBox * gammaVBox = Gtk::manage(new Gtk::VBox());
gammaVBox->set_spacing(2);
gamm = Gtk::manage(new Adjuster(M("TP_GAMMAWORK_GAMMA"), 0.40, 8.0, 0.001, 2.4));
slop = Gtk::manage(new Adjuster(M("TP_GAMMAWORK_SLOPE"), 0., 60., 0.01, 12.92));
gamm = Gtk::manage(new Adjuster(M("TP_GAMMAWORK_GAMMA"), 0.40, 10.0, 0.001, 2.4));
slop = Gtk::manage(new Adjuster(M("TP_GAMMAWORK_SLOPE"), 0., 80., 0.01, 12.92));
wVBox->pack_start(*gamm, Gtk::PACK_SHRINK);
gamm->show();