libopenraw  0.3.7
Protected Member Functions | Protected Attributes | List of all members
OpenRaw::Internals::IfdFile Class Reference

A generic IFD (TIFF) based raw file. More...

#include <ifdfile.hpp>

Inheritance diagram for OpenRaw::Internals::IfdFile:
OpenRaw::RawFile OpenRaw::Internals::Cr2File OpenRaw::Internals::MRWFile OpenRaw::Internals::OrfFile OpenRaw::Internals::PEFFile OpenRaw::Internals::Rw2File OpenRaw::Internals::TiffEpFile OpenRaw::Internals::ArwFile OpenRaw::Internals::DngFile OpenRaw::Internals::ERFFile OpenRaw::Internals::NefFile

Protected Member Functions

 IfdFile (const IO::Stream::Ptr &s, Type _type, bool instantiateContainer=true)
 
virtual ::or_error _enumThumbnailSizes (std::vector< uint32_t > &list) override
 List the thumbnails in the IFD. More...
 
::or_error _addThumbnailFromStream (uint32_t offset, uint32_t len, std::vector< uint32_t > &list)
 Add a thumbnail from a stream. More...
 
::or_error _addThumbnailFromEntry (const IfdEntry::Ref &e, off_t offset, std::vector< uint32_t > &list)
 Add the thumbnail found in the IfdEntry. More...
 
virtual ::or_error _locateThumbnail (const IfdDir::Ref &dir, std::vector< uint32_t > &list)
 Locate the thumnail in the IFD. More...
 
::or_error _getRawDataFromDir (RawData &data, const IfdDir::Ref &dir)
 Load the compressed raw data from a standard location in an IFD. More...
 
virtual uint32_t _getJpegThumbnailOffset (const IfdDir::Ref &dir, uint32_t &len)
 Get the JPEG thumbnail offset from dir. More...
 
virtual RawContainergetContainer () const override
 Get the container.
 
virtual IfdDir::Ref _locateCfaIfd () override
 Locate the IFD for the raw data. More...
 
virtual IfdDir::Ref _locateMainIfd () override
 Locate the main IFD. More...
 
virtual void _identifyId () override
 Identify the file and set the ID internally.
 
virtual MetaValue_getMetaValue (int32_t meta_index) override
 Implementation for getMetaValue()
 
virtual uint32_t _translateCompressionType (IFD::TiffCompress tiffCompression)
 Translate the compression type from the tiff type (16MSB) to the RAW specific type if needed (16MSB) More...
 
virtual ::or_error _unpackData (uint16_t bpc, uint32_t compression, RawData &data, uint32_t x, uint32_t y, uint32_t offset, uint32_t byte_length)
 Unpack the data. More...
 
virtual ::or_error _getRawData (RawData &data, uint32_t options) override
 Get the RAW data. More...
 
virtual ::or_error _decompressIfNeeded (RawData &, uint32_t)
 Call to decompress if needed from _getRawData()
 
- Protected Member Functions inherited from OpenRaw::RawFile
virtual Internals::IfdDir::Ref _locateExifIfd ()
 Locate the Exif IFD. More...
 
virtual Internals::MakerNoteDir::Ref _locateMakerNoteIfd ()
 Locate the MakerNote IFD. More...
 
 RawFile (Type _type)
 Construct a raw file. More...
 
virtual bool vendorCameraIdLocation (Internals::IfdDir::Ref &ifd, uint16_t &index, const Internals::ModelIdMap *&model_map)
 Get the vendor camera ID location. More...
 
void _setTypeId (TypeId _type_id)
 Set the file type id.
 
TypeId _typeId () const
 Just get the type id value. No identification. You might want to use typeId() in the general case.
 
virtual ::or_error _getThumbnail (uint32_t size, Thumbnail &thumbnail)
 Get the thumbnail of exact size. More...
 
void _addThumbnail (uint32_t size, Internals::ThumbDesc &&desc)
 
virtual ::or_error _getColourMatrix (uint32_t index, double *matrix, uint32_t &size)
 Get the colour matrix. More...
 
virtual ExifLightsourceValue _getCalibrationIlluminant (uint16_t index)
 
TypeId _typeIdFromModel (const std::string &make, const std::string &model)
 
TypeId _typeIdFromMake (const std::string &make, const std::string &model)
 
void _setIdMap (const camera_ids_t *map)
 
void _setMatrices (const Internals::BuiltinColourMatrix *matrices)
 
const Internals::BuiltinColourMatrix_getMatrices () const
 

Protected Attributes

IO::Stream::Ptr m_io
 
IfdFileContainerm_container
 

Additional Inherited Members

- Public Types inherited from OpenRaw::RawFile
typedef ::or_rawfile_type Type
 
typedef ::or_rawfile_typeid TypeId
 
- Public Member Functions inherited from OpenRaw::RawFile
 RawFile (const RawFile &)=delete
 
RawFileoperator= (const RawFile &)=delete
 
