本文整理汇总了C++中TiffEntry::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ TiffEntry::setData方法的具体用法?C++ TiffEntry::setData怎么用?C++ TiffEntry::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiffEntry
的用法示例。
在下文中一共展示了TiffEntry::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDecoder
RawDecoder* RawParser::getDecoder(CameraMetaData* meta) {
const unsigned char* data = mInput->getData(0);
// We need some data.
// For now it is 104 bytes for RAF images.
if (mInput->getSize() <= 104)
ThrowRDE("File too small");
// MRW images are easy to check for, let's try that first
if (MrwDecoder::isMRW(mInput)) {
try {
return new MrwDecoder(mInput);
} catch (RawDecoderException) {
}
}
if (0 == memcmp(&data[0], "ARRI\x12\x34\x56\x78", 8)) {
try {
return new AriDecoder(mInput);
} catch (RawDecoderException) {
}
}
// FUJI has pointers to IFD's at fixed byte offsets
// So if camera is FUJI, we cannot use ordinary TIFF parser
if (0 == memcmp(&data[0], "FUJIFILM", 8)) {
// First IFD typically JPEG and EXIF
uint32 first_ifd = data[87] | (data[86]<<8) | (data[85]<<16) | (data[84]<<24);
first_ifd += 12;
if (mInput->getSize() <= first_ifd)
ThrowRDE("File too small (FUJI first IFD)");
// RAW IFD on newer, pointer to raw data on older models, so we try parsing first
// And adds it as data if parsin fails
uint32 second_ifd = (uint32)data[103] | (data[102]<<8) | (data[101]<<16) | (data[100]<<24);
if (mInput->getSize() <= second_ifd)
second_ifd = 0;
// RAW information IFD on older
uint32 third_ifd = data[95] | (data[94]<<8) | (data[93]<<16) | (data[92]<<24);
if (mInput->getSize() <= third_ifd)
third_ifd = 0;
// Open the IFDs and merge them
try {
FileMap *m1 = new FileMap(mInput->getDataWrt(first_ifd), mInput->getSize()-first_ifd);
FileMap *m2 = NULL;
TiffParser p(m1);
p.parseData();
if (second_ifd) {
m2 = new FileMap(mInput->getDataWrt(second_ifd), mInput->getSize()-second_ifd);
try {
TiffParser p2(m2);
p2.parseData();
p.MergeIFD(&p2);
} catch (TiffParserException e) {
delete m2;
m2 = NULL;
}
}
TiffIFD *new_ifd = new TiffIFD(mInput);
p.RootIFD()->mSubIFD.push_back(new_ifd);
if (third_ifd) {
try {
ParseFuji(third_ifd, new_ifd);
} catch (TiffParserException e) {
}
}
// Make sure these aren't leaked.
RawDecoder *d = p.getDecoder();
d->ownedObjects.push_back(m1);
if (m2)
d->ownedObjects.push_back(m2);
if (!m2 && second_ifd) {
TiffEntry *entry = new TiffEntry(FUJI_STRIPOFFSETS, TIFF_LONG, 1);
entry->setData(&second_ifd, 4);
new_ifd->mEntry[entry->tag] = entry;
entry = new TiffEntry(FUJI_STRIPBYTECOUNTS, TIFF_LONG, 1);
uint32 max_size = mInput->getSize()-second_ifd;
entry->setData(&max_size, 4);
new_ifd->mEntry[entry->tag] = entry;
}
return d;
} catch (TiffParserException) {}
ThrowRDE("No decoder found. Sorry.");
}
// Ordinary TIFF images
try {
TiffParser p(mInput);
p.parseData();
return p.getDecoder();
} catch (TiffParserException) {}
try {
X3fParser parser(mInput);
return parser.getDecoder();
} catch (RawDecoderException) {
//.........这里部分代码省略.........