libopenraw
neffile.hpp
1/* -*- Mode: C++ -*- */
2/*
3 * libopenraw - neffile.h
4 *
5 * Copyright (C) 2006-2017 Hubert Figuiere
6 * Copyright (C) 2008 Novell, Inc.
7 *
8 * This library is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see
20 * <http://www.gnu.org/licenses/>.
21 */
22
23#ifndef OR_INTERNALS_NEFFILE_H_
24#define OR_INTERNALS_NEFFILE_H_
25
26#include <stdint.h>
27
28#include <array>
29
30#include <libopenraw/consts.h>
31
32#include "rawfile.hpp"
33#include "tiffepfile.hpp"
34#include "ifdfile.hpp"
35#include "io/stream.hpp"
36
37
38namespace OpenRaw {
39
40class RawData;
41
42namespace Internals {
43
44class RawContainer;
45struct HuffmanNode;
46
48 : public TiffEpFile
49{
50public:
51 static RawFile *factory(const IO::Stream::Ptr & _f);
52 NefFile(const IO::Stream::Ptr & _f);
53 virtual ~NefFile();
54
55 NefFile(const NefFile&) = delete;
56 NefFile & operator=(const NefFile &) = delete;
57
61 static bool isCompressed(RawContainer & container, uint32_t offset);
62 bool isNrw();
63
65 public:
67 : curve(0x8000, 0) {
68 }
69 uint16_t vpred[2][2];
70 std::vector<uint16_t> curve;
71 const HuffmanNode* huffman;
72 };
73
74protected:
75
76 virtual uint32_t _translateCompressionType(IFD::TiffCompress tiffCompression) override;
77 virtual ::or_error _unpackData(uint16_t bpc, uint32_t compression,
78 RawData &data, uint32_t x, uint32_t y,
79 uint32_t offset, uint32_t byte_length) override;
80
81private:
82 static const IfdFile::camera_ids_t s_def[];
83
84 bool _getCompressionCurve(RawData&, NEFCompressionInfo&);
85 ::or_error _decompressNikonQuantized(RawData&);
86 virtual ::or_error _decompressIfNeeded(RawData&, uint32_t) override;
87};
88
89}
90}
91
92#endif
static bool isCompressed(RawContainer &container, uint32_t offset)
Definition: neffile.cpp:437
virtual uint32_t _translateCompressionType(IFD::TiffCompress tiffCompression) override
Definition: neffile.cpp:482
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard....
Definition: arwfile.cpp:30