RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
UncompressedDecompressor.h
Go to the documentation of this file.
1/*
2 RawSpeed - RAW file decoder.
3
4 Copyright (C) 2009-2014 Klaus Post
5 Copyright (C) 2014 Pedro CĂ´rte-Real
6 Copyright (C) 2016-2019 Roman Lebedev
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
10 License as published by the Free Software Foundation; either
11 version 2 of 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, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21*/
22
23#pragma once
24
25#include "adt/Point.h"
27#include "common/RawImage.h"
29#include "io/ByteStream.h"
30#include "io/Endianness.h"
31#include <cstdint>
32
33namespace rawspeed {
34
35class iPoint2D;
36
40
46
48
49 // check buffer size, throw, or compute minimal height that can be decoded
50 void sanityCheck(const uint32_t* h, int bytesPerLine) const;
51
52 // check buffer size, throw, or compute minimal height that can be decoded
53 void sanityCheck(uint32_t w, const uint32_t* h, int bpp) const;
54
55 // for special packed formats
56 static int bytesPerLine(int w, bool skips);
57
58 template <typename Pump, typename NarrowFpType>
59 void decodePackedFP(int rows, int row) const;
60
61 template <typename Pump> void decodePackedInt(int rows, int row) const;
62
63public:
65 const iRectangle2D& crop, int inputPitchBytes,
67
68 /* Helper function for decoders, that will unpack uncompressed image data */
69 /* input: Input image, positioned at first pixel */
70 /* size: Size of the image to decode in pixels */
71 /* offset: offset to write the data into the final image */
72 /* inputPitch: Number of bytes between each line in the input image */
73 /* bitPerPixel: Number of bits to read for each input pixel. */
74 /* order: Order of the bits - see Common.h for possibilities. */
76
77 /* Faster versions for unpacking 8 bit data */
78 template <bool uncorrectedRawValues> void decode8BitRaw();
79
80 /* Faster version for unpacking 12 bit data with control byte every 10 pixels
81 */
82 template <Endianness e> void decode12BitRawWithControl();
83
84 /* Faster version for reading unpacked 12 bit data that is left aligned
85 * (needs >> 4 shift) */
86 template <Endianness e> void decode12BitRawUnpackedLeftAligned();
87};
88
91
92extern template void
94extern template void
96
97extern template void
100extern template void
102
103} // namespace rawspeed
void decodePackedInt(int rows, int row) const
void decodePackedFP(int rows, int row) const
void sanityCheck(const uint32_t *h, int bytesPerLine) const
static int bytesPerLine(int w, bool skips)
UncompressedDecompressor(ByteStream input, RawImage img, const iRectangle2D &crop, int inputPitchBytes, int bitPerPixel, BitOrder order)