|
|
|
@ -11,7 +11,7 @@
|
|
|
|
|
* Copyright (C) 2007-2008 by Guillaume Castagnino <casta at xwing dot info>
|
|
|
|
|
*
|
|
|
|
|
* NOTE: Do not use kdDebug() in this implementation because
|
|
|
|
|
* it will be multithreaded. Use qDebug() instead.
|
|
|
|
|
* it will be multithreaded. Use tqDebug() instead.
|
|
|
|
|
* See B.K.O #133026 for details.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it
|
|
|
|
@ -85,16 +85,16 @@ bool KDcraw::loadEmbeddedPreview(TQImage& image, const TQString& path)
|
|
|
|
|
|
|
|
|
|
if ( loadEmbeddedPreview(imgData, path) )
|
|
|
|
|
{
|
|
|
|
|
qDebug("Preview data size: %i", imgData.size());
|
|
|
|
|
tqDebug("Preview data size: %i", imgData.size());
|
|
|
|
|
|
|
|
|
|
if (image.loadFromData( imgData ))
|
|
|
|
|
{
|
|
|
|
|
qDebug("Using embedded RAW preview extraction");
|
|
|
|
|
tqDebug("Using embedded RAW preview extraction");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug("Failed to load embedded RAW preview");
|
|
|
|
|
tqDebug("Failed to load embedded RAW preview");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -112,7 +112,7 @@ bool KDcraw::loadEmbeddedPreview(TQByteArray& imgData, const TQString& path)
|
|
|
|
|
int ret = raw.open_file((const char*)(TQFile::encodeName(path)));
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -121,7 +121,7 @@ bool KDcraw::loadEmbeddedPreview(TQByteArray& imgData, const TQString& path)
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
raw.recycle();
|
|
|
|
|
qDebug("LibRaw: failed to run unpack_thumb: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run unpack_thumb: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -129,7 +129,7 @@ bool KDcraw::loadEmbeddedPreview(TQByteArray& imgData, const TQString& path)
|
|
|
|
|
libraw_processed_image_t *thumb = raw.dcraw_make_mem_thumb(&ret);
|
|
|
|
|
if(!thumb)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run dcraw_make_mem_thumb: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run dcraw_make_mem_thumb: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -149,7 +149,7 @@ bool KDcraw::loadEmbeddedPreview(TQByteArray& imgData, const TQString& path)
|
|
|
|
|
|
|
|
|
|
if ( imgData.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
qDebug("Failed to load JPEG thumb from LibRaw!");
|
|
|
|
|
tqDebug("Failed to load JPEG thumb from LibRaw!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -165,7 +165,7 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.upper().contains(ext))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
qDebug("Try to use reduced RAW picture extraction");
|
|
|
|
|
tqDebug("Try to use reduced RAW picture extraction");
|
|
|
|
|
|
|
|
|
|
LibRaw raw;
|
|
|
|
|
raw.imgdata.params.use_auto_wb = 1; // Use automatic white balance.
|
|
|
|
@ -178,7 +178,7 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
int ret = raw.open_file((const char*)(TQFile::encodeName(path)));
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -186,7 +186,7 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
ret = raw.unpack();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -194,7 +194,7 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
ret = raw.dcraw_process();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run dcraw_process: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run dcraw_process: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -202,7 +202,7 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
libraw_processed_image_t *halfImg = raw.dcraw_make_mem_image(&ret);
|
|
|
|
|
if(!halfImg)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run dcraw_make_mem_image: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run dcraw_make_mem_image: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -214,11 +214,11 @@ bool KDcraw::loadHalfPreview(TQImage& image, const TQString& path)
|
|
|
|
|
|
|
|
|
|
if (!image.loadFromData(imgData))
|
|
|
|
|
{
|
|
|
|
|
qDebug("Failed to load PPM data from LibRaw!");
|
|
|
|
|
tqDebug("Failed to load PPM data from LibRaw!");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug("Using reduced RAW picture extraction");
|
|
|
|
|
tqDebug("Using reduced RAW picture extraction");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -237,7 +237,7 @@ bool KDcraw::rawFileIdentify(DcrawInfoContainer& identify, const TQString& path)
|
|
|
|
|
int ret = raw.open_file((const char*)(TQFile::encodeName(path)));
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -245,7 +245,7 @@ bool KDcraw::rawFileIdentify(DcrawInfoContainer& identify, const TQString& path)
|
|
|
|
|
ret = raw.adjust_sizes_info_only();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run adjust_sizes_info_only: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run adjust_sizes_info_only: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -279,7 +279,7 @@ bool KDcraw::extractRAWData(const TQString& filePath, TQByteArray &rawData, Dcra
|
|
|
|
|
int ret = raw.open_file((const char*)(TQFile::encodeName(filePath)));
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -297,7 +297,7 @@ bool KDcraw::extractRAWData(const TQString& filePath, TQByteArray &rawData, Dcra
|
|
|
|
|
ret = raw.unpack();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -548,7 +548,7 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
RGB[0] = 1.0 / RGB[0];
|
|
|
|
|
RGB[1] = 1.0 / RGB[1];
|
|
|
|
|
RGB[2] = 1.0 / RGB[2];
|
|
|
|
|
qDebug("Warning: cannot get daylight multipliers");
|
|
|
|
|
tqDebug("Warning: cannot get daylight multipliers");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (-r) set Raw Color Balance Multipliers.
|
|
|
|
@ -644,12 +644,12 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
d->setProgress(0.1);
|
|
|
|
|
|
|
|
|
|
args.append(filePath);
|
|
|
|
|
qDebug("LibRaw: dcraw emulation: %s", args.join(", ").ascii());
|
|
|
|
|
tqDebug("LibRaw: dcraw emulation: %s", args.join(", ").ascii());
|
|
|
|
|
|
|
|
|
|
int ret = raw.open_file((const char*)(TQFile::encodeName(filePath)));
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run open_file: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -664,7 +664,7 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
ret = raw.unpack();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run unpack: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -679,7 +679,7 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
ret = raw.dcraw_process();
|
|
|
|
|
if (ret != LIBRAW_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run dcraw_process: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run dcraw_process: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -694,7 +694,7 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
libraw_processed_image_t *img = raw.dcraw_make_mem_image(&ret);
|
|
|
|
|
if(!img)
|
|
|
|
|
{
|
|
|
|
|
qDebug("LibRaw: failed to run dcraw_make_mem_image: %s", libraw_strerror(ret));
|
|
|
|
|
tqDebug("LibRaw: failed to run dcraw_make_mem_image: %s", libraw_strerror(ret));
|
|
|
|
|
raw.recycle();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -720,7 +720,7 @@ bool KDcraw::loadFromDcraw(const TQString& filePath, TQByteArray &imageData,
|
|
|
|
|
return false;
|
|
|
|
|
d->setProgress(0.4);
|
|
|
|
|
|
|
|
|
|
qDebug("LibRaw: data info: width %i height %i rgbmax %i", width, height, rgbmax);
|
|
|
|
|
tqDebug("LibRaw: data info: width %i height %i rgbmax %i", width, height, rgbmax);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|