3
#include "TiffEntryBE.h"
5
RawSpeed - RAW file decoder.
7
Copyright (C) 2009 Klaus Post
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2 of the License, or (at your option) any later version.
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
http://www.klauspost.com
28
TiffIFDBE::TiffIFDBE() {
32
TiffIFDBE::TiffIFDBE(FileMap* f, uint32 offset) {
37
const unsigned char* data = f->getData(offset);
38
entries = (unsigned short)data[0] << 8 | (unsigned short)data[1]; // Directory entries in this IFD
40
CHECKSIZE(offset + 2 + entries*4);
41
for (int i = 0; i < entries; i++) {
42
TiffEntryBE *t = new TiffEntryBE(f, offset + 2 + i*12);
44
if (t->tag == SUBIFDS || t->tag == EXIFIFDPOINTER || t->tag == DNGPRIVATEDATA || t->tag == MAKERNOTE) { // subIFD tag
45
if (t->tag == DNGPRIVATEDATA) {
47
TiffIFD *maker_ifd = parseDngPrivateData(t);
48
mSubIFD.push_back(maker_ifd);
50
} catch (TiffParserException) {
51
// Unparsable private data are added as entries
54
} else if (t->tag == MAKERNOTE || t->tag == 0x2e) {
56
mSubIFD.push_back(parseMakerNote(f, t->getDataOffset(), endian));
58
} catch (TiffParserException) {
59
// Unparsable makernotes are added as entries
63
const unsigned int* sub_offsets = t->getIntArray();
65
for (uint32 j = 0; j < t->count; j++) {
66
mSubIFD.push_back(new TiffIFDBE(f, sub_offsets[j]));
69
} catch (TiffParserException) {
70
// Unparsable subifds are added as entries
74
} else { // Store as entry
78
data = f->getDataWrt(offset + 2 + entries * 12);
79
nextIFD = (unsigned int)data[0] << 24 | (unsigned int)data[1] << 16 | (unsigned int)data[2] << 8 | (unsigned int)data[3];
83
TiffIFDBE::~TiffIFDBE(void) {
86
} // namespace RawSpeed