Using Steves threadsafe DCRAW to roughly double thumbnail generation speed on multicore CPUs. Now there are two update worker threads. Easy to remove if someone provides code for a more efficient distribution mechanism.
This commit is contained in:
@@ -970,3 +970,25 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void PreviewMultiLoader::setPreviewLoaderListener (PreviewLoaderListener* p) {
|
||||
loadA.setPreviewLoaderListener(p); loadB.setPreviewLoaderListener(p);
|
||||
}
|
||||
|
||||
// Simple round robin
|
||||
void PreviewMultiLoader::add(DirEntry de) {
|
||||
if (next==0) {
|
||||
loadA.add(de);
|
||||
next=1;
|
||||
} else {
|
||||
loadB.add(de);
|
||||
next=0;
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewMultiLoader::start () { loadA.start(); loadB.start(); }
|
||||
void PreviewMultiLoader::process () { loadA.process (); loadB.process(); }
|
||||
void PreviewMultiLoader::remove (Glib::ustring fname) { loadA.remove(fname); loadB.remove(fname); }
|
||||
void PreviewMultiLoader::end () { loadA.end(); loadB.end(); }
|
||||
bool PreviewMultiLoader::runs () { return loadA.runs() || loadB.runs(); }
|
||||
void PreviewMultiLoader::terminate () { loadA.terminate(); loadB.terminate(); }
|
||||
void PreviewMultiLoader::stop () { loadA.stop(); loadB.stop(); }
|
||||
|
@@ -67,6 +67,30 @@ class PreviewLoader : public ProcessingThread<DirEntry> {
|
||||
void end ();
|
||||
};
|
||||
|
||||
// Simple Multithreader: Harnesses two normal loader threads feeded by a round robin
|
||||
// Same interface as a normal PreviewLoader to minimize effects on code
|
||||
class PreviewMultiLoader {
|
||||
protected:
|
||||
PreviewLoader loadA,loadB;
|
||||
int next;
|
||||
|
||||
public:
|
||||
PreviewMultiLoader () { next=0; }
|
||||
|
||||
void setPreviewLoaderListener (PreviewLoaderListener* p);
|
||||
|
||||
void add (DirEntry de);
|
||||
|
||||
void start ();
|
||||
void process ();
|
||||
void remove (Glib::ustring fname);
|
||||
void end ();
|
||||
|
||||
bool runs ();
|
||||
void terminate ();
|
||||
void stop ();
|
||||
};
|
||||
|
||||
class FileCatalog : public Gtk::VBox,
|
||||
public DirSelectionListener,
|
||||
public PreviewLoaderListener,
|
||||
@@ -82,7 +106,9 @@ class FileCatalog : public Gtk::VBox,
|
||||
Glib::ustring selectedDirectory;
|
||||
bool enabled;
|
||||
|
||||
PreviewLoader previewLoader;
|
||||
// Restore PreviewLoader if the new threadsafe is not that threadsafe ;-)
|
||||
//PreviewLoader previewLoader;
|
||||
PreviewMultiLoader previewLoader;
|
||||
FileSelectionListener* listener;
|
||||
FileSelectionChangeListener* fslistener;
|
||||
ImageAreaToolListener* iatlistener;
|
||||
|
Reference in New Issue
Block a user