merge with dev

This commit is contained in:
Desmis
2017-10-14 08:34:38 +02:00
109 changed files with 3299 additions and 1084 deletions

View File

@@ -19,6 +19,7 @@
#ifndef _RTENGINE_
#define _RTENGINE_
#include "imageformat.h"
#include "rt_math.h"
#include "procparams.h"
#include "procevents.h"
@@ -48,60 +49,84 @@ namespace rtengine
class IImage8;
class IImage16;
class IImagefloat;
class ImageSource;
/**
* This class represents provides functions to obtain exif and IPTC metadata information
* from the image file
* This class provides functions to obtain exif and IPTC metadata information
* from any of the sub-frame of an image file
*/
class ImageMetaData
class FramesMetaData
{
public:
/** @return Returns the number of root Metadata */
virtual unsigned int getRootCount () const = 0;
/** @return Returns the number of frame contained in the file based on Metadata */
virtual unsigned int getFrameCount () const = 0;
/** Checks the availability of exif metadata tags.
* @return Returns true if image contains exif metadata tags */
virtual bool hasExif () const = 0;
virtual bool hasExif (unsigned int frame = 0) const = 0;
/** Returns the directory of exif metadata tags.
* @param root root number in the metadata tree
* @return The directory of exif metadata tags */
virtual const rtexif::TagDirectory* getExifData () const = 0;
virtual rtexif::TagDirectory* getRootExifData (unsigned int root = 0) const = 0;
/** Returns the directory of exif metadata tags.
* @param frame frame number in the metadata tree
* @return The directory of exif metadata tags */
virtual rtexif::TagDirectory* getFrameExifData (unsigned int frame = 0) const = 0;
/** Returns the directory of exif metadata tags containing at least the 'Make' tag for the requested frame.
* If no usable metadata exist in the frame, send back the best TagDirectory describing the frame content.
* @param imgSource rawimage that we want the metadata from
* @param rawParams RawParams to select the frame number
* @return The directory of exif metadata tags containing at least the 'Make' tag */
virtual rtexif::TagDirectory* getBestExifData (ImageSource *imgSource, procparams::RAWParams *rawParams) const = 0;
/** Checks the availability of IPTC tags.
* @return Returns true if image contains IPTC tags */
virtual bool hasIPTC () const = 0;
virtual bool hasIPTC (unsigned int frame = 0) const = 0;
/** Returns the directory of IPTC tags.
* @return The directory of IPTC tags */
virtual const procparams::IPTCPairs getIPTCData () const = 0;
virtual procparams::IPTCPairs getIPTCData (unsigned int frame = 0) const = 0;
/** @return a struct containing the date and time of the image */
virtual struct tm getDateTime () const = 0;
virtual tm getDateTime (unsigned int frame = 0) const = 0;
/** @return a timestamp containing the date and time of the image */
virtual time_t getDateTimeAsTS() const = 0;
virtual time_t getDateTimeAsTS(unsigned int frame = 0) const = 0;
/** @return the ISO of the image */
virtual int getISOSpeed () const = 0;
virtual int getISOSpeed (unsigned int frame = 0) const = 0;
/** @return the F number of the image */
virtual double getFNumber () const = 0;
virtual double getFNumber (unsigned int frame = 0) const = 0;
/** @return the focal length used at the exposure */
virtual double getFocalLen () const = 0;
virtual double getFocalLen (unsigned int frame = 0) const = 0;
/** @return the focal length in 35mm used at the exposure */
virtual double getFocalLen35mm () const = 0;
virtual double getFocalLen35mm (unsigned int frame = 0) const = 0;
/** @return the focus distance in meters, 0=unknown, 10000=infinity */
virtual float getFocusDist () const = 0;
virtual float getFocusDist (unsigned int frame = 0) const = 0;
/** @return the shutter speed */
virtual double getShutterSpeed () const = 0;
virtual double getShutterSpeed (unsigned int frame = 0) const = 0;
/** @return the exposure compensation */
virtual double getExpComp () const = 0;
virtual double getExpComp (unsigned int frame = 0) const = 0;
/** @return the maker of the camera */
virtual std::string getMake () const = 0;
virtual std::string getMake (unsigned int frame = 0) const = 0;
/** @return the model of the camera */
virtual std::string getModel () const = 0;
virtual std::string getModel (unsigned int frame = 0) const = 0;
std::string getCamera () const
std::string getCamera (unsigned int frame = 0) const
{
return getMake() + " " + getModel();
return getMake(frame) + " " + getModel(frame);
}
/** @return the lens on the camera */
virtual std::string getLens () const = 0;
virtual std::string getLens (unsigned int frame = 0) const = 0;
/** @return the orientation of the image */
virtual std::string getOrientation () const = 0;
virtual std::string getOrientation (unsigned int frame = 0) const = 0;
/** @return true if the file is a PixelShift shot (Pentax bodies) */
virtual bool getPixelShift (unsigned int frame = 0) const = 0;
/** @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) */
virtual bool getHDR (unsigned int frame = 0) const = 0;
/** @return the sample format based on MetaData */
virtual IIOSampleFormat getSampleFormat (unsigned int frame = 0) const = 0;
/** Functions to convert between floating point and string representation of shutter and aperture */
static std::string apertureToString (double aperture);
/** Functions to convert between floating point and string representation of shutter and aperture */
@@ -113,14 +138,15 @@ public:
/** Functions to convert between floating point and string representation of exposure compensation */
static std::string expcompToString (double expcomp, bool maskZeroexpcomp);
virtual ~ImageMetaData () {}
virtual ~FramesMetaData () = default;
/** Reads metadata from file.
* @param fname is the name of the file
* @param rml is a struct containing information about metadata location. Use it only for raw files. In case
* of jpgs and tiffs pass a NULL pointer.
* @param rml is a struct containing information about metadata location of the first frame.
* Use it only for raw files. In caseof jpgs and tiffs pass a NULL pointer.
* @param firstFrameOnly must be true to get the MetaData of the first frame only, e.g. for a PixelShift file.
* @return The metadata */
static ImageMetaData* fromFile (const Glib::ustring& fname, RawMetaDataLocation* rml);
static FramesMetaData* fromFile (const Glib::ustring& fname, std::unique_ptr<RawMetaDataLocation> rml, bool firstFrameOnly = false);
};
/** This listener interface is used to indicate the progress of time consuming operations */
@@ -159,9 +185,9 @@ public:
/** Returns the embedded icc profile of the image.
* @return The handle of the embedded profile */
virtual cmsHPROFILE getEmbeddedProfile () = 0;
/** Returns a class providing access to the exif and iptc metadata tags of the image.
* @return An instance of the ImageMetaData class */
virtual const ImageMetaData* getMetaData () = 0;
/** Returns a class providing access to the exif and iptc metadata tags of all frames of the image.
* @return An instance of the FramesMetaData class */
virtual const FramesMetaData* getMetaData () = 0;
/** This is a function used for internal purposes only. */
virtual ImageSource* getImageSource () = 0;
/** This class has manual reference counting. You have to call this function each time to make a new reference to an instance. */