1 /*
2     RawSpeed - RAW file decoder.
3 
4     Copyright (C) 2009-2014 Klaus Post
5     Copyright (C) 2014 Pedro Côrte-Real
6 
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11 
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Lesser General Public License for more details.
16 
17     You should have received a copy of the GNU Lesser General Public
18     License along with this library; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 #pragma once
23 
24 #include "common/Common.h"       // for BitOrder, BitOrder::MSB16
25 #include "common/RawImage.h"     // for RawImage
26 #include "decoders/RawDecoder.h" // for RawDecoder
27 #include <cstdint>               // for uint32_t
28 #include <map>                   // for map
29 #include <string>                // for string
30 
31 namespace rawspeed {
32 
33 class Camera;
34 class CameraMetaData;
35 class Buffer;
36 
37 class NakedDecoder final : public RawDecoder {
38   const Camera* cam;
39 
40   uint32_t width{0};
41   uint32_t height{0};
42   uint32_t filesize{0};
43   uint32_t bits{0};
44   uint32_t offset{0};
45   BitOrder bo{BitOrder::MSB16};
46 
47   static const std::map<std::string, BitOrder, std::less<>> order2enum;
48   void parseHints();
49 
50 public:
51   NakedDecoder(const Buffer& file, const Camera* c);
52   RawImage decodeRawInternal() override;
53   void checkSupportInternal(const CameraMetaData* meta) override;
54   void decodeMetaDataInternal(const CameraMetaData* meta) override;
55 
56 private:
getDecoderVersion()57   [[nodiscard]] int getDecoderVersion() const override { return 0; }
58 };
59 
60 } // namespace rawspeed
61