* Added support for non-raw files to the film negative tool. The tool is now under the "Color" tab. Moved the entire filmneg code downstream, right after input profile conversion. Usage changes a bit: White Balance must be set to the _backlight_ color temperature. Added two more sliders to color-balance the picture after negative inversion. Legacy inversion method kept for compatibility with processing profiles saved by RT v5.7 or 5.8 (only if Film Negative was enabled). Should be removed in a future version. There is still an issue with DCP profiles that need the look table to be active to work properly. Using a simple matrix input profile (or just camera standard) is recommended for now. * The user can now choose to perform inversion before or after input colorspace conversion. Seamless backwards compatibility with previous processing profiles; upgrading from a previous version now gives an (almost) identical output as before. Generalised the concept of film base values: the processing profile now contains a pair of RGB triplets, "reference input" and "reference output", which makes it much more straightforward to compute the output multipliers. * Added support for `RGB` data type to putToKeyFile, removed the now unused `RGB::toVector()` method. Some cleanup. * Spot balance picker now stays active indefinitely. Can be disabled by right-clicking, too. * Removed film negative from `filterRawRefresh` condition, since the new version does not require raw rendering anymore. * The Output Level slider is now exponential, so it should feel more familiar to use (similar to the exposure compensation slider). * Removed old `RedBase`, `GreenBase`, `BlueBase` keys from the PP3 file after params upgrade. Keys are only kept if the file only undergoes batch edit (hence no params upgrade was done). * Made the balance sliders exponential and centered at zero. Now they should be a bit smoother and possibly more user-friendly. * Changed adjusters' step to more useful values, they were too fine-grained and hard to adjust using the +/- spinbutton. Increased max ratio value from 3 to 5, as i found an old negative needing a very high blue channel exponent. * Added an initial processing profile for film negative inversion, to be provided as a bundled profile. * Removed Output Level and balance sliders when in batch mode: since the effect of these sliders is dependent on the reference input values, those values needed to be copied as well. And, touching any of the sliders needed to flag all three as dirty. All this felt more confusing than useful. It should be sufficient (and clearer) to copy/paste the params, and then fine-tune the balance on individual pictures when needed. * Set bayer demosaic method to RCD in the bundled "Film Negative" processing profile. RCD seems to play a bit better with Capture Sharpening in the presence of film grain, compared to Amaze. This will favor new users starting with all-defaults settings, hence having Capture Sharpening enabled by default. * Removed incorrect "contrast" term from the "Reference exponent" label. This parameter adjusts the image _gamma_, not its contrast.
169 lines
6.2 KiB
C++
169 lines
6.2 KiB
C++
/*
|
|
* This file is part of RawTherapee.
|
|
*
|
|
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
|
*
|
|
* RawTherapee is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* RawTherapee is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <lcms2.h>
|
|
|
|
#include "image16.h"
|
|
#include "image8.h"
|
|
#include "imagefloat.h"
|
|
#include "LUT.h"
|
|
#include "rawmetadatalocation.h"
|
|
|
|
#include "../rtgui/threadutils.h"
|
|
|
|
namespace Glib
|
|
{
|
|
|
|
class ustring;
|
|
|
|
}
|
|
|
|
namespace rtengine
|
|
{
|
|
|
|
class Thumbnail
|
|
{
|
|
|
|
MyMutex thumbMutex;
|
|
|
|
cmsHPROFILE camProfile;
|
|
double iColorMatrix[3][3];
|
|
double cam2xyz[3][3];
|
|
|
|
void transformPixel (int x, int y, int tran, int& tx, int& ty);
|
|
|
|
ImageIO* thumbImg;
|
|
double camwbRed;
|
|
double camwbGreen;
|
|
double camwbBlue;
|
|
double redAWBMul, greenAWBMul, blueAWBMul; // multipliers for auto WB
|
|
double autoWBTemp, autoWBGreen, wbEqual, wbTempBias; // autoWBTemp and autoWBGreen are updated each time autoWB is requested and if wbEqual has been modified
|
|
LUTu aeHistogram;
|
|
int aeHistCompression;
|
|
bool aeValid;
|
|
double aeExposureCompensation;
|
|
int aeLightness;
|
|
int aeContrast;
|
|
int aeBlack;
|
|
int aeHighlightCompression;
|
|
int aeHighlightCompressionThreshold;
|
|
int embProfileLength;
|
|
unsigned char* embProfileData;
|
|
cmsHPROFILE embProfile;
|
|
double redMultiplier;
|
|
double greenMultiplier;
|
|
double blueMultiplier;
|
|
double scale;
|
|
double defGain;
|
|
int scaleForSave;
|
|
bool gammaCorrected;
|
|
double colorMatrix[3][3];
|
|
double scaleGain;
|
|
|
|
void processFilmNegative(const procparams::ProcParams& params, const Imagefloat* baseImg, int rwidth, int rheight);
|
|
void processFilmNegativeV2(const procparams::ProcParams& params, const Imagefloat* baseImg, int rwidth, int rheight);
|
|
|
|
public:
|
|
|
|
bool isRaw;
|
|
|
|
~Thumbnail ();
|
|
Thumbnail ();
|
|
|
|
void init ();
|
|
|
|
IImage8* processImage (const procparams::ProcParams& pparams, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& scale, bool forMonitor=true, bool forHistogramMatching = false);
|
|
IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp);
|
|
int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio);
|
|
void getDimensions (int& w, int& h, double& scaleFac);
|
|
|
|
static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode = false, bool forHistogramMatching = false);
|
|
static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool forHistogramMatching = false);
|
|
static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh, double wbEq, bool inspectorMode = false);
|
|
static RawMetaDataLocation loadMetaDataFromRaw (const Glib::ustring& fname);
|
|
|
|
void getCamWB (double& temp, double& green);
|
|
void getAutoWB (double& temp, double& green, double equal, double tempBias);
|
|
void getAutoWBMultipliers (double& rm, double& gm, double& bm);
|
|
void getSpotWB (const procparams::ProcParams& params, int x, int y, int rect, double& temp, double& green);
|
|
void applyAutoExp (procparams::ProcParams& pparams);
|
|
|
|
unsigned char* getGrayscaleHistEQ (int trim_width);
|
|
bool writeImage (const Glib::ustring& fname);
|
|
bool readImage (const Glib::ustring& fname);
|
|
|
|
bool readData (const Glib::ustring& fname);
|
|
bool writeData (const Glib::ustring& fname);
|
|
|
|
bool readEmbProfile (const Glib::ustring& fname);
|
|
bool writeEmbProfile (const Glib::ustring& fname);
|
|
|
|
unsigned char* getImage8Data(); // accessor to the 8bit image if it is one, which should be the case for the "Inspector" mode.
|
|
|
|
// Hombre: ... let's hope that proper template can make this cleaner
|
|
|
|
static ImageIO* resizeToSameType(int nw, int nh, TypeInterpolation interp, ImageIO* srcImg)
|
|
{
|
|
ImageIO* imgPtr = nullptr;
|
|
|
|
if (srcImg->getType() == sImage8) {
|
|
Image8* castedSrcImg = static_cast<Image8*>(srcImg);
|
|
Image8* img8 = new Image8 (nw, nh);
|
|
castedSrcImg->resizeImgTo(nw, nh, interp, img8);
|
|
imgPtr = img8;
|
|
} else if (srcImg->getType() == sImage16) {
|
|
Image16* castedSrcImg = static_cast<Image16*>(srcImg);
|
|
Image16* img16 = new Image16 (nw, nh);
|
|
castedSrcImg->resizeImgTo(nw, nh, interp, img16);
|
|
imgPtr = img16;
|
|
} else if (srcImg->getType() == sImagefloat) {
|
|
Imagefloat* castedSrcImg = static_cast<Imagefloat*>(srcImg);
|
|
Imagefloat* imgfloat = new Imagefloat (nw, nh);
|
|
castedSrcImg->resizeImgTo(nw, nh, interp, imgfloat);
|
|
imgPtr = imgfloat;
|
|
}
|
|
|
|
return imgPtr;
|
|
}
|
|
|
|
template<class IC>
|
|
static IC* resizeTo(int nw, int nh, TypeInterpolation interp, ImageIO* srcImg)
|
|
{
|
|
|
|
IC* imgPtr = new IC (nw, nh);
|
|
|
|
// Hombre: ... let's hope that proper template can make this cleaner
|
|
|
|
if (srcImg->getType() == sImage8) {
|
|
Image8* castedSrcImg = static_cast<Image8*>(srcImg);
|
|
castedSrcImg->resizeImgTo<>(nw, nh, interp, imgPtr);
|
|
} else if (srcImg->getType() == sImage16) {
|
|
Image16* castedSrcImg = static_cast<Image16*>(srcImg);
|
|
castedSrcImg->resizeImgTo<>(nw, nh, interp, imgPtr);
|
|
} else if (srcImg->getType() == sImagefloat) {
|
|
Imagefloat* castedSrcImg = static_cast<Imagefloat*>(srcImg);
|
|
castedSrcImg->resizeImgTo<>(nw, nh, interp, imgPtr);
|
|
}
|
|
|
|
return imgPtr;
|
|
}
|
|
};
|
|
}
|