本文整理汇总了C++中TiffEntry::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ TiffEntry::getData方法的具体用法?C++ TiffEntry::getData怎么用?C++ TiffEntry::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiffEntry
的用法示例。
在下文中一共展示了TiffEntry::getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}
示例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);
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 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;
}
示例4: 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;
}