Merge branch 'dev' into browser-preview-applied-pparams

This commit is contained in:
Lawrence Lee
2023-08-29 22:58:51 -07:00
188 changed files with 12449 additions and 21671 deletions

View File

@@ -404,10 +404,10 @@ Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h,
namespace {
Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml, eSensorType &sensorType, int &w, int &h)
Image8 *load_inspector_mode(const Glib::ustring &fname, eSensorType &sensorType, int &w, int &h)
{
BENCHFUN
RawImageSource src;
int err = src.load(fname, true);
if (err) {
@@ -416,7 +416,7 @@ Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml
src.getFullSize(w, h);
sensorType = src.getSensorType();
ProcParams neutral;
neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
@@ -430,7 +430,7 @@ Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml
PreviewProps pp(0, 0, w, h, 1);
Imagefloat tmp(w, h);
src.getImage(src.getWB(), TR_NONE, &tmp, pp, neutral.toneCurve, neutral.raw, 0);
src.getImage(src.getWB(), TR_NONE, &tmp, pp, neutral.toneCurve, neutral.raw);
src.convertColorSpace(&tmp, neutral.icm, src.getWB());
Image8 *img = new Image8(w, h);
@@ -460,7 +460,7 @@ Image8 *load_inspector_mode(const Glib::ustring &fname, RawMetaDataLocation &rml
} // namespace
Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode, bool forHistogramMatching)
Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode, bool forHistogramMatching)
{
Thumbnail* tpp = new Thumbnail ();
tpp->isRaw = 1;
@@ -470,7 +470,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
tpp->colorMatrix[2][2] = 1.0;
if (inspectorMode && !forHistogramMatching && settings->thumbnail_inspector_mode == Settings::ThumbnailInspectorMode::RAW) {
Image8 *img = load_inspector_mode(fname, rml, sensorType, w, h);
Image8 *img = load_inspector_mode(fname, sensorType, w, h);
if (!img) {
delete tpp;
return nullptr;
@@ -481,7 +481,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
return tpp;
}
RawImage *ri = new RawImage (fname);
unsigned int imageNum = 0;
int r = ri->loadRaw (false, imageNum, false);
@@ -495,10 +495,6 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
sensorType = ri->getSensorType();
rml.exifBase = ri->get_exifBase();
rml.ciffBase = ri->get_ciffBase();
rml.ciffLength = ri->get_ciffLen();
Image8* img = new Image8 ();
// No sample format detection occurred earlier, so we set them here,
// as they are mandatory for the setScanline method
@@ -538,8 +534,8 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
if (!forHistogramMatching && settings->thumbnail_inspector_mode == Settings::ThumbnailInspectorMode::RAW_IF_NOT_JPEG_FULLSIZE && float(std::max(w, h))/float(std::max(ri->get_width(), ri->get_height())) < 0.9f) {
delete img;
delete ri;
img = load_inspector_mode(fname, rml, sensorType, w, h);
img = load_inspector_mode(fname, sensorType, w, h);
if (!img) {
delete tpp;
return nullptr;
@@ -547,7 +543,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
tpp->scale = 1.;
tpp->thumbImg = img;
return tpp;
}
} else {
@@ -603,28 +599,7 @@ Thumbnail* Thumbnail::loadQuickFromRaw (const Glib::ustring& fname, RawMetaDataL
#define FISGREEN(filter,row,col) \
((filter >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)==1 || !filter)
RawMetaDataLocation Thumbnail::loadMetaDataFromRaw (const Glib::ustring& fname)
{
RawMetaDataLocation rml;
rml.exifBase = -1;
rml.ciffBase = -1;
rml.ciffLength = -1;
RawImage ri (fname);
unsigned int imageNum = 0;
int r = ri.loadRaw (false, imageNum);
if ( !r ) {
rml.exifBase = ri.get_exifBase();
rml.ciffBase = ri.get_ciffBase();
rml.ciffLength = ri.get_ciffLen();
}
return rml;
}
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, StandardObserver wbObserver, bool rotate, const RAWParams *rawParams, bool forHistogramMatching)
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, StandardObserver wbObserver, bool rotate, const RAWParams *rawParams, bool forHistogramMatching)
{
RawImage *ri = new RawImage (fname);
unsigned int tempImageNum = 0;
@@ -680,10 +655,6 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
ri->pre_interpolate();
rml.exifBase = ri->get_exifBase();
rml.ciffBase = ri->get_ciffBase();
rml.ciffLength = ri->get_ciffLen();
tpp->camwbRed = tpp->redMultiplier / pre_mul[0]; //ri->get_pre_mul(0);
tpp->camwbGreen = tpp->greenMultiplier / pre_mul[1]; //ri->get_pre_mul(1);
tpp->camwbBlue = tpp->blueMultiplier / pre_mul[2]; //ri->get_pre_mul(2);
@@ -1086,6 +1057,9 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
}
tpp->init();
RawImageSource::computeFullSize(ri, TR_NONE, tpp->full_width, tpp->full_height);
delete ri;
return tpp;
}
@@ -1143,7 +1117,9 @@ Thumbnail::Thumbnail () :
gammaCorrected (false),
colorMatrix{},
scaleGain (1.0),
isRaw (true)
isRaw (true),
full_width(-1),
full_height(-1)
{
}
@@ -1196,20 +1172,12 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int
// Full thumbnail processing, second stage if complete profile exists
IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& myscale, bool forMonitor, bool forHistogramMatching)
{
unsigned int imgNum = 0;
if (isRaw) {
if (sensorType == ST_BAYER) {
imgNum = rtengine::LIM<unsigned int>(params.raw.bayersensor.imageNum, 0, metadata->getFrameCount() - 1);
} else if (sensorType == ST_FUJI_XTRANS) {
//imgNum = rtengine::LIM<unsigned int>(params.raw.xtranssensor.imageNum, 0, metadata->getFrameCount() - 1)
}
}
std::string camName = metadata->getCamera(imgNum);
float shutter = metadata->getShutterSpeed(imgNum);
float fnumber = metadata->getFNumber(imgNum);
float iso = metadata->getISOSpeed(imgNum);
float fcomp = metadata->getExpComp(imgNum);
const std::string camName = metadata->getCamera();
const float shutter = metadata->getShutterSpeed();
const float fnumber = metadata->getFNumber();
const float iso = metadata->getISOSpeed();
const float fcomp = metadata->getExpComp();
// check if the WB's equalizer, temperature bias, or observer value has changed
if (wbEqual < (params.wb.equal - 5e-4) || wbEqual > (params.wb.equal + 5e-4) || wbTempBias < (params.wb.tempBias - 5e-4) || wbTempBias > (params.wb.tempBias + 5e-4) || wbObserver != params.wb.observer) {
wbEqual = params.wb.equal;
@@ -1316,7 +1284,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
float red = baseImg->r (i, j) * rmi;
float green = baseImg->g (i, j) * gmi;
float blue = baseImg->b (i, j) * bmi;
// avoid magenta highlights if highlight recovery is enabled
if (params.toneCurve.hrenabled && red > MAXVALF && blue > MAXVALF) {
baseImg->r(i, j) = baseImg->g(i, j) = baseImg->b(i, j) = CLIP((red + green + blue) / 3.f);
@@ -1363,7 +1331,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
ipf.dehaze(baseImg, params.dehaze);
ipf.ToneMapFattal02(baseImg, params.fattal, 3, 0, nullptr, 0, 0, 0);
// perform transform
int origFW;
int origFH;
@@ -1514,7 +1482,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
}
}
// luminance processing
// ipf.EPDToneMap(labView,0,6);
@@ -2302,7 +2270,7 @@ bool Thumbnail::readData (const Glib::ustring& fname)
colorMatrix[i][j] = cm[ix++];
}
}
if (keyFile.has_key ("LiveThumbData", "ScaleGain")) {
scaleGain = keyFile.get_double ("LiveThumbData", "ScaleGain");
}