libopenraw  0.3.7
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
OpenRaw::RawFile Class Referenceabstract

RAW file. More...

#include <rawfile.hpp>

Inheritance diagram for OpenRaw::RawFile:
OpenRaw::Internals::CRWFile OpenRaw::Internals::Cr3File OpenRaw::Internals::IfdFile OpenRaw::Internals::RafFile 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

Classes

struct  camera_ids_t
 
class  Private
 

Public Types

typedef ::or_rawfile_type Type
 
typedef ::or_rawfile_typeid TypeId
 

Public Member Functions

 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

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...
 

Protected Member Functions

virtual Internals::IfdDir::Ref _locateCfaIfd ()=0
 Locate the IFD for the raw data. More...
 
virtual Internals::IfdDir::Ref _locateMainIfd ()=0
 Locate the main IFD. More...
 
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 Internals::RawContainergetContainer () const =0
 Get the container.
 
virtual ::or_error _enumThumbnailSizes (std::vector< uint32_t > &list)=0
 Enumerate the thumbnail sizes. More...
 
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 _getRawData (RawData &data, uint32_t options)=0
 Get the RAW data. More...
 
virtual ::or_error _getColourMatrix (uint32_t index, double *matrix, uint32_t &size)
 Get the colour matrix. More...
 
virtual ExifLightsourceValue _getCalibrationIlluminant (uint16_t index)
 
virtual MetaValue_getMetaValue (int32_t)=0
 Implementation for getMetaValue()
 
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
 
virtual void _identifyId ()=0
 Identify the file and set the ID internally.
 

Static Protected Member Functions

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)
 

Friends

template<typename T >
void Internals::audit_coefficients ()
 

Detailed Description

RAW file.

Definition at line 65 of file rawfile.hpp.

Constructor & Destructor Documentation

◆ RawFile()

OpenRaw::RawFile::RawFile ( RawFile::Type  _type)
protected

Construct a raw file.

Parameters
_typethe type

Definition at line 365 of file rawfile.cpp.

Member Function Documentation

◆ _enumThumbnailSizes()

virtual ::or_error OpenRaw::RawFile::_enumThumbnailSizes ( std::vector< uint32_t > &  list)
protectedpure virtual

◆ _getColourMatrix()

or_error OpenRaw::RawFile::_getColourMatrix ( uint32_t  index,
double *  matrix,
uint32_t &  size 
)
protected

Get the colour matrix.

Parameters
index1 or 2

Definition at line 599 of file rawfile.cpp.

References META_NS_TIFF.

Referenced by getColourMatrix1().

◆ _getRawData()

virtual ::or_error OpenRaw::RawFile::_getRawData ( RawData data,
uint32_t  options 
)
protectedpure virtual

Get the RAW data.

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

Implemented in OpenRaw::Internals::RafFile, OpenRaw::Internals::PEFFile, OpenRaw::Internals::OrfFile, OpenRaw::Internals::MRWFile, OpenRaw::Internals::IfdFile, OpenRaw::Internals::ERFFile, OpenRaw::Internals::DngFile, OpenRaw::Internals::CRWFile, OpenRaw::Internals::Cr3File, and OpenRaw::Internals::ArwFile.

Referenced by getRawData().

◆ _getThumbnail()

or_error OpenRaw::RawFile::_getThumbnail ( uint32_t  size,
Thumbnail thumbnail 
)
protected

Get the thumbnail of exact size.

Parameters
sizethe size in pixel of the square
[out]thumbnailthe thumbnail to load
Returns
OR_ERROR_NONE if success
See also
listThumbnailSizes() to understand how to fetch the sizes available

Internal implementation of getThumbnail. The size must match.

< of the buffer

Definition at line 495 of file rawfile.cpp.

References OpenRaw::Internals::ThumbDesc::data, OpenRaw::Internals::RawContainer::fetchData(), getContainer(), OpenRaw::Internals::ThumbDesc::offset, OR_ERROR_NONE, OR_ERROR_NOT_FOUND, OpenRaw::BitmapData::setDataType(), OpenRaw::BitmapData::setDimensions(), OpenRaw::Internals::ThumbDesc::type, OpenRaw::Internals::ThumbDesc::x, and OpenRaw::Internals::ThumbDesc::y.

