Filter for unnecessary slow demosaicing when switch between history states

see issue 923
This commit is contained in:
Oliver Duis
2011-08-20 21:26:52 +02:00
parent cb4ab1fabd
commit c57bc0c15f
9 changed files with 75 additions and 44 deletions

View File

@@ -121,17 +121,17 @@ int main (int argc, char* argv[]) {
// if you want to change the settings you have to ask for the procparams structure of the staged image processor
// you have to tell it what has changed. At the first time tell it EvPhotoLoaded so a full processing will be performed
rtengine::procparams::ProcParams* params = ipc->getParamsForUpdate (rtengine::EvPhotoLoaded);
rtengine::procparams::ProcParams* params = ipc->beginUpdateParams ();
// change this and that...
params->toneCurve.brightness = 1.0;
// you can load it, too, from a file: params->load (argv[2]);
// finally you have to call this non-blocking method, and the image processing starts in the background. When finished, the preview image listener will be notified
ipc->paramsUpdateReady ();
ipc->endUpdateParams (rtengine::EvPhotoLoaded);
// you can go on with changing of the settings, following the gui actions
// now we know that only the brightness has changed compared to the previous settings, to only a part of the processing has to be repeated
params = ipc->getParamsForUpdate (rtengine::EvBrightness);
params = ipc->beginUpdateParams ();
params->toneCurve.brightness = 1.2;
ipc->paramsUpdateReady ();
ipc->endUpdateParams (rtengine::EvBrightness);
// ... and so on. If you dont need it any more, you can destroy it (make sure that no processing is happening when you destroy it!)
StagedImageProcessor::destroy (ipc);

View File

@@ -615,17 +615,21 @@ void ImProcCoordinator::process () {
plistener->setProgressState (false);
}
ProcParams* ImProcCoordinator::getParamsForUpdate (ProcEvent change) {
ProcParams* ImProcCoordinator::beginUpdateParams () {
paramsUpdateMutex.lock ();
changeSinceLast |= refreshmap[(int)change];
return &nextParams;
}
void ImProcCoordinator::paramsUpdateReady () {
void ImProcCoordinator::endUpdateParams (ProcEvent change) {
endUpdateParams( refreshmap[(int)change] );
}
void ImProcCoordinator::endUpdateParams (int changeFlags) {
changeSinceLast |= changeFlags;
paramsUpdateMutex.unlock ();
startProcessing (); // Executes what has been requested with getParamsForUpdate
startProcessing ();
}

View File

@@ -126,8 +126,9 @@ class ImProcCoordinator : public StagedImageProcessor {
void getParams (procparams::ProcParams* dst) { *dst = params; }
void startProcessing(int changeCode);
ProcParams* getParamsForUpdate (ProcEvent change);
void paramsUpdateReady (); // must be called after getParamsForUpdate, triggers full update
ProcParams* beginUpdateParams ();
void endUpdateParams (ProcEvent change); // must be called after beginUpdateParams, triggers update
void endUpdateParams (int changeFlags);
void stopProcessing ();

View File

@@ -64,6 +64,7 @@
#define IPTC M_VOID
#define DIRPYREQUALIZER (M_COLOR|M_LUMINANCE)
#define NONE 0
#define ALLNORAW (M_INIT|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR)
extern int refreshmap[];
#endif

View File

@@ -250,12 +250,13 @@ namespace rtengine {
* processing parameters, that you have to update to reflect the changed situation. When ready, call the paramsUpdateReady
* function to start the image update.
* @param change is the ID of the changed setting */
virtual procparams::ProcParams* getParamsForUpdate (ProcEvent change) =0;
virtual procparams::ProcParams* beginUpdateParams () =0;
/** An essential member function. This indicates that you are ready with the update of the processing parameters you got
* with the getParamsForUpdate call, so the image can be updated. This function returns immediately.
* with the beginUpdateParams call, so the image can be updated. This function returns immediately.
* The image update starts immediately in the background. If it is ready, the result is passed to a PreviewImageListener
* and to a DetailedCropListener (if enabled). */
virtual void paramsUpdateReady () =0;
virtual void endUpdateParams (ProcEvent change) =0;
virtual void endUpdateParams (int changeFlags) =0;
// Starts a minimal update
virtual void startProcessing(int changeCode) =0;
/** Stops image processing. When it returns, the image processing is already stopped. */