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
"
26
#include "
bitstreams/BitStreams.h
"
27
#include "
common/RawImage.h
"
28
#include "
decompressors/AbstractDecompressor.h
"
29
#include "
io/ByteStream.h
"
30
#include "
io/Endianness.h
"
31
#include <cstdint>
32
33
namespace
rawspeed
{
34
35
class
iPoint2D
;
36
37
class
UncompressedDecompressor
final :
public
AbstractDecompressor
{
38
ByteStream
input
;
39
RawImage
mRaw
;
40
41
const
iPoint2D
size
;
42
const
iPoint2D
offset
;
43
int
inputPitchBytes
;
44
int
bitPerPixel
;
45
BitOrder
order
;
46
47
uint32_t
skipBytes
;
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
63
public
:
64
UncompressedDecompressor
(
ByteStream
input
,
RawImage
img,
65
const
iRectangle2D
& crop,
int
inputPitchBytes
,
66
int
bitPerPixel
,
BitOrder
order
);
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. */
75
void
readUncompressedRaw
();
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
89
extern
template
void
UncompressedDecompressor::decode8BitRaw<false>
();
90
extern
template
void
UncompressedDecompressor::decode8BitRaw<true>
();
91
92
extern
template
void
93
UncompressedDecompressor::decode12BitRawWithControl<Endianness::little>
();
94
extern
template
void
95
UncompressedDecompressor::decode12BitRawWithControl<Endianness::big>
();
96
97
extern
template
void
98
UncompressedDecompressor::decode12BitRawUnpackedLeftAligned
<
99
Endianness::little
>();
100
extern
template
void
101
UncompressedDecompressor::decode12BitRawUnpackedLeftAligned<Endianness::big>
();
102
103
}
// namespace rawspeed
AbstractDecompressor.h
BitStreams.h
ByteStream.h
Endianness.h
Point.h
RawImage.h
rawspeed::AbstractDecompressor
Definition
AbstractDecompressor.h:25
rawspeed::ByteStream
Definition
ByteStream.h:43
rawspeed::RawImage
Definition
RawImage.h:247
rawspeed::UncompressedDecompressor::inputPitchBytes
int inputPitchBytes
Definition
UncompressedDecompressor.h:43
rawspeed::UncompressedDecompressor::bitPerPixel
int bitPerPixel
Definition
UncompressedDecompressor.h:44
rawspeed::UncompressedDecompressor::decode8BitRaw
void decode8BitRaw()
Definition
UncompressedDecompressor.cpp:271
rawspeed::UncompressedDecompressor::decodePackedInt
void decodePackedInt(int rows, int row) const
Definition
UncompressedDecompressor.cpp:189
rawspeed::UncompressedDecompressor::input
ByteStream input
Definition
UncompressedDecompressor.h:38
rawspeed::UncompressedDecompressor::decodePackedFP
void decodePackedFP(int rows, int row) const
Definition
UncompressedDecompressor.cpp:172
rawspeed::UncompressedDecompressor::skipBytes
uint32_t skipBytes
Definition
UncompressedDecompressor.h:47
rawspeed::UncompressedDecompressor::readUncompressedRaw
void readUncompressedRaw()
Definition
UncompressedDecompressor.cpp:202
rawspeed::UncompressedDecompressor::size
const iPoint2D size
Definition
UncompressedDecompressor.h:41
rawspeed::UncompressedDecompressor::sanityCheck
void sanityCheck(const uint32_t *h, int bytesPerLine) const
Definition
UncompressedDecompressor.cpp:52
rawspeed::UncompressedDecompressor::mRaw
RawImage mRaw
Definition
UncompressedDecompressor.h:39
rawspeed::UncompressedDecompressor::offset
const iPoint2D offset
Definition
UncompressedDecompressor.h:42
rawspeed::UncompressedDecompressor::decode12BitRawWithControl
void decode12BitRawWithControl()
Definition
UncompressedDecompressor.cpp:297
rawspeed::UncompressedDecompressor::order
BitOrder order
Definition
UncompressedDecompressor.h:45
rawspeed::UncompressedDecompressor::decode12BitRawUnpackedLeftAligned
void decode12BitRawUnpackedLeftAligned()
Definition
UncompressedDecompressor.cpp:357
rawspeed::UncompressedDecompressor::bytesPerLine
static int bytesPerLine(int w, bool skips)
Definition
UncompressedDecompressor.cpp:88
rawspeed::UncompressedDecompressor::UncompressedDecompressor
UncompressedDecompressor(ByteStream input, RawImage img, const iRectangle2D &crop, int inputPitchBytes, int bitPerPixel, BitOrder order)
Definition
UncompressedDecompressor.cpp:106
rawspeed::iPoint2D
Definition
Point.h:35
rawspeed::iRectangle2D
Definition
Point.h:107
uint32_t
rawspeed
Definition
CoalescingOutputIteratorBenchmark.cpp:35
rawspeed::BitOrder
BitOrder
Definition
BitStreams.h:28
rawspeed::Endianness::little
@ little
Definition
Endianness.h:32
librawspeed
decompressors
UncompressedDecompressor.h
Generated by
1.15.0