Referenced by getThumbnail().

◆ _locateCfaIfd()

virtual Internals::IfdDir::Ref OpenRaw::RawFile::_locateCfaIfd ( )
protectedpure virtual

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.

Implemented in OpenRaw::Internals::TiffEpFile, OpenRaw::Internals::Rw2File, OpenRaw::Internals::RafFile, OpenRaw::Internals::MRWFile, OpenRaw::Internals::IfdFile, OpenRaw::Internals::CRWFile, OpenRaw::Internals::Cr3File, OpenRaw::Internals::Cr2File, and OpenRaw::Internals::ArwFile.

Referenced by cfaIfd().

◆ _locateExifIfd()

Internals::IfdDir::Ref OpenRaw::RawFile::_locateExifIfd ( )
protectedvirtual

Locate the Exif IFD.

The default implementation follow the specification by by calling getExifIFD() on the main IFD.

Returns
the Exif IFD.

Reimplemented in OpenRaw::Internals::Rw2File, OpenRaw::Internals::CRWFile, and OpenRaw::Internals::Cr3File.

Definition at line 676 of file rawfile.cpp.

References mainIfd().

Referenced by exifIfd().

◆ _locateMainIfd()

virtual Internals::IfdDir::Ref OpenRaw::RawFile::_locateMainIfd ( )
protectedpure virtual

◆ _locateMakerNoteIfd()

Internals::MakerNoteDir::Ref OpenRaw::RawFile::_locateMakerNoteIfd ( )
protectedvirtual

Locate the MakerNote IFD.

The default implementation follow the specification by by calling getMakerNoteIfd() on the main IFD.

Returns
the MakerNote IFD.

Reimplemented in OpenRaw::Internals::CRWFile, and OpenRaw::Internals::Cr3File.

Definition at line 686 of file rawfile.cpp.

References exifIfd(), and type().

Referenced by makerNoteIfd().

◆ colourMatrixSize()

uint32_t OpenRaw::RawFile::colourMatrixSize ( )
Returns
the number of items in the colour matrix.

Definition at line 584 of file rawfile.cpp.

Referenced by getRawData().

◆ fileExtensions()

const char ** OpenRaw::RawFile::fileExtensions ( )
static

Return a NULL terminated list of file extensions that the library handle.

This is purely informational.

Returns
a pointer the list, NULL terminated. The pointer is owned by the library.

Definition at line 180 of file rawfile.cpp.

◆ getCalibrationIlluminant1()

ExifLightsourceValue OpenRaw::RawFile::getCalibrationIlluminant1 ( )

Get the calibration illuminant that match the colour matrix.

Returns
the Exif value. 0 = unknown. Likely not found.

Definition at line 638 of file rawfile.cpp.

Referenced by or_rawfile_get_calibration_illuminant1().

◆ getColourMatrix1()

or_error OpenRaw::RawFile::getColourMatrix1 ( double *  matrix,
uint32_t &  size 
)

Get colour matrix.

Parameters
indexThe matrix index.
[out]matrixpointer to array of size double.
sizethe size of the buffer. On out the actual size. If it is too small the size is adjusted and an error OR_ERROR_BUF_TOO_SMALL returned.
Returns
an error code.

Definition at line 589 of file rawfile.cpp.

References _getColourMatrix().

Referenced by getRawData(), and or_rawfile_get_colourmatrix1().

◆ getColourMatrixOrigin()

or_colour_matrix_origin OpenRaw::RawFile::getColourMatrixOrigin ( ) const
virtual

Get the origin of the colour matrix for the RAW file.

Returns
value of or_colour_matrix_origin

Reimplemented in OpenRaw::Internals::DngFile.

Definition at line 648 of file rawfile.cpp.

References OR_COLOUR_MATRIX_BUILTIN.

Referenced by or_rawfile_get_colour_matrix_origin().

◆ getMetaValue()

const MetaValue * OpenRaw::RawFile::getMetaValue ( int32_t  meta_index)

Get a metadata value.

Returns
A MetaValue, or NULL if not found.

Definition at line 733 of file rawfile.cpp.

References _getMetaValue().

Referenced by getOrientation(), and or_rawfile_get_metavalue().

◆ getRawData()

