Fixed a bug where RT would crash sometimes after writing output file in batch queue. Plus small improvements to JPG thumbnails. Some little cleanups.
This commit is contained in:
@@ -336,7 +336,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
||||
baseImg->b[i][j] = CLIP(val);
|
||||
}
|
||||
|
||||
// appy highlight recovery, if needed
|
||||
// apply highlight recovery, if needed
|
||||
if (isRaw && params.hlrecovery.enabled) {
|
||||
int maxval = 65535 / defGain;
|
||||
if (params.hlrecovery.method=="Luminance" || params.hlrecovery.method=="Color")
|
||||
@@ -623,6 +623,7 @@ void Thumbnail::transformPixel (int x, int y, int tran, int& tx, int& ty) {
|
||||
ty/=scale;
|
||||
}
|
||||
|
||||
// format: 1=8bit direct, 2=16bit direct, 3=JPG
|
||||
bool Thumbnail::writeImage (const Glib::ustring& fname, int format) {
|
||||
|
||||
if (!thumbImg)
|
||||
@@ -689,6 +690,14 @@ bool Thumbnail::writeImage (const Glib::ustring& fname, int format) {
|
||||
cinfo.input_components = 3;
|
||||
jpeg_set_defaults (&cinfo);
|
||||
cinfo.write_JFIF_header = FALSE;
|
||||
|
||||
// compute optimal Huffman coding tables for the image. Bit slower to generate, but size of result image is a bit less (default was FALSE)
|
||||
cinfo.optimize_coding = TRUE;
|
||||
|
||||
// Since math coprocessors are common these days, FLOAT should be a bit more accurate AND fast (default is ISLOW)
|
||||
// (machine dependency is not really an issue, since we all run on x86 and having exactly the same file is not a requirement)
|
||||
cinfo.dct_method = JDCT_FLOAT;
|
||||
|
||||
jpeg_set_quality (&cinfo, 85, true);
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
int rowlen = thumbImg->width*3;
|
||||
|
@@ -195,7 +195,7 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
fname = autoCompleteFileName (removeExtension(processing->outFileName), getExtension(processing->outFileName));
|
||||
saveFormat = processing->saveFormat;
|
||||
}
|
||||
printf ("fname=%s, %s\n", fname.c_str(), removeExtension(fname).c_str());
|
||||
//printf ("fname=%s, %s\n", fname.c_str(), removeExtension(fname).c_str());
|
||||
if (img && fname!="") {
|
||||
int err = 0;
|
||||
if (saveFormat.format=="tif")
|
||||
@@ -205,14 +205,16 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
|
||||
else if (saveFormat.format=="jpg")
|
||||
err = img->saveAsJPEG (fname, saveFormat.jpegQuality);
|
||||
img->free ();
|
||||
if (!err && saveFormat.saveParams)
|
||||
|
||||
if (err) throw "Unable to save output file";
|
||||
|
||||
if (saveFormat.saveParams) {
|
||||
// We keep the extension to avoid overwriting the profile when we have
|
||||
// the same output filename with different extension
|
||||
//processing->params.save (removeExtension(fname) + paramFileExtension);
|
||||
processing->params.save (fname + paramFileExtension);
|
||||
else {
|
||||
printf("Unable to process or save %s\n", fname.c_str());
|
||||
}
|
||||
|
||||
if (processing->thumbnail) {
|
||||
processing->thumbnail->imageDeveloped ();
|
||||
processing->thumbnail->imageRemovedFromQueue ();
|
||||
|
@@ -98,9 +98,9 @@ Thumbnail* CacheManager::getEntry (const Glib::ustring& fname) {
|
||||
}
|
||||
delete cfs;
|
||||
}
|
||||
// if not, create a new one
|
||||
if (!res) {
|
||||
|
||||
// if not, create a new one
|
||||
if (!res) {
|
||||
res = new Thumbnail (this, fname, md5);
|
||||
if (!res->isSupported ()) {
|
||||
delete res;
|
||||
@@ -241,15 +241,9 @@ void CacheManager::clearThumbImages () {
|
||||
deleteDir ("images");
|
||||
deleteDir ("aehistograms");
|
||||
deleteDir ("embprofiles");
|
||||
|
||||
// re-generate thumbnail images of open thumbnails
|
||||
//string_thumb_map::iterator i;
|
||||
//for (i=openEntries.begin(); i!=openEntries.end(); i++)
|
||||
// i->second->generateThumbnailImage ();
|
||||
}
|
||||
|
||||
void CacheManager::clearProfiles () {
|
||||
|
||||
Glib::Mutex::Lock lock(mutex_);
|
||||
|
||||
deleteDir ("profiles");
|
||||
|
@@ -131,13 +131,7 @@ void Thumbnail::_generateThumbnailImage () {
|
||||
generateExifDateTimeStrings ();
|
||||
}
|
||||
|
||||
void Thumbnail::generateThumbnailImage () {
|
||||
Glib::Mutex::Lock lock(mutex);
|
||||
_generateThumbnailImage();
|
||||
}
|
||||
|
||||
bool Thumbnail::isSupported () {
|
||||
|
||||
return cfs.supported;
|
||||
}
|
||||
|
||||
|
@@ -98,8 +98,6 @@ class Thumbnail {
|
||||
void getThumbnailSize (int &w, int &h);
|
||||
void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h) { if (tpp) tpp->getFinalSize (pparams, w, h); }
|
||||
|
||||
void generateThumbnailImage ();
|
||||
|
||||
const Glib::ustring& getExifString ();
|
||||
const Glib::ustring& getDateTimeString ();
|
||||
void getCamWB (double& temp, double& green) { if (tpp) tpp->getCamWB (temp, green); }
|
||||
|
Reference in New Issue
Block a user