virtual ~RawFile ()
 Destructor.
 
Type type () const
 Accessor for the type.
 
TypeId typeId ()
 The RAW file type ID. Identify it if needed. More...
 
TypeId vendorId ()
 
const std::vector< uint32_t > & listThumbnailSizes (void)
 List the available thumbnail sizes.
 
::or_error getThumbnail (uint32_t size, Thumbnail &thumbnail)
 Get the thumbnail from the raw file. More...
 
::or_error getRawData (RawData &rawdata, uint32_t options)
 Get the RAW data. More...
 
::or_error getRenderedImage (BitmapData &bitmapdata, uint32_t options)
 Get the rendered image. More...
 
uint32_t getOrientation ()
 Get the orientation of the image, using Exif enums.
 
uint32_t colourMatrixSize ()
 
::or_error getColourMatrix1 (double *matrix, uint32_t &size)
 Get colour matrix. More...
 
::or_error getColourMatrix2 (double *matrix, uint32_t &size)
 
ExifLightsourceValue getCalibrationIlluminant1 ()
 Get the calibration illuminant that match the colour matrix. More...
 
ExifLightsourceValue getCalibrationIlluminant2 ()
 
virtual or_colour_matrix_origin getColourMatrixOrigin () const
 Get the origin of the colour matrix for the RAW file. More...
 
Internals::IfdDir::Ref cfaIfd ()
 Get the IFD containing the CFA.
 
Internals::IfdDir::Ref mainIfd ()
 Get the main IFD.
 
Internals::IfdDir::Ref exifIfd ()
 Get the Exif IFD.
 
Internals::MakerNoteDir::Ref makerNoteIfd ()
 Get the MakerNote IFD.
 
const MetaValuegetMetaValue (int32_t meta_index)
 Get a metadata value. More...
 
MetadataIteratorgetMetadataIterator ()
 
- Static Public Member Functions inherited from OpenRaw::RawFile
static const char ** fileExtensions ()
 Return a NULL terminated list of file extensions that the library handle. More...
 
static RawFilenewRawFile (const char *_filename, Type typeHint=OR_RAWFILE_TYPE_UNKNOWN)
 Factory method to create the proper RawFile instance. More...
 
static RawFilenewRawFileFromMemory (const uint8_t *buffer, uint32_t len, Type typeHint=OR_RAWFILE_TYPE_UNKNOWN)
 Factory method to create the proper RawFile instance from content. More...
 
- Static Protected Member Functions inherited from OpenRaw::RawFile
static RawFile::TypeId modelid_to_typeid (const std::map< uint32_t, RawFile::TypeId > &model_map, uint32_t model_id)
 Helper to get the TypeId from the map. More...
 
::or_error _getBuiltinLevels (const Internals::BuiltinColourMatrix *m, TypeId type_id, uint16_t &black, uint16_t &white)
 
::or_error _getBuiltinColourMatrix (const Internals::BuiltinColourMatrix *m, TypeId type_id, double *matrix, uint32_t &size)
 

Detailed Description

A generic IFD (TIFF) based raw file.

Definition at line 51 of file ifdfile.hpp.

Member Function Documentation

◆ _addThumbnailFromEntry()

or_error OpenRaw::Internals::IfdFile::_addThumbnailFromEntry ( const IfdEntry::Ref e,
off_t  offset,
std::vector< uint32_t > &  list 
)
protected

Add the thumbnail found in the IfdEntry.

Parameters
offsetis the offset for MakerNote. Pass 0 if not.
listthe thumbnail list to add to.

Definition at line 158 of file ifdfile.cpp.

References OR_ERROR_NOT_FOUND.

◆ _addThumbnailFromStream()

or_error OpenRaw::Internals::IfdFile::_addThumbnailFromStream ( uint32_t  offset,
uint32_t  len,
std::vector< uint32_t > &  list 
)
protected

Add a thumbnail from a stream.

Parameters
offsetthe offset in the IO stream
lenthe length of the data

Definition at line 133 of file ifdfile.cpp.

References OR_DATA_TYPE_JPEG, OR_ERROR_NONE, and OR_ERROR_NOT_FOUND.

◆ _enumThumbnailSizes()

or_error OpenRaw::Internals::IfdFile::_enumThumbnailSizes ( std::vector< uint32_t > &  list)
overrideprotectedvirtual

List the thumbnails in the IFD.

Return values
listthe list of thumbnails
Returns
the error code. OR_ERROR_NOT_FOUND if no thumbnail are found.

Implements OpenRaw::RawFile.

Reimplemented in OpenRaw::Internals::PEFFile, OpenRaw::Internals::OrfFile, OpenRaw::Internals::NefFile, and OpenRaw::Internals::MRWFile.

Definition at line 173 of file ifdfile.cpp.

References OR_ERROR_NONE, and OR_ERROR_NOT_FOUND.

