RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
SimpleTiffDecoder.cpp
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) 2017 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
#include "
decoders/SimpleTiffDecoder.h
"
24
#include "
adt/Point.h
"
25
#include "
common/RawImage.h
"
26
#include "
decoders/RawDecoderException.h
"
27
#include "
io/Buffer.h
"
28
#include "
tiff/TiffEntry.h
"
29
#include "
tiff/TiffIFD.h
"
30
#include "
tiff/TiffTag.h
"
31
32
namespace
rawspeed
{
33
34
void
SimpleTiffDecoder::anchor
()
const
{
35
// Empty out-of-line definition for the purpose of anchoring
36
// the class's vtable to this Translational Unit.
37
}
38
39
void
SimpleTiffDecoder::prepareForRawDecoding
() {
40
raw
=
getIFDWithLargestImage
();
41
width
=
raw
->getEntry(
TiffTag::IMAGEWIDTH
)->getU32();
42
height
=
raw
->getEntry(
TiffTag::IMAGELENGTH
)->getU32();
43
off
=
raw
->getEntry(
TiffTag::STRIPOFFSETS
)->getU32();
44
c2
=
raw
->getEntry(
TiffTag::STRIPBYTECOUNTS
)->getU32();
45
46
if
(!
mFile
.isValid(
off
,
c2
))
47
ThrowRDE
(
"Image is truncated."
);
48
49
if
(
c2
== 0)
50
ThrowRDE
(
"No image data found."
);
51
52
if
(0 ==
width
|| 0 ==
height
)
53
ThrowRDE
(
"Image has zero size."
);
54
55
checkImageDimensions
();
56
57
mRaw
->dim =
iPoint2D
(
width
,
height
);
58
}
59
60
}
// namespace rawspeed
Buffer.h
Point.h
RawDecoderException.h
ThrowRDE
#define ThrowRDE(...)
Definition
RawDecoderException.h:37
RawImage.h
SimpleTiffDecoder.h
TiffEntry.h
TiffIFD.h
TiffTag.h
rawspeed::AbstractTiffDecoder::getIFDWithLargestImage
const TiffIFD * getIFDWithLargestImage(TiffTag filter=TiffTag::IMAGEWIDTH) const
Definition
AbstractTiffDecoder.cpp:37
rawspeed::RawDecoder::mFile
Buffer mFile
Definition
RawDecoder.h:154
rawspeed::RawDecoder::mRaw
RawImage mRaw
Definition
RawDecoder.h:74
rawspeed::SimpleTiffDecoder::off
uint32_t off
Definition
SimpleTiffDecoder.h:50
rawspeed::SimpleTiffDecoder::raw
const TiffIFD * raw
Definition
SimpleTiffDecoder.h:47
rawspeed::SimpleTiffDecoder::c2
uint32_t c2
Definition
SimpleTiffDecoder.h:51
rawspeed::SimpleTiffDecoder::checkImageDimensions
virtual void checkImageDimensions()=0
rawspeed::SimpleTiffDecoder::prepareForRawDecoding
void prepareForRawDecoding()
Definition
SimpleTiffDecoder.cpp:39
rawspeed::SimpleTiffDecoder::height
uint32_t height
Definition
SimpleTiffDecoder.h:49
rawspeed::SimpleTiffDecoder::anchor
void anchor() const final
Definition
SimpleTiffDecoder.cpp:34
rawspeed::SimpleTiffDecoder::width
uint32_t width
Definition
SimpleTiffDecoder.h:48
rawspeed::iPoint2D
Definition
Point.h:35
rawspeed
Definition
CoalescingOutputIteratorBenchmark.cpp:35
rawspeed::TiffTag::IMAGELENGTH
@ IMAGELENGTH
Definition
TiffTag.h:43
rawspeed::TiffTag::IMAGEWIDTH
@ IMAGEWIDTH
Definition
TiffTag.h:41
rawspeed::TiffTag::STRIPOFFSETS
@ STRIPOFFSETS
Definition
TiffTag.h:53
rawspeed::TiffTag::STRIPBYTECOUNTS
@ STRIPBYTECOUNTS
Definition
TiffTag.h:58
librawspeed
decoders
SimpleTiffDecoder.cpp
Generated by
1.15.0