RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
TiffParser.h
Go to the documentation of this file.
1/*
2 RawSpeed - RAW file decoder.
3
4 Copyright (C) 2009-2014 Klaus Post
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19*/
20
21#pragma once
22
23#include "decoders/RawDecoder.h"
24#include "io/Buffer.h"
25#include "parsers/RawParser.h"
26#include "tiff/TiffIFD.h"
27#include <array>
28#include <memory>
29#include <utility>
30
31namespace rawspeed {
32
33class Buffer;
34class CameraMetaData;
35class RawDecoder;
36
37class TiffParser final : public RawParser {
38public:
39 explicit TiffParser(Buffer file);
40
41 std::unique_ptr<RawDecoder>
42 getDecoder(const CameraMetaData* meta = nullptr) override;
43
44 // TiffRootIFDOwner contains pointers into 'data' but if is is non-owning, it
45 // may be deleted immediately
46 static TiffRootIFDOwner parse(TiffIFD* parent, Buffer data);
47
48 // transfers ownership of TiffIFD into RawDecoder
49 static std::unique_ptr<RawDecoder> makeDecoder(TiffRootIFDOwner root,
50 Buffer data);
51
52 template <class Decoder>
53 static std::unique_ptr<RawDecoder> constructor(TiffRootIFDOwner&& root,
54 Buffer data);
55 using checker_t = bool (*)(const TiffRootIFD* root, Buffer data);
56 using constructor_t = std::unique_ptr<RawDecoder> (*)(TiffRootIFDOwner&& root,
57 Buffer data);
58 static const std::array<std::pair<checker_t, constructor_t>, 17> Map;
59};
60
61} // namespace rawspeed
RawParser(Buffer inputData)
Definition RawParser.h:33
std::unique_ptr< RawDecoder >(*)(TiffRootIFDOwner &&root, Buffer data) constructor_t
Definition TiffParser.h:56
static TiffRootIFDOwner parse(TiffIFD *parent, Buffer data)
static const std::array< std::pair< checker_t, constructor_t >, 17 > Map
Definition TiffParser.h:58
std::unique_ptr< RawDecoder > getDecoder(const CameraMetaData *meta=nullptr) override
TiffParser(Buffer file)
static std::unique_ptr< RawDecoder > makeDecoder(TiffRootIFDOwner root, Buffer data)
static std::unique_ptr< RawDecoder > constructor(TiffRootIFDOwner &&root, Buffer data)
bool(*)(const TiffRootIFD *root, Buffer data) checker_t
Definition TiffParser.h:55
std::unique_ptr< TiffRootIFD > TiffRootIFDOwner
Definition TiffIFD.h:46