merge with dev

This commit is contained in:
Desmis 2018-02-04 07:51:25 +01:00
commit 4b916e444f
15 changed files with 63 additions and 39 deletions

View File

@ -325,14 +325,22 @@ scale:disabled trough {
}
/* Better on/off state separation for text toggle buttons, e.g. auto-levels or histogram matching. */
button.text-button {
button.text-button.toggle {
background-image: linear-gradient(to bottom, rgba(100,100,100,.3), rgba(30,30,30,.3));
}
button.text-button:checked {
button.text-button.toggle:hover {
background-image: linear-gradient(to bottom, rgba(128,128,128,.3), rgba(64,64,64,.3));
}
button.text-button.toggle:checked {
background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4));
}
button.text-button.toggle:hover:checked {
background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3));
}
separator {
color: #363636;
margin: 5px;

View File

@ -507,10 +507,19 @@ GtkNotebook {
padding-right: 3px;
}
GtkButton.text-button {
/* Better on/off state separation for text toggle buttons, e.g. auto-levels or histogram matching. */
GtkToggleButton.button.text-button {
background-image: linear-gradient(to bottom, rgba(100,100,100,.3), rgba(30,30,30,.3));
}
GtkButton.text-button:checked {
GtkToggleButton.button.text-button:hover {
background-image: linear-gradient(to bottom, rgba(128,128,128,.3), rgba(64,64,64,.3));
}
GtkToggleButton.button.text-button:checked {
background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4));
}
GtkToggleButton.button.text-button:hover:checked {
background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3));
}

View File

@ -169,7 +169,7 @@ void mappingToCurve(const std::vector<int> &mapping, std::vector<double> &curve)
} // namespace
void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector<double> &outCurve)
{
BENCHFUN
@ -177,7 +177,18 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
std::cout << "performing histogram matching for " << getFileName() << " on the embedded thumbnail" << std::endl;
}
if (!histMatchingCache.empty()) {
const auto same_profile =
[](const ColorManagementParams &a, const ColorManagementParams &b) -> bool
{
return (a.input == b.input
&& a.toneCurve == b.toneCurve
&& a.applyLookTable == b.applyLookTable
&& a.applyBaselineExposureOffset == b.applyBaselineExposureOffset
&& a.applyHueSatMap == b.applyHueSatMap
&& a.dcpIlluminant == b.dcpIlluminant);
};
if (!histMatchingCache.empty() && same_profile(histMatchingParams, cp)) {
if (settings->verbose) {
std::cout << "tone curve found in cache" << std::endl;
}
@ -196,9 +207,12 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
}
ProcParams neutral;
neutral.icm = cp;
neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
neutral.icm.output = "sRGB";
neutral.icm.gamma = "default";
neutral.icm.freegamma = false;
std::unique_ptr<IImage8> source;
{
@ -211,6 +225,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
std::cout << "histogram matching: no thumbnail found, generating a neutral curve" << std::endl;
}
histMatchingCache = outCurve;
histMatchingParams = cp;
return;
}
skip = LIM(skip * fh / h, 6, 10); // adjust the skip factor -- the larger the thumbnail, the less we should skip to get a good match
@ -233,6 +248,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
std::cout << "histogram matching: raw decoding failed, generating a neutral curve" << std::endl;
}
histMatchingCache = outCurve;
histMatchingParams = cp;
return;
}
target.reset(thumb->processImage(neutral, sensor_type, fh / skip, TI_Nearest, getMetaData(), scale, false, true));
@ -304,6 +320,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
}
histMatchingCache = outCurve;
histMatchingParams = cp;
}
} // namespace rtengine

View File

@ -139,7 +139,7 @@ public:
}
// for RAW files, compute a tone curve using histogram matching on the embedded thumbnail
virtual void getAutoMatchedToneCurve(std::vector<double> &outCurve)
virtual void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector<double> &outCurve)
{
outCurve = { 0.0 };
}

View File

@ -600,7 +600,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall)
}
if (params.toneCurve.histmatching) {
imgsrc->getAutoMatchedToneCurve(params.toneCurve.curve);
imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve);
if (params.toneCurve.autoexp) {
params.toneCurve.expcomp = 0.0;

View File

@ -5809,7 +5809,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW
float aprov1 = Chprov2 * sincosval.y;
float bprov1 = Chprov2 * sincosval.x;
float fy = (Color::c1By116 * Lprov1 ) + Color::c1By116;
float fy = (Color::c1By116 * Lprov1 ) + Color::c16By116;
float fx = (0.002f * aprov1) + fy;
float fz = fy - (0.005f * bprov1);

View File

@ -96,6 +96,7 @@ protected:
float psBlueBrightness[4];
std::vector<double> histMatchingCache;
ColorManagementParams histMatchingParams;
void hphd_vertical(float** hpmap, int col_from, int col_to);
void hphd_horizontal(float** hpmap, int row_from, int row_to);
@ -186,7 +187,7 @@ public:
}
void getAutoExpHistogram(LUTu & histogram, int& histcompr);
void getRAWHistogram(LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw);
void getAutoMatchedToneCurve(std::vector<double> &outCurve);
void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector<double> &outCurve);
DCPProfile *getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as);
void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb);

View File