or_error OpenRaw::RawFile::getRawData ( RawData rawdata,
uint32_t  options 
)

Get the RAW data.

Parameters
rawdatathe RawData to put the data into
optionsthe option bits defined by or_options
Returns
the error code

Definition at line 536 of file rawfile.cpp.

References _getRawData(), colourMatrixSize(), getColourMatrix1(), OpenRaw::RawData::getColourMatrix1(), and OR_ERROR_NONE.

Referenced by getRenderedImage(), and or_rawfile_get_rawdata().

◆ getRenderedImage()

or_error OpenRaw::RawFile::getRenderedImage ( BitmapData bitmapdata,
uint32_t  options 
)

Get the rendered image.

Parameters
bitmapdatathe BitmapData to put the image into
optionsthe option bits. Pass 0 for now.
Returns
the error code

Definition at line 557 of file rawfile.cpp.

References getRawData(), OpenRaw::RawData::getRenderedImage(), and OR_ERROR_NONE.

Referenced by or_rawfile_get_rendered_image().

◆ getThumbnail()

or_error OpenRaw::RawFile::getThumbnail ( uint32_t  size,
Thumbnail thumbnail 
)

Get the thumbnail from the raw file.

Parameters
sizethe square size in px
[out]thumbnailthe thumbnail to extract into
Returns
the error code

Definition at line 445 of file rawfile.cpp.

References _getThumbnail(), listThumbnailSizes(), and OR_ERROR_NOT_FOUND.

Referenced by or_rawfile_get_thumbnail().

◆ modelid_to_typeid()

RawFile::TypeId OpenRaw::RawFile::modelid_to_typeid ( const std::map< uint32_t, RawFile::TypeId > &  model_map,
uint32_t  model_id 
)
staticprotected

Helper to get the TypeId from the map.

Returns
the TypeId or 0

Definition at line 406 of file rawfile.cpp.

◆ newRawFile()

RawFile * OpenRaw::RawFile::newRawFile ( const char *  _filename,
RawFile::Type  typeHint = OR_RAWFILE_TYPE_UNKNOWN 
)
static

Factory method to create the proper RawFile instance.

Parameters
_filenamethe name of the file to load
_typeHinta hint on the type. Use UNKNOWN_TYPE if you want to let the library detect it for you.

Definition at line 187 of file rawfile.cpp.

References OR_ERROR_NONE, and OR_RAWFILE_TYPE_UNKNOWN.

Referenced by OpenRaw::Thumbnail::getAndExtractThumbnail().

◆ newRawFileFromMemory()

RawFile * OpenRaw::RawFile::newRawFileFromMemory ( const uint8_t *  buffer,
uint32_t  len,
RawFile::Type  typeHint = OR_RAWFILE_TYPE_UNKNOWN 
)
static

Factory method to create the proper RawFile instance from content.

Parameters
bufferthe buffer to examine.
lenthe number of bytes in the length.
_typeHinta hint on the type. Use UNKNOWN_TYPE if you want to let the library detect it for you.

Definition at line 221 of file rawfile.cpp.

References OR_ERROR_NONE, and OR_RAWFILE_TYPE_UNKNOWN.

◆ typeId()

RawFile::TypeId OpenRaw::RawFile::typeId ( )

The RAW file type ID. Identify it if needed.

Todo:
figure how to make this const.

Definition at line 380 of file rawfile.cpp.

References _identifyId(), and OpenRaw::RawFile::Private::m_type_id.

Referenced by OpenRaw::Internals::MRWFile::_getRawData(), and or_rawfile_get_typeid().

◆ vendorCameraIdLocation()

bool OpenRaw::RawFile::vendorCameraIdLocation ( Internals::IfdDir::Ref ifd,
uint16_t &  index,
const Internals::ModelIdMap *&  model_map 
)
protectedvirtual

Get the vendor camera ID location.

Parameters
ifdthe IfdDir where it is.
indexthe value index in the IfdDir.
model_mapa point to the model map. Can't be null.
Returns
true if there is one, otherwise false

Reimplemented in OpenRaw::Internals::Cr2File, OpenRaw::Internals::ArwFile, and OpenRaw::Internals::PEFFile.

Definition at line 416 of file rawfile.cpp.


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