further speedup for histogram matching

This commit is contained in:
heckflosse
2018-02-01 18:44:25 +01:00
parent 7848915e58
commit 00d6da7d89
2 changed files with 133 additions and 133 deletions

View File

@@ -395,7 +395,7 @@ RawMetaDataLocation Thumbnail::loadMetaDataFromRaw (const Glib::ustring& fname)
return rml; return rml;
} }
Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool multiThread) Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool forHistogramMatching)
{ {
RawImage *ri = new RawImage (fname); RawImage *ri = new RawImage (fname);
unsigned int tempImageNum = 0; unsigned int tempImageNum = 0;
@@ -427,10 +427,9 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
tpp->greenMultiplier = ri->get_pre_mul (1); tpp->greenMultiplier = ri->get_pre_mul (1);
tpp->blueMultiplier = ri->get_pre_mul (2); tpp->blueMultiplier = ri->get_pre_mul (2);
//ri->scale_colors();
float pre_mul[4], scale_mul[4], cblack[4]; float pre_mul[4], scale_mul[4], cblack[4];
ri->get_colorsCoeff (pre_mul, scale_mul, cblack, false); ri->get_colorsCoeff (pre_mul, scale_mul, cblack, false);
scale_colors (ri, scale_mul, cblack, multiThread); scale_colors (ri, scale_mul, cblack, forHistogramMatching); // enable multithreading when forHistogramMatching is true
ri->pre_interpolate(); ri->pre_interpolate();
@@ -672,6 +671,7 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
} else { } else {
tpp->scale = (double) height / (rotate_90 ? w : h); tpp->scale = (double) height / (rotate_90 ? w : h);
} }
if(!forHistogramMatching) { // we don't need this for histogram matching
// generate histogram for auto exposure, also calculate autoWB // generate histogram for auto exposure, also calculate autoWB
tpp->aeHistCompression = 3; tpp->aeHistCompression = 3;
@@ -798,7 +798,6 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
} }
} }
} }
if (ri->get_colors() == 1) { if (ri->get_colors() == 1) {
pixSum[0] = pixSum[1] = pixSum[2] = 1.; pixSum[0] = pixSum[1] = pixSum[2] = 1.;
n[0] = n[1] = n[2] = 1; n[0] = n[1] = n[2] = 1;
@@ -819,6 +818,7 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
ColorTemp cTemp; ColorTemp cTemp;
cTemp.mul2temp (tpp->redAWBMul, tpp->greenAWBMul, tpp->blueAWBMul, tpp->wbEqual, tpp->autoWBTemp, tpp->autoWBGreen); cTemp.mul2temp (tpp->redAWBMul, tpp->greenAWBMul, tpp->blueAWBMul, tpp->wbEqual, tpp->autoWBTemp, tpp->autoWBGreen);
}
if (rotate && ri->get_rotateDegree() > 0) { if (rotate && ri->get_rotateDegree() > 0) {
tpp->thumbImg->rotate (ri->get_rotateDegree()); tpp->thumbImg->rotate (ri->get_rotateDegree());
@@ -930,7 +930,7 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int
} }
// Full thumbnail processing, second stage if complete profile exists // Full thumbnail processing, second stage if complete profile exists
IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& myscale, bool forMonitor, bool multiThread) IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& myscale, bool forMonitor, bool forHistogramMatching)
{ {
unsigned int imgNum = 0; unsigned int imgNum = 0;
if (isRaw) { if (isRaw) {
@@ -1062,7 +1062,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
int fh = baseImg->getHeight(); int fh = baseImg->getHeight();
//ColorTemp::CAT02 (baseImg, &params) ;//perhaps not good! //ColorTemp::CAT02 (baseImg, &params) ;//perhaps not good!
ImProcFunctions ipf (&params, multiThread); ImProcFunctions ipf (&params, forHistogramMatching); // enable multithreading when forHistogramMatching is true
ipf.setScale (sqrt (double (fw * fw + fh * fh)) / sqrt (double (thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale); ipf.setScale (sqrt (double (fw * fw + fh * fh)) / sqrt (double (thumbImg->getWidth() * thumbImg->getWidth() + thumbImg->getHeight() * thumbImg->getHeight()))*scale);
ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), options.rtSettings.monitorIntent, false, false); ipf.updateColorProfiles (ICCStore::getInstance()->getDefaultMonitorProfileName(), options.rtSettings.monitorIntent, false, false);

View File

@@ -71,13 +71,13 @@ public:
void init (); void init ();
IImage8* processImage (const procparams::ProcParams& pparams, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& scale, bool forMonitor=true, bool multiThread = false); IImage8* processImage (const procparams::ProcParams& pparams, eSensorType sensorType, int rheight, TypeInterpolation interp, const FramesMetaData *metadata, double& scale, bool forMonitor=true, bool forHistogramMatching = false);
IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp); IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp);
int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio); int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio);
void getDimensions (int& w, int& h, double& scaleFac); void getDimensions (int& w, int& h, double& scaleFac);
static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode = false); static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, bool rotate, bool inspectorMode = false);
static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool multiThread = false); static Thumbnail* loadFromRaw (const Glib::ustring& fname, RawMetaDataLocation& rml, eSensorType &sensorType, int &w, int &h, int fixwh, double wbEq, bool rotate, bool forHistogramMatching = false);
static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh, double wbEq, bool inspectorMode = false); static Thumbnail* loadFromImage (const Glib::ustring& fname, int &w, int &h, int fixwh, double wbEq, bool inspectorMode = false);
static RawMetaDataLocation loadMetaDataFromRaw (const Glib::ustring& fname); static RawMetaDataLocation loadMetaDataFromRaw (const Glib::ustring& fname);