@ -74,7 +74,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
0, // EvLDNEdgeTolerance: obsolete,
0, // EvCDNEnabled:obsolete,
0, // free entry
RGBCURVE, // EvDCPToneCurve,
RGBCURVE|M_AUTOEXP, // EvDCPToneCurve,
ALLNORAW, // EvDCPIlluminant,
RETINEX, // EvSHEnabled,
RGBCURVE, // EvSHHighlights,
@ -419,8 +419,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
DIRPYREQUALIZER, // EvWavgreenlow
DIRPYREQUALIZER, // EvWavbluelow
DIRPYREQUALIZER, // EvWavNeutral
RGBCURVE, // EvDCPApplyLookTable,
RGBCURVE, // EvDCPApplyBaselineExposureOffset,
RGBCURVE|M_AUTOEXP, // EvDCPApplyLookTable,
RGBCURVE|M_AUTOEXP, // EvDCPApplyBaselineExposureOffset,
ALLNORAW, // EvDCPApplyHueSatMap
DIRPYREQUALIZER, // EvWavenacont
DIRPYREQUALIZER, // EvWavenachrom

View File

@ -749,7 +749,7 @@ private:
}
if (params.toneCurve.histmatching) {
imgsrc->getAutoMatchedToneCurve(params.toneCurve.curve);
imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve);
if (params.toneCurve.autoexp) {
params.toneCurve.expcomp = 0.0;

View File

@ -2577,7 +2577,7 @@ void CropWindow::initialImageArrived ()
{
for (auto listener : listeners) {
listener->initialImageArrived (this);
listener->initialImageArrived();
}
}

View File

@ -40,7 +40,7 @@ public:
virtual void cropPositionChanged (CropWindow*) {}
virtual void cropWindowSizeChanged (CropWindow*) {}
virtual void cropZoomChanged (CropWindow*) {}
virtual void initialImageArrived (CropWindow*) {}
virtual void initialImageArrived () {}
};
class ImageArea;

View File

@ -1068,7 +1068,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
// since there was no resize event
if (iareapanel->imageArea->mainCropWindow) {
iareapanel->imageArea->mainCropWindow->cropHandler.newImage (ipc, false);
iareapanel->imageArea->mainCropWindow->initialImageArrived();
// In single tab mode, the image is not always updated between switches
// normal redraw don't work, so this is the hard way
@ -1082,6 +1081,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
}
history->resetSnapShotNumber();
navigator->setInvalid(ipc->getFullWidth(),ipc->getFullHeight());
}
void EditorPanel::close ()

View File

@ -25,7 +25,7 @@
#include "../rtengine/refreshmap.h"
#include "options.h"
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), firstOpen(true), fullImageWidth(0), fullImageHeight(0)
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), fullImageWidth(0), fullImageHeight(0)
{
infotext = "";
@ -633,33 +633,23 @@ void ImageArea::setZoom (double zoom)
zoomPanel->refreshZoomLabel ();
}
void ImageArea::initialImageArrived (CropWindow* cw)
void ImageArea::initialImageArrived ()
{
if (mainCropWindow) {
if(firstOpen || options.prevdemo != PD_Sidecar || (!options.rememberZoomAndPan) ) {
int w, h;
mainCropWindow->cropHandler.getFullImageSize(w, h);
if(options.prevdemo != PD_Sidecar || !options.rememberZoomAndPan || w != fullImageWidth || h != fullImageHeight) {
if (options.cropAutoFit || options.bgcolor != 0) {
mainCropWindow->zoomFitCrop();
} else {
mainCropWindow->zoomFit();
}
firstOpen = false;
mainCropWindow->cropHandler.getFullImageSize(fullImageWidth, fullImageHeight);
} else {
int w, h;
mainCropWindow->cropHandler.getFullImageSize(w, h);
if(w != fullImageWidth || h != fullImageHeight) {
if (options.cropAutoFit) {
mainCropWindow->zoomFitCrop();
} else {
mainCropWindow->zoomFit();
}
}
fullImageWidth = w;
fullImageHeight = h;
} else if ((options.cropAutoFit || options.bgcolor != 0) && mainCropWindow->cropHandler.cropParams.enabled) {
mainCropWindow->zoomFitCrop();
}
fullImageWidth = w;
fullImageHeight = h;
}
}

View File

@ -65,7 +65,6 @@ protected:
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const;
bool firstOpen;
int fullImageWidth, fullImageHeight;
public:
CropWindow* mainCropWindow;
@ -148,7 +147,7 @@ public:
void cropPositionChanged (CropWindow* cw);
void cropWindowSizeChanged (CropWindow* cw);
void cropZoomChanged (CropWindow* cw);
void initialImageArrived (CropWindow* cw) ;
void initialImageArrived ();
// LockablePickerToolListener interface
void switchPickerVisibility (bool isVisible);

View File

@ -46,7 +46,6 @@ protected:
Gtk::Label *lH, *lS, *lV;
Gtk::Label *lLAB_A, *lLAB_B, *lLAB_L;
void setInvalid (int fullWidth = -1, int fullHeight = -1);
public:
PreviewWindow* previewWindow;
@ -56,6 +55,7 @@ public:
// pointermotionlistener interface
// void pointerMoved (bool validPos, int x, int y, int r, int g, int b);
void pointerMoved (bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b);
void setInvalid (int fullWidth = -1, int fullHeight = -1);
void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB);
void getHSVText (float h, float s, float v, Glib::ustring &sH, Glib::ustring &sS, Glib::ustring &sV);