22 #include <libopenraw/cameraids.h>
25 #include "rawfile_private.hpp"
26 #include "erffile.hpp"
27 #include "rawdata.hpp"
28 #include "thumbnail.hpp"
30 using namespace Debug;
39 static const BuiltinColourMatrix s_matrices[] = {
41 { 6827, -1878, -732, -8429, 16012, 2564, -704, 592, 7145 } },
43 { 6827, -1878, -732, -8429, 16012, 2564, -704, 592, 7145 } },
45 { 6827, -1878, -732, -8429, 16012, 2564, -704, 592, 7145 } },
46 { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
49 const IfdFile::camera_ids_t ERFFile::s_def[] = {
51 OR_TYPEID_EPSON_RD1) },
53 OR_TYPEID_EPSON_RD1S) },
55 OR_TYPEID_EPSON_RD1X) },
59 RawFile *ERFFile::factory(
const IO::Stream::Ptr &s)
61 return new ERFFile(s);
64 ERFFile::ERFFile(
const IO::Stream::Ptr &s)
68 _setMatrices(s_matrices);
75 ::or_error ERFFile::getMakerNoteThumbnail(Thumbnail& thumbnail)
77 auto mnote = std::dynamic_pointer_cast<MakerNoteDir>(makerNoteIfd());
79 LOGERR(
"Couldn't find the MakerNote.");
82 auto thumb = mnote->getEntry(ERF_TAG_PREVIEW_IMAGE);
84 LOGERR(
"Couldn't find the preview image.");
88 auto count = thumb->count();
89 void *p = thumbnail.allocData(count);
90 auto size = thumb->loadDataInto((uint8_t*)p, count, 0);
92 LOGERR(
"Couldn't load the preview image. Read only %lu bytes, expected %d", (LSIZE)size, count);
97 ((uint8_t*)p)[0] = 0xff;
101 thumbnail.setDimensions(640, 424);
106 ::or_error ERFFile::_enumThumbnailSizes(std::vector<uint32_t>& list)
108 auto err = this->TiffEpFile::_enumThumbnailSizes(list);
120 getMakerNoteThumbnail(thumbnail);
123 return TiffEpFile::_getThumbnail(size, thumbnail);
132 err = _getRawDataFromDir(data, _cfaIfd);
133 auto mnote = makerNoteIfd();
134 auto sensor_area = mnote->getEntry(MNOTE_EPSON_SENSORAREA);
136 auto x = mnote->getEntryValue<uint16_t>(*sensor_area, 0,
true);
137 auto y = mnote->getEntryValue<uint16_t>(*sensor_area, 1,
true);
138 auto w = mnote->getEntryValue<uint16_t>(*sensor_area, 2,
true);
139 auto h = mnote->getEntryValue<uint16_t>(*sensor_area, 3,
true);
140 data.setActiveArea(x, y, w, h);
std::shared_ptr< IfdDir > Ref
Shared ptr of an IfdDir.
Represent camera raw data.
#define OR_MAKE_FILE_TYPEID(vendor, camera)
Make a or_rawfile_typeid with a vendor and camera.
or_error
Error codes returned by libopenraw.
Global namespace for libopenraw.