Performance improvement adding many files to queue
see issue 900
This commit is contained in:
@@ -62,6 +62,18 @@ BatchQueue::~BatchQueue ()
|
||||
delete pmenu;
|
||||
}
|
||||
|
||||
// Reduce the max size of a thumb, since thumb is processed synchronously on adding to queue
|
||||
// leading to very long waiting when adding more images
|
||||
int BatchQueue::calcMaxThumbnailHeight() {
|
||||
return MIN(options.maxThumbnailHeight, 200);
|
||||
}
|
||||
|
||||
// Function for virtual override in thumbbrowser base
|
||||
int BatchQueue::getMaxThumbnailHeight() const {
|
||||
return calcMaxThumbnailHeight();
|
||||
}
|
||||
|
||||
|
||||
void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry) {
|
||||
|
||||
pmenu->popup (3, this->eventTime);
|
||||
@@ -163,11 +175,11 @@ void BatchQueue::loadBatchQueue( )
|
||||
if( thumb ){
|
||||
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create(source, thumb->getType() == FT_Raw, pparams);
|
||||
|
||||
int prevh = options.maxThumbnailHeight;
|
||||
int prevh = getMaxThumbnailHeight();
|
||||
int prevw = prevh;
|
||||
guint8* prev = NULL;
|
||||
double tmpscale;
|
||||
rtengine::IImage8* img = thumb->processThumbImage(pparams, options.maxThumbnailHeight, tmpscale);
|
||||
rtengine::IImage8* img = thumb->processThumbImage(pparams, prevh, tmpscale);
|
||||
if (img) {
|
||||
prevw = img->getWidth();
|
||||
prevh = img->getHeight();
|
||||
|
@@ -40,6 +40,7 @@ class BatchQueue : public ThumbBrowserBase,
|
||||
public LWButtonListener {
|
||||
|
||||
protected:
|
||||
int getMaxThumbnailHeight() const;
|
||||
|
||||
BatchQueueEntry* processing; // holds the currently processed image
|
||||
|
||||
@@ -83,6 +84,7 @@ class BatchQueue : public ThumbBrowserBase,
|
||||
void loadBatchQueue ();
|
||||
|
||||
static Glib::ustring calcAutoFileNameBase (const Glib::ustring& origFileName);
|
||||
static int calcMaxThumbnailHeight();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -832,25 +832,35 @@ void FileCatalog::developRequested (std::vector<FileBrowserEntry*> tbe) {
|
||||
|
||||
if (listener) {
|
||||
std::vector<BatchQueueEntry*> entries;
|
||||
|
||||
#pragma omp parallel for ordered
|
||||
for (size_t i=0; i<tbe.size(); i++) {
|
||||
rtengine::procparams::ProcParams params = tbe[i]->thumbnail->getProcParams();
|
||||
rtengine::ProcessingJob* pjob = rtengine::ProcessingJob::create (tbe[i]->filename, tbe[i]->thumbnail->getType()==FT_Raw, params);
|
||||
double tmpscale;
|
||||
rtengine::IImage8* img = tbe[i]->thumbnail->processThumbImage (params, options.maxThumbnailHeight, tmpscale);
|
||||
rtengine::IImage8* img = tbe[i]->thumbnail->processThumbImage (params, BatchQueue::calcMaxThumbnailHeight(), tmpscale);
|
||||
|
||||
int pw, ph;
|
||||
guint8* prev=NULL;
|
||||
|
||||
if (img) {
|
||||
int pw = img->getWidth ();
|
||||
int ph = img->getHeight ();
|
||||
guint8* prev = new guint8 [pw*ph*3];
|
||||
pw = img->getWidth ();
|
||||
ph = img->getHeight ();
|
||||
prev = new guint8 [pw*ph*3];
|
||||
memcpy (prev, img->getData (), pw*ph*3);
|
||||
img->free();
|
||||
|
||||
} else {
|
||||
tbe[i]->thumbnail->getThumbnailSize (pw, ph);
|
||||
}
|
||||
|
||||
// processThumbImage is the processing intensive part, but adding to queue must be ordered
|
||||
#pragma omp ordered
|
||||
{
|
||||
entries.push_back(new BatchQueueEntry (pjob, params, tbe[i]->filename, prev, pw, ph, tbe[i]->thumbnail));
|
||||
}
|
||||
else {
|
||||
int pw, ph;
|
||||
tbe[i]->thumbnail->getThumbnailSize (pw, ph);
|
||||
entries.push_back(new BatchQueueEntry (pjob, params, tbe[i]->filename, NULL, pw, ph, tbe[i]->thumbnail));
|
||||
}
|
||||
}
|
||||
|
||||
listener->addBatchQueueJobs( entries );
|
||||
}
|
||||
}
|
||||
|
@@ -478,13 +478,13 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
|
||||
int optThumbSize=getCurrentThumbSize();
|
||||
if (zoomIn)
|
||||
for (i=0; i<options.thumbnailZoomRatios.size(); i++) {
|
||||
newHeight = (int)(options.thumbnailZoomRatios[i] * options.maxThumbnailHeight);
|
||||
newHeight = (int)(options.thumbnailZoomRatios[i] * getMaxThumbnailHeight());
|
||||
if (newHeight > optThumbSize)
|
||||
break;
|
||||
}
|
||||
else
|
||||
for (i=options.thumbnailZoomRatios.size()-1; i>=0; i--) {
|
||||
newHeight = (int)(options.thumbnailZoomRatios[i] * options.maxThumbnailHeight);
|
||||
newHeight = (int)(options.thumbnailZoomRatios[i] * getMaxThumbnailHeight());
|
||||
if (newHeight < optThumbSize)
|
||||
break;
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <gtkmm.h>
|
||||
#include <thumbbrowserentrybase.h>
|
||||
#include <set>
|
||||
#include <options.h>
|
||||
|
||||
/*
|
||||
* Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space
|
||||
@@ -52,6 +53,7 @@ class ThumbBrowserBase : public Gtk::VBox {
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual int getMaxThumbnailHeight() const { return options.maxThumbnailHeight; } // Differs between batch and file
|
||||
|
||||
Internal internal;
|
||||
Gtk::HScrollbar hscroll;
|
||||
|
Reference in New Issue
Block a user