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

@@ -16,27 +16,31 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#include <glibmm/thread.h>
#include <glibmm/ustring.h>
#include "cieimage.h"
#include "dcp.h"
#include "imagefloat.h"
#include "labimage.h"
#include "rtengine.h"
#include "clutstore.h"
#include "color.h"
#include "colortemp.h"
#include "curves.h"
#include "dcp.h"
#include "guidedfilter.h"
#include "iccstore.h"
#include "imagefloat.h"
#include "imagesource.h"
#include "improcfun.h"
#include "curves.h"
#include "iccstore.h"
#include "clutstore.h"
#include "labimage.h"
#include "mytime.h"
#include "processingjob.h"
#include "procparams.h"
#include <glibmm/ustring.h>
#include <glibmm/thread.h>
#include "../rtgui/options.h"
#include "rawimagesource.h"
#include "rtengine.h"
#include "utils.h"
#include "../rtgui/multilangmgr.h"
#include "mytime.h"
#include "guidedfilter.h"
#include "color.h"
#include "../rtgui/options.h"
#undef THREAD_PRIORITY_NORMAL
@@ -924,21 +928,6 @@ private:
ipf.lab2rgb(labcbdl, *baseImg, params.icm.workingProfile);
}
/* //gamma TRC working
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 = baseImg->getWidth();
const int ch = baseImg->getHeight();
cmsHTRANSFORM dummyTransForm = nullptr;
// put gamma TRC to 1
ipf.workingtrc(baseImg, baseImg, cw, ch, -5, params.icm.workingProfile, 2.4, 12.92310, dummyTransForm, true, false, false);
//adjust TRC
ipf.workingtrc(baseImg, baseImg, cw, ch, 5, params.icm.workingProfile, params.icm.workingTRCGamma, params.icm.workingTRCSlope, dummyTransForm, false, true, false);
}
}
*/
// RGB processing
labView = new LabImage(fw, fh);
@@ -1371,6 +1360,7 @@ private:
ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy);
if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) {
ipf.EPDToneMap (labView, 0, 1);
}
@@ -1570,6 +1560,52 @@ private:
ipf.softLight(labView, params.softlight);
if (params.icm.workingTRC != ColorManagementParams::WorkingTrc::NONE) {
const int GW = labView->W;
const int GH = labView->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(labView);
}
const std::unique_ptr<Imagefloat> tmpImage1(new Imagefloat(GW, GH));
ipf.lab2rgb(*labView, *tmpImage1, params.icm.workingProfile);
const float gamtone = params.icm.workingTRCGamma;
const float slotone = params.icm.workingTRCSlope;
int illum = toUnderlying(params.icm.will);
const int prim = toUnderlying(params.icm.wprim);
Glib::ustring prof = params.icm.workingProfile;
cmsHTRANSFORM dummy = nullptr;
int ill = 0;
ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, -5, prof, 2.4, 12.92310, ill, 0, dummy, true, false, false);
ipf.workingtrc(tmpImage1.get(), tmpImage1.get(), GW, GH, 5, prof, gamtone, slotone, illum, prim, dummy, false, true, true);
ipf.rgb2lab(*tmpImage1, *labView, params.icm.workingProfile);
// labView and provis
if(provis) {
ipf.preserv(labView, 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++) {
labView->a[x][y] = 0.f;
labView->b[x][y] = 0.f;
}
}
}
//Colorappearance and tone-mapping associated
int f_w = 1, f_h = 1;