Custom TRC Tone response curve and Illuminant - change Histogram - RGB and Lab values - for output (screen, TIF, JPG..) (#5949)

* Change TRC in the process

* Improve GUI slope

* Add tooltip output profile

* Various change to enable and tooltip

* Chnage rtthumbnail

* Small change tooltip trc

* Another small change tooltip

* Improve GUI - change default TRC BT709 - change tooltip

* Other GUI improvment

* Small changes to BT709 values

* Various change to TRC - add illuminant working profile

* Change labels tooltip TRC illuminant

* Display wp in console if wp provided

* Change tooltip

* Change max wlope

* Init trc + illum + primaries

* Add black point compensation

* Change location abstract

* Fixed bug with rtthumbnail...

* Added tooltip

* Logscale for wslope

* Change tooltip abstract

* Change labels tooltips abstract profile

* Added 6 sliders custom primaries X and Y

* Change GUI custom primaries

* Use custom primaries abstract profiles

* Tooltip with primaries red green blue

* Fixed warning gtk

* Change one tooltip

* Change range custom primaries

* Change GUI default Primaries

* Change one tooltip

* Speedup for trc

* Rendering intent for abstract profile

* Hide intent abstract

* Preserve neutral tones

* Chnage settings preserves neutral tones

* Improve GUI

* Improvment to preserv

* Clean code - speedup TRC when illuminant and primaries default

* Change label

* Change bad default value Blux

* Add forgoten illuminant when selecting primaries

* clean code

* Change labels

* improve workingtrc for LA

* Change default primaries when select default

* Added others working profile to primaries

* Change labels and GUI

* Change tooltip

* CIExy diagram displaying the primaries (interactive) and the white point (#6207)

* Ciexy diagram

* Change to Ciexy graph

* Change graph and defaut coordonates

* Various changes to graph - params

* Disable setListener(ToolPanelListener)

* Add some graduation to graph

* Clean comment code graph

* Change radius 0

* Enable sensitive graph Ciexy

* update Ciexy graph with primaries

* Remove reset button graph

* Change labels and behavior

* First step third spot green

* Second step 3rd spot green

* First try 3 primaries graph Ciexy

* Fixed bad behavior in lab grid

* Fixed another bad behavior graph

* Clean and comment code

* Change default gamma

* More accurate graph Cie xy

* Added white point to Ciexy graph

* Added tooltip Cie xy diagram

* Improvment when illuminant change

* Refine diagram CIE xy - added WP 2000K

* White point D120 + tooltip

* Change label

* Change labels

* Change tooltips

* Improve diagram CIE xy with parabolic

* Other parabolic to improve Cie xy diagram

* Small change GUI

* Added Label CIE xy - change labels

* Change behavior when none - change labels

* Improve gUI and trys to fix LGTM alerts

* CIE xy change set sensitive

* Improve tooltip primaries sliders

* Adapt tooltip to new labels

* Fixed crash and some bad behavior

* First fix bad behavior with some primaries

* Second fixed bad behavior primaries

* Third fixed bad behavior primaries

* Change white point BestRGB

* Change order rgb in history msg Ciexy

* Change tooltip

* Change tooltip

* Improve GUI primaries

* Illuminant 1500K - display in console matrix XYZ-RGB

* Improve GUI illuminant

* Change a tooltip

* Somme changes to GUI and verbose

* Test code for wprim in read

* clean code for wprims

* further cleanups, not tested

* Some cleanups and bugfixes, #5949

* Simplify `std::unique_ptr<>` dereferencing

Also some minor cleanups.

* Some changes suggested by Floessie

* Others change suggested

* Others changes suggested by Floessie

* Forgotten change in procparams.cc

* Added black and white for use with the primaries channel mixer

* Small change behavior GUI - illuminant

* Change pragma omp in iplab2rgb

* Add enums and clean up

* Remove unused code icmpanel.cc

* Fix LGTM alert, #5949

Co-authored-by: Ingo Weyrich <heckflosse67@gmx.de>
Co-authored-by: Flössie <floessie.mail@gmail.com>
This commit is contained in:
Desmis
2021-05-16 06:18:25 +02:00
committed by GitHub
parent 7040aed540
commit 35abd92209
27 changed files with 2751 additions and 309 deletions

View File

@@ -19,9 +19,11 @@
*/
#include "cieimage.h"
#include "color.h"
#include "curves.h"
#include "dcp.h"
#include "dcrop.h"
#include "guidedfilter.h"
#include "image8.h"
#include "imagefloat.h"
#include "improccoordinator.h"
@@ -30,9 +32,9 @@
#include "procparams.h"
#include "refreshmap.h"
#include "rt_math.h"
#include "color.h"
#include "utils.h"
#include "../rtgui/editcallbacks.h"
#include "guidedfilter.h"
#pragma GCC diagnostic warning "-Wall"
#pragma GCC diagnostic warning "-Wextra"
@@ -278,7 +280,7 @@ void Crop::update(int todo)
crW = 250;
}
// if(settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int((tileWskip/2));}//adapted to scale of preview
// if (settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int((tileWskip/2));}//adapted to scale of preview
if (settings->leveldnv == 2) {
crW = int (tileWskip / 2);
}
@@ -402,7 +404,7 @@ void Crop::update(int todo)
crH = 250;
}
// if(settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int((tileWskip/2));}//adapted to scale of preview
// if (settings->leveldnv ==2) {crW=int(tileWskip/2);crH=int((tileWskip/2));}//adapted to scale of preview
if (settings->leveldnv == 2) {
crW = int (tileWskip / 2);
crH = int (tileHskip / 2);
@@ -607,7 +609,7 @@ void Crop::update(int todo)
//end evaluate noise
}
// if(params.dirpyrDenoise.Cmethod=="AUT" || params.dirpyrDenoise.Cmethod=="PON") {//reinit origCrop after Auto
// if (params.dirpyrDenoise.Cmethod=="AUT" || params.dirpyrDenoise.Cmethod=="PON") {//reinit origCrop after Auto
if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { //reinit origCrop after Auto
PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip);
parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw);
@@ -975,7 +977,7 @@ void Crop::update(int todo)
double hlcomprthresh = params.locallab.spots.at(sp).hlcomprthresh;
double shcompr = params.locallab.spots.at(sp).shcompr;
double br = params.locallab.spots.at(sp).lightness;
if(black < 0. && params.locallab.spots.at(sp).expMethod == "pde" ) {
if (black < 0. && params.locallab.spots.at(sp).expMethod == "pde" ) {
black *= 1.5;
}
@@ -1053,7 +1055,7 @@ void Crop::update(int todo)
parent->previewDeltaE, parent->locallColorMask, parent->locallColorMaskinv, parent->locallExpMask, parent->locallExpMaskinv, parent->locallSHMask, parent->locallSHMaskinv, parent->locallvibMask, parent->localllcMask, parent->locallsharMask, parent->locallcbMask, parent->locallretiMask, parent->locallsoftMask, parent->localltmMask, parent->locallblMask,
parent->localllogMask, parent->locall_Mask, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax,
meantme, stdtme, meanretie, stdretie);
if(parent->previewDeltaE || parent->locallColorMask == 5 || parent->locallvibMask == 4 || parent->locallExpMask == 5 || parent->locallSHMask == 4 || parent->localllcMask == 4 || parent->localltmMask == 4 || parent->localllogMask == 4 || parent->locallsoftMask == 6 || parent->localllcMask == 4) {
if (parent->previewDeltaE || parent->locallColorMask == 5 || parent->locallvibMask == 4 || parent->locallExpMask == 5 || parent->locallSHMask == 4 || parent->localllcMask == 4 || parent->localltmMask == 4 || parent->localllogMask == 4 || parent->locallsoftMask == 6 || parent->localllcMask == 4) {
params.blackwhite.enabled = false;
params.colorToning.enabled = false;
params.rgbCurves.enabled = false;
@@ -1137,20 +1139,6 @@ void Crop::update(int todo)
if (todo & M_RGBCURVE) {
Imagefloat *workingCrop = baseCrop;
/*
if (params.icm.workingTRC == "Custom") { //exec TRC IN free
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") {
const int cw = baseCrop->getWidth();
const int ch = baseCrop->getHeight();
workingCrop = new Imagefloat(cw, ch);
//first put gamma TRC to 1
parent->ipf.workingtrc(baseCrop, workingCrop, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310, parent->getCustomTransformIn(), true, false, true);
//adjust gamma TRC
parent->ipf.workingtrc(workingCrop, workingCrop, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, parent->getCustomTransformOut(), false, true, true);
}
}
*/
double rrm, ggm, bbm;
DCPProfileApplyState as;
DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as);
@@ -1228,7 +1216,7 @@ void Crop::update(int todo)
int minwin = min(labnCrop->W, labnCrop->H);
int maxlevelcrop = 10;
// if(cp.mul[9]!=0)maxlevelcrop=10;
// if (cp.mul[9]!=0)maxlevelcrop=10;
// adap maximum level wavelet to size of crop
if (minwin * skip < 1024) {
maxlevelcrop = 9; //sampling wavelet 512
@@ -1314,7 +1302,7 @@ void Crop::update(int todo)
bool proton = WaveParams.exptoning;
bool pronois = WaveParams.expnoise;
if(WaveParams.showmask) {
if (WaveParams.showmask) {
// WaveParams.showmask = false;
// WaveParams.expclari = true;
}
@@ -1441,7 +1429,7 @@ void Crop::update(int todo)
}
float indic = 1.f;
if(WaveParams.showmask){
if (WaveParams.showmask){
mL0 = mC0 = -1.f;
indic = -1.f;
mL = fabs(mL);
@@ -1476,6 +1464,50 @@ void Crop::update(int todo)
parent->ipf.softLight(labnCrop, params.softlight);
if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) {
const int GW = labnCrop->W;
const int GH = labnCrop->H;
std::unique_ptr<LabImage> provis;
const float pres = 0.01f * params.icm.preser;
if (pres > 0.f && params.icm.wprim != ColorManagementParams::Primaries::DEFAULT) {
provis.reset(new LabImage(GW, GH));
provis->CopyFrom(labnCrop);
}
const std::unique_ptr<Imagefloat> tmpImage1(new Imagefloat(GW, GH));
parent->ipf.lab2rgb(*labnCrop, *tmpImage1, params.icm.workingProfile);
const float gamtone = parent->params->icm.workingTRCGamma;
const float slotone = parent->params->icm.workingTRCSlope;
int illum = rtengine::toUnderlying(params.icm.will);
const int prim = rtengine::toUnderlying(params.icm.wprim);
Glib::ustring prof = params.icm.workingProfile;
cmsHTRANSFORM dummy = nullptr;
int ill = 0;
parent->ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false);
parent->ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, dummy, false, true, true);
parent->ipf.rgb2lab(*tmpImage1, *labnCrop, params.icm.workingProfile);
//labnCrop and provis
if (provis) {
parent->ipf.preserv(labnCrop, provis.get(), GW, GH);
}
if (params.icm.fbw) {
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int x = 0; x < GH; x++)
for (int y = 0; y < GW; y++) {
labnCrop->a[x][y] = 0.f;
labnCrop->b[x][y] = 0.f;
}
}
}
if (params.colorappearance.enabled) {
float fnum = parent->imgsrc->getMetaData()->getFNumber(); // F number
float fiso = parent->imgsrc->getMetaData()->getISOSpeed() ; // ISO
@@ -1519,6 +1551,8 @@ void Crop::update(int todo)
// all pipette buffer processing should be finished now
PipetteBuffer::setReady();
// Computing the preview image, i.e. converting from lab->Monitor color space (soft-proofing disabled) or lab->Output profile->Monitor color space (soft-proofing enabled)
parent->ipf.lab2monitorRgb(labnCrop, cropImg);