continuing with my experiments on an alternative "fast export"

This commit is contained in:
Alberto Griggio 2017-03-08 00:50:50 +01:00
parent 200e6dd882
commit 93296cff17
8 changed files with 53 additions and 38 deletions

View File

@ -21,16 +21,16 @@
namespace rtengine
{
ProcessingJob* ProcessingJob::create (const Glib::ustring& fname, bool isRaw, const procparams::ProcParams& pparams)
ProcessingJob* ProcessingJob::create (const Glib::ustring& fname, bool isRaw, const procparams::ProcParams& pparams, bool fast)
{
return new ProcessingJobImpl (fname, isRaw, pparams);
return new ProcessingJobImpl (fname, isRaw, pparams, fast);
}
ProcessingJob* ProcessingJob::create (InitialImage* initialImage, const procparams::ProcParams& pparams)
ProcessingJob* ProcessingJob::create (InitialImage* initialImage, const procparams::ProcParams& pparams, bool fast)
{
return new ProcessingJobImpl (initialImage, pparams);
return new ProcessingJobImpl (initialImage, pparams, fast);
}
void ProcessingJob::destroy (ProcessingJob* job)

View File

@ -32,12 +32,13 @@ public:
bool isRaw;
InitialImage* initialImage;
procparams::ProcParams pparams;
bool fast;
ProcessingJobImpl (const Glib::ustring& fn, bool iR, const procparams::ProcParams& pp)
: fname(fn), isRaw(iR), initialImage(nullptr), pparams(pp) {}
ProcessingJobImpl (const Glib::ustring& fn, bool iR, const procparams::ProcParams& pp, bool ff)
: fname(fn), isRaw(iR), initialImage(nullptr), pparams(pp), fast(ff) {}
ProcessingJobImpl (InitialImage* iImage, const procparams::ProcParams& pp)
: fname(""), isRaw(true), initialImage(iImage), pparams(pp)
ProcessingJobImpl (InitialImage* iImage, const procparams::ProcParams& pp, bool ff)
: fname(""), isRaw(true), initialImage(iImage), pparams(pp), fast(ff)
{
iImage->increaseRef();
}

View File

@ -468,7 +468,7 @@ public:
* @param isRaw shall be true if it is a raw file
* @param pparams is a struct containing the processing parameters
* @return an object containing the data above. It can be passed to the functions that do the actual image processing. */
static ProcessingJob* create (const Glib::ustring& fname, bool isRaw, const procparams::ProcParams& pparams);
static ProcessingJob* create (const Glib::ustring& fname, bool isRaw, const procparams::ProcParams& pparams, bool fast=false);
/** Creates a processing job from a file name. This function always succeeds. It only stores the data into the ProcessingJob class, it does not load
* the image thus it returns immediately. This function increases the reference count of the initialImage. If you decide not the process the image you
@ -477,7 +477,7 @@ public:
* @param initialImage is a loaded and pre-processed initial image
* @param pparams is a struct containing the processing parameters
* @return an object containing the data above. It can be passed to the functions that do the actual image processing. */
static ProcessingJob* create (InitialImage* initialImage, const procparams::ProcParams& pparams);
static ProcessingJob* create (InitialImage* initialImage, const procparams::ProcParams& pparams, bool fast=false);
/** Cancels and destroys a processing job. The reference count of the corresponding initialImage (if any) is decreased. After the call of this function the ProcessingJob instance
* gets invalid, you must not use it any more. Dont call this function while the job is being processed.

View File

@ -41,7 +41,7 @@ class ImageProcessor {
public:
ImageProcessor(ProcessingJob* pjob, int& errorCode,
ProgressListener* pl, bool tunnelMetaData, bool flush):
pjob(pjob),
job(static_cast<ProcessingJobImpl*>(pjob)),
errorCode(errorCode),
pl(pl),
tunnelMetaData(tunnelMetaData),
@ -55,9 +55,9 @@ public:
{
}
Image16 *operator()(bool fast)
Image16 *operator()()
{
if (!fast) {
if (!job->fast) {
return normal_pipeline();
} else {
return fast_pipeline();
@ -81,21 +81,28 @@ private:
Image16 *fast_pipeline()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
if (!job->pparams.resize.enabled) {
return normal_pipeline();
}
pl = nullptr;
if (!stage_1()) {
return nullptr;
}
stage_calc_denoise();
printf("after calc denoise\n"); fflush(stdout);
stage_2();
stage_4();
printf("after 4\n"); fflush(stdout);
stage_early_resize();
stage_calc_denoise();
printf("after early resize\n"); fflush(stdout);
stage_3();
printf("after 3\n"); fflush(stdout);
stage_5();
printf("after 5\n"); fflush(stdout);
stage_6();
printf("after 6\n"); fflush(stdout);
return stage_7();
}
@ -103,8 +110,6 @@ private:
{
errorCode = 0;
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
if (pl) {
pl->setProgressStr ("PROGRESSBAR_PROCESSING");
pl->setProgress (0.0);
@ -235,7 +240,6 @@ private:
void stage_calc_denoise()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -714,7 +718,6 @@ private:
void stage_2()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -753,7 +756,6 @@ private:
void stage_3()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -826,7 +828,6 @@ private:
void stage_4()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -849,7 +850,6 @@ private:
void stage_5()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -994,7 +994,6 @@ private:
void stage_6()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -1192,7 +1191,6 @@ private:
Image16 *stage_7()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -1389,7 +1387,6 @@ private:
void stage_early_resize()
{
ProcessingJobImpl* job = static_cast<ProcessingJobImpl*>(pjob);
procparams::ProcParams& params = job->pparams;
ImProcFunctions ipf (&params, true);
@ -1435,14 +1432,16 @@ private:
tmplab = resized;
params.resize.enabled = false;
if (params.prsharpening.enabled) {
params.sharpening = params.prsharpening;
}
params.wavelet.strength =
int(float(params.wavelet.strength) * tmpScale);
params.dirpyrDenoise.luma *= tmpScale;
// params.dirpyrDenoise.smethod = "shal";
params.dirpyrDenoise.smethod = "shal";
for (int i = 0; i < 6; ++i) {
auto &n = params.dirpyrequalizer.mult[i];
n = 1.0 + (n - 1.0) * tmpScale;
}
fw = imw;
fh = imh;
@ -1455,7 +1454,7 @@ private:
}
private:
ProcessingJob* pjob;
ProcessingJobImpl* job;
int& errorCode;
ProgressListener* pl;
bool tunnelMetaData;
@ -1534,7 +1533,7 @@ private:
IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool tunnelMetaData, bool flush)
{
ImageProcessor proc(pjob, errorCode, pl, tunnelMetaData, flush);
return proc(true);
return proc();
}
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData)

View File

@ -34,6 +34,9 @@
#include "guiutils.h"
#include "rtimage.h"
#include <sys/time.h>
#include "../rtengine/processingjob.h"
using namespace std;
using namespace rtengine;
@ -227,7 +230,7 @@ bool BatchQueue::saveBatchQueue ()
// The column's header is mandatory (the first line will be skipped when loaded)
file << "input image full path|param file full path|output image full path|file format|jpeg quality|jpeg subsampling|"
<< "png bit depth|png compression|tiff bit depth|uncompressed tiff|save output params|force format options|<end of line>"
<< "png bit depth|png compression|tiff bit depth|uncompressed tiff|save output params|force format options|fast export|<end of line>"
<< std::endl;
// method is already running with entryLock, so no need to lock again
@ -242,6 +245,7 @@ bool BatchQueue::saveBatchQueue ()
<< saveFormat.pngBits << '|' << saveFormat.pngCompression << '|'
<< saveFormat.tiffBits << '|' << saveFormat.tiffUncompressed << '|'
<< saveFormat.saveParams << '|' << entry->forceFormatOpts << '|'
<< static_cast<ProcessingJobImpl *>(entry->job)->fast << '|'
<< std::endl;
}
}
@ -308,6 +312,7 @@ bool BatchQueue::loadBatchQueue ()
const auto tiffUncompressed = nextIntOr (options.saveFormat.tiffUncompressed);
const auto saveParams = nextIntOr (options.saveFormat.saveParams);
const auto forceFormatOpts = nextIntOr (options.forceFormatOpts);
const auto fast = nextIntOr(false);
rtengine::procparams::ProcParams pparams;
@ -319,7 +324,7 @@ bool BatchQueue::loadBatchQueue ()
if (!thumb)
continue;
auto job = rtengine::ProcessingJob::create (source, thumb->getType () == FT_Raw, pparams);
auto job = rtengine::ProcessingJob::create (source, thumb->getType () == FT_Raw, pparams, fast);
auto prevh = getMaxThumbnailHeight ();
auto prevw = prevh;

View File

@ -389,6 +389,7 @@ FileBrowser::FileBrowser ()
untrash->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Delete, Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE);
open->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Return, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE);
develop->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_B, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
developfast->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_B, Gdk::CONTROL_MASK | Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE);
copyprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_C, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
pasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_V, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
partpasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_V, Gdk::CONTROL_MASK | Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE);
@ -1139,9 +1140,12 @@ bool FileBrowser::keyPressed (GdkEventKey* event)
} else if (event->keyval == GDK_KEY_Delete && shift) {
menuItemActivated (untrash);
return true;
} else if ((event->keyval == GDK_KEY_B || event->keyval == GDK_KEY_b) && ctrl) {
} else if ((event->keyval == GDK_KEY_B || event->keyval == GDK_KEY_b) && ctrl && !shift) {
menuItemActivated (develop);
return true;
} else if ((event->keyval == GDK_KEY_B || event->keyval == GDK_KEY_b) && ctrl && shift) {
menuItemActivated (developfast);
return true;
} else if ((event->keyval == GDK_KEY_A || event->keyval == GDK_KEY_a) && ctrl) {
menuItemActivated (selall);
return true;

View File

@ -1094,7 +1094,7 @@ void FileCatalog::developRequested (std::vector<FileBrowserEntry*> tbe, bool fas
// controlling time and resource consuming tasks
// and also those which effect is not pronounced after reducing the image size
// TODO!!! could expose selections below via preferences
if (fastmode) {
if (fastmode && false) {
if (options.fastexport_bypass_sharpening ) {
params.sharpening.enabled = false;
}
@ -1187,7 +1187,7 @@ void FileCatalog::developRequested (std::vector<FileBrowserEntry*> tbe, bool fas
params.resize.height = options.fastexport_resize_height ;
}
rtengine::ProcessingJob* pjob = rtengine::ProcessingJob::create (fbe->filename, th->getType() == FT_Raw, params);
rtengine::ProcessingJob* pjob = rtengine::ProcessingJob::create (fbe->filename, th->getType() == FT_Raw, params, fastmode);
int pw;
int ph = BatchQueue::calcMaxThumbnailHeight();

View File

@ -83,6 +83,8 @@ Glib::ustring fname_to_utf8 (const char* fname)
#endif
}
bool fast_export = false;
}
// This recursive mutex will be used by gdk_threads_enter/leave instead of a simple mutex
@ -537,6 +539,10 @@ int processLineParams( int argc, char **argv )
compression = -1;
break;
case 'f':
fast_export = true;
break;
case 'c': // MUST be last option
while (iArg + 1 < argc) {
iArg++;
@ -845,7 +851,7 @@ int processLineParams( int argc, char **argv )
continue;
}
job = rtengine::ProcessingJob::create (ii, currentParams);
job = rtengine::ProcessingJob::create (ii, currentParams, fast_export);
if( !job ) {
errors++;