[Digikam-devel] extragear/graphics/digikam/libs
Marcel Wiesweg
marcel.wiesweg at gmx.de
Sat May 27 14:44:49 BST 2006
SVN commit 545416 by mwiesweg:
Use fast raw loading for histogram,
and do not cache the low quality version instead of the full image
- make DImg::fileFormat() static public
- Use a different cache key in LoadingCache if image is loaded with halfSizeColorImage option
- detect raw file format in ImagePropertiesColorTab, set time-optimized RawDecodingSettings
CCMAIL: digikam-devel at kde.org
M +3 -1 dimg/dimg.h
M +19 -4 imageproperties/imagepropertiescolorstab.cpp
M +12 -3 threadimageio/loadingdescription.h
M +3 -3 threadimageio/loadsavetask.cpp
M +13 -2 threadimageio/loadsavethread.cpp
M +0 -1 threadimageio/managedloadsavethread.cpp
--- trunk/extragear/graphics/digikam/libs/dimg/dimg.h #545415:545416
@@ -84,6 +84,9 @@
VERTICAL
};
+ /** Identify file format */
+ static FORMAT fileFormat(const QString& filePath);
+
/** Create null image */
DImg();
@@ -319,7 +322,6 @@
private:
- FORMAT fileFormat(const QString& filePath);
void copyMetaData(const DImgPrivate *src);
void copyImageData(const DImgPrivate *src);
void setImageData(bool null, uint width, uint height, bool sixteenBit, bool alpha);
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiescolorstab.cpp #545415:545416
@@ -581,11 +581,26 @@
}
d->currentFilePath = url.path();
- d->imageLoaderThread->load(d->currentFilePath, SharedLoadSaveThread::AccessModeRead,
- SharedLoadSaveThread::LoadingPolicyFirstRemovePrevious);
-
+
+ if (DImg::fileFormat(d->currentFilePath) == DImg::RAW)
+ {
+ // use raw settings optimized for speed
+
+ RawDecodingSettings rawDecodingSettings = RawDecodingSettings();
+ rawDecodingSettings.optimizeTimeLoading();
+
+ d->imageLoaderThread->load(LoadingDescription(d->currentFilePath, rawDecodingSettings),
+ SharedLoadSaveThread::AccessModeRead,
+ SharedLoadSaveThread::LoadingPolicyFirstRemovePrevious);
+ }
+ else
+ {
+ d->imageLoaderThread->load(d->currentFilePath, SharedLoadSaveThread::AccessModeRead,
+ SharedLoadSaveThread::LoadingPolicyFirstRemovePrevious);
+ }
+
d->histogramWidget->setDataLoading();
-
+
// Toggle ICC header to busy during loading.
d->blinkTimer->start(200);
}
--- trunk/extragear/graphics/digikam/libs/threadimageio/loadingdescription.h #545415:545416
@@ -34,20 +34,29 @@
{
public:
+ /*
+ Use this for files that are not raw files.
+ Stores only the filePath.
+ */
LoadingDescription(const QString &filePath)
: filePath(filePath)
{
rawDecodingSettings = RawDecodingSettings();
};
-
+
+ /*
+ For raw files:
+ Stores filePath and RawDecodingSettings
+ */
LoadingDescription(const QString &filePath, RawDecodingSettings settings)
: filePath(filePath), rawDecodingSettings(settings)
{};
-
+
QString filePath;
RawDecodingSettings rawDecodingSettings;
- bool operator==(const LoadingDescription &other);
+ QString cacheKey() const;
+ bool operator==(const LoadingDescription &other) const;
};
} // namespace Digikam
--- trunk/extragear/graphics/digikam/libs/threadimageio/loadsavetask.cpp #545415:545416
@@ -117,7 +117,7 @@
{
LoadingCache::CacheLock lock(cache);
DImg *cachedImg;
- if ( (cachedImg = cache->retrieveImage(m_loadingDescription.filePath)) )
+ if ( (cachedImg = cache->retrieveImage(m_loadingDescription.cacheKey())) )
{
// image is found in image cache, loading is successfull
//kdDebug() << "SharedLoadingTask " << this << ": " << m_loadingDescription.filePath << " found in image cache" << endl;
@@ -127,7 +127,7 @@
QApplication::postEvent(m_thread, new LoadedEvent(m_loadingDescription.filePath, img));
return;
}
- else if ( (usedProcess = cache->retrieveLoadingProcess(m_loadingDescription.filePath)) )
+ else if ( (usedProcess = cache->retrieveLoadingProcess(m_loadingDescription.cacheKey())) )
{
// Other process is right now loading this image.
// Add this task to the list of listeners and
@@ -166,7 +166,7 @@
LoadingCache::CacheLock lock(cache);
// put (valid) image into cache of loaded images
if (!img.isNull())
- isCached = cache->putImage(m_loadingDescription.filePath, new DImg(img));
+ isCached = cache->putImage(m_loadingDescription.cacheKey(), new DImg(img));
// remove this from the list of loading processes in cache
cache->removeLoadingProcess(this);
}
--- trunk/extragear/graphics/digikam/libs/threadimageio/loadsavethread.cpp #545415:545416
@@ -28,14 +28,25 @@
#include "loadsavethread.h"
#include "managedloadsavethread.h"
#include "sharedloadsavethread.h"
-#include "loadingcache.h"
#include "loadsavetask.h"
namespace Digikam
{
-bool LoadingDescription::operator==(const LoadingDescription &other)
+QString LoadingDescription::cacheKey() const
{
+ // Here we have the knowledge which LoadingDescriptions / RawFileDecodingSettings
+ // must be cached separately.
+ // When the Raw loading settings are changed in setup, the cache is cleaned,
+ // so we do not need to store check for every option here.
+ if (rawDecodingSettings.halfSizeColorImage)
+ return filePath + "-halfSizeColorImage";
+ else
+ return filePath;
+}
+
+bool LoadingDescription::operator==(const LoadingDescription &other) const
+{
return filePath == other.filePath &&
rawDecodingSettings.cameraColorBalance == other.rawDecodingSettings.cameraColorBalance &&
rawDecodingSettings.automaticColorBalance == other.rawDecodingSettings.automaticColorBalance &&
--- trunk/extragear/graphics/digikam/libs/threadimageio/managedloadsavethread.cpp #545415:545416
@@ -27,7 +27,6 @@
// Local includes.
#include "managedloadsavethread.h"
-#include "loadingcache.h"
#include "loadsavetask.h"
namespace Digikam
More information about the Digikam-devel
mailing list