RawSpeed
fast raw decoding library
Loading...
Searching...
No Matches
AbstractTiffDecoder.cpp
Go to the documentation of this file.
1
/*
2
RawSpeed - RAW file decoder.
3
4
Copyright (C) 2017 Axel Waggershauser
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include "
decoders/AbstractTiffDecoder.h
"
22
#include "
decoders/RawDecoderException.h
"
23
#include "
tiff/TiffEntry.h
"
24
#include "
tiff/TiffIFD.h
"
25
#include "
tiff/TiffTag.h
"
26
#include <cstdint>
27
#include <vector>
28
29
namespace
rawspeed
{
30
31
void
AbstractTiffDecoder::anchor
()
const
{
32
// Empty out-of-line definition for the purpose of anchoring
33
// the class's vtable to this Translational Unit.
34
}
35
36
const
TiffIFD
*
37
AbstractTiffDecoder::getIFDWithLargestImage
(
TiffTag
filter)
const
{
38
std::vector<const TiffIFD*> ifds =
mRootIFD
->getIFDsWithTag(filter);
39
40
if
(ifds.empty())
41
ThrowRDE
(
"No suitable IFD with tag 0x%04x found."
,
42
static_cast<
unsigned
>
(filter));
43
44
const
auto
* res = ifds[0];
45
uint32_t
width = res->getEntry(
TiffTag::IMAGEWIDTH
)->getU32();
46
for
(
const
auto
* ifd : ifds) {
47
const
TiffEntry
* widthE = ifd->getEntry(
TiffTag::IMAGEWIDTH
);
48
// guard against random maker note entries with the same tag
49
if
(widthE->
count
== 1 && widthE->
getU32
() > width) {
50
res = ifd;
51
width = widthE->
getU32
();
52
}
53
}
54
55
return
res;
56
}
57
58
}
// namespace rawspeed
AbstractTiffDecoder.h
RawDecoderException.h
ThrowRDE
#define ThrowRDE(...)
Definition
RawDecoderException.h:37
TiffEntry.h
TiffIFD.h
TiffTag.h
rawspeed::AbstractTiffDecoder::anchor
virtual void anchor() const
Definition
AbstractTiffDecoder.cpp:31
rawspeed::AbstractTiffDecoder::getIFDWithLargestImage
const TiffIFD * getIFDWithLargestImage(TiffTag filter=TiffTag::IMAGEWIDTH) const
Definition
AbstractTiffDecoder.cpp:37
rawspeed::AbstractTiffDecoder::mRootIFD
TiffRootIFDOwner mRootIFD
Definition
AbstractTiffDecoder.h:40
rawspeed::TiffEntry
Definition
TiffEntry.h:62
rawspeed::TiffEntry::getU32
uint32_t getU32(uint32_t index=0) const
Definition
TiffEntry.cpp:203
rawspeed::TiffEntry::count
uint32_t count
Definition
TiffEntry.h:84
rawspeed::TiffIFD
Definition
TiffIFD.h:49
uint32_t
rawspeed
Definition
CoalescingOutputIteratorBenchmark.cpp:35
rawspeed::TiffTag
TiffTag
Definition
TiffTag.h:32
rawspeed::TiffTag::IMAGEWIDTH
@ IMAGEWIDTH
Definition
TiffTag.h:41
librawspeed
decoders
AbstractTiffDecoder.cpp
Generated by
1.15.0