Speedup in opening an image

This commit is contained in:
ffsup2
2010-10-28 23:40:40 +02:00
parent 8c6bfa22ad
commit e137ccd151
6 changed files with 41 additions and 66 deletions

View File

@@ -28,8 +28,8 @@ namespace rtengine {
extern Settings* settings;
ImProcCoordinator::ImProcCoordinator ()
: awbComputed(false), ipf(&params, true), scale(-1), allocated(false),
pW(-1), pH(-1), plistener(NULL), imageListener(NULL),
: awbComputed(false), ipf(&params, true), scale(10), allocated(false),
pW(-1), pH(-1), plistener(NULL), imageListener(NULL),fineDetailsProcessed(false),
aeListener(NULL), hListener(NULL), resultValid(false),
changeSinceLast(0), updaterRunning(false), destroying(false) {
}
@@ -61,7 +61,7 @@ DetailedCrop* ImProcCoordinator::createCrop () {
return new Crop (this);
}
void ImProcCoordinator::updatePreviewImage (int todo) {
void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
mProcessing.lock ();
@@ -77,11 +77,28 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
ipf.setScale (scale);
bool highDetailNeeded=false;
for (int i=0; i<crops.size(); i++)
if (crops[i]->get_skip() == 1 ){
highDetailNeeded=true;
break;
}
progress ("Applying white balance, color correction & sRBG conversion...",100*readyphase/numofphases);
if ( todo & M_PREPROC)
imgsrc->preprocess( params.raw );
if( todo & M_RAW)
imgsrc->demosaic( params.raw );
if( todo & M_RAW){
RAWParams rp = params.raw;
if( !highDetailNeeded ){
rp.dmethod = RAWParams::methodstring[RAWParams::fast];
rp.ca_autocorrect = false;
rp.ccSteps = 0;
fineDetailsProcessed = false;
}else
fineDetailsProcessed = true;
imgsrc->demosaic( rp );
}
if (todo & M_INIT) {
minit.lock ();
if (settings->verbose) printf ("Applying white balance, color correction & sRBG conversion...\n");
@@ -161,54 +178,6 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
if (todo & M_LUMACURVE)
CurveFactory::complexCurve (0.0, 0.0, 0.0, 0.0, params.lumaCurve.brightness, params.lumaCurve.contrast, 0.0, 0.0, false, params.lumaCurve.curve, lhist16, lumacurve, bcLhist, scale==1 ? 1 : 16);
/*
if (todo & M_LUMINANCE) {
progress ("Applying Luminance Curve...",100*readyphase/numofphases);
ipf.luminanceCurve (oprevl, nprevl, lumacurve, 0, pH);
readyphase++;
if (scale==1) {
progress ("Denoising luminance impulse...",100*readyphase/numofphases);
ipf.impulsedenoise (nprevl);
}
if (scale==1) {
progress ("Denoising luminance...",100*readyphase/numofphases);
ipf.lumadenoise (nprevl, buffer);
}
readyphase++;
if (scale==1) {
progress ("Sharpening...",100*readyphase/numofphases);
ipf.sharpening (nprevl, (unsigned short**)buffer);
}
if (scale==1) {
progress ("Wavelet...",100*readyphase/numofphases);
ipf.waveletEqualizer (nprevl, true, false);
}
readyphase++;
}
if (todo & M_COLOR) {
progress ("Applying Color Boost...",100*readyphase/numofphases);
ipf.colorCurve (oprevl, nprevl);
readyphase++;
if (scale==1) {
progress ("Denoising color...",100*readyphase/numofphases);
ipf.colordenoise (nprevl, buffer);
}
if (scale==1) {
progress ("Denoising luma/chroma...",100*readyphase/numofphases);
ipf.dirpyrdenoise (nprevl);
}
if (scale==1) {
progress ("Wavelet...",100*readyphase/numofphases);
ipf.waveletEqualizer (nprevl, false, true);
}
readyphase++;
}
*/
if (todo & (M_LUMINANCE+M_COLOR) ) {
progress ("Applying Luminance Curve...",100*readyphase/numofphases);
ipf.luminanceCurve (oprevl, nprevl, lumacurve, 0, pH);
@@ -238,10 +207,6 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
ipf.sharpening (nprevl, (unsigned short**)buffer);
}
readyphase++;
//if (scale==1) {
// progress ("Denoising luminance impulse...",100*readyphase/numofphases);
// ipf.impulsedenoise (nprevl);
//}
if (scale==1) {
progress ("Pyramid equalizer...",100*readyphase/numofphases);
ipf.dirpyrequalizer (nprevl);
@@ -256,7 +221,7 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
// process crop, if needed
for (int i=0; i<crops.size(); i++)
if (crops[i]->hasListener ())
if (crops[i]->hasListener () && cropCall != crops[i] )
crops[i]->update (todo, true);
progress ("Conversion to RGB...",100*readyphase/numofphases);