reduce updates to preview, panning background, navigator and thumbs, fixes #4834

This commit is contained in:
heckflosse 2018-09-27 18:16:29 +02:00
parent 080033765c
commit 095cb010e5
6 changed files with 824 additions and 764 deletions

File diff suppressed because it is too large Load Diff

View File

@ -179,7 +179,7 @@ protected:
void reallocAll ();
void updateLRGBHistograms ();
void setScale (int prevscale);
void updatePreviewImage (int todo, Crop* cropCall = nullptr);
void updatePreviewImage (int todo, bool panningRelatedChange);
MyMutex mProcessing;
ProcParams params;

View File

@ -1646,7 +1646,9 @@ bool LensProfParams::operator ==(const LensProfParams& other) const
&& useCA == other.useCA
&& lfCameraMake == other.lfCameraMake
&& lfCameraModel == other.lfCameraModel
&& lfLens == other.lfLens;
&& lfLens == other.lfLens
&& useDist == other.useDist
&& useVign == other.useVign;
}
bool LensProfParams::operator !=(const LensProfParams& other) const
@ -5046,6 +5048,73 @@ int ProcParams::write(const Glib::ustring& fname, const Glib::ustring& content)
return error;
}
bool ProcParams::isThumbRelatedChange(const ProcParams &newParams) const
{
return toneCurve != newParams.toneCurve
|| labCurve != newParams.labCurve
|| localContrast != newParams.localContrast
|| rgbCurves != newParams.rgbCurves
|| colorToning != newParams.colorToning
|| vibrance != newParams.vibrance
|| wb != newParams.wb
|| colorappearance != newParams.colorappearance
|| epd != newParams.epd
|| fattal != newParams.fattal
|| sh != newParams.sh
|| crop != newParams.crop
|| coarse != newParams.coarse
|| commonTrans != newParams.commonTrans
|| rotate != newParams.rotate
|| distortion != newParams.distortion
|| lensProf != newParams.lensProf
|| perspective != newParams.perspective
|| gradient != newParams.gradient
|| pcvignette != newParams.pcvignette
|| cacorrection != newParams.cacorrection
|| vignetting != newParams.vignetting
|| chmixer != newParams.chmixer
|| blackwhite != newParams.blackwhite
|| icm != newParams.icm
|| hsvequalizer != newParams.hsvequalizer
|| filmSimulation != newParams.filmSimulation
|| softlight != newParams.softlight;
}
bool ProcParams::isPanningRelatedChange(const ProcParams &newParams) const
{
return toneCurve != newParams.toneCurve
|| labCurve != newParams.labCurve
|| localContrast != newParams.localContrast
|| rgbCurves != newParams.rgbCurves
|| colorToning != newParams.colorToning
|| vibrance != newParams.vibrance
|| wb != newParams.wb
|| colorappearance != newParams.colorappearance
|| epd != newParams.epd
|| fattal != newParams.fattal
|| sh != newParams.sh
|| crop != newParams.crop
|| coarse != newParams.coarse
|| commonTrans != newParams.commonTrans
|| rotate != newParams.rotate
|| distortion != newParams.distortion
|| lensProf != newParams.lensProf
|| perspective != newParams.perspective
|| gradient != newParams.gradient
|| pcvignette != newParams.pcvignette
|| cacorrection != newParams.cacorrection
|| vignetting != newParams.vignetting
|| chmixer != newParams.chmixer
|| blackwhite != newParams.blackwhite
|| icm != newParams.icm
|| hsvequalizer != newParams.hsvequalizer
|| filmSimulation != newParams.filmSimulation
|| softlight != newParams.softlight
|| raw != newParams.raw
|| retinex != newParams.retinex
|| dirpyrequalizer != newParams.dirpyrequalizer;
}
PartialProfile::PartialProfile(bool createInstance, bool paramsEditedValue)
{
if (createInstance) {

View File

@ -1488,6 +1488,9 @@ public:
bool operator ==(const ProcParams& other) const;
bool operator !=(const ProcParams& other) const;
bool isThumbRelatedChange(const ProcParams &newParams) const;
bool isPanningRelatedChange(const ProcParams &newParams) const;
private:
/** Write the ProcParams's text in the file of the given name.
* @param fname the name of the file

View File

@ -37,7 +37,7 @@ using namespace rtengine::procparams;
Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf)
: fname(fname), cfs(*cf), cachemgr(cm), ref(1), enqueueNumber(0), tpp(nullptr),
pparamsValid(false), needsReProcessing(true), imageLoading(false), lastImg(nullptr),
pparamsValid(false), imageLoading(false), lastImg(nullptr),
lastW(0), lastH(0), lastScale(0), initial_(false)
{
@ -65,7 +65,7 @@ Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageDa
Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5)
: fname(fname), cachemgr(cm), ref(1), enqueueNumber(0), tpp(nullptr), pparamsValid(false),
needsReProcessing(true), imageLoading(false), lastImg(nullptr),
imageLoading(false), lastImg(nullptr),
lastW(0), lastH(0), lastScale(0.0), initial_(true)
{
@ -155,7 +155,6 @@ void Thumbnail::_generateThumbnailImage ()
tpp->getAutoWBMultipliers(cfs.redAWBMul, cfs.greenAWBMul, cfs.blueAWBMul);
_saveThumbnail ();
cfs.supported = true;
needsReProcessing = true;
cfs.save (getCacheFileName ("data", ".txt"));
@ -368,7 +367,6 @@ void Thumbnail::clearProcParams (int whoClearedIt)
cfs.recentlySaved = false;
pparamsValid = false;
needsReProcessing = true;
//TODO: run though customprofilebuilder?
// probably not as this is the only option to set param values to default
@ -413,7 +411,7 @@ void Thumbnail::clearProcParams (int whoClearedIt)
}
}
bool Thumbnail::hasProcParams ()
bool Thumbnail::hasProcParams () const
{
return pparamsValid;
@ -421,26 +419,21 @@ bool Thumbnail::hasProcParams ()
void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoChangedIt, bool updateCacheNow)
{
const bool needsReprocessing = pparams.isThumbRelatedChange(pp);
{
MyMutex::MyLock lock(mutex);
if (pparams.sharpening.threshold.isDouble() != pp.sharpening.threshold.isDouble()) {
printf("WARNING: Sharpening different!\n");
}
if (pparams.vibrance.psthreshold.isDouble() != pp.vibrance.psthreshold.isDouble()) {
printf("WARNING: Vibrance different!\n");
}
if (pparams != pp) {
cfs.recentlySaved = false;
} else if (pparamsValid && !updateCacheNow) {
// nothing to do
return;
}
// do not update rank, colorlabel and inTrash
int rank = getRank();
int colorlabel = getColorLabel();
int inTrash = getStage();
const int rank = getRank();
const int colorlabel = getColorLabel();
const int inTrash = getStage();
if (pe) {
pe->combine(pparams, pp, true);
@ -449,24 +442,24 @@ void Thumbnail::setProcParams (const ProcParams& pp, ParamsEdited* pe, int whoCh
}
pparamsValid = true;
needsReProcessing = true;
setRank(rank);
setColorLabel(colorlabel);
setStage(inTrash);
if (updateCacheNow) {
updateCache ();
updateCache();
}
} // end of mutex lock
for (size_t i = 0; i < listeners.size(); i++) {
listeners[i]->procParamsChanged (this, whoChangedIt);
if (needsReprocessing) {
for (size_t i = 0; i < listeners.size(); i++) {
listeners[i]->procParamsChanged (this, whoChangedIt);
}
}
}
bool Thumbnail::isRecentlySaved ()
bool Thumbnail::isRecentlySaved () const
{
return cfs.recentlySaved;
@ -495,17 +488,17 @@ void Thumbnail::imageRemovedFromQueue ()
enqueueNumber--;
}
bool Thumbnail::isEnqueued ()
bool Thumbnail::isEnqueued () const
{
return enqueueNumber > 0;
}
bool Thumbnail::isPixelShift ()
bool Thumbnail::isPixelShift () const
{
return cfs.isPixelShift;
}
bool Thumbnail::isHDR ()
bool Thumbnail::isHDR () const
{
return cfs.isHDR;
}
@ -694,13 +687,13 @@ void Thumbnail::generateExifDateTimeStrings ()
dateTimeString = ostr.str ();
}
const Glib::ustring& Thumbnail::getExifString ()
const Glib::ustring& Thumbnail::getExifString () const
{
return exifString;
}
const Glib::ustring& Thumbnail::getDateTimeString ()
const Glib::ustring& Thumbnail::getDateTimeString () const
{
return dateTimeString;
@ -798,7 +791,6 @@ int Thumbnail::infoFromImage (const Glib::ustring& fname, std::unique_ptr<rtengi
void Thumbnail::_loadThumbnail(bool firstTrial)
{
needsReProcessing = true;
tw = -1;
th = options.maxThumbnailHeight;
delete tpp;

View File

@ -49,7 +49,6 @@ class Thumbnail
rtengine::procparams::ProcParams pparams;
bool pparamsValid;
bool needsReProcessing;
bool imageLoading;
// these are the data of the result image of the last getthumbnailimage call (for caching purposes)
@ -81,7 +80,7 @@ public:
Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5);
~Thumbnail ();
bool hasProcParams ();
bool hasProcParams () const;
const rtengine::procparams::ProcParams& getProcParams ();
const rtengine::procparams::ProcParams& getProcParamsU (); // Unprotected version
@ -94,21 +93,21 @@ public:
void notifylisterners_procParamsChanged(int whoChangedIt);
bool isQuick()
bool isQuick() const
{
return cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL;
}
bool isPParamsValid()
bool isPParamsValid() const
{
return pparamsValid;
}
bool isRecentlySaved ();
bool isRecentlySaved () const;
void imageDeveloped ();
void imageEnqueued ();
void imageRemovedFromQueue ();
bool isEnqueued ();
bool isPixelShift ();
bool isHDR ();
bool isEnqueued () const;
bool isPixelShift () const;
bool isHDR () const;
// unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w
rtengine::IImage8* processThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
@ -116,9 +115,9 @@ public:
void getThumbnailSize (int &w, int &h, const rtengine::procparams::ProcParams *pparams = nullptr);
void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h);
const Glib::ustring& getExifString ();
const Glib::ustring& getDateTimeString ();
void getCamWB (double& temp, double& green)
const Glib::ustring& getExifString () const;
const Glib::ustring& getDateTimeString () const;
void getCamWB (double& temp, double& green) const
{
if (tpp) {
tpp->getCamWB (temp, green);
@ -143,7 +142,7 @@ public:
}
ThFileType getType ();
Glib::ustring getFileName ()
Glib::ustring getFileName () const
{
return fname;
}
@ -155,12 +154,12 @@ public:
{
return &cfs;
}
std::string getMD5 ()
std::string getMD5 () const
{
return cfs.md5;
}
int getRank ()
int getRank () const
{
return pparams.rank;
}
@ -172,7 +171,7 @@ public:
}
}
int getColorLabel ()
int getColorLabel () const
{
return pparams.colorlabel;
}
@ -184,7 +183,7 @@ public:
}
}
int getStage ()
int getStage () const
{
return pparams.inTrash;
}