Referenced by OpenRaw::Internals::OrfFile::_enumThumbnailSizes(), and OpenRaw::Internals::PEFFile::_enumThumbnailSizes().

◆ _getJpegThumbnailOffset()

uint32_t OpenRaw::Internals::IfdFile::_getJpegThumbnailOffset ( const IfdDir::Ref dir,
uint32_t &  len 
)
protectedvirtual

Get the JPEG thumbnail offset from dir.

Parameters
dirthe IFD to get the thumbnail from
lenthe length of the JPEG stream. 0 is not valid.
Returns
the offset. 0 is not valid.

Definition at line 341 of file ifdfile.cpp.

◆ _getRawData()

or_error OpenRaw::Internals::IfdFile::_getRawData ( RawData data,
uint32_t  options 
)
overrideprotectedvirtual

Get the RAW data.

Parameters
dataThe RAW data
optionThe option bits
Returns
OR_ERROR_NONE if success Return the data compressed or uncompressed.

Implements OpenRaw::RawFile.

Reimplemented in OpenRaw::Internals::PEFFile, OpenRaw::Internals::OrfFile, and OpenRaw::Internals::MRWFile.

Definition at line 508 of file ifdfile.cpp.

References OR_ERROR_NONE, and OR_ERROR_NOT_FOUND.

◆ _getRawDataFromDir()

or_error OpenRaw::Internals::IfdFile::_getRawDataFromDir ( RawData data,
const IfdDir::Ref dir 
)
protected

Load the compressed raw data from a standard location in an IFD.

Parameters
datathe data storage
dirthe IFD
Returns
the error code.

Definition at line 533 of file ifdfile.cpp.

References OR_ERROR_NONE, and OR_ERROR_NOT_FOUND.

Referenced by OpenRaw::Internals::OrfFile::_getRawData(), and OpenRaw::Internals::PEFFile::_getRawData().

◆ _locateCfaIfd()

IfdDir::Ref OpenRaw::Internals::IfdFile::_locateCfaIfd ( )
overrideprotectedvirtual

Locate the IFD for the raw data.

This is not necessarily a unique IFD and it can be the same as the main.

Returns
the CFA Ifd. May be null.

Implements OpenRaw::RawFile.

Reimplemented in OpenRaw::Internals::TiffEpFile, OpenRaw::Internals::Rw2File, OpenRaw::Internals::MRWFile, OpenRaw::Internals::Cr2File, and OpenRaw::Internals::ArwFile.

Definition at line 73 of file ifdfile.cpp.

◆ _locateMainIfd()

IfdDir::Ref OpenRaw::Internals::IfdFile::_locateMainIfd ( )
overrideprotectedvirtual

Locate the main IFD.

Returns
the main IFD. Main be null.

Implements OpenRaw::RawFile.

Reimplemented in OpenRaw::Internals::Rw2File, OpenRaw::Internals::MRWFile, and OpenRaw::Internals::Cr2File.

Definition at line 79 of file ifdfile.cpp.

References OR_IFD_MAIN.

◆ _locateThumbnail()

or_error OpenRaw::Internals::IfdFile::_locateThumbnail ( const IfdDir::Ref dir,
std::vector< uint32_t > &  list 
)
protected

Locate the thumnail in the IFD.

Parameters
dirthe IfdDir where to locate the thumbnail
Returns
the error code. OR_ERROR_NOT_FOUND if the thumbnails are not found.

Definition at line 209 of file ifdfile.cpp.

References OR_ERROR_NOT_FOUND.

◆ _translateCompressionType()

uint32_t OpenRaw::Internals::IfdFile::_translateCompressionType ( IFD::TiffCompress  tiff_compression)
protectedvirtual

Translate the compression type from the tiff type (16MSB) to the RAW specific type if needed (16MSB)

Parameters
tiffCompressionthe 16 bits value from TIFF
Returns
the actually value. Anything >= 2^16 is specific the RAW type

by default we don't translate the compression

Reimplemented in OpenRaw::Internals::NefFile.

Definition at line 382 of file ifdfile.cpp.

◆ _unpackData()

or_error OpenRaw::Internals::IfdFile::_unpackData ( uint16_t  bpc,
uint32_t  compression,
RawData data,
uint32_t  x,
uint32_t  y,
uint32_t  offset,
uint32_t  byte_length 
)
protected

Unpack the data.

Parameters
bpcbits per components
compressionthe compression type
xthe width
ythe height
offsetthe offset of the data
byte_lengththe amount of data
Returns
error code

Definition at line 685 of file ifdfile.cpp.

References OR_ERROR_NONE, and OpenRaw::Internals::Unpack::unpack_be12to16().

Member Data Documentation

◆ m_container

IfdFileContainer* OpenRaw::Internals::IfdFile::m_container
protected

◆ m_io

IO::Stream::Ptr OpenRaw::Internals::IfdFile::m_io
protected

the IO handle

Definition at line 106 of file ifdfile.hpp.


The documentation for this class was generated from the following files: