Coverage Report

Created: 2026-05-31 06:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/exiv2/src/canonmn_int.hpp
Line
Count
Source
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/*!
3
  @file    canonmn_int.hpp
4
  @brief   Canon makernote tags.<BR>References:<BR>
5
           [1] <a href="http://www.burren.cx/david/canon.html">EXIF MakerNote of Canon</a> by David Burren<br>
6
           [2] <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html">Canon makernote tags</a> by
7
  Phil Harvey
8
  @author  <a href="mailto:ahuggel@gmx.net">Andreas Huggel (ahu)</a><br>
9
           <a href="mailto:david@edeca.net">David Cannings (dc)</a>
10
           <a href="mailto:andi.clemens@gmx.net">Andi Clemens (ac)</a>
11
  @date    18-Feb-04, ahu: created<BR>
12
           07-Mar-04, ahu: isolated as a separate component<BR>
13
           12-Aug-06,  dc: started updating all tags
14
 */
15
#ifndef EXIV2_CANONMN_INT_HPP
16
#define EXIV2_CANONMN_INT_HPP
17
18
// *****************************************************************************
19
// included header files
20
#include <cstdint>
21
#include <iosfwd>
22
23
// *****************************************************************************
24
// namespace extensions
25
namespace Exiv2 {
26
class ExifData;
27
class Value;
28
struct TagInfo;
29
30
namespace Internal {
31
// *****************************************************************************
32
// class definitions
33
34
//! MakerNote for Canon cameras
35
class CanonMakerNote {
36
 public:
37
  //! Return read-only list of built-in Canon tags
38
65.8k
  static constexpr auto tagList() {
39
65.8k
    return tagInfo_;
40
65.8k
  }
41
  //! Return read-only list of built-in Canon Camera Settings tags
42
1.68k
  static constexpr auto tagListCs() {
43
1.68k
    return tagInfoCs_;
44
1.68k
  }
45
  //! Return read-only list of built-in Canon Shot Info tags
46
6.33k
  static constexpr auto tagListSi() {
47
6.33k
    return tagInfoSi_;
48
6.33k
  }
49
  //! Return read-only list of built-in Canon Panorama tags
50
6.18k
  static constexpr auto tagListPa() {
51
6.18k
    return tagInfoPa_;
52
6.18k
  }
53
  //! Return read-only list of built-in Canon Custom Function tags
54
11.7k
  static constexpr auto tagListCf() {
55
11.7k
    return tagInfoCf_;
56
11.7k
  }
57
  //! Return read-only list of built-in Canon Picture Info tags
58
32
  static constexpr auto tagListPi() {
59
32
    return tagInfoPi_;
60
32
  }
61
  //! Return read-only list of built-in Canon Time Info tags
62
28.9k
  static constexpr auto tagListTi() {
63
28.9k
    return tagInfoTi_;
64
28.9k
  }
65
  //! Return read-only list of built-in Canon File Info tags
66
0
  static constexpr auto tagListFi() {
67
0
    return tagInfoFi_;
68
0
  }
69
  //! Return read-only list of built-in Canon Processing Info tags
70
6
  static constexpr auto tagListPr() {
71
6
    return tagInfoPr_;
72
6
  }
73
  //! Return read-only list of built-in Canon Movie Info tags
74
0
  static constexpr auto tagListMv() {
75
0
    return tagInfoMv_;
76
0
  }
77
  //! Return read-only list of built-in Canon My Colors Info tags
78
0
  static constexpr auto tagListMc() {
79
0
    return tagInfoMc_;
80
0
  }
81
  //! Return read-only list of built-in Canon Face detection Info tags
82
0
  static constexpr auto tagListFcd3() {
83
0
    return tagInfoFcd3_;
84
0
  }
85
  //! Return read-only list of built-in Canon White balance Info tags
86
0
  static constexpr auto tagListWbi() {
87
0
    return tagInfoWbi_;
88
0
  }
89
  //! Return read-only list of built-in Canon Contrast Info tags
90
0
  static constexpr auto tagListCo() {
91
0
    return tagInfoCo_;
92
0
  }
93
  //! Return read-only list of built-in Canon Face detection 1 Info tags
94
0
  static constexpr auto tagListFcd2() {
95
0
    return tagInfoFcd2_;
96
0
  }
97
  //! Return read-only list of built-in Canon Face detection 2 Info tags
98
0
  static constexpr auto tagListFcd1() {
99
0
    return tagInfoFcd1_;
100
0
  }
101
  //! Return read-only list of built-in Canon Aspect Info tags
102
0
  static constexpr auto tagListAs() {
103
0
    return tagInfoAs_;
104
0
  }
105
  //! Return read-only list of built-in Canon Balance Info tags
106
0
  static constexpr auto tagListCbi() {
107
0
    return tagInfoCbi_;
108
0
  }
109
  //! Return read-only list of built-in Canon Flags Info tags
110
0
  static constexpr auto tagListFl() {
111
0
    return tagInfoFl_;
112
0
  }
113
  //! Return read-only list of built-in Canon Modified On Info tags
114
0
  static constexpr auto tagListMo() {
115
0
    return tagInfoMo_;
116
0
  }
117
  //! Return read-only list of built-in Canon Preview Image Info tags
118
0
  static constexpr auto tagListPreI() {
119
0
    return tagInfoPreI_;
120
0
  }
121
  //! Return read-only list of built-in Canon Color Info tags
122
0
  static constexpr auto tagListCi() {
123
0
    return tagInfoCi_;
124
0
  }
125
  //! Return read-only list of built-in Canon AFMicroAdjMode Quality Info tags
126
0
  static constexpr auto tagListAfMiAdj() {
127
0
    return tagInfoAfMiAdj_;
128
0
  }
129
  //! Return read-only list of built-in Canon VignettingCorr Info tags
130
0
  static constexpr auto tagListVigCor() {
131
0
    return tagInfoVigCor_;
132
0
  }
133
  //! Return read-only list of built-in Canon VignettingCorr2 Info tags
134
0
  static constexpr auto tagListVigCor2() {
135
0
    return tagInfoVigCor2_;
136
0
  }
137
  //! Return read-only list of built-in Canon LightingOpt Info tags
138
0
  static constexpr auto tagListLiOp() {
139
0
    return tagInfoLiOp_;
140
0
  }
141
  //! Return read-only list of built-in Canon LensInfo Info tags
142
0
  static constexpr auto tagListLe() {
143
0
    return tagInfoLe_;
144
0
  }
145
  //! Return read-only list of built-in Canon Ambience Info tags
146
0
  static constexpr auto tagListAm() {
147
0
    return tagInfoAm_;
148
0
  }
149
  //! Return read-only list of built-in Canon MultiExposureControl Info tags
150
26.1k
  static constexpr auto tagListMe() {
151
26.1k
    return tagInfoMe_;
152
26.1k
  }
153
  //! Return read-only list of built-in Canon Filter Info tags
154
0
  static constexpr auto tagListFil() {
155
0
    return tagInfoFil_;
156
0
  }
157
  //! Return read-only list of built-in Canon HDR Info tags
158
0
  static constexpr auto tagListHdr() {
159
0
    return tagInfoHdr_;
160
0
  }
161
  //! Return read-only list of built-in Canon AFConfig Info tags
162
0
  static constexpr auto tagListAfC() {
163
0
    return tagInfoAfC_;
164
0
  }
165
  //! Return read-only list of built-in Canon RawBurstInfo Info tags
166
10
  static constexpr auto tagListRawB() {
167
10
    return tagInfoRawB_;
168
10
  }
169
170
  //! @name Print functions for Canon %MakerNote tags
171
  //@{
172
  //! Print the FileInfo FileNumber
173
  static std::ostream& printFiFileNumber(std::ostream& os, const Value& value, const ExifData* metadata);
174
  //! Print the focal length
175
  static std::ostream& printFocalLength(std::ostream& os, const Value& value, const ExifData*);
176
  //! Print the image number
177
  static std::ostream& print0x0008(std::ostream& os, const Value& value, const ExifData*);
178
  //! Print 0x000a
179
  static std::ostream& print0x000a(std::ostream& os, const Value& value, const ExifData*);
180
  //! Print the serial number of the camera
181
  static std::ostream& print0x000c(std::ostream& os, const Value& value, const ExifData*);
182
  //! Self timer
183
  static std::ostream& printCs0x0002(std::ostream& os, const Value& value, const ExifData*);
184
  //! Camera lens type. For some values, the exact type can only be determined if \em metadata is provided.
185
  static std::ostream& printCsLensType(std::ostream& os, const Value& value, const ExifData* metadata);
186
  //! Camera lens information
187
  static std::ostream& printCsLens(std::ostream& os, const Value& value, const ExifData*);
188
  //! CanonLe lens serial number
189
  static std::ostream& printLe0x0000(std::ostream& os, const Value& value, const ExifData*);
190
  //! AutoISO speed used
191
  static std::ostream& printSi0x0001(std::ostream& os, const Value& value, const ExifData*);
192
  //! ISO speed used
193
  static std::ostream& printSi0x0002(std::ostream& os, const Value& value, const ExifData*);
194
  //! MeasuredEV
195
  static std::ostream& printSi0x0003(std::ostream& os, const Value& value, const ExifData*);
196
  //! Sequence number
197
  static std::ostream& printSi0x0009(std::ostream& os, const Value& value, const ExifData*);
198
  //! Ambient Temperature
199
  static std::ostream& printSi0x000c(std::ostream& os, const Value& value, const ExifData*);
200
  //! Flash Guide Number
201
  static std::ostream& printSi0x000d(std::ostream& os, const Value& value, const ExifData*);
202
  //! AF point used
203
  static std::ostream& printSi0x000e(std::ostream& os, const Value& value, const ExifData* pExifData);
204
  //! Subject distance
205
  static std::ostream& printSi0x0013(std::ostream& os, const Value& value, const ExifData*);
206
  //! Aperture
207
  static std::ostream& printSi0x0015(std::ostream& os, const Value& value, const ExifData*);
208
  //! Shutter speed
209
  static std::ostream& printSi0x0016(std::ostream& os, const Value& value, const ExifData*);
210
  //! MeasuredEV2
211
  static std::ostream& printSi0x0017(std::ostream& os, const Value& value, const ExifData*);
212
  //! Bulb Duration
213
  static std::ostream& printSi0x0018(std::ostream& os, const Value& value, const ExifData*);
214
  //! Focus Distance
215
  static std::ostream& printFiFocusDistance(std::ostream& os, const Value& value, const ExifData*);
216
  //@}
217
218
 private:
219
  // DATA
220
221
  //! Tag information
222
  static const TagInfo tagInfo_[];
223
  static const TagInfo tagInfoAfC_[];
224
  static const TagInfo tagInfoAfMiAdj_[];
225
  static const TagInfo tagInfoAm_[];
226
  static const TagInfo tagInfoAs_[];
227
  static const TagInfo tagInfoCs_[];
228
  static const TagInfo tagInfoCbi_[];
229
  static const TagInfo tagInfoSi_[];
230
  static const TagInfo tagInfoCf_[];
231
  static const TagInfo tagInfoCi_[];
232
  static const TagInfo tagInfoCo_[];
233
  static const TagInfo tagInfoFl_[];
234
  static const TagInfo tagInfoFil_[];
235
  static const TagInfo tagInfoLiOp_[];
236
  static const TagInfo tagInfoLe_[];
237
  static const TagInfo tagInfoHdr_[];
238
  static const TagInfo tagInfoMe_[];
239
  static const TagInfo tagInfoMo_[];
240
  static const TagInfo tagInfoMv_[];
241
  static const TagInfo tagInfoMc_[];
242
  static const TagInfo tagInfoFcd1_[];
243
  static const TagInfo tagInfoFcd2_[];
244
  static const TagInfo tagInfoFcd3_[];
245
  static const TagInfo tagInfoPi_[];
246
  static const TagInfo tagInfoTi_[];
247
  static const TagInfo tagInfoFi_[];
248
  static const TagInfo tagInfoPa_[];
249
  static const TagInfo tagInfoPr_[];
250
  static const TagInfo tagInfoPreI_[];
251
  static const TagInfo tagInfoVigCor_[];
252
  static const TagInfo tagInfoVigCor2_[];
253
  static const TagInfo tagInfoWbi_[];
254
  static const TagInfo tagInfoRawB_[];
255
256
};  // class CanonMakerNote
257
258
// *****************************************************************************
259
// template, inline and free functions
260
261
/*!
262
   @brief Convert Canon hex-based EV (modulo 0x20) to real number
263
          Ported from Phil Harvey's Image::ExifTool::Canon::CanonEv
264
          by Will Stokes
265
266
   0x00 -> 0
267
   0x0c -> 0.33333
268
   0x10 -> 0.5
269
   0x14 -> 0.66666
270
   0x20 -> 1
271
   ..
272
   160 -> 5
273
   128 -> 4
274
   143 -> 4.46875
275
 */
276
float canonEv(int64_t val);
277
278
}  // namespace Internal
279
}  // namespace Exiv2
280
281
#endif  // EXIV2_CANONMN_INT_HPP