本文整理汇总了C++中TiffEntry::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ TiffEntry::getInt方法的具体用法?C++ TiffEntry::getInt怎么用?C++ TiffEntry::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiffEntry
的用法示例。
在下文中一共展示了TiffEntry::getInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decodeRawInternal
RawImage KdcDecoder::decodeRawInternal() {
int compression = mRootIFD->getEntryRecursive(COMPRESSION)->getInt();
if (7 != compression)
ThrowRDE("KDC Decoder: Unsupported compression %d", compression);
TiffEntry *ex = mRootIFD->getEntryRecursive(PIXELXDIMENSION);
TiffEntry *ey = mRootIFD->getEntryRecursive(PIXELYDIMENSION);
if (NULL == ex || NULL == ey)
ThrowRDE("KDC Decoder: Unable to retrieve image size");
uint32 width = ex->getInt();
uint32 height = ey->getInt();
TiffEntry *offset = mRootIFD->getEntryRecursive(KODAK_KDC_OFFSET);
if (!offset || offset->count < 13)
ThrowRDE("KDC Decoder: Couldn't find the KDC offset");
const uint32 *offsetarray = offset->getIntArray();
uint32 off = offsetarray[4] + offsetarray[12];
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
ByteStream input(mFile->getData(off), mFile->getSize()-off);
Decode12BitRawBE(input, width, height);
return mRaw;
}
示例2: decodeMetaDataInternal
void KdcDecoder::decodeMetaDataInternal(CameraMetaData *meta) {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(MODEL);
if (data.empty())
ThrowRDE("KDC Decoder: Model name found");
if (!data[0]->hasEntry(MAKE))
ThrowRDE("KDC Decoder: Make name not found");
string make = data[0]->getEntry(MAKE)->getString();
string model = data[0]->getEntry(MODEL)->getString();
setMetaData(meta, make, model, "", 0);
// Try the kodak hidden IFD for WB
if (mRootIFD->hasEntryRecursive(KODAK_IFD2)) {
TiffEntry *ifdoffset = mRootIFD->getEntryRecursive(KODAK_IFD2);
TiffIFD *kodakifd = NULL;
try {
if (mRootIFD->endian == getHostEndianness())
kodakifd = new TiffIFD(mFile, ifdoffset->getInt());
else
kodakifd = new TiffIFDBE(mFile, ifdoffset->getInt());
if (kodakifd && kodakifd->hasEntryRecursive(KODAK_KDC_WB)) {
TiffEntry *wb = kodakifd->getEntryRecursive(KODAK_KDC_WB);
if (wb->count == 3) {
const uint32 *tmp = wb->getIntArray();
mRaw->metadata.wbCoeffs[0] = (float)tmp[0];
mRaw->metadata.wbCoeffs[1] = (float)tmp[1];
mRaw->metadata.wbCoeffs[2] = (float)tmp[2];
}
}
} catch(TiffParserException e) {
mRaw->setError(e.what());
}
if (kodakifd)
delete kodakifd;
}
// Use the normal WB if available
if (mRootIFD->hasEntryRecursive(KODAKWB)) {
TiffEntry *wb = mRootIFD->getEntryRecursive(KODAKWB);
if (wb->count == 734 || wb->count == 1502) {
const uchar8 *tmp = wb->getData();
mRaw->metadata.wbCoeffs[0] = (float)((((ushort16) tmp[148])<<8)|tmp[149])/256.0f;
mRaw->metadata.wbCoeffs[1] = 1.0f;
mRaw->metadata.wbCoeffs[2] = (float)((((ushort16) tmp[150])<<8)|tmp[151])/256.0f;
}
}
}
示例3: decodeRawInternal
RawImage PefDecoder::decodeRawInternal() {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(STRIPOFFSETS);
if (data.empty())
ThrowRDE("PEF Decoder: No image data found");
TiffIFD* raw = data[0];
int compression = raw->getEntry(COMPRESSION)->getInt();
if (1 == compression) {
decodeUncompressed(raw, true);
return mRaw;
}
if (65535 != compression)
ThrowRDE("PEF Decoder: Unsupported compression");
TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
if (offsets->count != 1) {
ThrowRDE("PEF Decoder: Multiple Strips found: %u", offsets->count);
}
if (counts->count != offsets->count) {
ThrowRDE("PEF Decoder: Byte count number does not match strip size: count:%u, strips:%u ", counts->count, offsets->count);
}
if (!mFile->isValid(offsets->getInt() + counts->getInt()))
ThrowRDE("PEF Decoder: Truncated file.");
uint32 width = raw->getEntry(IMAGEWIDTH)->getInt();
uint32 height = raw->getEntry(IMAGELENGTH)->getInt();
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
try {
PentaxDecompressor l(mFile, mRaw);
l.decodePentax(mRootIFD, offsets->getInt(), counts->getInt());
} catch (IOException &e) {
errors.push_back(_strdup(e.what()));
// Let's ignore it, it may have delivered somewhat useful data.
}
return mRaw;
}
示例4: decodeRawInternal
RawImage KdcDecoder::decodeRawInternal() {
if (!mRootIFD->hasEntryRecursive(COMPRESSION))
ThrowRDE("KDC Decoder: Couldn't find compression setting");
int compression = mRootIFD->getEntryRecursive(COMPRESSION)->getInt();
if (7 != compression)
ThrowRDE("KDC Decoder: Unsupported compression %d", compression);
uint32 width = 0;
uint32 height = 0;
TiffEntry *ew = mRootIFD->getEntryRecursive(KODAK_KDC_WIDTH);
TiffEntry *eh = mRootIFD->getEntryRecursive(KODAK_KDC_HEIGHT);
if (ew && eh) {
width = ew->getInt()+80;
height = eh->getInt()+70;
} else
ThrowRDE("KDC Decoder: Unable to retrieve image size");
TiffEntry *offset = mRootIFD->getEntryRecursive(KODAK_KDC_OFFSET);
if (!offset || offset->count < 13)
ThrowRDE("KDC Decoder: Couldn't find the KDC offset");
const uint32 *offsetarray = offset->getIntArray();
uint32 off = offsetarray[4] + offsetarray[12];
// Offset hardcoding gotten from dcraw
if (hints.find("easyshare_offset_hack") != hints.end())
off = off < 0x15000 ? 0x15000 : 0x17000;
if (off > mFile->getSize())
ThrowRDE("KDC Decoder: offset is out of bounds");
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
ByteStream input(mFile, off);
Decode12BitRawBE(input, width, height);
return mRaw;
}
示例5: 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;
}
示例6: decodeRawInternal
RawImage NefDecoder::decodeRawInternal() {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(CFAPATTERN);
if (data.empty())
ThrowRDE("NEF Decoder: No image data found");
TiffIFD* raw = data[0];
int compression = raw->getEntry(COMPRESSION)->getInt();
data = mRootIFD->getIFDsWithTag(MODEL);
if (data.empty())
ThrowRDE("NEF Decoder: No model data found");
TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
if (!data[0]->getEntry(MODEL)->getString().compare("NIKON D100 ")) { /**Sigh**/
if (!mFile->isValid(offsets->getInt()))
ThrowRDE("NEF Decoder: Image data outside of file.");
if (!D100IsCompressed(offsets->getInt())) {
DecodeD100Uncompressed();
return mRaw;
}
}
if (compression == 1 || (hints.find(string("force_uncompressed")) != hints.end()) ||
NEFIsUncompressed(raw)) {
DecodeUncompressed();
return mRaw;
}
if (NEFIsUncompressedRGB(raw)) {
DecodeSNefUncompressed();
return mRaw;
}
if (offsets->count != 1) {
ThrowRDE("NEF Decoder: Multiple Strips found: %u", offsets->count);
}
if (counts->count != offsets->count) {
ThrowRDE("NEF Decoder: Byte count number does not match strip size: count:%u, strips:%u ", counts->count, offsets->count);
}
if (!mFile->isValid(offsets->getInt(), counts->getInt()))
ThrowRDE("NEF Decoder: Invalid strip byte count. File probably truncated.");
if (34713 != compression)
ThrowRDE("NEF Decoder: Unsupported compression");
uint32 width = raw->getEntry(IMAGEWIDTH)->getInt();
uint32 height = raw->getEntry(IMAGELENGTH)->getInt();
uint32 bitPerPixel = raw->getEntry(BITSPERSAMPLE)->getInt();
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
data = mRootIFD->getIFDsWithTag((TiffTag)0x8c);
if (data.empty())
ThrowRDE("NEF Decoder: Decompression info tag not found");
TiffEntry *meta;
if (data[0]->hasEntry((TiffTag)0x96)) {
meta = data[0]->getEntry((TiffTag)0x96);
} else {
meta = data[0]->getEntry((TiffTag)0x8c); // Fall back
}
try {
NikonDecompressor decompressor(mFile, mRaw);
decompressor.uncorrectedRawValues = uncorrectedRawValues;
ByteStream* metastream;
if (getHostEndianness() == data[0]->endian)
metastream = new ByteStream(meta->getData(), meta->count);
else
metastream = new ByteStreamSwap(meta->getData(), meta->count);
decompressor.DecompressNikon(metastream, width, height, bitPerPixel, offsets->getInt(), counts->getInt());
delete metastream;
} catch (IOException &e) {
mRaw->setError(e.what());
// Let's ignore it, it may have delivered somewhat useful data.
}
return mRaw;
}
示例7: decodeRawInternal
RawImage NefDecoder::decodeRawInternal() {
vector<TiffIFD*> data = mRootIFD->getIFDsWithTag(CFAPATTERN);
if (data.empty())
ThrowRDE("NEF Decoder: No image data found");
TiffIFD* raw = data[0];
int compression = raw->getEntry(COMPRESSION)->getInt();
data = mRootIFD->getIFDsWithTag(MODEL);
if (data.empty())
ThrowRDE("NEF Decoder: No model data found");
TiffEntry *offsets = raw->getEntry(STRIPOFFSETS);
TiffEntry *counts = raw->getEntry(STRIPBYTECOUNTS);
if (!data[0]->getEntry(MODEL)->getString().compare("NIKON D100 ")) { /**Sigh**/
if (!mFile->isValid(offsets->getInt()))
ThrowRDE("NEF Decoder: Image data outside of file.");
if (!D100IsCompressed(offsets->getInt())) {
DecodeD100Uncompressed();
return mRaw;
}
}
if (compression == 1) {
DecodeUncompressed();
return mRaw;
}
if (offsets->count != 1) {
ThrowRDE("NEF Decoder: Multiple Strips found: %u", offsets->count);
}
if (counts->count != offsets->count) {
ThrowRDE("NEF Decoder: Byte count number does not match strip size: count:%u, strips:%u ", counts->count, offsets->count);
}
if (!mFile->isValid(offsets->getInt() + counts->getInt()))
ThrowRDE("NEF Decoder: Invalid strip byte count. File probably truncated.");
if (34713 != compression)
ThrowRDE("NEF Decoder: Unsupported compression");
uint32 width = raw->getEntry(IMAGEWIDTH)->getInt();
uint32 height = raw->getEntry(IMAGELENGTH)->getInt();
uint32 bitPerPixel = raw->getEntry(BITSPERSAMPLE)->getInt();
mRaw->dim = iPoint2D(width, height);
mRaw->createData();
data = mRootIFD->getIFDsWithTag(MAKERNOTE);
if (data.empty())
ThrowRDE("NEF Decoder: No EXIF data found");
TiffIFD* exif = data[0];
TiffEntry *makernoteEntry = exif->getEntry(MAKERNOTE);
const uchar8* makernote = makernoteEntry->getData();
FileMap makermap((uchar8*)&makernote[10], mFile->getSize() - makernoteEntry->getDataOffset() - 10);
TiffParser makertiff(&makermap);
makertiff.parseData();
data = makertiff.RootIFD()->getIFDsWithTag((TiffTag)0x8c);
if (data.empty())
ThrowRDE("NEF Decoder: Decompression info tag not found");
TiffEntry *meta;
try {
meta = data[0]->getEntry((TiffTag)0x96);
} catch (TiffParserException) {
meta = data[0]->getEntry((TiffTag)0x8c); // Fall back
}
try {
NikonDecompressor decompressor(mFile, mRaw);
ByteStream* metastream;
if (getHostEndianness() == data[0]->endian)
metastream = new ByteStream(meta->getData(), meta->count);
else
metastream = new ByteStreamSwap(meta->getData(), meta->count);
decompressor.DecompressNikon(metastream, width, height, bitPerPixel, offsets->getInt(), counts->getInt());
delete metastream;
} catch (IOException &e) {
mRaw->setError(e.what());
// Let's ignore it, it may have delivered somewhat useful data.
}
return mRaw;
}