RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
DngDecoder.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 "adt/Optional.h"
24#include "common/RawImage.h"
26#include "tiff/TiffIFD.h"
27#include <cstdint>
28#include <vector>
29
30namespace rawspeed {
31
32class Buffer;
33class CameraMetaData;
34class iRectangle2D;
36
37class DngDecoder final : public AbstractTiffDecoder {
38public:
39 static bool isAppropriateDecoder(const TiffRootIFD* rootIFD, Buffer file);
40 DngDecoder(TiffRootIFDOwner&& rootIFD, Buffer file);
41
42 RawImage decodeRawInternal() override;
43 void decodeMetaDataInternal(const CameraMetaData* meta) override;
44 void checkSupportInternal(const CameraMetaData* meta) override;
45
46private:
47 [[nodiscard]] int getDecoderVersion() const override { return 0; }
49 static void dropUnsuportedChunks(std::vector<const TiffIFD*>* data);
51 void parseCFA(const TiffIFD* raw) const;
52 void parseColorMatrix() const;
53 void parseWhiteBalance() const;
55 void decodeData(const TiffIFD* raw, uint32_t sample_format) const;
56 void handleMetadata(const TiffIFD* raw);
57 bool decodeMaskedAreas(const TiffIFD* raw) const;
58 bool decodeBlackLevels(const TiffIFD* raw) const;
59 void setBlack(const TiffIFD* raw) const;
60
62 int compression = -1;
63};
64
65} // namespace rawspeed
AbstractTiffDecoder(TiffRootIFDOwner &&root, Buffer file)
DngDecoder(TiffRootIFDOwner &&rootIFD, Buffer file)
void decodeMetaDataInternal(const CameraMetaData *meta) override
void setBlack(const TiffIFD *raw) const
bool decodeMaskedAreas(const TiffIFD *raw) const
bool decodeBlackLevels(const TiffIFD *raw) const
void parseCFA(const TiffIFD *raw) const
Optional< int > bps
Definition DngDecoder.h:61
void decodeData(const TiffIFD *raw, uint32_t sample_format) const
RawImage decodeRawInternal() override
static bool isAppropriateDecoder(const TiffRootIFD *rootIFD, Buffer file)
static void dropUnsuportedChunks(std::vector< const TiffIFD * > *data)
void handleMetadata(const TiffIFD *raw)
DngTilingDescription getTilingDescription(const TiffIFD *raw) const
void checkSupportInternal(const CameraMetaData *meta) override
void parseWhiteBalance() const
int getDecoderVersion() const override
Definition DngDecoder.h:47
Optional< iRectangle2D > parseACTIVEAREA(const TiffIFD *raw) const
void parseColorMatrix() const
std::unique_ptr< TiffRootIFD > TiffRootIFDOwner
Definition TiffIFD.h:46