Merge branch 'dev' into metadata-exiv2

- Rating (#5325) not yet implemented
This commit is contained in:
Flössie
2019-09-24 14:30:54 +02:00
539 changed files with 7707 additions and 5098 deletions

View File

@@ -14,7 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
* along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/
#include "improccoordinator.h"
#include "curves.h"
@@ -53,6 +53,7 @@ ImProcCoordinator::ImProcCoordinator() :
softProof(false),
gamutCheck(false),
sharpMask(false),
sharpMaskChanged(false),
scale(10),
highDetailPreprocessComputed(false),
highDetailRawComputed(false),
@@ -120,6 +121,8 @@ ImProcCoordinator::ImProcCoordinator() :
flatFieldAutoClipListener(nullptr),
bayerAutoContrastListener(nullptr),
xtransAutoContrastListener(nullptr),
pdSharpenAutoContrastListener(nullptr),
pdSharpenAutoRadiusListener(nullptr),
frameCountListener(nullptr),
imageTypeListener(nullptr),
actListener(nullptr),
@@ -277,6 +280,18 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw);
highDetailPreprocessComputed = highDetailNeeded;
// After preprocess, run film negative processing if enabled
if (
(todo & M_RAW)
&& (
imgsrc->getSensorType() == ST_BAYER
|| imgsrc->getSensorType() == ST_FUJI_XTRANS
)
&& params->filmNegative.enabled
) {
imgsrc->filmNegativeProcess(params->filmNegative);
}
}
/*
@@ -318,18 +333,35 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
}
bool autoContrast = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicAutoContrast : params->raw.xtranssensor.dualDemosaicAutoContrast;
double contrastThreshold = imgsrc->getSensorType() == ST_BAYER ? params->raw.bayersensor.dualDemosaicContrast : params->raw.xtranssensor.dualDemosaicContrast;
imgsrc->demosaic(rp, autoContrast, contrastThreshold); //enabled demosaic
imgsrc->demosaic(rp, autoContrast, contrastThreshold, params->pdsharpening.enabled);
if (imgsrc->getSensorType() == ST_BAYER && bayerAutoContrastListener && autoContrast) {
bayerAutoContrastListener->autoContrastChanged(autoContrast ? contrastThreshold : -1.0);
}
if (imgsrc->getSensorType() == ST_FUJI_XTRANS && xtransAutoContrastListener && autoContrast) {
bayerAutoContrastListener->autoContrastChanged(contrastThreshold);
} else if (imgsrc->getSensorType() == ST_FUJI_XTRANS && xtransAutoContrastListener && autoContrast) {
xtransAutoContrastListener->autoContrastChanged(autoContrast ? contrastThreshold : -1.0);
}
// if a demosaic happened we should also call getimage later, so we need to set the M_INIT flag
todo |= M_INIT;
todo |= (M_INIT | M_CSHARP);
}
if ((todo & (M_RAW | M_CSHARP)) && params->pdsharpening.enabled) {
double pdSharpencontrastThreshold = params->pdsharpening.contrast;
double pdSharpenRadius = params->pdsharpening.deconvradius;
imgsrc->captureSharpening(params->pdsharpening, sharpMask, pdSharpencontrastThreshold, pdSharpenRadius);
if (pdSharpenAutoContrastListener && params->pdsharpening.autoContrast) {
pdSharpenAutoContrastListener->autoContrastChanged(pdSharpencontrastThreshold);
}
if (pdSharpenAutoRadiusListener && params->pdsharpening.autoRadius) {
pdSharpenAutoRadiusListener->autoRadiusChanged(pdSharpenRadius);
}
}
if ((todo & M_RAW)
|| (!highDetailRawComputed && highDetailNeeded)
|| (params->toneCurve.hrenabled && params->toneCurve.method != "Color" && imgsrc->isRGBSourceModified())
|| (!params->toneCurve.hrenabled && params->toneCurve.method == "Color" && imgsrc->isRGBSourceModified())) {
if (highDetailNeeded) {
highDetailRawComputed = true;
} else {
@@ -1240,6 +1272,31 @@ void ImProcCoordinator::getSpotWB(int x, int y, int rect, double& temp, double&
}
}
bool ImProcCoordinator::getFilmNegativeExponents(int xA, int yA, int xB, int yB, std::array<float, 3>& newExps)
{
MyMutex::MyLock lock(mProcessing);
const auto xlate =
[this](int x, int y) -> Coord2D
{
const std::vector<Coord2D> points = {Coord2D(x, y)};
std::vector<Coord2D> red;
std::vector<Coord2D> green;
std::vector<Coord2D> blue;
ipf.transCoord(fw, fh, points, red, green, blue);
return green[0];
};
const int tr = getCoarseBitMask(params->coarse);
const Coord2D p1 = xlate(xA, yA);
const Coord2D p2 = xlate(xB, yB);
return imgsrc->getFilmNegativeExponents(p1, p2, tr, params->filmNegative, newExps);
}
void ImProcCoordinator::getAutoCrop(double ratio, int &x, int &y, int &w, int &h)
{
@@ -1297,9 +1354,16 @@ void ImProcCoordinator::getSoftProofing(bool &softProof, bool &gamutCheck)
gamutCheck = this->gamutCheck;
}
void ImProcCoordinator::setSharpMask (bool sharpMask)
ProcEvent ImProcCoordinator::setSharpMask (bool sharpMask)
{
this->sharpMask = sharpMask;
if (this->sharpMask != sharpMask) {
sharpMaskChanged = true;
this->sharpMask = sharpMask;
return params->pdsharpening.enabled ? rtengine::EvPdShrMaskToggled : rtengine::EvShrEnabled;
} else {
sharpMaskChanged = false;
return rtengine::EvShrEnabled;
}
}
void ImProcCoordinator::saveInputICCReference(const Glib::ustring& fname, bool apply_wb)
@@ -1467,13 +1531,13 @@ void ImProcCoordinator::process()
while (changeSinceLast) {
const bool panningRelatedChange =
params->toneCurve != nextParams->toneCurve
params->toneCurve.isPanningRelatedChange(nextParams->toneCurve)
|| params->labCurve != nextParams->labCurve
|| params->localContrast != nextParams->localContrast
|| params->rgbCurves != nextParams->rgbCurves
|| params->colorToning != nextParams->colorToning
|| params->vibrance != nextParams->vibrance
|| params->wb != nextParams->wb
|| params->wb.isPanningRelatedChange(nextParams->wb)
|| params->colorappearance != nextParams->colorappearance
|| params->epd != nextParams->epd
|| params->fattal != nextParams->fattal
@@ -1499,8 +1563,11 @@ void ImProcCoordinator::process()
|| params->retinex != nextParams->retinex
|| params->wavelet != nextParams->wavelet
|| params->dirpyrequalizer != nextParams->dirpyrequalizer
|| params->dehaze != nextParams->dehaze;
|| params->dehaze != nextParams->dehaze
|| params->pdsharpening != nextParams->pdsharpening
|| sharpMaskChanged;
sharpMaskChanged = false;
*params = *nextParams;
int change = changeSinceLast;
changeSinceLast = 0;