"Fossies" - the Fresh Open Source Software Archive

Member "rawtherapee-5.7/rtengine/rtengine.h" (10 Sep 2019, 30276 Bytes) of package /linux/misc/rawtherapee-5.7.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "rtengine.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5.6_vs_5.7.

    1 /*
    2  *  This file is part of RawTherapee.
    3  *
    4  *  Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
    5  *
    6  *  RawTherapee is free software: you can redistribute it and/or modify
    7  *  it under the terms of the GNU General Public License as published by
    8  *  the Free Software Foundation, either version 3 of the License, or
    9  *  (at your option) any later version.
   10  *
   11  *  RawTherapee is distributed in the hope that it will be useful,
   12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  *  GNU General Public License for more details.
   15  *
   16  *  You should have received a copy of the GNU General Public License
   17  *  along with RawTherapee.  If not, see <https://www.gnu.org/licenses/>.
   18  */
   19 #pragma once
   20 
   21 #include <array>
   22 #include <ctime>
   23 #include <string>
   24 
   25 #include <glibmm.h>
   26 
   27 #include <lcms2.h>
   28 
   29 #include "iimage.h"
   30 #include "imageformat.h"
   31 #include "LUT.h"
   32 #include "procevents.h"
   33 #include "rawmetadatalocation.h"
   34 #include "rt_math.h"
   35 #include "settings.h"
   36 #include "utils.h"
   37 
   38 #include "../rtexif/rtexif.h"
   39 
   40 #include "../rtgui/threadutils.h"
   41 
   42 /**
   43  * @file
   44  * This file contains the main functionality of the RawTherapee engine.
   45  *
   46  */
   47 
   48 class EditDataProvider;
   49 
   50 namespace rtengine
   51 {
   52 
   53 enum RenderingIntent : int;
   54 
   55 namespace procparams
   56 {
   57 
   58 class ProcParams;
   59 class IPTCPairs;
   60 
   61 struct RAWParams;
   62 struct ColorManagementParams;
   63 struct CropParams;
   64 
   65 enum class ToneCurveMode : int;
   66 
   67 }
   68 
   69 class IImage8;
   70 class IImage16;
   71 class IImagefloat;
   72 class ImageSource;
   73 
   74 /**
   75   * This class provides functions to obtain exif and IPTC metadata information
   76   * from any of the sub-frame of an image file
   77   */
   78 class FramesMetaData
   79 {
   80 
   81 public:
   82     /** @return Returns the number of root Metadata */
   83     virtual unsigned int getRootCount () const = 0;
   84     /** @return Returns the number of frame contained in the file based on Metadata */
   85     virtual unsigned int getFrameCount () const = 0;
   86 
   87     /** Checks the availability of exif metadata tags.
   88       * @return Returns true if image contains exif metadata tags */
   89     virtual bool hasExif (unsigned int frame = 0) const = 0;
   90     /** Returns the directory of exif metadata tags.
   91       * @param root root number in the metadata tree
   92       * @return The directory of exif metadata tags */
   93     virtual rtexif::TagDirectory* getRootExifData (unsigned int root = 0) const = 0;
   94     /** Returns the directory of exif metadata tags.
   95       * @param frame frame number in the metadata tree
   96       * @return The directory of exif metadata tags */
   97     virtual rtexif::TagDirectory* getFrameExifData (unsigned int frame = 0) const = 0;
   98     /** Returns the directory of exif metadata tags containing at least the 'Make' tag for the requested frame.
   99       * If no usable metadata exist in the frame, send back the best TagDirectory describing the frame content.
  100       * @param imgSource rawimage that we want the metadata from
  101       * @param rawParams RawParams to select the frame number
  102       * @return The directory of exif metadata tags containing at least the 'Make' tag */
  103     virtual rtexif::TagDirectory* getBestExifData (ImageSource *imgSource, procparams::RAWParams *rawParams) const = 0;
  104     /** Checks the availability of IPTC tags.
  105       * @return Returns true if image contains IPTC tags */
  106     virtual bool hasIPTC (unsigned int frame = 0) const = 0;
  107     /** Returns the directory of IPTC tags.
  108       * @return The directory of IPTC tags */
  109     virtual procparams::IPTCPairs getIPTCData (unsigned int frame = 0) const = 0;
  110     /** @return a struct containing the date and time of the image */
  111     virtual tm getDateTime (unsigned int frame = 0) const = 0;
  112     /** @return a timestamp containing the date and time of the image */
  113     virtual time_t getDateTimeAsTS(unsigned int frame = 0) const = 0;
  114     /** @return the ISO of the image */
  115     virtual int getISOSpeed (unsigned int frame = 0) const = 0;
  116     /** @return the F number of the image */
  117     virtual double getFNumber  (unsigned int frame = 0) const = 0;
  118     /** @return the focal length used at the exposure */
  119     virtual double getFocalLen (unsigned int frame = 0) const = 0;
  120     /** @return the focal length in 35mm used at the exposure */
  121     virtual double getFocalLen35mm (unsigned int frame = 0) const = 0;
  122     /** @return the focus distance in meters, 0=unknown, 10000=infinity */
  123     virtual float getFocusDist (unsigned int frame = 0) const = 0;
  124     /** @return the shutter speed */
  125     virtual double getShutterSpeed (unsigned int frame = 0) const = 0;
  126     /** @return the exposure compensation */
  127     virtual double getExpComp (unsigned int frame = 0) const = 0;
  128     /** @return the maker of the camera */
  129     virtual std::string getMake     (unsigned int frame = 0) const = 0;
  130     /** @return the model of the camera */
  131     virtual std::string getModel    (unsigned int frame = 0) const = 0;
  132 
  133     std::string getCamera   (unsigned int frame = 0) const
  134     {
  135         return getMake(frame) + " " + getModel(frame);
  136     }
  137 
  138     /** @return the lens on the camera  */
  139     virtual std::string getLens     (unsigned int frame = 0) const = 0;
  140     /** @return the orientation of the image */
  141     virtual std::string getOrientation (unsigned int frame = 0) const = 0;
  142     /** @return the rating of the image */
  143     virtual int getRating (unsigned int frame = 0) const = 0;
  144 
  145     /** @return true if the file is a PixelShift shot (Pentax and Sony bodies) */
  146     virtual bool getPixelShift () const = 0;
  147     /** @return false: not an HDR file ; true: single or multi-frame HDR file (e.g. Pentax HDR raw file or 32 bit float DNG file or Log compressed) */
  148     virtual bool getHDR (unsigned int frame = 0) const = 0;
  149 
  150     /** @return false: not an HDR file ; true: single or multi-frame HDR file (e.g. Pentax HDR raw file or 32 bit float DNG file or Log compressed) */
  151     virtual std::string getImageType (unsigned int frame) const = 0;
  152     /** @return the sample format based on MetaData */
  153     virtual IIOSampleFormat getSampleFormat (unsigned int frame = 0) const = 0;
  154 
  155     /** Functions to convert between floating point and string representation of shutter and aperture */
  156     static std::string apertureToString (double aperture);
  157     /** Functions to convert between floating point and string representation of shutter and aperture */
  158     static std::string shutterToString (double shutter);
  159     /** Functions to convert between floating point and string representation of shutter and aperture */
  160     static double apertureFromString (std::string shutter);
  161     /** Functions to convert between floating point and string representation of shutter and aperture */
  162     static double shutterFromString (std::string shutter);
  163     /** Functions to convert between floating point and string representation of exposure compensation */
  164     static std::string expcompToString (double expcomp, bool maskZeroexpcomp);
  165 
  166     virtual ~FramesMetaData () = default;
  167 
  168     /** Reads metadata from file.
  169       * @param fname is the name of the file
  170       * @param rml is a struct containing information about metadata location of the first frame.
  171       * Use it only for raw files. In caseof jpgs and tiffs pass a NULL pointer.
  172       * @param firstFrameOnly must be true to get the MetaData of the first frame only, e.g. for a PixelShift file.
  173       * @return The metadata */
  174     static FramesMetaData* fromFile (const Glib::ustring& fname, std::unique_ptr<RawMetaDataLocation> rml, bool firstFrameOnly = false);
  175 };
  176 
  177 /** This listener interface is used to indicate the progress of time consuming operations */
  178 class ProgressListener
  179 {
  180 public:
  181     virtual ~ProgressListener() = default;
  182     /** This member function is called when the percentage of the progress has been changed.
  183       * @param p is a number between 0 and 1 */
  184     virtual void setProgress(double p) = 0;
  185     /** This member function is called when a textual information corresponding to the progress has been changed.
  186       * @param str is the textual information corresponding to the progress */
  187     virtual void setProgressStr(const Glib::ustring& str) = 0;
  188     /** This member function is called when the state of the processing has been changed.
  189       * @param inProcessing =true if the processing has been started, =false if it has been stopped */
  190     virtual void setProgressState(bool inProcessing) = 0;
  191     /** This member function is called when an error occurs during the operation.
  192       * @param descr is the error message */
  193     virtual void error(const Glib::ustring& descr) = 0;
  194 };
  195 
  196 class ImageSource;
  197 
  198 /**
  199   * This class represents an image loaded into the memory. It is the basis of further processing.
  200   * The embedded icc profile and metadata information can be obtained through this class, too.
  201   */
  202 class InitialImage
  203 {
  204 
  205 public:
  206     /** Returns the file name of the image.
  207       * @return The file name of the image */
  208     virtual Glib::ustring getFileName () = 0;
  209     /** Returns the embedded icc profile of the image.
  210       * @return The handle of the embedded profile */
  211     virtual cmsHPROFILE getEmbeddedProfile () = 0;
  212     /** Returns a class providing access to the exif and iptc metadata tags of all frames of the image.
  213       * @return An instance of the FramesMetaData class */
  214     virtual const FramesMetaData* getMetaData () = 0;
  215     /** This is a function used for internal purposes only. */
  216     virtual ImageSource* getImageSource () = 0;
  217     /** This class has manual reference counting. You have to call this function each time to make a new reference to an instance. */
  218     virtual void increaseRef () {}
  219     /** This class has manual reference counting. You have to call this function each time to remove a reference
  220       * (the last one deletes the instance automatically). */
  221     virtual void decreaseRef () {}
  222 
  223     virtual ~InitialImage () {}
  224 
  225     /** Loads an image into the memory.
  226       * @param fname the name of the file
  227       * @param isRaw shall be true if it is a raw file
  228       * @param errorCode is a pointer to a variable that is set to nonzero if an error happened (output)
  229       * @param pl is a pointer pointing to an object implementing a progress listener. It can be NULL, in this case progress is not reported.
  230       * @return an object representing the loaded and pre-processed image */
  231     static InitialImage* load (const Glib::ustring& fname, bool isRaw, int* errorCode, ProgressListener* pl = nullptr);
  232 };
  233 
  234 /** When the preview image is ready for display during staged processing (thus the changes have been updated),
  235   * the staged processor notifies the listener class implementing a PreviewImageListener.
  236   * It is important to note that the file passed to the listener can be used in a shared manner (copying it is not
  237   * needed) as long as the mutex corresponding to the image is used every time the image is accessed.
  238   * If the scale of the preview image is >1, no sharpening, no denoising and no cropping is applied, and
  239   * the transform operations (rotate, c/a, vignetting correction) are performed using a faster less quality algorithm.
  240   * The image you get with this listener is created to display on the monitor (monitor profile has been already applied). */
  241 class PreviewImageListener
  242 {
  243 public:
  244     virtual ~PreviewImageListener() = default;
  245     /** With this member function the staged processor notifies the listener that it allocated a new
  246      * image to store the end result of the processing. It can be used in a shared manner.
  247      * @param img is a pointer to the image
  248      * @param scale describes the current scaling applied compared to the 100% size (preview scale)
  249      * @param cp holds the coordinates of the current crop rectangle */
  250     virtual void setImage(IImage8* img, double scale, const procparams::CropParams& cp) = 0;
  251     /** With this member function the staged processor notifies the listener that the image passed as parameter
  252       * will be deleted, and no longer used to store the preview image.
  253       * @param img the pointer to the image to be destroyed. The listener has to free the image!  */
  254     virtual void delImage(IImage8* img) = 0;
  255     /** With this member function the staged processor notifies the listener that the preview image has been updated.
  256       * @param cp holds the coordinates of the current crop rectangle */
  257     virtual void imageReady(const procparams::CropParams& cp) = 0;
  258 };
  259 
  260 /** When the detailed crop image is ready for display during staged processing (thus the changes have been updated),
  261   * the staged processor notifies the listener class implementing a DetailedCropListener.
  262   * It is important to note that the file passed to the listener can <b>not</b> be used in a shared manner, the class
  263   * implementing this interface has to store a copy of it. */
  264 class DetailedCropListener
  265 {
  266 public:
  267     virtual ~DetailedCropListener() = default;
  268     /** With this member function the staged processor notifies the listener that the detailed crop image has been updated.
  269       * @param img is a pointer to the detailed crop image */
  270     virtual void setDetailedCrop(
  271         IImage8* img,
  272         IImage8* imgtrue,
  273         const procparams::ColorManagementParams& cmp,
  274         const procparams::CropParams& cp,
  275         int cx,
  276         int cy,
  277         int cw,
  278         int ch,
  279         int skip
  280     ) = 0;
  281     virtual void getWindow(int& cx, int& cy, int& cw, int& ch, int& skip) = 0;
  282 };
  283 
  284 /** This listener is used when the full size of the final image has been changed (e.g. rotated by 90 deg.) */
  285 class SizeListener
  286 {
  287 public:
  288     virtual ~SizeListener() = default;
  289     /** This member function is called when the size of the final image has been changed
  290       * @param w is the width of the final image (without cropping)
  291       * @param h is the height of the final image (without cropping)
  292       * @param ow is the width of the final image (without resizing and cropping)
  293       * @param oh is the height of the final image (without resizing and cropping) */
  294     virtual void sizeChanged(int w, int h, int ow, int oh) = 0;
  295 };
  296 
  297 /** This listener is used when the histogram of the final image has changed. */
  298 class HistogramListener
  299 {
  300 public:
  301     virtual ~HistogramListener() = default;
  302     /** This member function is called when the histogram of the final image has changed.
  303       * @param histRed is the array of size 256 containing the histogram of the red channel
  304       * @param histGreen is the array of size 256 containing the histogram of the green channel
  305       * @param histBlue is the array of size 256 containing the histogram of the blue channel
  306       * @param histLuma is the array of size 256 containing the histogram of the luminance channel
  307       * other for curves backgrounds, histRAW is RAW without colors */
  308     virtual void histogramChanged(
  309         const LUTu& histRed,
  310         const LUTu& histGreen,
  311         const LUTu& histBlue,
  312         const LUTu& histLuma,
  313         const LUTu& histToneCurve,
  314         const LUTu& histLCurve,
  315         const LUTu& histCCurve,
  316         const LUTu& histLCAM,
  317         const LUTu& histCCAM,
  318         const LUTu& histRedRaw,
  319         const LUTu& histGreenRaw,
  320         const LUTu& histBlueRaw,
  321         const LUTu& histChroma,
  322         const LUTu& histLRETI
  323     ) = 0;
  324 };
  325 
  326 /** This listener is used when the auto exposure has been recomputed (e.g. when the clipping ratio changed). */
  327 class AutoExpListener
  328 {
  329 public:
  330     virtual ~AutoExpListener() = default;
  331     /** This member function is called when the auto exposure has been recomputed.
  332       * @param brightness is the new brightness value (in logarithmic scale)
  333       * @param bright is the new ...
  334       * @param black is the new black level (measured in absolute pixel data)
  335       * @param contrast is the new contrast values
  336       * @param hlcompr is the new highlight recovery amount
  337       * @param hlcomprthresh is the new threshold for hlcompr
  338       * @param hlrecons set to true if HighLight Reconstruction is enabled */
  339     virtual void autoExpChanged(double brightness, int bright, int contrast, int black, int hlcompr, int hlcomprthresh, bool hlrecons) = 0;
  340 
  341     virtual void autoMatchedToneCurveChanged(procparams::ToneCurveMode curveMode, const std::vector<double>& curve) = 0;
  342 };
  343 
  344 class AutoCamListener
  345 {
  346 public :
  347     virtual ~AutoCamListener() = default;
  348     virtual void autoCamChanged(double ccam, double ccamout) = 0;
  349     virtual void adapCamChanged(double cadap) = 0;
  350     virtual void ybCamChanged(int yb) = 0;
  351 };
  352 
  353 class AutoChromaListener
  354 {
  355 public :
  356     virtual ~AutoChromaListener() = default;
  357     virtual void chromaChanged(double autchroma, double autred, double autblue) = 0;
  358     virtual void noiseChanged(double nresid, double highresid) = 0;
  359     virtual void noiseTilePrev(int tileX, int tileY, int prevX, int prevY, int sizeT, int sizeP) = 0;
  360 };
  361 
  362 class RetinexListener
  363 {
  364 public:
  365     virtual ~RetinexListener() = default;
  366     virtual void minmaxChanged(double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) = 0;
  367 };
  368 
  369 class AutoColorTonListener
  370 {
  371 public:
  372     virtual ~AutoColorTonListener() = default;
  373     virtual void autoColorTonChanged(int bwct, int satthres, int satprot) = 0;
  374 };
  375 
  376 class AutoBWListener
  377 {
  378 public:
  379     virtual ~AutoBWListener() = default;
  380     virtual void BWChanged(double redbw, double greenbw, double bluebw) = 0;
  381 };
  382 
  383 class AutoWBListener
  384 {
  385 public:
  386     virtual ~AutoWBListener() = default;
  387     virtual void WBChanged(double temp, double green) = 0;
  388 };
  389 
  390 class FrameCountListener
  391 {
  392 public:
  393     virtual ~FrameCountListener() = default;
  394     virtual void FrameCountChanged(int n, int frameNum) = 0;
  395 };
  396 
  397 class FlatFieldAutoClipListener
  398 {
  399 public:
  400     virtual ~FlatFieldAutoClipListener() = default;
  401     virtual void flatFieldAutoClipValueChanged(int n) = 0;
  402 };
  403 
  404 class ImageTypeListener
  405 {
  406 public:
  407     virtual ~ImageTypeListener() = default;
  408     virtual void imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans, bool is_Mono = false) = 0;
  409 };
  410 
  411 class AutoContrastListener
  412 {
  413 public :
  414     virtual ~AutoContrastListener() = default;
  415     virtual void autoContrastChanged (double autoContrast) = 0;
  416 };
  417 
  418 class WaveletListener
  419 {
  420 public:
  421     virtual ~WaveletListener() = default;
  422     virtual void wavChanged(double nlevel) = 0;
  423 
  424 };
  425 
  426 /** This class represents a detailed part of the image (looking through a kind of window).
  427   * It can be created and destroyed with the appropriate members of StagedImageProcessor.
  428   * Several crops can be assigned to the same image.   */
  429 class DetailedCrop
  430 {
  431 public:
  432     virtual ~DetailedCrop() {}
  433     /** Sets the window defining the crop. */
  434     virtual void setWindow   (int cx, int cy, int cw, int ch, int skip) {}
  435 
  436     /** First try to update (threadless update). If it returns false, make a full update */
  437     virtual bool tryUpdate  ()
  438     {
  439         return false;
  440     }
  441     /** Perform a full recalculation of the part of the image corresponding to the crop. */
  442     virtual void fullUpdate  () {}
  443     /** Sets the listener of the crop. */
  444     virtual void setListener (DetailedCropListener* il) {}
  445     /** Destroys the crop. */
  446     virtual void destroy () {}
  447 };
  448 
  449 /** This is a staged, cached image processing manager with partial image update support.  */
  450 class StagedImageProcessor
  451 {
  452 
  453 public:
  454     /** Returns the initial image corresponding to the image processor.
  455       * @return the initial image corresponding to the image processor */
  456     virtual InitialImage* getInitialImage () = 0;
  457     /** Returns the current processing parameters.
  458       * @param dst is the location where the image processing parameters are copied (it is assumed that the memory is allocated by the caller) */
  459     virtual void        getParams (procparams::ProcParams* dst) = 0;
  460     /** An essential member function. Call this when a setting has been changed. This function returns a pointer to the
  461       * processing parameters, that you have to update to reflect the changed situation. When ready, call the paramsUpdateReady
  462       * function to start the image update.
  463       * @param change is the ID of the changed setting */
  464     virtual procparams::ProcParams* beginUpdateParams () = 0;
  465     /** An essential member function. This indicates that you are ready with the update of the processing parameters you got
  466       * with the beginUpdateParams call, so the image can be updated. This function returns immediately.
  467       * The image update starts immediately in the background. If it is ready, the result is passed to a PreviewImageListener
  468       * and to a DetailedCropListener (if enabled). */
  469     virtual void        endUpdateParams (ProcEvent change) = 0;
  470     void endUpdateParams(ProcEventCode change) { endUpdateParams(ProcEvent(change)); }
  471     virtual void        endUpdateParams (int changeFlags) = 0;
  472     // Starts a minimal update
  473     virtual void        startProcessing (int changeCode) = 0;
  474     /** Stops image processing. When it returns, the image processing is already stopped. */
  475     virtual void        stopProcessing () = 0;
  476     /** Sets the scale of the preview image. The larger the number is, the faster the image updates are (typical values are 4-5).
  477       * @param scale is the scale of the preview image */
  478     virtual void        setPreviewScale (int scale) = 0;
  479     /** Returns the scale of the preview image.
  480       * @return the current scale of the preview image */
  481     virtual int         getPreviewScale () = 0;
  482     /** Returns the full width of the resulting image (in 1:1 scale).
  483       * @return the width of the final image */
  484     virtual int         getFullWidth () = 0;
  485     /** Returns the full height of the resulting image (in 1:1 scale).
  486       * @return the height of the final image */
  487     virtual int         getFullHeight () = 0;
  488     /** Returns the width of the preview image.
  489       * @return the width of the preview image */
  490     virtual int         getPreviewWidth () = 0;
  491     /** Returns the height of the preview image.
  492       * @return the height of the preview image */
  493     virtual int         getPreviewHeight () = 0;
  494 
  495     virtual bool        getHighQualComputed() = 0;
  496     virtual void        setHighQualComputed() = 0;
  497 
  498     virtual bool        updateTryLock() = 0;
  499 
  500     virtual void        updateUnLock() = 0;
  501 
  502     /** Creates and returns a Crop instance that acts as a window on the image
  503       * @param editDataProvider pointer to the EditDataProvider that communicates with the EditSubscriber
  504       * @return a pointer to the Crop object that handles the image data trough its own pipeline */
  505     virtual DetailedCrop* createCrop  (::EditDataProvider *editDataProvider, bool isDetailWindow) = 0;
  506 
  507     virtual bool        getAutoWB   (double& temp, double& green, double equal, double tempBias) = 0;
  508     virtual void        getCamWB    (double& temp, double& green) = 0;
  509     virtual void        getSpotWB  (int x, int y, int rectSize, double& temp, double& green) = 0;
  510     virtual bool        getFilmNegativeExponents(int xA, int yA, int xB, int yB, std::array<float, 3>& newExps) = 0;
  511     virtual void        getAutoCrop (double ratio, int &x, int &y, int &w, int &h) = 0;
  512 
  513     virtual void        saveInputICCReference (const Glib::ustring& fname, bool apply_wb) = 0;
  514 
  515     virtual void        setProgressListener     (ProgressListener* l) = 0;
  516     virtual void        setSizeListener         (SizeListener* l) = 0;
  517     virtual void        delSizeListener         (SizeListener* l) = 0;
  518     virtual void        setAutoExpListener      (AutoExpListener* l) = 0;
  519     virtual void        setHistogramListener    (HistogramListener *l) = 0;
  520     virtual void        setPreviewImageListener (PreviewImageListener* l) = 0;
  521     virtual void        setAutoCamListener      (AutoCamListener* l) = 0;
  522     virtual void        setFlatFieldAutoClipListener   (FlatFieldAutoClipListener* l) = 0;
  523     virtual void        setFrameCountListener   (FrameCountListener* l) = 0;
  524     virtual void        setBayerAutoContrastListener (AutoContrastListener* l) = 0;
  525     virtual void        setXtransAutoContrastListener (AutoContrastListener* l) = 0;
  526     virtual void        setAutoBWListener       (AutoBWListener* l) = 0;
  527     virtual void        setAutoWBListener       (AutoWBListener* l) = 0;
  528     virtual void        setAutoColorTonListener (AutoColorTonListener* l) = 0;
  529     virtual void        setAutoChromaListener   (AutoChromaListener* l) = 0;
  530     virtual void        setRetinexListener      (RetinexListener* l) = 0;
  531     virtual void        setWaveletListener      (WaveletListener* l) = 0;
  532     virtual void        setImageTypeListener    (ImageTypeListener* l) = 0;
  533 
  534     virtual void        setMonitorProfile       (const Glib::ustring& monitorProfile, RenderingIntent intent) = 0;
  535     virtual void        getMonitorProfile       (Glib::ustring& monitorProfile, RenderingIntent& intent) const = 0;
  536     virtual void        setSoftProofing         (bool softProof, bool gamutCheck) = 0;
  537     virtual void        getSoftProofing         (bool &softProof, bool &gamutCheck) = 0;
  538     virtual void        setSharpMask            (bool sharpMask) = 0;
  539 
  540     virtual ~StagedImageProcessor () {}
  541 
  542     /** Returns a staged, cached image processing manager supporting partial updates
  543     * @param initialImage is a loaded and pre-processed initial image
  544     * @return the staged image processing manager */
  545     static StagedImageProcessor* create (InitialImage* initialImage);
  546     static void destroy (StagedImageProcessor* sip);
  547 };
  548 
  549 
  550 /**
  551   * @brief Initializes the RT engine
  552   * @param s is a struct of basic settings
  553   * @param baseDir base directory of RT's installation dir
  554   * @param userSettingsDir RT's base directory in the user's settings dir
  555   * @param loadAll if false, don't load the various dependencies (profiles, HALDClut files, ...), they'll be loaded from disk each time they'll be used (launching time improvement) */
  556 int init (const Settings* s, Glib::ustring baseDir, Glib::ustring userSettingsDir, bool loadAll = true);
  557 
  558 /** Cleanup the RT engine (static variables) */
  559 void cleanup ();
  560 
  561 /** This class  holds all the necessary information to accomplish the full processing of the image */
  562 class ProcessingJob
  563 {
  564 
  565 public:
  566     virtual ~ProcessingJob() {}
  567 
  568     /** 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
  569        * the image thus it returns immediately.
  570        * @param fname the name of the file
  571        * @param isRaw shall be true if it is a raw file
  572        * @param pparams is a struct containing the processing parameters
  573        * @return an object containing the data above. It can be passed to the functions that do the actual image processing. */
  574     static ProcessingJob* create (const Glib::ustring& fname, bool isRaw, const procparams::ProcParams& pparams, bool fast = false);
  575 
  576     /** 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
  577        * the image thus it returns immediately. This function increases the reference count of the initialImage. If you decide not the process the image you
  578        * have to cancel it by calling the member function void cancel(). If the image is processed the reference count of initialImage is decreased automatically, thus the ProcessingJob
  579        * instance gets invalid. You can not use a ProcessingJob instance to process an image twice.
  580        * @param initialImage is a loaded and pre-processed initial image
  581        * @param pparams is a struct containing the processing parameters
  582        * @return an object containing the data above. It can be passed to the functions that do the actual image processing. */
  583     static ProcessingJob* create (InitialImage* initialImage, const procparams::ProcParams& pparams, bool fast = false);
  584 
  585     /** 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
  586       * gets invalid, you must not use it any more. Don't call this function while the job is being processed.
  587       * @param job is the job to destroy */
  588     static void destroy (ProcessingJob* job);
  589 
  590     virtual bool fastPipeline() const = 0;
  591 };
  592 
  593 /** This function performs all the image processing steps corresponding to the given ProcessingJob. It returns when it is ready, so it can be slow.
  594    * The ProcessingJob passed becomes invalid, you can not use it any more.
  595    * @param job the ProcessingJob to cancel.
  596    * @param errorCode is the error code if an error occurred (e.g. the input image could not be loaded etc.)
  597    * @param pl is an optional ProgressListener if you want to keep track of the progress
  598    * @return the resulting image, with the output profile applied, exif and iptc data set. You have to save it or you can access the pixel data directly.  */
  599 IImagefloat* processImage (ProcessingJob* job, int& errorCode, ProgressListener* pl = nullptr, bool flush = false);
  600 
  601 /** This class is used to control the batch processing. The class implementing this interface will be called when the full processing of an
  602    * image is ready and the next job to process is needed. */
  603 class BatchProcessingListener : public ProgressListener
  604 {
  605 public:
  606     /** This function is called when an image gets ready during the batch processing. It has to return with the next job, or with NULL if
  607                    * there is no jobs left.
  608                    * @param img is the result of the last ProcessingJob
  609                    * @return the next ProcessingJob to process */
  610     virtual ProcessingJob* imageReady(IImagefloat* img) = 0;
  611 };
  612 /** This function performs all the image processing steps corresponding to the given ProcessingJob. It runs in the background, thus it returns immediately,
  613    * When it finishes, it calls the BatchProcessingListener with the resulting image and asks for the next job. It the listener gives a new job, it goes on
  614    * with processing. If no new job is given, it finishes.
  615    * The ProcessingJob passed becomes invalid, you can not use it any more.
  616    * @param job the ProcessingJob to cancel.
  617    * @param bpl is the BatchProcessingListener that is called when the image is ready or the next job is needed. It also acts as a ProgressListener.
  618    **/
  619 void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl);
  620 
  621 
  622 extern MyMutex* lcmsMutex;
  623 }