~ubuntu-branches/ubuntu/saucy/darktable/saucy

« back to all changes in this revision

Viewing changes to src/rawspeed/RawSpeed/TiffIFD.h

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2011-08-02 21:32:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110802213231-r9v63trgyk1e822j
Tags: 0.9.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef TIFF_IFD_H
2
 
#define TIFF_IFD_H
3
 
 
4
 
#include "FileMap.h"
5
 
#include "TiffEntry.h"
6
 
#include "TiffParserException.h"
7
 
 
8
 
/* 
9
 
    RawSpeed - RAW file decoder.
10
 
 
11
 
    Copyright (C) 2009 Klaus Post
12
 
 
13
 
    This library is free software; you can redistribute it and/or
14
 
    modify it under the terms of the GNU Lesser General Public
15
 
    License as published by the Free Software Foundation; either
16
 
    version 2 of the License, or (at your option) any later version.
17
 
 
18
 
    This library is distributed in the hope that it will be useful,
19
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21
 
    Lesser General Public License for more details.
22
 
 
23
 
    You should have received a copy of the GNU Lesser General Public
24
 
    License along with this library; if not, write to the Free Software
25
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26
 
 
27
 
    http://www.klauspost.com
28
 
*/
29
 
 
30
 
namespace RawSpeed {
31
 
 
32
 
 
33
 
class TiffIFD
34
 
{
35
 
public:
36
 
  TiffIFD();
37
 
  TiffIFD(FileMap* f, uint32 offset);
38
 
  virtual ~TiffIFD(void);
39
 
  vector<TiffIFD*> mSubIFD;
40
 
  map<TiffTag, TiffEntry*> mEntry;
41
 
  int getNextIFD() {return nextIFD;}
42
 
  vector<TiffIFD*> getIFDsWithTag(TiffTag tag);
43
 
  TiffEntry* getEntry(TiffTag tag);
44
 
  bool hasEntry(TiffTag tag);
45
 
  bool hasEntryRecursive(TiffTag tag);
46
 
  TiffEntry* getEntryRecursive(TiffTag tag);
47
 
  TiffIFD* parseDngPrivateData(TiffEntry *t);
48
 
  TiffIFD* parseMakerNote(FileMap *f, uint32 offset, Endianness parent_end);
49
 
  Endianness endian;
50
 
protected:
51
 
  int nextIFD;
52
 
};
53
 
 
54
 
inline bool isTiffSameAsHost(const ushort16* tifftag) {
55
 
  Endianness host = getHostEndianness();
56
 
  if (tifftag[0] == 0x4949)
57
 
    return little == host;
58
 
  if (tifftag[0] == 0x4d4d)
59
 
    return big == host;
60
 
  ThrowTPE("Unknown Tiff Byteorder :%x", tifftag[0]);
61
 
  return false;
62
 
}
63
 
 
64
 
inline Endianness getTiffEndianness(const ushort16* tifftag) {
65
 
  if (tifftag[0] == 0x4949)
66
 
    return little;
67
 
  if (tifftag[0] == 0x4d4d)
68
 
    return big;
69
 
  return unknown;
70
 
}
71
 
 
72
 
} // namespace RawSpeed
73
 
 
74
 
#endif