histogram matching: cache the computed tone curve in RawImageSource

This commit is contained in:
Alberto Griggio
2018-01-19 21:43:55 +01:00
parent 8728e3f3f3
commit 8f76392885
5 changed files with 14 additions and 3 deletions

View File

@@ -139,6 +139,14 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
std::cout << "performing histogram matching for " << getFileName() << " on the embedded thumbnail" << std::endl;
}
if (!histMatchingCache.empty()) {
if (settings->verbose) {
std::cout << "tone curve found in cache" << std::endl;
outCurve = histMatchingCache;
return;
}
}
outCurve = { DCT_Linear };
int fw, fh;
@@ -161,6 +169,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
if (settings->verbose) {
std::cout << "histogram matching: no thumbnail found, generating a neutral curve" << std::endl;
}
histMatchingCache = outCurve;
return;
}
source.reset(thumb->quickProcessImage(neutral, fh / skip, TI_Nearest));
@@ -233,6 +242,8 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector<double> &outCurve)
if (settings->verbose) {
std::cout << "histogram matching: generated curve with " << outCurve.size()/2 << " control points" << std::endl;
}
histMatchingCache = outCurve;
}
} // namespace rtengine