57 const auto id = rootIFD->
getID();
58 const std::string&
make =
id.make;
72 return software ==
"Camera Library";
79 auto id = mRootIFD->getID();
83 const TiffEntry* xmp = mRootIFD->getEntryRecursive(TiffTag::XMP);
85 ThrowRDE(
"Couldn't find the XMP");
87 assert(xmp != nullptr);
88 std::string xmpText = xmp->getString();
89 make = getXMPTag(xmpText,
"Make");
90 model = getXMPTag(xmpText,
"Model");
95 std::string::size_type start = xmp.find(
"<tiff:" + std::string(tag) +
">");
96 std::string::size_type end = xmp.find(
"</tiff:" + std::string(tag) +
">");
97 if (start == std::string::npos || end == std::string::npos || end <= start)
98 ThrowRDE(
"Couldn't find tag '%s' in the XMP", tag.data());
100 return std::string(xmp.substr(start + startlen, end - start - startlen));
120 if (width == 0 || height == 0 || width > 10328 || height > 7760)
121 ThrowRDE(
"Unexpected image dimensions found: (%u; %u)", width, height);
137 u.readUncompressedRaw();
138 }
else if (99 == compression || 7 == compression) {
139 ThrowRDE(
"Leaf LJpeg not yet supported");
143 ThrowRDE(
"Unsupported compression: %d", compression);
164 const uint32_t minSize = 16 + 28 + 4 + 3 + 1;
173 std::array<uint32_t, 4> tmp = {{}};
175 std::istringstream iss(tmpString);
176 iss >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3];
177 if (!iss.fail() && tmp[0] > 0 && tmp[1] > 0 && tmp[2] > 0 &&
179 std::array<float, 4> wbCoeffs = {};
186 mRaw->metadata.wbCoeffs = wbCoeffs;
AbstractTiffDecoder(TiffRootIFDOwner &&root, Buffer file)
TiffRootIFDOwner mRootIFD
std::string_view peekString() const
size_type RAWSPEED_READONLY getRemainSize() const
void skipBytes(size_type nbytes)
const uint8_t * peekData(size_type count) const
bool skipPrefix(std::string_view prefix)
static bool isAppropriateDecoder(Buffer file)
MosDecoder(TiffRootIFDOwner &&rootIFD, Buffer file)
static std::string getXMPTag(std::string_view xmp, std::string_view tag)
void checkSupportInternal(const CameraMetaData *meta) override
static bool isAppropriateDecoder(const TiffRootIFD *rootIFD, Buffer file)
void decodeMetaDataInternal(const CameraMetaData *meta) override
RawImage decodeRawInternal() override
virtual void setMetaData(const CameraMetaData *meta, const std::string &make, const std::string &model, const std::string &mode, int iso_speed=0)
bool checkCameraSupported(const CameraMetaData *meta, const std::string &make, const std::string &model, const std::string &mode)
uint32_t getU32(uint32_t index=0) const
std::string getString() const
TiffEntry *RAWSPEED_READONLY getEntryRecursive(TiffTag tag) const
TiffEntry * getEntry(TiffTag tag) const
std::string trimSpaces(std::string_view str)
constexpr RAWSPEED_READNONE Ttgt implicit_cast(Tsrc value)
std::unique_ptr< TiffRootIFD > TiffRootIFDOwner
Endianness getTiffByteOrder(ByteStream bs, uint32_t pos, const char *context="")