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 reallocAll ();
void updateLRGBHistograms (); void updateLRGBHistograms ();
void setScale (int prevscale); void setScale (int prevscale);
void updatePreviewImage (int todo, Crop* cropCall = nullptr); void updatePreviewImage (int todo, bool panningRelatedChange);
MyMutex mProcessing; MyMutex mProcessing;
ProcParams params; ProcParams params;

View File

@ -1646,7 +1646,9 @@ bool LensProfParams::operator ==(const LensProfParams& other) const
&& useCA == other.useCA && useCA == other.useCA
&& lfCameraMake == other.lfCameraMake && lfCameraMake == other.lfCameraMake
&& lfCameraModel == other.lfCameraModel && lfCameraModel == other.lfCameraModel
&& lfLens == other.lfLens; && lfLens == other.lfLens
&& useDist == other.useDist
&& useVign == other.useVign;
} }
bool LensProfParams::operator !=(const LensProfParams& other) const bool LensProfParams::operator !=(const LensProfParams& other) const
@ -5046,6 +5048,73 @@ int ProcParams::write(const Glib::ustring& fname, const Glib::ustring& content)
return error; 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) PartialProfile::PartialProfile(bool createInstance, bool paramsEditedValue)
{ {
if (createInstance) { if (createInstance) {

View File

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

View File

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