本文整理汇总了C++中TiffIFD::hasEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ TiffIFD::hasEntry方法的具体用法?C++ TiffIFD::hasEntry怎么用?C++ TiffIFD::hasEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiffIFD
的用法示例。
在下文中一共展示了TiffIFD::hasEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ThrowRDE
void Cr2Decoder::checkSupportInternal(CameraMetaData *meta) {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(MODEL);
if (data.empty())
ThrowRDE("CR2 Support check: Model name not found");
if (!data[0]->hasEntry(MAKE))
ThrowRDE("CR2 Support: Make name not found");
string make = data[0]->getEntry(MAKE)->getString();
string model = data[0]->getEntry(MODEL)->getString();
// Check for sRaw mode
data = mRootIFD->getIFDsWithTag((TiffTag)0xc5d8);
if (!data.empty()) {
TiffIFD* raw = data[0];
if (raw->hasEntry((TiffTag)0xc6c5)) {
ushort16 ss = raw->getEntry((TiffTag)0xc6c5)->getInt();
if (ss == 4) {
this->checkCameraSupported(meta, make, model, "sRaw1");
return;
}
}
}
this->checkCameraSupported(meta, make, model, "");
}
示例2: input_start
RawImage Rw2Decoder::decodeRawInternal() {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(PANASONIC_STRIPOFFSET);
bool isOldPanasonic = FALSE;
if (data.empty()) {
if (!mRootIFD->hasEntryRecursive(STRIPOFFSETS))
ThrowRDE("RW2 Decoder: No image data found");
isOldPanasonic = TRUE;
data = mRootIFD->getIFDsWithTag(STRIPOFFSETS);
}
TiffIFD* raw = data[0];
uint32 height = raw->getEntry((TiffTag)3)->getShort();
uint32 width = raw->getEntry((TiffTag)2)->getShort();
if (isOldPanasonic) {
ThrowRDE("Cannot decode old-style Panasonic RAW files");
TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
if (offsets->count != 1) {
ThrowRDE("RW2 Decoder: Multiple Strips found: %u", offsets->count);
}
int off = offsets->getInt();
if (!mFile->isValid(off))
ThrowRDE("Panasonic RAW Decoder: Invalid image data offset, cannot decode.");
int count = counts->getInt();
if (count != (int)(width*height*2))
ThrowRDE("Panasonic RAW Decoder: Byte count is wrong.");
if (!mFile->isValid(off+count))
ThrowRDE("Panasonic RAW Decoder: Invalid image data offset, cannot decode.");
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
ByteStream input_start(mFile->getData(off), mFile->getSize() - off);
iPoint2D pos(0, 0);
readUncompressedRaw(input_start, mRaw->dim,pos, width*2, 16, BitOrder_Plain);
} else {
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
TiffEntry *offsets = raw->getEntry(PANASONIC_STRIPOFFSET);
if (offsets->count != 1) {
ThrowRDE("RW2 Decoder: Multiple Strips found: %u", offsets->count);
}
load_flags = 0x2008;
int off = offsets->getInt();
if (!mFile->isValid(off))
ThrowRDE("RW2 Decoder: Invalid image data offset, cannot decode.");
input_start = new ByteStream(mFile->getData(off), mFile->getSize() - off);
DecodeRw2();
}
// Read blacklevels
if (raw->hasEntry((TiffTag)0x1c) && raw->hasEntry((TiffTag)0x1d) && raw->hasEntry((TiffTag)0x1e)) {
mRaw->blackLevelSeparate[0] = raw->getEntry((TiffTag)0x1c)->getInt() + 15;
mRaw->blackLevelSeparate[1] = mRaw->blackLevelSeparate[2] = raw->getEntry((TiffTag)0x1d)->getInt() + 15;
mRaw->blackLevelSeparate[3] = raw->getEntry((TiffTag)0x1e)->getInt() + 15;
}
return mRaw;
}
示例3: final_size
RawImage Cr2Decoder::decodeRawInternal() {
if(hints.find("old_format") != hints.end()) {
uint32 off = 0;
if (mRootIFD->getEntryRecursive((TiffTag)0x81))
off = mRootIFD->getEntryRecursive((TiffTag)0x81)->getInt();
else {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(CFAPATTERN);
if (data.empty())
ThrowRDE("CR2 Decoder: Couldn't find offset");
else {
if (data[0]->hasEntry(STRIPOFFSETS))
off = data[0]->getEntry(STRIPOFFSETS)->getInt();
else
ThrowRDE("CR2 Decoder: Couldn't find offset");
}
}
ByteStream *b;
if (getHostEndianness() == big)
b = new ByteStream(mFile, off+41);
else
b = new ByteStreamSwap(mFile, off+41);
uint32 height = b->getShort();
uint32 width = b->getShort();
// Every two lines can be encoded as a single line, probably to try and get
// better compression by getting the same RGBG sequence in every line
if(hints.find("double_line_ljpeg") != hints.end()) {
height *= 2;
mRaw->dim = iPoint2D(width*2, height/2);
}
else {
width *= 2;
mRaw->dim = iPoint2D(width, height);
}
mRaw->createData();
LJpegPlain *l = new LJpegPlain(mFile, mRaw);
try {
l->startDecoder(off, mFile->getSize()-off, 0, 0);
} catch (IOException& e) {
mRaw->setError(e.what());
}
delete l;
if(hints.find("double_line_ljpeg") != hints.end()) {
// We now have a double width half height image we need to convert to the
// normal format
iPoint2D final_size(width, height);
RawImage procRaw = RawImage::create(final_size, TYPE_USHORT16, 1);
procRaw->metadata = mRaw->metadata;
procRaw->copyErrorsFrom(mRaw);
for (uint32 y = 0; y < height; y++) {
ushort16 *dst = (ushort16*)procRaw->getData(0,y);
ushort16 *src = (ushort16*)mRaw->getData(y%2 == 0 ? 0 : width, y/2);
for (uint32 x = 0; x < width; x++)
dst[x] = src[x];
}
mRaw = procRaw;
}
if (mRootIFD->getEntryRecursive((TiffTag)0x123)) {
TiffEntry *curve = mRootIFD->getEntryRecursive((TiffTag)0x123);
if (curve->type == TIFF_SHORT && curve->count == 4096) {
TiffEntry *linearization = mRootIFD->getEntryRecursive((TiffTag)0x123);
uint32 len = linearization->count;
ushort16 *table = new ushort16[len];
linearization->getShortArray(table, len);
if (!uncorrectedRawValues) {
mRaw->setTable(table, 4096, true);
// Apply table
mRaw->sixteenBitLookup();
// Delete table
mRaw->setTable(NULL);
} else {
// We want uncorrected, but we store the table.
mRaw->setTable(table, 4096, false);
}
}
}
return mRaw;
}
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag((TiffTag)0xc5d8);
if (data.empty())
ThrowRDE("CR2 Decoder: No image data found");
TiffIFD* raw = data[0];
mRaw = RawImage::create();
mRaw->isCFA = true;
vector<Cr2Slice> slices;
int completeH = 0;
bool doubleHeight = false;
try {
//.........这里部分代码省略.........