If a custom TRC is set, it is applied after every edit, fixes #5023

This commit is contained in:
heckflosse
2018-11-24 13:01:18 +01:00
parent d5cd62cd14
commit ad7f47804b
2 changed files with 26 additions and 20 deletions

View File

@@ -808,56 +808,58 @@ void Crop::update(int todo)
}
if (todo & (M_AUTOEXP | M_RGBCURVE)) {
if (todo & M_RGBCURVE) {
Imagefloat *workingCrop = baseCrop;
if (params.icm.workingTRC == "Custom") { //exec TRC IN free
Glib::ustring profile;
profile = params.icm.workingProfile;
const Glib::ustring profile = params.icm.workingProfile;
if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") {
int cw = baseCrop->getWidth();
int ch = baseCrop->getHeight();
workingCrop = new Imagefloat(cw, ch);
baseCrop->copyData(workingCrop);
//first put gamma TRC to 1
int cw = baseCrop->getWidth();
int ch = baseCrop->getHeight();
Imagefloat* readyImg0 = parent->ipf.workingtrc(baseCrop, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310);
Imagefloat* readyImg0 = parent->ipf.workingtrc(workingCrop, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
for (int col = 0; col < cw; col++) {
baseCrop->r(row, col) = (float)readyImg0->r(row, col);
baseCrop->g(row, col) = (float)readyImg0->g(row, col);
baseCrop->b(row, col) = (float)readyImg0->b(row, col);
workingCrop->r(row, col) = (float)readyImg0->r(row, col);
workingCrop->g(row, col) = (float)readyImg0->g(row, col);
workingCrop->b(row, col) = (float)readyImg0->b(row, col);
}
}
delete readyImg0;
//adjust gamma TRC
Imagefloat* readyImg = parent->ipf.workingtrc(baseCrop, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope);
Imagefloat* readyImg = parent->ipf.workingtrc(workingCrop, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope);
#pragma omp parallel for
for (int row = 0; row < ch; row++) {
for (int col = 0; col < cw; col++) {
baseCrop->r(row, col) = (float)readyImg->r(row, col);
baseCrop->g(row, col) = (float)readyImg->g(row, col);
baseCrop->b(row, col) = (float)readyImg->b(row, col);
workingCrop->r(row, col) = (float)readyImg->r(row, col);
workingCrop->g(row, col) = (float)readyImg->g(row, col);
workingCrop->b(row, col) = (float)readyImg->b(row, col);
}
}
delete readyImg;
}
}
}
if (todo & M_RGBCURVE) {
double rrm, ggm, bbm;
DCPProfile::ApplyState as;
DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as);
LUTu histToneCurve;
parent->ipf.rgbProc (baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve,
parent->ipf.rgbProc (workingCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve,
params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, parent->colourToningSatLimit, parent->colourToningSatLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve, parent->cl2Toningcurve,
parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW, rrm, ggm, bbm,
parent->bwAutoR, parent->bwAutoG, parent->bwAutoB, dcpProf, as, histToneCurve);
if (workingCrop != baseCrop) {
delete workingCrop;
}
}
/*xref=000;yref=000;

View File

@@ -506,8 +506,12 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
if (todo & (M_AUTOEXP | M_RGBCURVE)) {
if (params.icm.workingTRC == "Custom") { //exec TRC IN free
Glib::ustring profile;
profile = params.icm.workingProfile;
if (oprevi == orig_prev) {
oprevi = new Imagefloat(pW, pH);
orig_prev->copyData(oprevi);
}
Glib::ustring profile = params.icm.workingProfile;
if (profile == "sRGB" || profile == "Adobe RGB" || profile == "ProPhoto" || profile == "WideGamut" || profile == "BruceRGB" || profile == "Beta RGB" || profile == "BestRGB" || profile == "Rec2020" || profile == "ACESp0" || profile == "ACESp1") {
int cw = oprevi->getWidth();