skip unnecessary transform
This commit is contained in:
@@ -173,8 +173,6 @@ void Crop::update(int todo)
|
|||||||
int widIm = parent->fw;//full image
|
int widIm = parent->fw;//full image
|
||||||
int heiIm = parent->fh;
|
int heiIm = parent->fh;
|
||||||
|
|
||||||
bool needstransform = parent->ipf.needsTransform();
|
|
||||||
|
|
||||||
if (todo & (M_INIT | M_LINDENOISE | M_HDR)) {
|
if (todo & (M_INIT | M_LINDENOISE | M_HDR)) {
|
||||||
MyMutex::MyLock lock(parent->minit); // Also used in improccoord
|
MyMutex::MyLock lock(parent->minit); // Also used in improccoord
|
||||||
|
|
||||||
@@ -766,6 +764,7 @@ void Crop::update(int todo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool needstransform = parent->ipf.needsTransform(skips(parent->fw, skip), skips(parent->fh, skip), parent->imgsrc->getRotateDegree(), parent->imgsrc->getMetaData());
|
||||||
// transform
|
// transform
|
||||||
if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) {
|
if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) {
|
||||||
if (!transCrop) {
|
if (!transCrop) {
|
||||||
@@ -784,10 +783,7 @@ void Crop::update(int todo)
|
|||||||
baseCrop = transCrop;
|
baseCrop = transCrop;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (transCrop) {
|
|
||||||
delete transCrop;
|
delete transCrop;
|
||||||
}
|
|
||||||
|
|
||||||
transCrop = nullptr;
|
transCrop = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1167,6 +1163,7 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter
|
|||||||
|
|
||||||
parent->ipf.transCoord(parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh);
|
parent->ipf.transCoord(parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh);
|
||||||
|
|
||||||
|
if (parent->ipf.needsTransform(skips(parent->fw, skip), skips(parent->fh, skip), parent->imgsrc->getRotateDegree(), parent->imgsrc->getMetaData())) {
|
||||||
if (check_need_larger_crop_for_lcp_distortion(parent->fw, parent->fh, orx, ory, orw, orh, *parent->params)) {
|
if (check_need_larger_crop_for_lcp_distortion(parent->fw, parent->fh, orx, ory, orw, orh, *parent->params)) {
|
||||||
// TODO - this is an estimate of the max distortion relative to the image size. ATM it is hardcoded to be 15%, which seems enough. If not, need to revise
|
// TODO - this is an estimate of the max distortion relative to the image size. ATM it is hardcoded to be 15%, which seems enough. If not, need to revise
|
||||||
int dW = int (double (parent->fw) * 0.15 / (2 * skip));
|
int dW = int (double (parent->fw) * 0.15 / (2 * skip));
|
||||||
@@ -1201,7 +1198,7 @@ bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool inter
|
|||||||
orw = min(x2 - x1, parent->fw - orx);
|
orw = min(x2 - x1, parent->fw - orx);
|
||||||
orh = min(y2 - y1, parent->fh - ory);
|
orh = min(y2 - y1, parent->fh - ory);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
leftBorder = skips(rqx1 - bx1, skip);
|
leftBorder = skips(rqx1 - bx1, skip);
|
||||||
upperBorder = skips(rqy1 - by1, skip);
|
upperBorder = skips(rqy1 - by1, skip);
|
||||||
|
|
||||||
|
@@ -545,7 +545,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)
|
|||||||
oprevi = orig_prev;
|
oprevi = orig_prev;
|
||||||
|
|
||||||
// Remove transformation if unneeded
|
// Remove transformation if unneeded
|
||||||
bool needstransform = ipf.needsTransform();
|
bool needstransform = ipf.needsTransform(fw, fh, imgsrc->getRotateDegree(), imgsrc->getMetaData());
|
||||||
|
|
||||||
if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled))) {
|
if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params->dirpyrequalizer.cbdlMethod == "bef" && params->dirpyrequalizer.enabled && !params->colorappearance.enabled))) {
|
||||||
assert(oprevi);
|
assert(oprevi);
|
||||||
@@ -1349,7 +1349,7 @@ void ImProcCoordinator::saveInputICCReference(const Glib::ustring& fname, bool a
|
|||||||
imgsrc->getImage(currWB, tr, im, pp, ppar.toneCurve, ppar.raw);
|
imgsrc->getImage(currWB, tr, im, pp, ppar.toneCurve, ppar.raw);
|
||||||
ImProcFunctions ipf(&ppar, true);
|
ImProcFunctions ipf(&ppar, true);
|
||||||
|
|
||||||
if (ipf.needsTransform()) {
|
if (ipf.needsTransform(fW, fH, imgsrc->getRotateDegree(), imgsrc->getMetaData())) {
|
||||||
Imagefloat* trImg = new Imagefloat(fW, fH);
|
Imagefloat* trImg = new Imagefloat(fW, fH);
|
||||||
ipf.transform(im, trImg, 0, 0, 0, 0, fW, fH, fW, fH,
|
ipf.transform(im, trImg, 0, 0, 0, 0, fW, fH, fW, fH,
|
||||||
imgsrc->getMetaData(), imgsrc->getRotateDegree(), true);
|
imgsrc->getMetaData(), imgsrc->getRotateDegree(), true);
|
||||||
|
@@ -119,7 +119,7 @@ public:
|
|||||||
}
|
}
|
||||||
void setScale(double iscale);
|
void setScale(double iscale);
|
||||||
|
|
||||||
bool needsTransform() const;
|
bool needsTransform(int oW, int oH, int rawRotationDeg, const FramesMetaData *metadata) const;
|
||||||
bool needsPCVignetting() const;
|
bool needsPCVignetting() const;
|
||||||
|
|
||||||
void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams ¶ms, LUTu & vhist16);
|
void firstAnalysis(const Imagefloat* const working, const procparams::ProcParams ¶ms, LUTu & vhist16);
|
||||||
|
@@ -1358,9 +1358,14 @@ bool ImProcFunctions::needsLensfun() const
|
|||||||
return params->lensProf.useLensfun();
|
return params->lensProf.useLensfun();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImProcFunctions::needsTransform () const
|
bool ImProcFunctions::needsTransform (int oW, int oH, int rawRotationDeg, const FramesMetaData *metadata) const
|
||||||
{
|
{
|
||||||
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLensfun();
|
bool needsLf = needsLensfun();
|
||||||
|
if (needsLf) {
|
||||||
|
std::unique_ptr<const LensCorrection> pLCPMap = LFDatabase::getInstance()->findModifier(params->lensProf, metadata, oW, oH, params->coarse, rawRotationDeg);
|
||||||
|
needsLf = pLCPMap.get();
|
||||||
|
}
|
||||||
|
return needsCA () || needsDistortion () || needsRotation () || needsPerspective () || needsGradient () || needsPCVignetting () || needsVignetting () || needsLCP() || needsLf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1247,12 +1247,12 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
|
|||||||
ipf.ToneMapFattal02(baseImg);
|
ipf.ToneMapFattal02(baseImg);
|
||||||
|
|
||||||
// perform transform
|
// perform transform
|
||||||
if (ipf.needsTransform()) {
|
|
||||||
Imagefloat* trImg = new Imagefloat (fw, fh);
|
|
||||||
int origFW;
|
int origFW;
|
||||||
int origFH;
|
int origFH;
|
||||||
double tscale = 0.0;
|
double tscale = 0.0;
|
||||||
getDimensions (origFW, origFH, tscale);
|
getDimensions (origFW, origFH, tscale);
|
||||||
|
if (ipf.needsTransform(origFW * tscale + 0.5, origFH * tscale + 0.5, 0, metadata)) {
|
||||||
|
Imagefloat* trImg = new Imagefloat (fw, fh);
|
||||||
ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, origFW * tscale + 0.5, origFH * tscale + 0.5, metadata, 0, true); // Raw rotate degree not detectable here
|
ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, origFW * tscale + 0.5, origFH * tscale + 0.5, metadata, 0, true); // Raw rotate degree not detectable here
|
||||||
delete baseImg;
|
delete baseImg;
|
||||||
baseImg = trImg;
|
baseImg = trImg;
|
||||||
|
@@ -872,7 +872,7 @@ private:
|
|||||||
ipf.ToneMapFattal02(baseImg);
|
ipf.ToneMapFattal02(baseImg);
|
||||||
|
|
||||||
// perform transform (excepted resizing)
|
// perform transform (excepted resizing)
|
||||||
if (ipf.needsTransform()) {
|
if (ipf.needsTransform(fw, fh, imgsrc->getRotateDegree(), imgsrc->getMetaData())) {
|
||||||
Imagefloat* trImg = nullptr;
|
Imagefloat* trImg = nullptr;
|
||||||
if (ipf.needsLuminanceOnly()) {
|
if (ipf.needsLuminanceOnly()) {
|
||||||
trImg = baseImg;
|
trImg = baseImg;
|
||||||
|
Reference in New Issue
Block a user