Project

General

Profile

Feature #1219 » canonmn.cpp

Raphael Attie, 09 Sep 2016 21:10

 
1
// ***************************************************************** -*- C++ -*-
2
/*
3
 * Copyright (C) 2004-2015 Andreas Huggel <ahuggel@gmx.net>
4
 *
5
 * This program is part of the Exiv2 distribution.
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
20
 */
21
/*
22
  File:      canonmn.cpp
23
  Version:   $Rev: 4450 $
24
  Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
25
             David Cannings (dc) <david@edeca.net>
26
             Andi Clemens (ac) <andi.clemens@gmx.net>
27
 */
28
// *****************************************************************************
29
#include "rcsid_int.hpp"
30
EXIV2_RCSID("@(#) $Id: canonmn.cpp 4450 2016-08-30 16:05:45Z robinwmills $")
31

    
32
// *****************************************************************************
33
// included header files
34
#include "types.hpp"
35
#include "makernote_int.hpp"
36
#include "canonmn_int.hpp"
37
#include "tags_int.hpp"
38
#include "value.hpp"
39
#include "exif.hpp"
40
#include "i18n.h"                // NLS support.
41

    
42
// + standard includes
43
#include <string>
44
#include <sstream>
45
#include <iomanip>
46
#include <ios>
47
#include <algorithm>
48
#include <cassert>
49
#include <cstring>
50
#include <cmath>
51

    
52
// *****************************************************************************
53
// class member definitions
54
namespace Exiv2 {
55
    namespace Internal {
56

    
57
    //! OffOn, multiple tags
58
    extern const TagDetails canonOffOn[] = {
59
        {  0, N_("Off") },
60
        {  1, N_("On")  }
61
    };
62

    
63
    //! Special treatment pretty-print function for non-unique lens ids.
64
    std::ostream& printCsLensByFocalLengthAndMaxAperture(std::ostream& os,
65
                                           const Value& value,
66
                                           const ExifData* metadata);
67
    std::ostream& printCsLensByFocalLength(std::ostream& os,
68
                                           const Value& value,
69
                                           const ExifData* metadata);
70
    std::ostream& printCsLensByFocalLengthTC(std::ostream& os,
71
                                           const Value& value,
72
                                           const ExifData* metadata);
73
    std::ostream& printCsLensFFFF(std::ostream& os,
74
                                  const Value& value,
75
                                  const ExifData* metadata);
76

    
77
    //! ModelId, tag 0x0010
78
    extern const TagDetails canonModelId[] = {
79
        { (long int)0x1010000, "PowerShot A30" },
80
        { (long int)0x1040000, "PowerShot S300 / Digital IXUS 300 / IXY Digital 300" },
81
        { (long int)0x1060000, "PowerShot A20" },
82
        { (long int)0x1080000, "PowerShot A10" },
83
        { (long int)0x1090000, "PowerShot S110 / Digital IXUS v / IXY Digital 200" },
84
        { (long int)0x1100000, "PowerShot G2" },
85
        { (long int)0x1110000, "PowerShot S40" },
86
        { (long int)0x1120000, "PowerShot S30" },
87
        { (long int)0x1130000, "PowerShot A40" },
88
        { (long int)0x1140000, "EOS D30" },
89
        { (long int)0x1150000, "PowerShot A100" },
90
        { (long int)0x1160000, "PowerShot S200 / Digital IXUS v2 / IXY Digital 200a" },
91
        { (long int)0x1170000, "PowerShot A200" },
92
        { (long int)0x1180000, "PowerShot S330 / Digital IXUS 330 / IXY Digital 300a" },
93
        { (long int)0x1190000, "PowerShot G3" },
94
        { (long int)0x1210000, "PowerShot S45" },
95
        { (long int)0x1230000, "PowerShot SD100 / Digital IXUS II / IXY Digital 30" },
96
        { (long int)0x1240000, "PowerShot S230 / Digital IXUS v3 / IXY Digital 320" },
97
        { (long int)0x1250000, "PowerShot A70" },
98
        { (long int)0x1260000, "PowerShot A60" },
99
        { (long int)0x1270000, "PowerShot S400 / Digital IXUS 400 / IXY Digital 400" },
100
        { (long int)0x1290000, "PowerShot G5" },
101
        { (long int)0x1300000, "PowerShot A300" },
102
        { (long int)0x1310000, "PowerShot S50" },
103
        { (long int)0x1340000, "PowerShot A80" },
104
        { (long int)0x1350000, "PowerShot SD10 / Digital IXUS i / IXY Digital L" },
105
        { (long int)0x1360000, "PowerShot S1 IS" },
106
        { (long int)0x1370000, "PowerShot Pro1" },
107
        { (long int)0x1380000, "PowerShot S70" },
108
        { (long int)0x1390000, "PowerShot S60" },
109
        { (long int)0x1400000, "PowerShot G6" },
110
        { (long int)0x1410000, "PowerShot S500 / Digital IXUS 500 / IXY Digital 500" },
111
        { (long int)0x1420000, "PowerShot A75" },
112
        { (long int)0x1440000, "PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a" },
113
        { (long int)0x1450000, "PowerShot A400" },
114
        { (long int)0x1470000, "PowerShot A310" },
115
        { (long int)0x1490000, "PowerShot A85" },
116
        { (long int)0x1520000, "PowerShot S410 / Digital IXUS 430 / IXY Digital 450" },
117
        { (long int)0x1530000, "PowerShot A95" },
118
        { (long int)0x1540000, "PowerShot SD300 / Digital IXUS 40 / IXY Digital 50" },
119
        { (long int)0x1550000, "PowerShot SD200 / Digital IXUS 30 / IXY Digital 40" },
120
        { (long int)0x1560000, "PowerShot A520" },
121
        { (long int)0x1570000, "PowerShot A510" },
122
        { (long int)0x1590000, "PowerShot SD20 / Digital IXUS i5 / IXY Digital L2" },
123
        { (long int)0x1640000, "PowerShot S2 IS" },
124
        { (long int)0x1650000, "PowerShot SD430 / IXUS Wireless / IXY Wireless" },
125
        { (long int)0x1660000, "PowerShot SD500 / Digital IXUS 700 / IXY Digital 600" },
126
        { (long int)0x1668000, "EOS D60" },
127
        { (long int)0x1700000, "PowerShot SD30 / Digital IXUS i zoom / IXY Digital L3" },
128
        { (long int)0x1740000, "PowerShot A430" },
129
        { (long int)0x1750000, "PowerShot A410" },
130
        { (long int)0x1760000, "PowerShot S80" },
131
        { (long int)0x1780000, "PowerShot A620" },
132
        { (long int)0x1790000, "PowerShot A610" },
133
        { (long int)0x1800000, "PowerShot SD630 / Digital IXUS 65 / IXY Digital 80" },
134
        { (long int)0x1810000, "PowerShot SD450 / Digital IXUS 55 / IXY Digital 60" },
135
        { (long int)0x1820000, "PowerShot TX1" },
136
        { (long int)0x1870000, "PowerShot SD400 / Digital IXUS 50 / IXY Digital 55" },
137
        { (long int)0x1880000, "PowerShot A420" },
138
        { (long int)0x1890000, "PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000" },
139
        { (long int)0x1900000, "PowerShot SD550 / Digital IXUS 750 / IXY Digital 700" },
140
        { (long int)0x1920000, "PowerShot A700" },
141
        { (long int)0x1940000, "PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS" },
142
        { (long int)0x1950000, "PowerShot S3 IS" },
143
        { (long int)0x1960000, "PowerShot A540" },
144
        { (long int)0x1970000, "PowerShot SD600 / Digital IXUS 60 / IXY Digital 70" },
145
        { (long int)0x1980000, "PowerShot G7" },
146
        { (long int)0x1990000, "PowerShot A530" },
147
        { (long int)0x2000000, "PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS" },
148
        { (long int)0x2010000, "PowerShot SD40 / Digital IXUS i7 / IXY Digital L4" },
149
        { (long int)0x2020000, "PowerShot A710 IS" },
150
        { (long int)0x2030000, "PowerShot A640" },
151
        { (long int)0x2040000, "PowerShot A630" },
152
        { (long int)0x2090000, "PowerShot S5 IS" },
153
        { (long int)0x2100000, "PowerShot A460" },
154
        { (long int)0x2120000, "PowerShot SD850 IS / Digital IXUS 950 IS" },
155
        { (long int)0x2130000, "PowerShot A570 IS" },
156
        { (long int)0x2140000, "PowerShot A560" },
157
        { (long int)0x2150000, "PowerShot SD750 / Digital IXUS 75 / IXY Digital 90" },
158
        { (long int)0x2160000, "PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10" },
159
        { (long int)0x2180000, "PowerShot A550" },
160
        { (long int)0x2190000, "PowerShot A450" },
161
        { (long int)0x2230000, "PowerShot G9" },
162
        { (long int)0x2240000, "PowerShot A650 IS" },
163
        { (long int)0x2260000, "PowerShot A720 IS" },
164
        { (long int)0x2290000, "PowerShot SX100 IS" },
165
        { (long int)0x2300000, "PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS" },
166
        { (long int)0x2310000, "PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS" },
167
        { (long int)0x2320000, "PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS" },
168
        { (long int)0x2360000, "PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS" },
169
        { (long int)0x2370000, "PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS" },
170
        { (long int)0x2380000, "PowerShot A590 IS" },
171
        { (long int)0x2390000, "PowerShot A580" },
172
        { (long int)0x2420000, "PowerShot A470" },
173
        { (long int)0x2430000, "PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS" },
174
        { (long int)0x2460000, "PowerShot SX1 IS" },
175
        { (long int)0x2470000, "PowerShot SX10 IS" },
176
        { (long int)0x2480000, "PowerShot A1000 IS" },
177
        { (long int)0x2490000, "PowerShot G10" },
178
        { (long int)0x2510000, "PowerShot A2000 IS" },
179
        { (long int)0x2520000, "PowerShot SX110 IS" },
180
        { (long int)0x2530000, "PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS" },
181
        { (long int)0x2540000, "PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS" },
182
        { (long int)0x2550000, "PowerShot E1" },
183
        { (long int)0x2560000, "PowerShot D10" },
184
        { (long int)0x2570000, "PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS" },
185
        { (long int)0x2580000, "PowerShot A2100 IS" },
186
        { (long int)0x2590000, "PowerShot A480" },
187
        { (long int)0x2600000, "PowerShot SX200 IS" },
188
        { (long int)0x2610000, "PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS" },
189
        { (long int)0x2620000, "PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS" },
190
        { (long int)0x2630000, "PowerShot A1100 IS" },
191
        { (long int)0x2640000, "PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS" },
192
        { (long int)0x2700000, "PowerShot G11" },
193
        { (long int)0x2710000, "PowerShot SX120 IS" },
194
        { (long int)0x2720000, "PowerShot S90" },
195
        { (long int)0x2750000, "PowerShot SX20 IS" },
196
        { (long int)0x2760000, "PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS" },
197
        { (long int)0x2770000, "PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS" },
198
        { (long int)0x2800000, "PowerShot A495" },
199
        { (long int)0x2810000, "PowerShot A490" },
200
        { (long int)0x2820000, "PowerShot A3100 IS / A3150 IS" },
201
        { (long int)0x2830000, "PowerShot A3000 IS" },
202
        { (long int)0x2840000, "PowerShot SD1400 IS / IXUS 130 / IXY 400F" },
203
        { (long int)0x2850000, "PowerShot SD1300 IS / IXUS 105 / IXY 200F" },
204
        { (long int)0x2860000, "PowerShot SD3500 IS / IXUS 210 / IXY 10S" },
205
        { (long int)0x2870000, "PowerShot SX210 IS" },
206
        { (long int)0x2880000, "PowerShot SD4000 IS / IXUS 300 HS / IXY 30S" },
207
        { (long int)0x2890000, "PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S" },
208
        { (long int)0x2920000, "PowerShot G12" },
209
        { (long int)0x2930000, "PowerShot SX30 IS" },
210
        { (long int)0x2940000, "PowerShot SX130 IS" },
211
        { (long int)0x2950000, "PowerShot S95" },
212
        { (long int)0x2980000, "PowerShot A3300 IS" },
213
        { (long int)0x2990000, "PowerShot A3200 IS" },
214
        { (long int)0x3000000, "PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S" },
215
        { (long int)0x3010000, "PowerShot Pro90 IS" },
216
        { (long int)0x3010001, "PowerShot A800" },
217
        { (long int)0x3020000, "PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F" },
218
        { (long int)0x3030000, "PowerShot SX230 HS" },
219
        { (long int)0x3040000, "PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F" },
220
        { (long int)0x3050000, "PowerShot A2200" },
221
        { (long int)0x3060000, "PowerShot A1200" },
222
        { (long int)0x3070000, "PowerShot SX220 HS" },
223
        { (long int)0x3080000, "PowerShot G1 X" },
224
        { (long int)0x3090000, "PowerShot SX150 IS" },
225
        { (long int)0x3100000, "PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S" },
226
        { (long int)0x3110000, "PowerShot S100 (new)" },
227
        { (long int)0x3130000, "PowerShot SX40 HS" },
228
        { (long int)0x3120000, "PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F" },
229
        { (long int)0x3140000, "IXY 32S" },
230
        { (long int)0x3160000, "PowerShot A1300" },
231
        { (long int)0x3170000, "PowerShot A810" },
232
        { (long int)0x3180000, "PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F" },
233
        { (long int)0x3190000, "PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F" },
234
        { (long int)0x3200000, "PowerShot D20" },
235
        { (long int)0x3210000, "PowerShot A4000 IS" },
236
        { (long int)0x3220000, "PowerShot SX260 HS" },
237
        { (long int)0x3230000, "PowerShot SX240 HS" },
238
        { (long int)0x3240000, "PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1" },
239
        { (long int)0x3250000, "PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3" },
240
        { (long int)0x3260000, "PowerShot A3400 IS" },
241
        { (long int)0x3270000, "PowerShot A2400 IS" },
242
        { (long int)0x3280000, "PowerShot A2300" },
243
        { (long int)0x3330000, "PowerShot G15" },
244
        { (long int)0x3340000, "PowerShot SX50" },
245
        { (long int)0x3350000, "PowerShot SX160 IS" },
246
        { (long int)0x3360000, "PowerShot S110 (new)" },
247
        { (long int)0x3370000, "PowerShot SX500 IS" },
248
        { (long int)0x3380000, "PowerShot N" },
249
        { (long int)0x3390000, "IXUS 245 HS / IXY 430F" },
250
        { (long int)0x3400000, "PowerShot SX280 HS" },
251
        { (long int)0x3410000, "PowerShot SX270 HS" },
252
        { (long int)0x3420000, "PowerShot A3500 IS" },
253
        { (long int)0x3430000, "PowerShot A2600" },
254
        { (long int)0x3450000, "PowerShot A1400" },
255
        { (long int)0x3460000, "PowerShot ELPH 130 IS / IXUS 140 / IXY 110F" },
256
        { (long int)0x3470000, "PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F" },
257
        { (long int)0x3490000, "PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F" },
258
        { (long int)0x3510000, "PowerShot A2500" },
259
        { (long int)0x3540000, "PowerShot G16" },
260
        { (long int)0x3550000, "PowerShot S120" },
261
        { (long int)0x3560000, "PowerShot SX170 IS" },
262
        { (long int)0x3580000, "PowerShot SX510 HS" },
263
        { (long int)0x3590000, "PowerShot S200 (new)" },
264
        { (long int)0x3600000, "IXY 620F" },
265
        { (long int)0x3610000, "PowerShot N100" },
266
        { (long int)0x3640000, "PowerShot G1 X Mark II" },
267
        { (long int)0x3650000, "PowerShot D30" },
268
        { (long int)0x3660000, "PowerShot SX700 HS" },
269
        { (long int)0x3670000, "PowerShot SX600 HS" },
270
        { (long int)0x3680000, "PowerShot ELPH 140 IS / IXUS 150 / IXY 130" },
271
        { (long int)0x3690000, "PowerShot ELPH 135 / IXUS 145 / IXY 120" },
272
        { (long int)0x3700000, "PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630" },
273
        { (long int)0x3710000, "PowerShot ELPH 150 IS / IXUS 155 / IXY 140" },
274
        { (long int)0x3740000, "EOS M3" },
275
        { (long int)0x3750000, "PowerShot SX60 HS" },
276
        { (long int)0x3760000, "PowerShot SX520 HS" },
277
        { (long int)0x3770000, "PowerShot SX400 IS" },
278
        { (long int)0x3780000, "PowerShot G7 X" },
279
        { (long int)0x3790000, "PowerShot N2" },
280
        { (long int)0x3800000, "PowerShot SX530 HS" },
281
        { (long int)0x3820000, "PowerShot SX710 HS" },
282
        { (long int)0x3830000, "PowerShot SX610 HS" },
283
        { (long int)0x3840000, "EOS M10" },
284
        { (long int)0x3850000, "PowerShot G3 X" },
285
        { (long int)0x3860000, "PowerShot ELPH 165 HS / IXUS 165 / IXY 160" },
286
        { (long int)0x3870000, "PowerShot ELPH 160 / IXUS 160" },
287
        { (long int)0x3880000, "PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640" },
288
        { (long int)0x3890000, "PowerShot ELPH 170 IS / IXUS 170" },
289
        { (long int)0x3910000, "PowerShot SX410 HS" },
290
        { (long int)0x3930000, "PowerShot G9 X" },
291
        { (long int)0x3950000, "PowerShot G5 X" },
292
        { (long int)0x3970000, "PowerShot G7 X Mark II" },
293
        { (long int)0x3990000, "PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650" },
294
        { (long int)0x4010000, "PowerShot SX540 HS" },
295
        { (long int)0x4020000, "PowerShot SX420 IS" },
296
        { (long int)0x4030000, "PowerShot ELPH 190 IS / IXUS 180 / IXY 190" },
297
        { (long int)0x4040000, "PowerShot G1" },
298
        { (long int)0x4040001, "IXY 180" },
299
        { (long int)0x4050000, "PowerShot SX720 HS" },
300
        { (long int)0x6040000, "PowerShot S100 / Digital IXUS / IXY Digital" },
301
        { (long int)0x4007d673, "DC19/DC21/DC22" },
302
        { (long int)0x4007d674, "XH A1" },
303
        { (long int)0x4007d675, "HV10" },
304
        { (long int)0x4007d676, "MD130/MD140/MD150/MD160/ZR850" },
305
        { (long int)0x4007d777, "DC50" },
306
        { (long int)0x4007d778, "HV20" },
307
        { (long int)0x4007d779, "DC211" },
308
        { (long int)0x4007d77a,"HG10" },
309
        { (long int)0x4007d77b, "HR10" },
310
        { (long int)0x4007d77c, "MD255/ZR950" },
311
        { (long int)0x4007d81c, "HF11" },
312
        { (long int)0x4007d878, "HV30" },
313
        { (long int)0x4007d87c, "XH A1S" },
314
        { (long int)0x4007d87e, "DC301/DC310/DC311/DC320/DC330" },
315
        { (long int)0x4007d87f, "FS100" },
316
        { (long int)0x4007d880, "HF10" },
317
        { (long int)0x4007d882, "HG20/HG21" },
318
        { (long int)0x4007d925, "HF21" },
319
        { (long int)0x4007d926, "HF S11" },
320
        { (long int)0x4007d978, "HV40" },
321
        { (long int)0x4007d987, "DC410/DC411/DC420" },
322
        { (long int)0x4007d988, "FS19/FS20/FS21/FS22/FS200" },
323
        { (long int)0x4007d989, "HF20/HF200" },
324
        { (long int)0x4007d98a, "HF S10/S100" },
325
        { (long int)0x4007da8e, "HF R10/R16/R17/R18/R100/R106" },
326
        { (long int)0x4007da8f, "HF M30/M31/M36/M300/M306" },
327
        { (long int)0x4007da90, "HF S20/S21/S200" },
328
        { (long int)0x4007da92, "FS31/FS36/FS37/FS300/FS305/FS306/FS307" },
329
        { (long int)0x4007dda9, "HF G25" },
330
        { (long int)0x4007dfb4, "XC10" },
331
        { (long int)0x80000001, "EOS-1D" },
332
        { (long int)0x80000167, "EOS-1DS" },
333
        { (long int)0x80000168, "EOS 10D" },
334
        { (long int)0x80000169, "EOS-1D Mark III" },
335
        { (long int)0x80000170, "EOS Digital Rebel / 300D / Kiss Digital" },
336
        { (long int)0x80000174, "EOS-1D Mark II" },
337
        { (long int)0x80000175, "EOS 20D" },
338
        { (long int)0x80000176, "EOS Digital Rebel XSi / 450D / Kiss X2" },
339
        { (long int)0x80000188, "EOS-1Ds Mark II" },
340
        { (long int)0x80000189, "EOS Digital Rebel XT / 350D / Kiss Digital N" },
341
        { (long int)0x80000190, "EOS 40D" },
342
        { (long int)0x80000213, "EOS 5D" },
343
        { (long int)0x80000215, "EOS-1Ds Mark III" },
344
        { (long int)0x80000218, "EOS 5D Mark II" },
345
        { (long int)0x80000219, "WFT-E1" },
346
        { (long int)0x80000232, "EOS-1D Mark II N" },
347
        { (long int)0x80000234, "EOS 30D" },
348
        { (long int)0x80000236, "EOS Digital Rebel XTi / 400D / Kiss Digital X" },
349
        { (long int)0x80000241, "WFT-E2" },
350
        { (long int)0x80000246, "WFT-E3" },
351
        { (long int)0x80000250, "EOS 7D" },
352
        { (long int)0x80000252, "EOS Rebel T1i / 500D / Kiss X3" },
353
        { (long int)0x80000254, "EOS Rebel XS / 1000D / Kiss F" },
354
        { (long int)0x80000261, "EOS 50D" },
355
        { (long int)0x80000269, "EOS-1D X" },
356
        { (long int)0x80000270, "EOS Rebel T2i / 550D / Kiss X4" },
357
        { (long int)0x80000271, "WFT-E4" },
358
        { (long int)0x80000273, "WFT-E5" },
359
        { (long int)0x80000281, "EOS-1D Mark IV" },
360
        { (long int)0x80000285, "EOS 5D Mark III" },
361
        { (long int)0x80000286, "EOS Rebel T3i / 600D / Kiss X5" },
362
        { (long int)0x80000287, "EOS 60D" },
363
        { (long int)0x80000288, "EOS Rebel T3 / 1100D / Kiss X50" },
364
        { (long int)0x80000289, "EOS 7D Mark II" },
365
        { (long int)0x80000297, "WFT-E2 II" },
366
        { (long int)0x80000298, "WFT-E4 II" },
367
        { (long int)0x80000301, "EOS Rebel T4i / 650D / Kiss X6i" },
368
        { (long int)0x80000302, "EOS 6D" },
369
        { (long int)0x80000324, "EOS-1D C" },
370
        { (long int)0x80000325, "EOS 70D" },
371
        { (long int)0x80000326, "EOS Rebel T5i / 700D / Kiss X7i" },
372
        { (long int)0x80000327, "EOS Rebel T5 / 1200D / Kiss X70" },
373
        { (long int)0x80000328, "EOS-1D X MARK II" },
374
        { (long int)0x80000331, "EOS M" },
375
        { (long int)0x80000350, "EOS 80D" },
376
        { (long int)0x80000355, "EOS M2" },
377
        { (long int)0x80000346, "EOS Rebel SL1 / 100D / Kiss X7" },
378
        { (long int)0x80000347, "EOS Rebel T6s / 760D / 8000D" },
379
        { (long int)0x80000382, "EOS 5DS" },
380
        { (long int)0x80000393, "EOS Rebel T6i / 750D / Kiss X8i" },
381
        { (long int)0x80000401, "EOS 5DS R" },
382
        { (long int)0x80000404, "EOS Rebel T6 / 1300D / Kiss X80" }
383
    };
384

    
385
    //! SerialNumberFormat, tag 0x0015
386
    extern const TagDetails canonSerialNumberFormat[] = {
387
        {  (long int)0x90000000, N_("Format 1") },
388
        {  (long int)0xa0000000, N_("Format 2") },
389
    };
390

    
391
    //! SuperMacro, tag 0x001a
392
    extern const TagDetails canonSuperMacro[] = {
393
        {  0, N_("Off")     },
394
        {  1, N_("On (1)")  },
395
        {  2, N_("On (2)")  }
396
    };
397

    
398
    //! ColorSpace, tag 0x00b4
399
    extern const TagDetails canonColorSpace[] = {
400
        {  1, N_("sRGB")      },
401
        {  2, N_("Adobe RGB") }
402
    };
403

    
404
    // Canon MakerNote Tag Info
405
    const TagInfo CanonMakerNote::tagInfo_[] = {
406
        TagInfo(0x0000, "0x0000", "0x0000", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue),
407
        TagInfo(0x0001, "CameraSettings", N_("Camera Settings"), N_("Various camera settings"), canonId, makerTags, unsignedShort, -1, printValue),
408
        TagInfo(0x0002, "FocalLength", N_("Focal Length"), N_("Focal length"), canonId, makerTags, unsignedShort, -1, printFocalLength),
409
        TagInfo(0x0003, "0x0003", "0x0003", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue),
410
        TagInfo(0x0004, "ShotInfo", N_("Shot Info"), N_("Shot information"), canonId, makerTags, unsignedShort, -1, printValue),
411
        TagInfo(0x0005, "Panorama", N_("Panorama"), N_("Panorama"), canonId, makerTags, unsignedShort, -1, printValue),
412
        TagInfo(0x0006, "ImageType", N_("Image Type"), N_("Image type"), canonId, makerTags, asciiString, -1, printValue),
413
        TagInfo(0x0007, "FirmwareVersion", N_("Firmware Version"), N_("Firmware version"), canonId, makerTags, asciiString, -1, printValue),
414
        TagInfo(0x0008, "FileNumber", N_("File Number"), N_("File number"), canonId, makerTags, unsignedLong, -1, print0x0008),
415
        TagInfo(0x0009, "OwnerName", N_("Owner Name"), N_("Owner Name"), canonId, makerTags, asciiString, -1, printValue),
416
        TagInfo(0x000c, "SerialNumber", N_("Serial Number"), N_("Camera serial number"), canonId, makerTags, unsignedLong, -1, print0x000c),
417
        TagInfo(0x000d, "CameraInfo", N_("Camera Info"), N_("Camera info"), canonId, makerTags, unsignedShort, -1, printValue),
418
        TagInfo(0x000f, "CustomFunctions", N_("Custom Functions"), N_("Custom Functions"), canonId, makerTags, unsignedShort, -1, printValue),
419
        TagInfo(0x0010, "ModelID", N_("ModelID"), N_("Model ID"), canonId, makerTags, unsignedLong, -1, EXV_PRINT_TAG(canonModelId)),
420
        TagInfo(0x0012, "PictureInfo", N_("Picture Info"), N_("Picture info"), canonId, makerTags, unsignedShort, -1, printValue),
421
        TagInfo(0x0013, "ThumbnailImageValidArea", N_("Thumbnail Image Valid Area"), N_("Thumbnail image valid area"), canonId, makerTags, signedShort, -1, printValue),
422
        TagInfo(0x0015, "SerialNumberFormat", N_("Serial Number Format"), N_("Serial number format"), canonId, makerTags, unsignedLong, -1, EXV_PRINT_TAG(canonSerialNumberFormat)),
423
        TagInfo(0x001a, "SuperMacro", N_("Super Macro"), N_("Super macro"), canonId, makerTags, signedShort, -1, EXV_PRINT_TAG(canonSuperMacro)),
424
        TagInfo(0x0026, "AFInfo", N_("AF Info"), N_("AF info"), canonId, makerTags, unsignedShort, -1, printValue),
425
        TagInfo(0x0083, "OriginalDecisionDataOffset", N_("Original Decision Data Offset"), N_("Original decision data offset"), canonId, makerTags, signedLong, -1, printValue),
426
        TagInfo(0x00a4, "WhiteBalanceTable", N_("White Balance Table"), N_("White balance table"), canonId, makerTags, unsignedShort, -1, printValue),
427
        TagInfo(0x0095, "LensModel", N_("Lens Model"), N_("Lens model"), canonId, makerTags, asciiString, -1, printValue),
428
        TagInfo(0x0096, "InternalSerialNumber", N_("Internal Serial Number"), N_("Internal serial number"), canonId, makerTags, asciiString, -1, printValue),
429
        TagInfo(0x0097, "DustRemovalData", N_("Dust Removal Data"), N_("Dust removal data"), canonId, makerTags, asciiString, -1, printValue),
430
        TagInfo(0x0099, "CustomFunctions", N_("Custom Functions"), N_("Custom functions"), canonId, makerTags, unsignedShort, -1, printValue),
431
        TagInfo(0x00a0, "ProcessingInfo", N_("Processing Info"), N_("Processing info"), canonId, makerTags, unsignedShort, -1, printValue),
432
        TagInfo(0x00aa, "MeasuredColor", N_("Measured Color"), N_("Measured color"), canonId, makerTags, unsignedShort, -1, printValue),
433
        TagInfo(0x00b4, "ColorSpace", N_("ColorSpace"), N_("ColorSpace"), canonId, makerTags, signedShort,  -1, EXV_PRINT_TAG(canonColorSpace)),
434
        TagInfo(0x00b5, "0x00b5", "0x00b5", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue),
435
        TagInfo(0x00c0, "0x00c0", "0x00c0", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue),
436
        TagInfo(0x00c1, "0x00c1", "0x00c1", N_("Unknown"), canonId, makerTags, unsignedShort, -1, printValue),
437
        TagInfo(0x00d0, "VRDOffset", N_("VRD Offset"), N_("VRD offset"), canonId, makerTags, unsignedLong, -1, printValue),
438
        TagInfo(0x00e0, "SensorInfo", N_("Sensor Info"), N_("Sensor info"), canonId, makerTags, unsignedShort, -1, printValue),
439
        TagInfo(0x4001, "ColorData", N_("Color Data"), N_("Color data"), canonId, makerTags, unsignedShort, -1, printValue),
440
        // End of list marker
441
        TagInfo(0xffff, "(UnknownCanonMakerNoteTag)", "(UnknownCanonMakerNoteTag)", N_("Unknown CanonMakerNote tag"), canonId, makerTags, asciiString, -1, printValue)
442
    };
443

    
444
    const TagInfo* CanonMakerNote::tagList()
445
    {
446
        return tagInfo_;
447
    }
448

    
449
    //! Macro, tag 0x0001
450
    extern const TagDetails canonCsMacro[] = {
451
        { 1, N_("On")  },
452
        { 2, N_("Off") }
453
    };
454

    
455
    //! Quality, tag 0x0003
456
    extern const TagDetails canonCsQuality[] = {
457
        { 1,   N_("Economy")      },
458
        { 2,   N_("Normal")       },
459
        { 3,   N_("Fine")         },
460
        { 4,   N_("RAW")          },
461
        { 5,   N_("Superfine")    },
462
        { 130, N_("Normal Movie") },
463
        { 131, N_("Movie (2)")    }
464
    };
465

    
466
    //! FlashMode, tag 0x0004
467
    extern const TagDetails canonCsFlashMode[] = {
468
        {  0, N_("Off")            },
469
        {  1, N_("Auto")           },
470
        {  2, N_("On")             },
471
        {  3, N_("Red-eye")        },
472
        {  4, N_("Slow sync")      },
473
        {  5, N_("Auto + red-eye") },
474
        {  6, N_("On + red-eye")   },
475
        { 16, N_("External")       },
476
        { 16, N_("External")       }    // To silence compiler warning
477
    };
478

    
479
    //! DriveMode, tag 0x0005
480
    extern const TagDetails canonCsDriveMode[] = {
481
        {  0, N_("Single / timer")             },
482
        {  1, N_("Continuous")                 },
483
        {  2, N_("Movie")                      },
484
        {  3, N_("Continuous, speed priority") },
485
        {  4, N_("Continuous, low")            },
486
        {  5, N_("Continuous, high")           },
487
        {  6, N_("Silent Single")              },
488
        {  9, N_("Single, Silent")             },
489
        { 10, N_("Continuous, Silent")         }
490
    };
491

    
492
    //! FocusMode, tag 0x0007
493
    extern const TagDetails canonCsFocusMode[] = {
494
        {   0, N_("One shot AF")      },
495
        {   1, N_("AI servo AF")      },
496
        {   2, N_("AI focus AF")      },
497
        {   3, N_("Manual focus (3)") },
498
        {   4, N_("Single")           },
499
        {   5, N_("Continuous")       },
500
        {   6, N_("Manual focus (6)") },
501
        {  16, N_("Pan focus")        },
502
        { 256, N_("AF + MF")          },
503
        { 512, N_("Movie Snap Focus") },
504
        { 519, N_("Movie Servo AF")   },
505
        { 519, N_("Movie Servo AF")   }    // To silence compiler warning
506
    };
507

    
508
    //! ImageSize, tag 0x000a
509
    extern const TagDetails canonCsImageSize[] = {
510
        {   0, N_("Large")             },
511
        {   1, N_("Medium")            },
512
        {   2, N_("Small")             },
513
        {   5, N_("Medium 1")          },
514
        {   6, N_("Medium 2")          },
515
        {   7, N_("Medium 3")          },
516
        {   8, N_("Postcard")          },
517
        {   9, N_("Widescreen")        },
518
        {  10, N_("Medium Widescreen") },
519
        {  14, N_("Small 1")           },
520
        {  15, N_("Small 2")           },
521
        {  16, N_("Small 3")           },
522
        { 128, N_("640x480 Movie")     },
523
        { 129, N_("Medium Movie")      },
524
        { 130, N_("Small Movie")       },
525
        { 137, N_("1280x720 Movie")    },
526
        { 142, N_("1920x1080 Movie")   }
527
    };
528

    
529
    //! EasyMode, tag 0x000b
530
    extern const TagDetails canonCsEasyMode[] = {
531
        {   0, N_("Full auto")              },
532
        {   1, N_("Manual")                 },
533
        {   2, N_("Landscape")              },
534
        {   3, N_("Fast shutter")           },
535
        {   4, N_("Slow shutter")           },
536
        {   5, N_("Night")                  },
537
        {   6, N_("Gray Scale")             },
538
        {   7, N_("Sepia")                  },
539
        {   8, N_("Portrait")               },
540
        {   9, N_("Sports")                 },
541
        {  10, N_("Macro")                  },
542
        {  11, N_("Black & White")          },
543
        {  12, N_("Pan focus")              },
544
        {  13, N_("Vivid")                  },
545
        {  14, N_("Neutral")                },
546
        {  15, N_("Flash Off")              },
547
        {  16, N_("Long Shutter")           },
548
        {  17, N_("Super Macro")            },
549
        {  18, N_("Foliage")                },
550
        {  19, N_("Indoor")                 },
551
        {  20, N_("Fireworks")              },
552
        {  21, N_("Beach")                  },
553
        {  22, N_("Underwater")             },
554
        {  23, N_("Snow")                   },
555
        {  24, N_("Kids & Pets")            },
556
        {  25, N_("Night Snapshot")         },
557
        {  26, N_("Digital Macro")          },
558
        {  27, N_("My Colors")              },
559
        {  28, N_("Movie Snap")             },
560
        {  29, N_("Super Macro 2")          },
561
        {  30, N_("Color Accent")           },
562
        {  31, N_("Color Swap")             },
563
        {  32, N_("Aquarium")               },
564
        {  33, N_("ISO 3200")               },
565
        {  34, N_("ISO 6400")               },
566
        {  35, N_("Creative Light Effect")  },
567
        {  36, N_("Easy")                   },
568
        {  37, N_("Quick Shot")             },
569
        {  38, N_("Creative Auto")          },
570
        {  39, N_("Zoom Blur")              },
571
        {  40, N_("Low Light")              },
572
        {  41, N_("Nostalgic")              },
573
        {  42, N_("Super Vivid")            },
574
        {  43, N_("Poster Effect")          },
575
        {  44, N_("Face Self-timer")        },
576
        {  45, N_("Smile")                  },
577
        {  46, N_("Wink Self-timer")        },
578
        {  47, N_("Fisheye Effect")         },
579
        {  48, N_("Miniature Effect")       },
580
        {  49, N_("High-speed Burst")       },
581
        {  50, N_("Best Image Selection")   },
582
        {  51, N_("High Dynamic Range")     },
583
        {  52, N_("Handheld Night Scene")   },
584
        {  53, N_("Movie Digest")           },
585
        {  54, N_("Live View Control")      },
586
        {  55, N_("Discreet")               },
587
        {  56, N_("Blur Reduction")         },
588
        {  57, N_("Monochrome")             },
589
        {  58, N_("Toy Camera Effect")      },
590
        {  59, N_("Scene Intelligent Auto") },
591
        {  60, N_("High-speed Burst HQ")    },
592
        {  61, N_("Smooth Skin")            },
593
        {  62, N_("Soft Focus")             },
594
        { 257, N_("Spotlight")              },
595
        { 258, N_("Night 2")                },
596
        { 259, N_("Night+")                 },
597
        { 260, N_("Super Night")            },
598
        { 261, N_("Sunset")                 },
599
        { 263, N_("Night Scene")            },
600
        { 264, N_("Surface")                },
601
        { 265, N_("Low Light 2")            }
602
    };
603

    
604
    //! DigitalZoom, tag 0x000c
605
    extern const TagDetails canonCsDigitalZoom[] = {
606
        { 0, N_("None")  },
607
        { 1, "2x"        },
608
        { 2, "4x"        },
609
        { 3, N_("Other") },
610
        { 3, N_("Other") }                      // To silence compiler warning
611
    };
612

    
613
    //! Contrast, Saturation Sharpness, tags 0x000d, 0x000e, 0x000f
614
    extern const TagDetails canonCsLnh[] = {
615
        { 0xffff, N_("Low")    },
616
        { 0x0000, N_("Normal") },
617
        { 0x0001, N_("High")   }
618
    };
619

    
620
    //! ISOSpeeds, tag 0x0010
621
    extern const TagDetails canonCsISOSpeed[] = {
622
        {     0, N_("n/a")       },
623
        {    14, N_("Auto High") },
624
        {    15, N_("Auto")      },
625
        {    16,   "50"      },
626
        {    17,  "100"      },
627
        {    18,  "200"      },
628
        {    19,  "400"      },
629
        {    20,  "800"      },
630
        { 16464,   "80"      },
631
        { 16484,  "100"      },
632
        { 16584,  "200"      },
633
        { 16784,  "400"      },
634
        { 17184,  "800"      },
635
        { 17984, "1600"      },
636
        { 19584, "3200"      }
637
    };
638

    
639
    //! MeteringMode, tag 0x0011
640
    extern const TagDetails canonCsMeteringMode[] = {
641
        { 0, N_("Default")                 },
642
        { 1, N_("Spot")                    },
643
        { 2, N_("Average")                 },
644
        { 3, N_("Evaluative")              },
645
        { 4, N_("Partial")                 },
646
        { 5, N_("Center-weighted average") }
647
    };
648

    
649
    //! FocusType, tag 0x0012
650
    extern const TagDetails canonCsFocusType[] = {
651
        {  0, N_("Manual")       },
652
        {  1, N_("Auto")         },
653
        {  2, N_("Not known")    },
654
        {  3, N_("Macro")        },
655
        {  4, N_("Very close")   },
656
        {  5, N_("Close")        },
657
        {  6, N_("Middle range") },
658
        {  7, N_("Far range")    },
659
        {  8, N_("Pan focus")    },
660
        {  9, N_("Super macro")  },
661
        { 10, N_("Infinity")     }
662
    };
663

    
664
    //! AFPoint, tag 0x0013
665
    extern const TagDetails canonCsAfPoint[] = {
666
        { 0x2005, N_("Manual AF point selection") },
667
        { 0x3000, N_("None (MF)")                 },
668
        { 0x3001, N_("Auto-selected")             },
669
        { 0x3002, N_("Right")                     },
670
        { 0x3003, N_("Center")                    },
671
        { 0x3004, N_("Left")                      },
672
        { 0x4001, N_("Auto AF point selection")   },
673
        { 0x4006, N_("Face Detect")               }
674
    };
675

    
676
    //! ExposureProgram, tag 0x0014
677
    extern const TagDetails canonCsExposureProgram[] = {
678
        { 0, N_("Easy shooting (Auto)")   },
679
        { 1, N_("Program (P)")            },
680
        { 2, N_("Shutter priority (Tv)")  },
681
        { 3, N_("Aperture priority (Av)") },
682
        { 4, N_("Manual (M)")             },
683
        { 5, N_("A-DEP")                  },
684
        { 6, N_("M-DEP")                  },
685
        { 7, N_("Bulb")                   }
686
    };
687

    
688
    //! LensType, tag 0x0016
689
    extern const TagDetails canonCsLensType[] = {
690
        {   1, "Canon EF 50mm f/1.8"                                        },
691
        {   2, "Canon EF 28mm f/2.8"                                        },
692
        {   3, "Canon EF 135mm f/2.8 Soft"                                  },
693
        {   4, "Canon EF 35-105mm f/3.5-4.5"                                }, // 0
694
        {   4, "Sigma UC Zoom 35-135mm f/4-5.6"                             }, // 1
695
        {   5, "Canon EF 35-70mm f/3.5-4.5"                                 },
696
        {   6, "Canon EF 28-70mm f/3.5-4.5"                                 }, // 0
697
        {   6, "Sigma 18-50mm f/3.5-5.6 DC"                                 }, // 1
698
        {   6, "Sigma 18-125mm f/3.5-5.6 DC IF ASP"                         }, // 2
699
        {   6, "Tokina AF193-2 19-35mm f/3.5-4.5"                           }, // 3
700
        {   6, "Sigma 28-80mm f/3.5-5.6 II Macro"                           }, // 4
701
        {   7, "Canon EF 100-300mm f/5.6L"                                  },
702
        {   8, "Canon EF 100-300mm f/5.6"                                   }, // 0
703
        {   8, "Sigma 70-300mm f/4-5.6 [APO] DG Macro"                      }, // 1
704
        {   8, "Tokina AT-X 242 AF 24-200mm f/3.5-5.6"                      }, // 2
705
        {   9, "Canon EF 70-210mm f/4"                                      }, // 0
706
        {   9, "Sigma 55-200mm f/4-5.6 DC"                                  }, // 1
707
        {  10, "Canon EF 50mm f/2.5 Macro"                                  }, // 0
708
        {  10, "Sigma 50mm f/2.8 EX"                                        }, // 1
709
        {  10, "Sigma 28mm f/1.8"                                           }, // 2
710
        {  10, "Sigma 105mm f/2.8 Macro EX"                                 }, // 3
711
        {  10, "Sigma 70mm f/2.8 EX DG Macro EF"                            }, // 4
712
        {  11, "Canon EF 35mm f/2"                                          },
713
        {  13, "Canon EF 15mm f/2.8 Fisheye"                                },
714
        {  14, "Canon EF 50-200mm f/3.5-4.5L"                               },
715
        {  15, "Canon EF 50-200mm f/3.5-4.5"                                },
716
        {  16, "Canon EF 35-135mm f/3.5-4.5"                                },
717
        {  17, "Canon EF 35-70mm f/3.5-4.5A"                                },
718
        {  18, "Canon EF 28-70mm f/3.5-4.5"                                 },
719
        {  20, "Canon EF 100-200mm f/4.5A"                                  },
720
        {  21, "Canon EF 80-200mm f/2.8L"                                   },
721
        {  22, "Canon EF 20-35mm f/2.8L"                                    }, // 0
722
        {  22, "Tokina AT-X 280 AF PRO 28-80mm f/2.8 Aspherical"            }, // 1
723
        {  23, "Canon EF 35-105mm f/3.5-4.5"                                },
724
        {  24, "Canon EF 35-80mm f/4-5.6 Power Zoom"                        },
725
        {  25, "Canon EF 35-80mm f/4-5.6 Power Zoom"                        },
726
        {  26, "Canon EF 100mm f/2.8 Macro"                                 }, // 0
727
        {  26, "Cosina 100mm f/3.5 Macro AF"                                }, // 1
728
        {  26, "Tamron SP AF 90mm f/2.8 Di Macro"                           }, // 2
729
        {  26, "Tamron SP AF 180mm f/3.5 Di Macro"                          }, // 3
730
        {  26, "Carl Zeiss Planar T* 50mm f/1.4"                            }, // 4
731
        {  27, "Canon EF 35-80mm f/4-5.6"                                   },
732
        {  28, "Canon EF 80-200mm f/4.5-5.6"                                }, // 0
733
        {  28, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF"               }, // 1
734
        {  28, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro"  }, // 2
735
        {  28, "Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro"                 }, // 3
736
        {  28, "Tamron AF Aspherical 28-200mm f/3.8-5.6"                    }, // 4
737
        {  29, "Canon EF 50mm f/1.8 II"                                     },
738
        {  30, "Canon EF 35-105mm f/4.5-5.6"                                },
739
        {  31, "Canon EF 75-300mm f/4-5.6"                                  }, // 0
740
        {  31, "Tamron SP AF 300mm f/2.8 LD IF"                             }, // 1
741
        {  32, "Canon EF 24mm f/2.8"                                        }, // 0
742
        {  32, "Sigma 15mm f/2.8 EX Fisheye"                                }, // 1
743
        {  33, "Voigtlander or Carl Zeiss Lens"                             }, // 0
744
        {  33, "Voigtlander Ultron 40mm f/2 SLII Aspherical"                }, // 1
745
        {  33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical"        }, // 2
746
        {  33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus"        }, // 3
747
        {  33, "Carl Zeiss Distagon 15mm T* f/2.8 ZE"                       }, // 4
748
        {  33, "Carl Zeiss Distagon 18mm T* f/3.5 ZE"                       }, // 5
749
        {  33, "Carl Zeiss Distagon 21mm T* f/2.8 ZE"                       }, // 6
750
        {  33, "Carl Zeiss Distagon 25mm T* f/2 ZE"                         }, // 7
751
        {  33, "Carl Zeiss Distagon 28mm T* f/2 ZE"                         }, // 8
752
        {  33, "Carl Zeiss Distagon 35mm T* f/2 ZE"                         }, // 9
753
        {  33, "Carl Zeiss Distagon 35mm T* f/1.4 ZE"                       }, // 10
754
        {  33, "Carl Zeiss Planar 50mm T* f/1.4 ZE"                         }, // 11
755
        {  33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE"                     }, // 12
756
        {  33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE"                    }, // 13
757
        {  33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE"                      }, // 14
758
        {  35, "Canon EF 35-80mm f/4-5.6"                                   },
759
        {  36, "Canon EF 38-76mm f/4.5-5.6"                                 },
760
        {  37, "Canon EF 35-80mm f/4-5.6"                                   }, // 0
761
        {  37, "Tamron 70-200mm f/2.8 Di LD IF Macro"                       }, // 1
762
        {  37, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 2
763
        {  37, "Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF] " }, // 3
764
        {  37, "Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro" }, // 4
765
        {  38, "Canon EF 80-200mm f/4.5-5.6"                                },
766
        {  39, "Canon EF 75-300mm f/4-5.6"                                  },
767
        {  40, "Canon EF 28-80mm f/3.5-5.6"                                 },
768
        {  41, "Canon EF 28-90mm f/4-5.6"                                   },
769
        {  42, "Canon EF 28-200mm f/3.5-5.6"                                }, // 0
770
        {  42, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20" }, // 1
771
        {  43, "Canon EF 28-105mm f/4-5.6"                                  },
772
        {  44, "Canon EF 90-300mm f/4.5-5.6"                                },
773
        {  45, "Canon EF-S 18-55mm f/3.5-5.6"                               },
774
        {  46, "Canon EF 28-90mm f/4-5.6"                                   },
775
        {  47, "Zeiss Milvus 35mm f/2"                                      }, // 0
776
        {  47, "Zeiss Milvus 50mm f/2 Makro"                                }, // 1
777
        {  48, "Canon EF-S 18-55mm f/3.5-5.6 IS"                            },
778
        {  49, "Canon EF-S 55-250mm f/4-5.6 IS"                             },
779
        {  50, "Canon EF-S 18-200mm f/3.5-5.6 IS"                           },
780
        {  51, "Canon EF-S 18-135mm f/3.5-5.6 IS"                           },
781
        {  52, "Canon EF-S 18-55mm f/3.5-5.6 IS II"                         },
782
        {  53, "Canon EF-S 18-55mm f/3.5-5.6 III"                           },
783
        {  54, "Canon EF-S 55-250mm f/4-5.6 IS II"                          },
784
        {  94, "Canon TS-E 17mm f/4L"                                       },
785
        {  95, "Canon TS-E 24.0mm f/3.5 L II"                               },
786
        { 124, "Canon MP-E 65mm f/2.8 1-5x Macro Photo"                     },
787
        { 125, "Canon TS-E 24mm f/3.5L"                                     },
788
        { 126, "Canon TS-E 45mm f/2.8"                                      },
789
        { 127, "Canon TS-E 90mm f/2.8"                                      },
790
        { 129, "Canon EF 300mm f/2.8L"                                      },
791
        { 130, "Canon EF 50mm f/1.0L"                                       },
792
        { 131, "Canon EF 28-80mm f/2.8-4L"                                  }, // 0
793
        { 131, "Sigma 8mm f/3.5 EX DG Circular Fisheye"                     }, // 1
794
        { 131, "Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM"                 }, // 2
795
        { 131, "Sigma 17-70mm f/2.8-4.5 DC Macro"                           }, // 3
796
        { 131, "Sigma APO 50-150mm f/2.8 EX DC HSM"                         }, // 4
797
        { 131, "Sigma APO 120-300mm f/2.8 EX DG HSM"                        }, // 5
798
        { 131, "Sigma 4.5mm F2.8 EX DC HSM Circular Fisheye"                }, // 6
799
        { 131, "Sigma 70-200mm f/2.8 APO EX HSM"                            }, // 7
800
        { 132, "Canon EF 1200mm f/5.6L"                                     },
801
        { 134, "Canon EF 600mm f/4L IS"                                     },
802
        { 135, "Canon EF 200mm f/1.8L"                                      },
803
        { 136, "Canon EF 300mm f/2.8L"                                      },
804
        { 137, "Canon EF 85mm f/1.2L"                                       }, // 0
805
        { 137, "Sigma 18-50mm f/2.8-4.5 DC OS HSM"                          }, // 1
806
        { 137, "Sigma 50-200mm f/4-5.6 DC OS HSM"                           }, // 2
807
        { 137, "Sigma 18-250mm f/3.5-6.3 DC OS HSM"                         }, // 3
808
        { 137, "Sigma 24-70mm f/2.8 IF EX DG HSM"                           }, // 4
809
        { 137, "Sigma 18-125mm f/3.8-5.6 DC OS HSM"                         }, // 5
810
        { 137, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C"                  }, // 6
811
        { 137, "Sigma 17-50mm f/2.8 OS HSM"                                 }, // 7
812
        { 137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]"                    }, // 8
813
        { 137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD"                  }, // 9
814
        { 137, "Sigma 8-16mm f/4.5-5.6 DC HSM"                              }, // 10
815
        { 137, "Tamron SP 17-50mm f/2.8 XR Di II VC"                        }, // 11
816
        { 137, "Tamron SP 60mm f/2 Macro Di II"                             }, // 12
817
        { 137, "Sigma 10-20mm f/3.5 EX DC HSM"                              }, // 13
818
        { 137, "Tamron SP 24-70mm f/2.8 Di VC USD"                          }, // 14
819
        { 137, "Sigma 18-35mm f/1.8 DC HSM"                                 }, // 15
820
        { 137, "Sigma 12-24mm f/4.5-5.6 DG HSM II"                          }, // 16
821
        { 138, "Canon EF 28-80mm f/2.8-4L"                                  },
822
        { 139, "Canon EF 400mm f/2.8L"                                      },
823
        { 140, "Canon EF 500mm f/4.5L"                                      },
824
        { 141, "Canon EF 500mm f/4.5L"                                      },
825
        { 142, "Canon EF 300mm f/2.8L IS"                                   },
826
        { 143, "Canon EF 500mm f/4L IS"                                     }, // 0
827
        { 143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM"                      }, // 1
828
        { 144, "Canon EF 35-135mm f/4-5.6 USM"                              },
829
        { 145, "Canon EF 100-300mm f/4.5-5.6 USM"                           },
830
        { 146, "Canon EF 70-210mm f/3.5-4.5 USM"                            },
831
        { 147, "Canon EF 35-135mm f/4-5.6 USM"                              },
832
        { 148, "Canon EF 28-80mm f/3.5-5.6 USM"                             },
833
        { 149, "Canon EF 100mm f/2 USM"                                     },
834
        { 150, "Canon EF 14mm f/2.8L"                                       }, // 0
835
        { 150, "Sigma 20mm EX f/1.8"                                        }, // 1
836
        { 150, "Sigma 30mm f/1.4 DC HSM"                                    }, // 2
837
        { 150, "Sigma 24mm f/1.8 DG Macro EX"                               }, // 3
838
        { 150, "Sigma 28mm f/1.8 DG Macro EX"                               }, // 4
839
        { 151, "Canon EF 200mm f/2.8L"                                      },
840
        { 152, "Canon EF 300mm f/4L IS"                                     }, // 0
841
        { 152, "Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM"               }, // 1
842
        { 152, "Sigma 14mm f/2.8 EX Aspherical HSM"                         }, // 2
843
        { 152, "Sigma 10-20mm f/4-5.6"                                      }, // 3
844
        { 152, "Sigma 100-300mm f/4"                                        }, // 4
845
        { 153, "Canon EF 35-350mm f/3.5-5.6L"                               }, // 0
846
        { 153, "Sigma 50-500mm f/4-6.3 APO HSM EX"                          }, // 1
847
        { 153, "Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro"   }, // 2
848
        { 153, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14" }, // 3
849
        { 153, "Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro"   }, // 4
850
        { 154, "Canon EF 20mm f/2.8 USM"                                    }, // 0
851
        { 154, "Zeiss Milvus 21mm f/2.8"                                    }, // 1
852
        { 155, "Canon EF 85mm f/1.8 USM"                                    },
853
        { 156, "Canon EF 28-105mm f/3.5-4.5 USM"                            }, // 0
854
        { 156, "Tamron SP 70-300mm f/4-5.6 Di VC USD"                       }, // 1
855
        { 156, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF"               }, // 2
856
        { 160, "Canon EF 20-35mm f/3.5-4.5 USM"                             }, // 0
857
        { 160, "Tamron AF 19-35mm f/3.5-4.5"                                }, // 1
858
        { 160, "Tokina AT-X 124 AF 12-24mm f/4 DX"                          }, // 2
859
        { 160, "Tokina AT-X 107 AF DX Fish-eye 10-17mm f/3.5-4.5"           }, // 3
860
        { 160, "Tokina AT-X 116 PRO DX AF 11-16mm f/2.8"                    }, // 4
861
        { 160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8"     }, // 5
862
        { 161, "Canon EF 28-70mm f/2.8L"                                    }, // 0
863
        { 161, "Sigma 24-70mm EX f/2.8"                                     }, // 1
864
        { 161, "Sigma 28-70mm f/2.8 EX"                                     }, // 2
865
        { 161, "Sigma 24-60mm f/2.8 EX DG"                                  }, // 3
866
        { 161, "Tamron AF 17-50mm f/2.8 Di-II LD Aspherical"                }, // 4
867
        { 161, "Tamron 90mm f/2.8"                                          }, // 5
868
        { 161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF"           }, // 6
869
        { 161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro"  }, // 7
870
        { 162, "Canon EF 200mm f/2.8L"                                      },
871
        { 163, "Canon EF 300mm f/4L"                                        },
872
        { 164, "Canon EF 400mm f/5.6L"                                      },
873
        { 165, "Canon EF 70-200mm f/2.8 L"                                  },
874
        { 166, "Canon EF 70-200mm f/2.8 L + 1.4x"                           },
875
        { 167, "Canon EF 70-200mm f/2.8 L + 2x"                             },
876
        { 168, "Canon EF 28mm f/1.8 USM"                                    }, // 0
877
        { 168, "Sigma 50-100mm f/1.8 DC HSM | A"                            }, // 1
878
        { 169, "Canon EF 17-35mm f/2.8L"                                    }, // 0
879
        { 169, "Sigma 18-200mm f/3.5-6.3 DC OS"                             }, // 1
880
        { 169, "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical"                   }, // 2
881
        { 169, "Sigma 18-50mm f/2.8 Macro"                                  }, // 3
882
        { 169, "Sigma 50mm f/1.4 EX DG HSM"                                 }, // 4
883
        { 169, "Sigma 85mm f/1.4 EX DG HSM"                                 }, // 5
884
        { 169, "Sigma 30mm f/1.4 EX DC HSM"                                 }, // 6
885
        { 169, "Sigma 35mm f/1.4 DG HSM"                                    }, // 7
886
        { 170, "Canon EF 200mm f/2.8L II"                                   },
887
        { 171, "Canon EF 300mm f/4L"                                        },
888
        { 172, "Canon EF 400mm f/5.6L"                                      }, // 0
889
        { 172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S"                      }, // 1
890
        { 172, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 1.4x"               }, // 2
891
        { 173, "Canon EF 180mm Macro f/3.5L"                                }, // 0
892
        { 173, "Sigma 180mm EX HSM Macro f/3.5"                             }, // 1
893
        { 173, "Sigma APO Macro 150mm f/3.5 EX DG IF HSM"                   }, // 2
894
        { 173, "Sigma 150-500mm f/5-6.3 APO DG OS HSM + 2x"                 }, // 3
895
        { 174, "Canon EF 135mm f/2L"                                        }, // 0
896
        { 174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM"                      }, // 1
897
        { 174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM"                     }, // 2
898
        { 174, "Sigma 150-500mm f/5-6.3 APO DG OS HSM"                      }, // 3
899
        { 174, "Zeiss Milvus 100mm f/2 Makro"                               }, // 4
900
        { 175, "Canon EF 400mm f/2.8L"                                      },
901
        { 176, "Canon EF 24-85mm f/3.5-4.5 USM"                             },
902
        { 177, "Canon EF 300mm f/4L IS"                                     },
903
        { 178, "Canon EF 28-135mm f/3.5-5.6 IS"                             },
904
        { 179, "Canon EF 24mm f/1.4L"                                       },
905
        { 180, "Canon EF 35mm f/1.4L"                                       }, // 0
906
        { 180, "Sigma 50mm f/1.4 DG HSM | A"                                }, // 1
907
        { 180, "Sigma 24mm f/1.4 DG HSM | A"                                }, // 2
908
        { 180, "Zeiss Milvus 50mm f/1.4"                                    }, // 3
909
        { 180, "Zeiss Milvus 85mm f/1.4"                                    }, // 4
910
        { 180, "Zeiss Otus 28mm f/1.4 ZE"                                   }, // 5
911
        { 181, "Canon EF 100-400mm f/4.5-5.6L IS + 1.4x"                    }, // 0
912
        { 181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x"               }, // 1
913
        { 182, "Canon EF 100-400mm f/4.5-5.6L IS + 2x"                      }, // 0
914
        { 182, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x"                 }, // 1
915
        { 183, "Canon EF 100-400mm f/4.5-5.6L IS"                           }, // 0
916
        { 183, "Sigma 150mm f/2.8 EX DG OS HSM APO Macro"                   }, // 1
917
        { 183, "Sigma 105mm f/2.8 EX DG OS HSM Macro"                       }, // 2
918
        { 183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro"                   }, // 3
919
        { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C"                      }, // 4
920
        { 183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S"                      }, // 5
921
        { 184, "Canon EF 400mm f/2.8L + 2x"                                 },
922
        { 185, "Canon EF 600mm f/4L IS"                                     },
923
        { 186, "Canon EF 70-200mm f/4L"                                     },
924
        { 187, "Canon EF 70-200mm f/4L + 1.4x"                              },
925
        { 188, "Canon EF 70-200mm f/4L + 2x"                                },
926
        { 189, "Canon EF 70-200mm f/4L + 2.8x"                              },
927
        { 190, "Canon EF 100mm f/2.8 Macro USM"                             },
928
        { 191, "Canon EF 400mm f/4 DO IS"                                   },
929
        { 193, "Canon EF 35-80mm f/4-5.6 USM"                               },
930
        { 194, "Canon EF 80-200mm f/4.5-5.6 USM"                            },
931
        { 195, "Canon EF 35-105mm f/4.5-5.6 USM"                            },
932
        { 196, "Canon EF 75-300mm f/4-5.6 USM"                              },
933
        { 197, "Canon EF 75-300mm f/4-5.6 IS USM"                           },
934
        { 198, "Canon EF 50mm f/1.4 USM"                                    }, // 0
935
        { 198, "Zeiss Otus 55mm f/1.4 ZE"                                   }, // 1
936
        { 198, "Zeiss Otus 85mm f/1.4 ZE"                                   }, // 2
937
        { 199, "Canon EF 28-80mm f/3.5-5.6 USM"                             },
938
        { 200, "Canon EF 75-300mm f/4-5.6 USM"                              },
939
        { 201, "Canon EF 28-80mm f/3.5-5.6 USM"                             },
940
        { 202, "Canon EF 28-80mm f/3.5-5.6 USM IV"                          },
941
        { 208, "Canon EF 22-55mm f/4-5.6 USM"                               },
942
        { 209, "Canon EF 55-200mm f/4.5-5.6"                                },
943
        { 210, "Canon EF 28-90mm f/4-5.6 USM"                               },
944
        { 211, "Canon EF 28-200mm f/3.5-5.6 USM"                            },
945
        { 212, "Canon EF 28-105mm f/4-5.6 USM"                              },
946
        { 213, "Canon EF 90-300mm f/4.5-5.6 USM"                            }, // 0
947
        { 213, "Tamron SP 150-600mm F/5-6.3 Di VC USD"                      }, // 1
948
        { 213, "Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro"               }, // 2
949
        { 213, "Tamron SP 35mm f/1.8 Di VC USD"                             }, // 3
950
        { 213, "Tamron SP 45mm f/1.8 Di VC USD"                             }, // 4
951
        { 213, "Tamron SP 70-300mm f/4-5.6 Di VC USD"                       }, // 5
952
        { 214, "Canon EF-S 18-55mm f/3.5-5.6 USM"                           },
953
        { 215, "Canon EF 55-200mm f/4.5-5.6 II USM"                         },
954
        { 217, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD"                  },
955
        { 224, "Canon EF 70-200mm f/2.8L IS"                                },
956
        { 225, "Canon EF 70-200mm f/2.8L IS + 1.4x"                         },
957
        { 226, "Canon EF 70-200mm f/2.8L IS + 2x"                           },
958
        { 227, "Canon EF 70-200mm f/2.8L IS + 2.8x"                         },
959
        { 228, "Canon EF 28-105mm f/3.5-4.5 USM"                            },
960
        { 229, "Canon EF 16-35mm f/2.8L"                                    },
961
        { 230, "Canon EF 24-70mm f/2.8L"                                    },
962
        { 231, "Canon EF 17-40mm f/4L"                                      },
963
        { 232, "Canon EF 70-300mm f/4.5-5.6 DO IS USM"                      },
964
        { 233, "Canon EF 28-300mm f/3.5-5.6L IS"                            },
965
        { 234, "Canon EF-S 17-85mm f4-5.6 IS USM"                           }, // 0
966
        { 234, "Tokina AT-X 12-28 PRO DX 12-28mm f/4"                       }, // 1
967
        { 235, "Canon EF-S 10-22mm f/3.5-4.5 USM"                           },
968
        { 236, "Canon EF-S 60mm f/2.8 Macro USM"                            },
969
        { 237, "Canon EF 24-105mm f/4L IS"                                  },
970
        { 238, "Canon EF 70-300mm f/4-5.6 IS USM"                           },
971
        { 239, "Canon EF 85mm f/1.2L II"                                    },
972
        { 240, "Canon EF-S 17-55mm f/2.8 IS USM"                            },
973
        { 241, "Canon EF 50mm f/1.2L"                                       },
974
        { 242, "Canon EF 70-200mm f/4L IS"                                  },
975
        { 243, "Canon EF 70-200mm f/4L IS + 1.4x"                           },
976
        { 244, "Canon EF 70-200mm f/4L IS + 2x"                             },
977
        { 245, "Canon EF 70-200mm f/4L IS + 2.8x"                           },
978
        { 246, "Canon EF 16-35mm f/2.8L II"                                 },
979
        { 247, "Canon EF 14mm f/2.8L II USM"                                },
980
        { 248, "Canon EF 200mm f/2L IS"                                     }, // 0
981
        { 248, "Sigma 24-35mm f/2 DG HSM | A"                               }, // 1
982
        { 249, "Canon EF 800mm f/5.6L IS"                                   },
983
        { 250, "Canon EF 24 f/1.4L II"                                      }, // 0
984
        { 250, "Sigma 20mm f/1.4 DG HSM | A"                                }, // 1
985
        { 251, "Canon EF 70-200mm f/2.8L IS II USM"                         },
986
        { 252, "Canon EF 70-200mm f/2.8L IS II USM + 1.4x"                  },
987
        { 253, "Canon EF 70-200mm f/2.8L IS II USM + 2x"                    },
988
        { 254, "Canon EF 100mm f/2.8L Macro IS USM"                         },
989
        { 255, "Sigma 24-105mm f/4 DG OS HSM | A"                           }, // 0
990
        { 255, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro"                   }, // 1
991
        { 488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM"                        },
992
        { 489, "Canon EF 70-300mm f/4-5.6L IS USM"                          },
993
        { 490, "Canon EF 8-15mm f/4L Fisheye USM"                           },
994
        { 491, "Canon EF 300mm f/2.8L IS II USM"                            },
995
        { 492, "Canon EF 400mm f/2.8L IS II USM"                            },
996
        { 493, "Canon EF 500mm f/4L IS II USM"                              }, // 0
997
        { 493, "Canon EF 24-105mm f/4L IS USM"                              }, // 1
998
        { 494, "Canon EF 600mm f/4.0L IS II USM"                            },
999
        { 495, "Canon EF 24-70mm f/2.8L II USM"                             },
1000
        { 496, "Canon EF 200-400mm f/4L IS USM"                             },
1001
        { 499, "Canon EF 200-400mm f/4L IS USM + 1.4x"                      },
1002
        { 502, "Canon EF 28mm f/2.8 IS USM"                                 },
1003
        { 503, "Canon EF 24mm f/2.8 IS USM"                                 },
1004
        { 504, "Canon EF 24-70mm f/4L IS USM"                               },
1005
        { 505, "Canon EF 35mm f/2 IS USM"                                   },
1006
        { 506, "Canon EF 400mm f/4 DO IS II USM"                            },
1007
        { 507, "Canon EF 16-35mm f/4L IS USM"                               },
1008
        { 508, "Canon EF 11-24mm f/4L USM"                                  },
1009
        { 747, "Canon EF 100-400mm f/4.5-5.6L IS II USM"                    },
1010
        { 748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x"             },
1011
        { 750, "Canon EF 35mm f/1.4L II USM"                                },
1012
        { 4142,"Canon EF-S 18-135mm f/3.5-5.6 IS STM"                       },
1013
        { 4143,"Canon EF-M 18-55mm f/3.5-5.6 IS STM"                        }, // 0
1014
        { 4143,"Tamron 18-200mm F/3.5-6.3 Di III VC"                        }, // 1
1015
        { 4144,"Canon EF 40mm f/2.8 STM"                                    },
1016
        { 4145,"Canon EF-M 22mm f/2 STM"                                    },
1017
        { 4146,"Canon EF-S 18-55mm f/3.5-5.6 IS STM"                        },
1018
        { 4147,"Canon EF-M 11-22mm f/4-5.6 IS STM"                          },
1019
        { 4148,"Canon EF-S 55-250mm f/4-5.6 IS STM"                         },
1020
        { 4149,"Canon EF-M 55-200mm f/4.5-6.3 IS STM"                       },
1021
        { 4150,"Canon EF-S 10-18mm f/4.5-5.6 IS STM"                        },
1022
        { 4152,"Canon EF 24-105mm f/3.5-5.6 IS STM"                         },
1023
        { 4153,"Canon EF-M 15-45mm f/3.5-6.3 IS STM"                        },
1024
        { 4154,"Canon EF-S 24mm f/2.8 STM"                                  },
1025
        { 4155,"Canon EF-M 28mm f/3.5 Macro IS STM"                         },
1026
        { 4156,"Canon EF 50mm f/1.8 STM"                                    },
1027
        {36912,"Canon EF-S 18-135mm f/3.5-5.6 IS USM"                       },
1028
        {65535,"n/a"                                                        }
1029
    };
1030

    
1031
    //! A lens id and a pretty-print function for special treatment of the id.
1032
    struct LensIdFct {
1033
        long     id_;                           //!< Lens id
1034
        PrintFct fct_;                          //!< Pretty-print function
1035
        //! Comparison operator for find template
1036
        bool operator==(long id) const { return id_ == id; }
1037
    };
1038

    
1039
    //! List of lens ids which require special treatment with the medicine
1040
    const LensIdFct lensIdFct[] = {
1041
        {   4, printCsLensByFocalLength }, // not tested
1042
        {   6, printCsLensByFocalLength },
1043
        {   8, printCsLensByFocalLength },
1044
        {   9, printCsLensByFocalLength },
1045
        {  10, printCsLensByFocalLengthAndMaxAperture }, // works partly
1046
        {  22, printCsLensByFocalLength },
1047
        {  26, printCsLensByFocalLengthAndMaxAperture }, // works partly
1048
        {  28, printCsLensByFocalLength },
1049
        {  31, printCsLensByFocalLength },
1050
        {  32, printCsLensByFocalLength },
1051
        {  33, printCsLensByFocalLengthAndMaxAperture }, // works partly
1052
        {  37, printCsLensByFocalLength },
1053
        {  42, printCsLensByFocalLength },
1054
        {  47, printCsLensByFocalLength }, // not tested
1055
        { 131, printCsLensByFocalLength },
1056
        { 137, printCsLensByFocalLength }, // not tested
1057
        { 143, printCsLensByFocalLength },
1058
        { 150, printCsLensByFocalLength },
1059
        { 152, printCsLensByFocalLength },
1060
        { 153, printCsLensByFocalLength },
1061
        { 154, printCsLensByFocalLength }, // not tested
1062
        { 156, printCsLensByFocalLengthAndMaxAperture },
1063
        { 160, printCsLensByFocalLength },
1064
        { 161, printCsLensByFocalLength },
1065
        { 168, printCsLensByFocalLength },
1066
        { 169, printCsLensByFocalLengthAndMaxAperture },
1067
        { 172, printCsLensByFocalLengthTC }, // not tested
1068
        { 173, printCsLensByFocalLengthTC }, // works partly
1069
        { 174, printCsLensByFocalLength }, // not tested
1070
        { 180, printCsLensByFocalLength },
1071
        { 181, printCsLensByFocalLengthTC }, // not tested
1072
        { 182, printCsLensByFocalLengthTC }, // not tested
1073
        { 183, printCsLensByFocalLength }, // not tested
1074
        { 198, printCsLensByFocalLength }, // not tested
1075
        { 213, printCsLensByFocalLength }, // not tested
1076
        { 234, printCsLensByFocalLength }, // not tested
1077
        { 248, printCsLensByFocalLength }, // not tested
1078
        { 250, printCsLensByFocalLength }, // not tested
1079
        { 255, printCsLensByFocalLength }, // not tested
1080
        { 493, printCsLensByFocalLength }, // not tested
1081
        { 4143,printCsLensByFocalLength }, // not tested
1082
        { 4154,printCsLensByFocalLength }, // not tested
1083
       {0xffff,printCsLensFFFF          }
1084
    };
1085

    
1086
    //! FlashActivity, tag 0x001c
1087
    extern const TagDetails canonCsFlashActivity[] = {
1088
        { 0, N_("Did not fire") },
1089
        { 1, N_("Fired")        }
1090
    };
1091

    
1092
    //! FlashDetails, tag 0x001d
1093
    extern const TagDetailsBitmask canonCsFlashDetails[] = {
1094
        { 0x4000, N_("External flash")        },
1095
        { 0x2000, N_("Internal flash")        },
1096
        { 0x0001, N_("Manual")                },
1097
        { 0x0002, N_("TTL")                   },
1098
        { 0x0004, N_("A-TTL")                 },
1099
        { 0x0008, N_("E-TTL")                 },
1100
        { 0x0010, N_("FP sync enabled")       },
1101
        { 0x0080, N_("2nd-curtain sync used") },
1102
        { 0x0800, N_("FP sync used")          }
1103
    };
1104

    
1105
    //! FocusContinuous, tag 0x0020
1106
    extern const TagDetails canonCsFocusContinuous[] = {
1107
        { 0, N_("Single")     },
1108
        { 1, N_("Continuous") },
1109
        { 8, N_("Manual")     }
1110
    };
1111

    
1112
    //! AESetting, tag 0x0021
1113
    extern const TagDetails canonCsAESetting[] = {
1114
        { 0, N_("Normal AE")                       },
1115
        { 1, N_("Exposure compensation")           },
1116
        { 2, N_("AE lock")                         },
1117
        { 3, N_("AE lock + exposure compensation") },
1118
        { 4, N_("No AE")                           }
1119
    };
1120

    
1121
    //! ImageStabilization, tag 0x0022
1122
    extern const TagDetails canonCsImageStabilization[] = {
1123
        {   0, N_("Off")            },
1124
        {   1, N_("On")             },
1125
        {   2, N_("Shoot Only")     },
1126
        {   3, N_("Panning")        },
1127
        {   4, N_("Dynamic")        },
1128
        { 256, N_("Off (2)")        },
1129
        { 257, N_("On (2)")         },
1130
        { 258, N_("Shoot Only (2)") },
1131
        { 259, N_("Panning (2)")    },
1132
        { 260, N_("Dynamic (2)")    }
1133
    };
1134

    
1135
    //! SpotMeteringMode, tag 0x0027
1136
    extern const TagDetails canonCsSpotMeteringMode[] = {
1137
        { 0,   N_("Center")   },
1138
        { 1,   N_("AF Point") }
1139
    };
1140

    
1141
    //! PhotoEffect, tag 0x0028
1142
    extern const TagDetails canonCsPhotoEffect[] = {
1143
        { 0,   N_("Off")           },
1144
        { 1,   N_("Vivid")         },
1145
        { 2,   N_("Neutral")       },
1146
        { 3,   N_("Smooth")        },
1147
        { 4,   N_("Sepia")         },
1148
        { 5,   N_("B&W")           },
1149
        { 6,   N_("Custom")        },
1150
        { 100, N_("My color data") },
1151
        { 100, N_("My color data") }    // To silence compiler warning
1152
    };
1153

    
1154
    //! ManualFlashOutput, tag 0x0029
1155
    extern const TagDetails canonCsManualFlashOutput[] = {
1156
        { 0x0000, N_("n/a")    },
1157
        { 0x0500, N_("Full")   },
1158
        { 0x0502, N_("Medium") },
1159
        { 0x0504, N_("Low")    },
1160
        { 0x7fff, N_("n/a")    }
1161
    };
1162

    
1163
    //! SRAWQuality, tag 0x002e
1164
    extern const TagDetails canonCsSRAWQuality[] = {
1165
        { 0, N_("n/a")          },
1166
        { 1, N_("sRAW1 (mRAW)") },
1167
        { 2, N_("sRAW2 (sRAW)") }
1168
    };
1169

    
1170
    // Canon Camera Settings Tag Info
1171
    const TagInfo CanonMakerNote::tagInfoCs_[] = {
1172
        TagInfo(0x0001, "Macro", N_("Macro"), N_("Macro mode"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsMacro)),
1173
        TagInfo(0x0002, "Selftimer", N_("Selftimer"), N_("Self timer"), canonCsId, makerTags, signedShort, 1, printCs0x0002),
1174
        TagInfo(0x0003, "Quality", N_("Quality"), N_("Quality"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsQuality)),
1175
        TagInfo(0x0004, "FlashMode", N_("Flash Mode"), N_("Flash mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFlashMode)),
1176
        TagInfo(0x0005, "DriveMode", N_("Drive Mode"), N_("Drive mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsDriveMode)),
1177
        TagInfo(0x0006, "0x0006", "0x0006", N_("Unknown"), canonCsId, makerTags, unsignedShort, 1, printValue),
1178
        TagInfo(0x0007, "FocusMode", N_("Focus Mode"), N_("Focus mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFocusMode)),
1179
        TagInfo(0x0008, "0x0008", "0x0008", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1180
        TagInfo(0x0009, "0x0009", "0x0009", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1181
        TagInfo(0x000a, "ImageSize", N_("Image Size"), N_("Image size"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsImageSize)),
1182
        TagInfo(0x000b, "EasyMode", N_("Easy Mode"), N_("Easy shooting mode"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsEasyMode)),
1183
        TagInfo(0x000c, "DigitalZoom", N_("Digital Zoom"), N_("Digital zoom"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsDigitalZoom)),
1184
        TagInfo(0x000d, "Contrast", N_("Contrast"), N_("Contrast setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsLnh)),
1185
        TagInfo(0x000e, "Saturation", N_("Saturation"), N_("Saturation setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsLnh)),
1186
        TagInfo(0x000f, "Sharpness", N_("Sharpness"), N_("Sharpness setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsLnh)),
1187
        TagInfo(0x0010, "ISOSpeed", N_("ISO Speed Mode"), N_("ISO speed setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsISOSpeed)),
1188
        TagInfo(0x0011, "MeteringMode", N_("Metering Mode"), N_("Metering mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsMeteringMode)),
1189
        TagInfo(0x0012, "FocusType", N_("Focus Type"), N_("Focus type setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFocusType)),
1190
        TagInfo(0x0013, "AFPoint", N_("AF Point"), N_("AF point selected"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsAfPoint)),
1191
        TagInfo(0x0014, "ExposureProgram", N_("Exposure Program"), N_("Exposure mode setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsExposureProgram)),
1192
        TagInfo(0x0015, "0x0015", "0x0015", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1193
        TagInfo(0x0016, "LensType", N_("Lens Type"), N_("Lens type"), canonCsId, makerTags, signedShort, 1, printCsLensType),
1194
        TagInfo(0x0017, "Lens", N_("Lens"), N_("'long' and 'short' focal length of lens (in 'focal units') and 'focal units' per mm"), canonCsId, makerTags, unsignedShort, 3, printCsLens),
1195
        TagInfo(0x0018, "ShortFocal", N_("Short Focal"), N_("Short focal"), canonCsId, makerTags, unsignedShort, 1, printValue),
1196
        TagInfo(0x0019, "FocalUnits", N_("Focal Units"), N_("Focal units"), canonCsId, makerTags, signedShort, 1, printValue),
1197
        TagInfo(0x001a, "MaxAperture", N_("Max Aperture"), N_("Max aperture"), canonCsId, makerTags, signedShort, 1, printSi0x0015),
1198
        TagInfo(0x001b, "MinAperture", N_("Min Aperture"), N_("Min aperture"), canonCsId, makerTags, signedShort, 1, printSi0x0015),
1199
        TagInfo(0x001c, "FlashActivity", N_("Flash Activity"), N_("Flash activity"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFlashActivity)),
1200
        TagInfo(0x001d, "FlashDetails", N_("Flash Details"), N_("Flash details"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG_BITMASK(canonCsFlashDetails)),
1201
        TagInfo(0x001e, "0x001e", "0x001e", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1202
        TagInfo(0x001f, "0x001f", "0x001f", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1203
        TagInfo(0x0020, "FocusContinuous", N_("Focus Continuous"), N_("Focus continuous setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsFocusContinuous)),
1204
        TagInfo(0x0021, "AESetting", N_("AESetting"), N_("AE setting"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsAESetting)),
1205
        TagInfo(0x0022, "ImageStabilization", N_("Image Stabilization"), N_("Image stabilization"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsImageStabilization)),
1206
        TagInfo(0x0023, "DisplayAperture", N_("Display Aperture"), N_("Display aperture"), canonCsId, makerTags, signedShort, 1, printValue),
1207
        TagInfo(0x0024, "ZoomSourceWidth", N_("Zoom Source Width"), N_("Zoom source width"), canonCsId, makerTags, signedShort, 1, printValue),
1208
        TagInfo(0x0025, "ZoomTargetWidth", N_("Zoom Target Width"), N_("Zoom target width"), canonCsId, makerTags, signedShort, 1, printValue),
1209
        TagInfo(0x0026, "0x0026", "0x0026", N_("Unknown"), canonCsId, makerTags, signedShort, 1, printValue),
1210
        TagInfo(0x0027, "SpotMeteringMode", N_("Spot Metering Mode"), N_("Spot metering mode"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsSpotMeteringMode)),
1211
        TagInfo(0x0028, "PhotoEffect", N_("Photo Effect"), N_("Photo effect"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsPhotoEffect)),
1212
        TagInfo(0x0029, "ManualFlashOutput", N_("Manual Flash Output"), N_("Manual flash output"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsSRAWQuality)),
1213
        TagInfo(0x002a, "ColorTone", N_("Color Tone"), N_("Color tone"), canonCsId, makerTags, signedShort, 1, printValue),
1214
        TagInfo(0x002e, "SRAWQuality", N_("SRAW Quality Tone"), N_("SRAW quality"), canonCsId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsSRAWQuality)),
1215
        // End of list marker
1216
        TagInfo(0xffff, "(UnknownCanonCsTag)", "(UnknownCanonCsTag)", N_("Unknown Canon Camera Settings 1 tag"), canonCsId, makerTags, signedShort, 1, printValue)
1217
    };
1218

    
1219
    const TagInfo* CanonMakerNote::tagListCs()
1220
    {
1221
        return tagInfoCs_;
1222
    }
1223

    
1224
    //! WhiteBalance, multiple tags
1225
    extern const TagDetails canonSiWhiteBalance[] = {
1226
        {  0, N_("Auto")                        },
1227
        {  1, N_("Daylight")                    },
1228
        {  2, N_("Cloudy")                      },
1229
        {  3, N_("Tungsten")                    },
1230
        {  4, N_("Fluorescent")                 },
1231
        {  5, N_("Flash")                       },
1232
        {  6, N_("Custom")                      },
1233
        {  7, N_("Black & White")               },
1234
        {  8, N_("Shade")                       },
1235
        {  9, N_("Manual Temperature (Kelvin)") },
1236
        { 10, N_("PC Set 1")                    },
1237
        { 11, N_("PC Set 2")                    },
1238
        { 12, N_("PC Set 3")                    },
1239
        { 14, N_("Daylight Fluorescent")        },
1240
        { 15, N_("Custom 1")                    },
1241
        { 16, N_("Custom 2")                    },
1242
        { 17, N_("Underwater")                  },
1243
        { 18, N_("Custom 3")                    },
1244
        { 19, N_("Custom 3")                    },
1245
        { 20, N_("PC Set 4")                    },
1246
        { 21, N_("PC Set 5")                    },
1247
        { 23, N_("Auto (ambience priority)")    }
1248
    };
1249

    
1250
    //! AFPointUsed, tag 0x000e
1251
    extern const TagDetailsBitmask canonSiAFPointUsed[] = {
1252
        { 0x0004, N_("left")   },
1253
        { 0x0002, N_("center") },
1254
        { 0x0001, N_("right")  }
1255
    };
1256

    
1257
    //! FlashBias, tag 0x000f
1258
    extern const TagDetails canonSiFlashBias[] = {
1259
        { 0xffc0, "-2 EV"    },
1260
        { 0xffcc, "-1.67 EV" },
1261
        { 0xffd0, "-1.50 EV" },
1262
        { 0xffd4, "-1.33 EV" },
1263
        { 0xffe0, "-1 EV"    },
1264
        { 0xffec, "-0.67 EV" },
1265
        { 0xfff0, "-0.50 EV" },
1266
        { 0xfff4, "-0.33 EV" },
1267
        { 0x0000, "0 EV"     },
1268
        { 0x000c, "0.33 EV"  },
1269
        { 0x0010, "0.50 EV"  },
1270
        { 0x0014, "0.67 EV"  },
1271
        { 0x0020, "1 EV"     },
1272
        { 0x002c, "1.33 EV"  },
1273
        { 0x0030, "1.50 EV"  },
1274
        { 0x0034, "1.67 EV"  },
1275
        { 0x0040, "2 EV"     }
1276
    };
1277

    
1278
    // Canon Shot Info Tag
1279
    const TagInfo CanonMakerNote::tagInfoSi_[] = {
1280
        TagInfo(0x0001, "0x0001", "0x0001", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1281
        TagInfo(0x0002, "ISOSpeed", N_("ISO Speed Used"), N_("ISO speed used"), canonSiId, makerTags, unsignedShort, 1, printSi0x0002),
1282
        TagInfo(0x0003, "MeasuredEV", N_("Measured EV"), N_("Measured EV"), canonSiId, makerTags, unsignedShort, 1, printSi0x0003),
1283
        TagInfo(0x0004, "TargetAperture", N_("Target Aperture"), N_("Target Aperture"), canonSiId, makerTags, unsignedShort, 1, printSi0x0015),
1284
        TagInfo(0x0005, "TargetShutterSpeed", N_("Target Shutter Speed"), N_("Target shutter speed"), canonSiId, makerTags, unsignedShort, 1, printSi0x0016),
1285
        TagInfo(0x0006, "0x0006", "0x0006", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1286
        TagInfo(0x0007, "WhiteBalance", N_("White Balance"), N_("White balance setting"), canonSiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(canonSiWhiteBalance)),
1287
        TagInfo(0x0008, "0x0008", "0x0008", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1288
        TagInfo(0x0009, "Sequence", N_("Sequence"), N_("Sequence number (if in a continuous burst)"), canonSiId, makerTags, unsignedShort, 1, printSi0x0009),
1289
        TagInfo(0x000a, "0x000a", "0x000a", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1290
        TagInfo(0x000b, "0x000b", "0x000b", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1291
        TagInfo(0x000c, "CameraTemperature", N_("Sensor temperature"), N_("Temperature of electronics around sensor"), canonSiId, makerTags, unsignedShort, 1, printValueMinus128),
1292
        TagInfo(0x000d, "0x000d", "0x000d", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1293
        TagInfo(0x000e, "AFPointUsed", N_("AF Point Used"), N_("AF point used"), canonSiId, makerTags, unsignedShort, 1, printSi0x000e),
1294
        TagInfo(0x000f, "FlashBias", N_("Flash Bias"), N_("Flash bias"), canonSiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(canonSiFlashBias)),
1295
        TagInfo(0x0010, "0x0010", "0x0010", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1296
        TagInfo(0x0011, "0x0011", "0x0011", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1297
        TagInfo(0x0012, "0x0012", "0x0012", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1298
        TagInfo(0x0013, "SubjectDistance", N_("Subject Distance"), N_("Subject distance (units are not clear)"), canonSiId, makerTags, unsignedShort, 1, printSi0x0013),
1299
        TagInfo(0x0014, "0x0014", "0x0014", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1300
        TagInfo(0x0015, "ApertureValue", N_("Aperture Value"), N_("Aperture"), canonSiId, makerTags, unsignedShort, 1, printSi0x0015),
1301
        TagInfo(0x0016, "ShutterSpeedValue", N_("Shutter Speed Value"), N_("Shutter speed"), canonSiId, makerTags, unsignedShort, 1, printSi0x0016),
1302
        TagInfo(0x0017, "MeasuredEV2", N_("Measured EV 2"), N_("Measured EV 2"), canonSiId, makerTags, unsignedShort, 1, printSi0x0017),
1303
        TagInfo(0x0018, "0x0018", "0x0018", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1304
        TagInfo(0x0019, "0x0019", "0x0019", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1305
        TagInfo(0x001a, "0x001a", "0x001a", N_("Unknown"), canonSiId, makerTags, unsignedShort, 1, printValue),
1306
        // End of list marker
1307
        TagInfo(0xffff, "(UnknownCanonCsTag)", "(UnknownCanonCsTag)", N_("Unknown Canon Camera Settings 1 tag"), canonCsId, makerTags, unsignedShort, 1, printValue)
1308
    };
1309

    
1310
    const TagInfo* CanonMakerNote::tagListSi()
1311
    {
1312
        return tagInfoSi_;
1313
    }
1314

    
1315
    //! PanoramaDirection, tag 0x0005
1316
    extern const TagDetails canonPaDirection[] = {
1317
        { 0, N_("Left to right")          },
1318
        { 1, N_("Right to left")          },
1319
        { 2, N_("Bottom to top")          },
1320
        { 3, N_("Top to bottom")          },
1321
        { 4, N_("2x2 matrix (Clockwise)") }
1322
    };
1323

    
1324
    // Canon Panorama Info
1325
    const TagInfo CanonMakerNote::tagInfoPa_[] = {
1326
        TagInfo(0x0002, "PanoramaFrame", N_("Panorama Frame"), N_("Panorama frame number"), canonPaId, makerTags, unsignedShort, 1, printValue),
1327
        TagInfo(0x0005, "PanoramaDirection", N_("Panorama Direction"), N_("Panorama direction"), canonPaId, makerTags, unsignedShort, 1, EXV_PRINT_TAG(canonPaDirection)),
1328
        // End of list marker
1329
        TagInfo(0xffff, "(UnknownCanonCs2Tag)", "(UnknownCanonCs2Tag)", N_("Unknown Canon Panorama tag"), canonPaId, makerTags, unsignedShort, 1, printValue)
1330
    };
1331

    
1332
    const TagInfo* CanonMakerNote::tagListPa()
1333
    {
1334
        return tagInfoPa_;
1335
    }
1336

    
1337
    // Canon Custom Function Tag Info
1338
    const TagInfo CanonMakerNote::tagInfoCf_[] = {
1339
        TagInfo(0x0001, "NoiseReduction", N_("Noise Reduction"), N_("Long exposure noise reduction"), canonCfId, makerTags, unsignedShort, 1, printValue),
1340
        TagInfo(0x0002, "ShutterAeLock", N_("Shutter Ae Lock"), N_("Shutter/AE lock buttons"), canonCfId, makerTags, unsignedShort, 1, printValue),
1341
        TagInfo(0x0003, "MirrorLockup", N_("Mirror Lockup"), N_("Mirror lockup"), canonCfId, makerTags, unsignedShort, 1, printValue),
1342
        TagInfo(0x0004, "ExposureLevelIncrements", N_("Exposure Level Increments"), N_("Tv/Av and exposure level"), canonCfId, makerTags, unsignedShort, 1, printValue),
1343
        TagInfo(0x0005, "AFAssist", N_("AF Assist"), N_("AF assist light"), canonCfId, makerTags, unsignedShort, 1, printValue),
1344
        TagInfo(0x0006, "FlashSyncSpeedAv", N_("Flash Sync Speed Av"), N_("Shutter speed in Av mode"), canonCfId, makerTags, unsignedShort, 1, printValue),
1345
        TagInfo(0x0007, "AEBSequence", N_("AEB Sequence"), N_("AEB sequence/auto cancellation"), canonCfId, makerTags, unsignedShort, 1, printValue),
1346
        TagInfo(0x0008, "ShutterCurtainSync", N_("Shutter Curtain Sync"), N_("Shutter curtain sync"), canonCfId, makerTags, unsignedShort, 1, printValue),
1347
        TagInfo(0x0009, "LensAFStopButton", N_("Lens AF Stop Button"), N_("Lens AF stop button Fn. Switch"), canonCfId, makerTags, unsignedShort, 1, printValue),
1348
        TagInfo(0x000a, "FillFlashAutoReduction", N_("Fill Flash Auto Reduction"), N_("Auto reduction of fill flash"), canonCfId, makerTags, unsignedShort, 1, printValue),
1349
        TagInfo(0x000b, "MenuButtonReturn", N_("Menu Button Return"), N_("Menu button return position"), canonCfId, makerTags, unsignedShort, 1, printValue),
1350
        TagInfo(0x000c, "SetButtonFunction", N_("Set Button Function"), N_("SET button func. when shooting"), canonCfId, makerTags, unsignedShort, 1, printValue),
1351
        TagInfo(0x000d, "SensorCleaning", N_("Sensor Cleaning"), N_("Sensor cleaning"), canonCfId, makerTags, unsignedShort, 1, printValue),
1352
        TagInfo(0x000e, "SuperimposedDisplay", N_("Superimposed Display"), N_("Superimposed display"), canonCfId, makerTags, unsignedShort, 1, printValue),
1353
        TagInfo(0x000f, "ShutterReleaseNoCFCard", N_("Shutter Release No CF Card"), N_("Shutter Release W/O CF Card"), canonCfId, makerTags, unsignedShort, 1, printValue),
1354
        // End of list marker
1355
        TagInfo(0xffff, "(UnknownCanonCfTag)", "(UnknownCanonCfTag)", N_("Unknown Canon Custom Function tag"), canonCfId, makerTags, unsignedShort, 1, printValue)
1356
    };
1357

    
1358
    const TagInfo* CanonMakerNote::tagListCf()
1359
    {
1360
        return tagInfoCf_;
1361
    }
1362

    
1363
    //! AFPointsUsed, tag 0x0016
1364
    extern const TagDetailsBitmask canonPiAFPointsUsed[] = {
1365
        { 0x01, N_("right")     },
1366
        { 0x02, N_("mid-right") },
1367
        { 0x04, N_("bottom")    },
1368
        { 0x08, N_("center")    },
1369
        { 0x10, N_("top")       },
1370
        { 0x20, N_("mid-left")  },
1371
        { 0x40, N_("left")      }
1372
    };
1373

    
1374
    //! AFPointsUsed20D, tag 0x001a
1375
    extern const TagDetailsBitmask canonPiAFPointsUsed20D[] = {
1376
        { 0x001, N_("top")         },
1377
        { 0x002, N_("upper-left")  },
1378
        { 0x004, N_("upper-right") },
1379
        { 0x008, N_("left")        },
1380
        { 0x010, N_("center")      },
1381
        { 0x020, N_("right")       },
1382
        { 0x040, N_("lower-left")  },
1383
        { 0x080, N_("lower-right") },
1384
        { 0x100, N_("bottom")      }
1385
    };
1386

    
1387
    // Canon Picture Info Tag
1388
    const TagInfo CanonMakerNote::tagInfoPi_[] = {
1389
        TagInfo(0x0002, "ImageWidth", N_("Image Width"), N_("Image width"), canonPiId, makerTags, unsignedShort, 1, printValue),
1390
        TagInfo(0x0003, "ImageHeight", N_("Image Height"), N_("Image height"), canonPiId, makerTags, unsignedShort, 1, printValue),
1391
        TagInfo(0x0004, "ImageWidthAsShot", N_("Image Width As Shot"), N_("Image width (as shot)"), canonPiId, makerTags, unsignedShort, 1, printValue),
1392
        TagInfo(0x0005, "ImageHeightAsShot", N_("Image Height As Shot"), N_("Image height (as shot)"), canonPiId, makerTags, unsignedShort, 1, printValue),
1393
        TagInfo(0x0016, "AFPointsUsed", N_("AF Points Used"), N_("AF points used"), canonPiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG_BITMASK(canonPiAFPointsUsed)),
1394
        TagInfo(0x001a, "AFPointsUsed20D", N_("AF Points Used 20D"), N_("AF points used (20D)"), canonPiId, makerTags, unsignedShort, 1, EXV_PRINT_TAG_BITMASK(canonPiAFPointsUsed20D)),
1395
        // End of list marker
1396
        TagInfo(0xffff, "(UnknownCanonPiTag)", "(UnknownCanonPiTag)", N_("Unknown Canon Picture Info tag"), canonPiId, makerTags, unsignedShort, 1, printValue)
1397
    };
1398

    
1399
    const TagInfo* CanonMakerNote::tagListPi()
1400
    {
1401
        return tagInfoPi_;
1402
    }
1403

    
1404
    //! BracketMode, tag 0x0003
1405
    extern const TagDetails canonBracketMode[] = {
1406
        { 0, N_("Off") },
1407
        { 1, N_("AEB") },
1408
        { 2, N_("FEB") },
1409
        { 3, N_("ISO") },
1410
        { 4, N_("WB")  }
1411
    };
1412

    
1413
    //! RawJpgSize, tag 0x0007
1414
    extern const TagDetails canonRawJpgSize[] = {
1415
        {   0, N_("Large")             },
1416
        {   1, N_("Medium")            },
1417
        {   2, N_("Small")             },
1418
        {   5, N_("Medium 1")          },
1419
        {   6, N_("Medium 2")          },
1420
        {   7, N_("Medium 3")          },
1421
        {   8, N_("Postcard")          },
1422
        {   9, N_("Widescreen")        },
1423
        {  10, N_("Medium Widescreen") },
1424
        {  14, N_("Small 1")           },
1425
        {  15, N_("Small 2")           },
1426
        {  16, N_("Small 3")           },
1427
        { 128, N_("640x480 Movie")     },
1428
        { 129, N_("Medium Movie")      },
1429
        { 130, N_("Small Movie")       },
1430
        { 137, N_("1280x720 Movie")    },
1431
        { 142, N_("1920x1080 Movie")   }
1432
    };
1433

    
1434
    //! NoiseReduction, tag 0x0008
1435
    extern const TagDetails canonNoiseReduction[] = {
1436
        { 0, N_("Off")  },
1437
        { 1, N_("On 1") },
1438
        { 2, N_("On 2") },
1439
        { 3, N_("On")   },
1440
        { 4, N_("Auto") }
1441
    };
1442

    
1443
    //! WBBracketMode, tag 0x0009
1444
    extern const TagDetails canonWBBracketMode[] = {
1445
        { 0, N_("Off")           },
1446
        { 1, N_("On (shift AB)") },
1447
        { 2, N_("On (shift GM)") }
1448
    };
1449

    
1450
    //! FilterEffect, tag 0x000e
1451
    extern const TagDetails canonFilterEffect[] = {
1452
        { 0, N_("None")   },
1453
        { 1, N_("Yellow") },
1454
        { 2, N_("Orange") },
1455
        { 3, N_("Red")    },
1456
        { 4, N_("Green")  }
1457
    };
1458

    
1459
    //! ToningEffect, tag 0x000e
1460
    extern const TagDetails canonToningEffect[] = {
1461
        { 0, N_("None")   },
1462
        { 1, N_("Sepia")  },
1463
        { 2, N_("Blue")   },
1464
        { 3, N_("Purple") },
1465
        { 4, N_("Green")  }
1466
    };
1467

    
1468
    // Canon File Info Tag
1469
    const TagInfo CanonMakerNote::tagInfoFi_[] = {
1470
        TagInfo(0x0001, "FileNumber", N_("File Number"), N_("File Number"), canonFiId, makerTags, unsignedLong, 1, printFiFileNumber),
1471
        TagInfo(0x0003, "BracketMode", N_("Bracket Mode"), N_("Bracket Mode"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonBracketMode)),
1472
        TagInfo(0x0004, "BracketValue", N_("Bracket Value"), N_("Bracket Value"), canonFiId, makerTags, signedShort, 1, printValue),
1473
        TagInfo(0x0005, "BracketShotNumber", N_("Bracket Shot Number"), N_("Bracket Shot Number"), canonFiId, makerTags, signedShort, 1, printValue),
1474
        TagInfo(0x0006, "RawJpgQuality", N_("Raw Jpg Quality"), N_("Raw Jpg Quality"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonCsQuality)),
1475
        TagInfo(0x0007, "RawJpgSize", N_("Raw Jpg Size"), N_("Raw Jpg Size"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonRawJpgSize)),
1476
        TagInfo(0x0008, "NoiseReduction", N_("Noise Reduction"), N_("Noise Reduction"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonNoiseReduction)),
1477
        TagInfo(0x0009, "WBBracketMode", N_("WB Bracket Mode"), N_("WB Bracket Mode"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonWBBracketMode)),
1478
        TagInfo(0x000c, "WBBracketValueAB", N_("WB Bracket Value AB"), N_("WB Bracket Value AB"), canonFiId, makerTags, signedShort, 1, printValue),
1479
        TagInfo(0x000d, "WBBracketValueGM", N_("WB Bracket Value GM"), N_("WB Bracket Value GM"), canonFiId, makerTags, signedShort, 1, printValue),
1480
        TagInfo(0x000e, "FilterEffect", N_("Filter Effect"), N_("Filter Effect"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonFilterEffect)),
1481
        TagInfo(0x000f, "ToningEffect", N_("Toning Effect"), N_("Toning Effect"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonToningEffect)),
1482
        TagInfo(0x0010, "MacroMagnification", N_("Macro Magnification"), N_("Macro magnification"), canonFiId, makerTags, signedShort, 1, printValue),
1483
        TagInfo(0x0013, "LiveViewShooting", N_("Live View Shooting"), N_("Live view shooting"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonOffOn)),
1484
        TagInfo(0x0014, "FocusDistanceUpper", N_("Focus Distance Upper"), N_("Focus Distance Upper"), canonFiId, makerTags, signedShort, 1, printFiFocusDistance),
1485
        TagInfo(0x0015, "FocusDistanceLower", N_("Focus Distance Lower"), N_("Focus Distance Lower"), canonFiId, makerTags, signedShort, 1, printFiFocusDistance),
1486
        TagInfo(0x0019, "FlashExposureLock", N_("Flash Exposure Lock"), N_("Flash exposure lock"), canonFiId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonOffOn)),
1487
        // End of list marker
1488
        TagInfo(0xffff, "(UnknownCanonFiTag)", "(UnknownCanonFiTag)", N_("Unknown Canon File Info tag"), canonFiId, makerTags, signedShort, 1, printValue)
1489
    };
1490

    
1491
    const TagInfo* CanonMakerNote::tagListFi()
1492
    {
1493
        return tagInfoFi_;
1494
    }
1495

    
1496
    //! Tone Curve Values
1497
    extern const TagDetails canonToneCurve[] = {
1498
        { 0, N_("Standard") },
1499
        { 1, N_("Manual")   },
1500
        { 2, N_("Custom")   }
1501
    };
1502

    
1503
    //! Sharpness Frequency Values
1504
    extern const TagDetails canonSharpnessFrequency[] = {
1505
        { 0, N_("n/a")      },
1506
        { 1, N_("Lowest")   },
1507
        { 2, N_("Low")      },
1508
        { 3, N_("Standard") },
1509
        { 4, N_("High")     },
1510
        { 5, N_("Highest")  }
1511
    };
1512

    
1513
    //! PictureStyle Values
1514
    extern const TagDetails canonPictureStyle[] = {
1515
        { 0x00, N_("None")            },
1516
        { 0x01, N_("Standard")        },
1517
        { 0x02, N_("Portrait")        },
1518
        { 0x03, N_("High Saturation") },
1519
        { 0x04, N_("Adobe RGB")       },
1520
        { 0x05, N_("Low Saturation")  },
1521
        { 0x06, N_("CM Set 1")        },
1522
        { 0x07, N_("CM Set 2")        },
1523
        { 0x21, N_("User Def. 1")     },
1524
        { 0x22, N_("User Def. 2")     },
1525
        { 0x23, N_("User Def. 3")     },
1526
        { 0x41, N_("PC 1")            },
1527
        { 0x42, N_("PC 2")            },
1528
        { 0x43, N_("PC 3")            },
1529
        { 0x81, N_("Standard")        },
1530
        { 0x82, N_("Portrait")        },
1531
        { 0x83, N_("Landscape")       },
1532
        { 0x84, N_("Neutral")         },
1533
        { 0x85, N_("Faithful")        },
1534
        { 0x86, N_("Monochrome")      },
1535
        { 0x87, N_("Auto")            },
1536
        { 0x88, N_("Fine Detail")     }
1537
    };
1538

    
1539
    // Canon Processing Info Tag
1540
    const TagInfo CanonMakerNote::tagInfoPr_[] = {
1541
        TagInfo(0x0001, "ToneCurve", N_("ToneCurve"), N_("Tone curve"), canonPrId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonToneCurve)),
1542
        TagInfo(0x0002, "Sharpness", N_("Sharpness"), N_("Sharpness"), canonPrId, makerTags, signedShort, 1, printValue),
1543
        TagInfo(0x0003, "SharpnessFrequency", N_("SharpnessFrequency"), N_("Sharpness frequency"), canonPrId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonSharpnessFrequency)),
1544
        TagInfo(0x0004, "SensorRedLevel", N_("SensorRedLevel"), N_("Sensor red level"), canonPrId, makerTags, signedShort, 1, printValue),
1545
        TagInfo(0x0005, "SensorBlueLevel", N_("SensorBlueLevel"), N_("Sensor blue level"), canonPrId, makerTags, signedShort, 1, printValue),
1546
        TagInfo(0x0006, "WhiteBalanceRed", N_("WhiteBalanceRed"), N_("White balance red"), canonPrId, makerTags, signedShort, 1, printValue),
1547
        TagInfo(0x0007, "WhiteBalanceBlue", N_("WhiteBalanceBlue"), N_("White balance blue"), canonPrId, makerTags, signedShort, 1, printValue),
1548
        TagInfo(0x0008, "WhiteBalance", N_("WhiteBalance"), N_("White balance"), canonPrId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonSiWhiteBalance)),
1549
        TagInfo(0x0009, "ColorTemperature", N_("ColorTemperature"), N_("Color Temperature"), canonPrId, makerTags, signedShort, 1, printValue),
1550
        TagInfo(0x000a, "PictureStyle", N_("PictureStyle"), N_("Picture style"), canonPrId, makerTags, signedShort, 1, EXV_PRINT_TAG(canonPictureStyle)),
1551
        TagInfo(0x000b, "DigitalGain", N_("DigitalGain"), N_("Digital gain"), canonPrId, makerTags, signedShort, 1, printValue),
1552
        TagInfo(0x000c, "WBShiftAB", N_("WBShiftAB"), N_("WBShift AB"), canonPrId, makerTags, signedShort, 1, printValue),
1553
        TagInfo(0x000d, "WBShiftGM", N_("WBShiftGM"), N_("WB Shift GM"), canonPrId, makerTags, signedShort, 1, printValue),
1554
        TagInfo(0xffff, "(UnknownCanonPrTag)", "(UnknownCanonPrTag)", N_("Unknown Canon Processing Info tag"), canonPrId, makerTags, signedShort, 1, printValue)
1555
    };
1556

    
1557
    const TagInfo* CanonMakerNote::tagListPr()
1558
    {
1559
        return tagInfoPr_;
1560
    }
1561

    
1562
    std::ostream& CanonMakerNote::printFiFileNumber(std::ostream& os,
1563
                                                    const Value& value,
1564
                                                    const ExifData* metadata)
1565
    {
1566
        std::ios::fmtflags f( os.flags() );
1567
        if (   !metadata || value.typeId() != unsignedLong
1568
            || value.count() == 0)
1569
        {
1570
            os << "(" << value << ")";
1571
            os.flags(f);
1572
            return os;
1573
        }
1574

    
1575
        ExifData::const_iterator pos = metadata->findKey(ExifKey("Exif.Image.Model"));
1576
        if (pos == metadata->end()) return os << "(" << value << ")";
1577

    
1578
        // Ported from Exiftool
1579
        std::string model = pos->toString();
1580
        if (   model.find("20D") != std::string::npos
1581
            || model.find("350D") != std::string::npos
1582
            || model.substr(model.size() - 8, 8) == "REBEL XT"
1583
            || model.find("Kiss Digital N") != std::string::npos) {
1584
            uint32_t val = value.toLong();
1585
            uint32_t dn = (val & 0xffc0) >> 6;
1586
            uint32_t fn = ((val >> 16) & 0xff) + ((val & 0x3f) << 8);
1587
            os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
1588
            os.flags(f);
1589
            return os;
1590
        }
1591
        if (   model.find("30D") != std::string::npos
1592
            || model.find("400D") != std::string::npos
1593
            || model.find("REBEL XTi") != std::string::npos
1594
            || model.find("Kiss Digital X") != std::string::npos
1595
            || model.find("K236") != std::string::npos) {
1596
            uint32_t val = value.toLong();
1597
            uint32_t dn = (val & 0xffc00) >> 10;
1598
            while (dn < 100) dn += 0x40;
1599
            uint32_t fn = ((val & 0x3ff) << 4) + ((val >> 20) & 0x0f);
1600
            os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
1601
            os.flags(f);
1602
            return os;
1603
        }
1604

    
1605
        os.flags(f);
1606
        return os << "(" << value << ")";
1607
    }
1608

    
1609
    std::ostream& CanonMakerNote::printFocalLength(std::ostream& os,
1610
                                                   const Value& value,
1611
                                                   const ExifData* metadata)
1612
    {
1613
        std::ios::fmtflags f( os.flags() );
1614
        if (   !metadata
1615
            || value.count() < 4
1616
            || value.typeId() != unsignedShort) {
1617
            os.flags(f);
1618
            return os << value;
1619
        }
1620

    
1621
        ExifKey key("Exif.CanonCs.Lens");
1622
        ExifData::const_iterator pos = metadata->findKey(key);
1623
        if (   pos != metadata->end()
1624
            && pos->value().count() >= 3
1625
            && pos->value().typeId() == unsignedShort) {
1626
            float fu = pos->value().toFloat(2);
1627
            if (fu != 0.0) {
1628
                float fl = value.toFloat(1) / fu;
1629
                std::ostringstream oss;
1630
                oss.copyfmt(os);
1631
                os << std::fixed << std::setprecision(1);
1632
                os << fl << " mm";
1633
                os.copyfmt(oss);
1634
                os.flags(f);
1635
                return os;
1636
            }
1637
        }
1638

    
1639
        os.flags(f);
1640
        return os << value;
1641
    }
1642

    
1643
    std::ostream& CanonMakerNote::print0x0008(std::ostream& os,
1644
                                              const Value& value,
1645
                                              const ExifData*)
1646
    {
1647
        std::string n = value.toString();
1648
        if (n.length() < 4) return os << "(" << n << ")";
1649
        return os << n.substr(0, n.length() - 4) << "-"
1650
                  << n.substr(n.length() - 4);
1651
    }
1652

    
1653
    std::ostream& CanonMakerNote::print0x000c(std::ostream& os,
1654
                                              const Value& value,
1655
                                              const ExifData*)
1656
    {
1657
        std::istringstream is(value.toString());
1658
        uint32_t l;
1659
        is >> l;
1660
        return os << std::setw(4) << std::setfill('0') << std::hex
1661
                  << ((l & 0xffff0000) >> 16)
1662
                  << std::setw(5) << std::setfill('0') << std::dec
1663
                  << (l & 0x0000ffff);
1664
    }
1665

    
1666
    std::ostream& CanonMakerNote::printCs0x0002(std::ostream& os,
1667
                                                const Value& value,
1668
                                                const ExifData*)
1669
    {
1670
        if (   value.typeId() != unsignedShort
1671
            || value.count() == 0) return os << value;
1672

    
1673
        long l = value.toLong();
1674
        if (l == 0) {
1675
            os << "Off";
1676
        }
1677
        else {
1678
            os << l / 10.0 << " s";
1679
        }
1680
        return os;
1681
    }
1682

    
1683
    std::ostream& printCsLensFFFF(std::ostream& os,
1684
                                const Value& value,
1685
                                const ExifData* metadata)
1686
    {
1687
        try {
1688
            // 1140
1689
            if( metadata->findKey(ExifKey("Exif.Image.Model"        ))->value().toString() == "Canon EOS 30D"
1690
            &&  metadata->findKey(ExifKey("Exif.CanonCs.Lens"       ))->value().toString() == "24 24 1"
1691
            &&  metadata->findKey(ExifKey("Exif.CanonCs.MaxAperture"))->value().toString() == "95" // F2.8
1692
            ){
1693
                return os << "Canon EF-S 24mm f/2.8 STM" ;
1694
            }
1695
        } catch (std::exception&) {};
1696

    
1697
        return EXV_PRINT_TAG(canonCsLensType)(os, value, metadata);
1698
    }
1699

    
1700
    //! Helper structure
1701
    struct LensTypeAndFocalLengthAndMaxAperture {
1702
        long        lensType_;                  //!< Lens type
1703
        float       focalLengthMin_;            //!< Mininum focal length
1704
        float       focalLengthMax_;            //!< Maximum focal length
1705
        std::string focalLength_;               //!< Focal length as a string
1706
        std::string maxAperture_;               //!< Aperture
1707
    };
1708

    
1709
    //! Compare tag details with a lens entry
1710
    bool operator==(const TagDetails& td, const LensTypeAndFocalLengthAndMaxAperture& ltfl) {
1711
        return (   td.val_ == ltfl.lensType_
1712
                && std::string(td.label_).find(ltfl.focalLength_) != std::string::npos
1713
                && std::string(td.label_).find(ltfl.maxAperture_) != std::string::npos);
1714
    }
1715

    
1716
    void extractLensFocalLength(LensTypeAndFocalLengthAndMaxAperture& ltfl,
1717
                                const ExifData* metadata)
1718
    {
1719
        ExifKey key("Exif.CanonCs.Lens");
1720
        ExifData::const_iterator pos = metadata->findKey(key);
1721
        ltfl.focalLengthMin_ = 0.0;
1722
        ltfl.focalLengthMax_ = 0.0;
1723
        if (   pos != metadata->end()
1724
            && pos->value().count() >= 3
1725
            && pos->value().typeId() == unsignedShort) {
1726
            float fu = pos->value().toFloat(2);
1727
            if (fu != 0.0) {
1728
                ltfl.focalLengthMin_ = pos->value().toLong(1) / fu;
1729
                ltfl.focalLengthMax_ = pos->value().toLong(0) / fu;
1730
            }
1731
        }
1732
    }
1733

    
1734
    void convertFocalLength(LensTypeAndFocalLengthAndMaxAperture& ltfl,
1735
                            double divisor)
1736
    {
1737
        std::ostringstream oss;
1738
        oss << std::fixed << std::setprecision(0);
1739
        if (ltfl.focalLengthMin_ == ltfl.focalLengthMax_) {
1740
            oss << (ltfl.focalLengthMin_ / divisor) << "mm";
1741
        } else {
1742
            oss << (ltfl.focalLengthMin_ / divisor) << "-" << (ltfl.focalLengthMax_ / divisor) << "mm";
1743
        }
1744
        ltfl.focalLength_ = oss.str();
1745
    }
1746

    
1747
    std::ostream& printCsLensByFocalLengthAndMaxAperture(std::ostream& os,
1748
                                           const Value& value,
1749
                                           const ExifData* metadata)
1750
    {
1751
        if (   !metadata || value.typeId() != unsignedShort
1752
            || value.count() == 0) return os << value;
1753

    
1754
        LensTypeAndFocalLengthAndMaxAperture ltfl;
1755
        ltfl.lensType_ = value.toLong();
1756

    
1757
        extractLensFocalLength(ltfl, metadata);
1758
        if (ltfl.focalLengthMax_ == 0.0) return os << value;
1759
        convertFocalLength(ltfl, 1.0);
1760

    
1761
        ExifKey key("Exif.CanonCs.MaxAperture");
1762
        ExifData::const_iterator pos = metadata->findKey(key);
1763
        if (   pos != metadata->end()
1764
            && pos->value().count() == 1
1765
            && pos->value().typeId() == unsignedShort) {
1766

    
1767
            long val = static_cast<int16_t>(pos->value().toLong(0));
1768
            if (val > 0)
1769
            {
1770
                std::ostringstream oss;
1771
                oss << std::setprecision(2);
1772
                oss << fnumber(canonEv(val));
1773
                ltfl.maxAperture_ = oss.str();
1774
            }
1775
        }
1776
        if (ltfl.maxAperture_.empty()) return os << value;
1777

    
1778
        const TagDetails* td = find(canonCsLensType, ltfl);
1779
        if (!td) return os << value;
1780
        return os << td->label_;
1781
    }
1782

    
1783
    std::ostream& printCsLensByFocalLength(std::ostream& os,
1784
                                           const Value& value,
1785
                                           const ExifData* metadata)
1786
    {
1787
        if (   !metadata || value.typeId() != unsignedShort
1788
            || value.count() == 0) return os << value;
1789

    
1790
        LensTypeAndFocalLengthAndMaxAperture ltfl;
1791
        ltfl.lensType_ = value.toLong();
1792

    
1793
        extractLensFocalLength(ltfl, metadata);
1794
        if (ltfl.focalLengthMax_ == 0.0) return os << value;
1795
        convertFocalLength(ltfl, 1.0);
1796

    
1797
        if (ltfl.focalLength_.empty()) return os << value;
1798

    
1799
        const TagDetails* td = find(canonCsLensType, ltfl);
1800
        if (!td) return os << value;
1801
        return os << td->label_;
1802
    }
1803

    
1804
    std::ostream& printCsLensByFocalLengthTC(std::ostream& os,
1805
                                             const Value& value,
1806
                                             const ExifData* metadata)
1807
    {
1808
        if (   !metadata || value.typeId() != unsignedShort
1809
            || value.count() == 0) return os << value;
1810

    
1811
        LensTypeAndFocalLengthAndMaxAperture ltfl;
1812
        ltfl.lensType_ = value.toLong();
1813

    
1814
        extractLensFocalLength(ltfl, metadata);
1815
        if (ltfl.focalLengthMax_ == 0.0) return os << value;
1816
        convertFocalLength(ltfl, 1.0); // just lens
1817
        const TagDetails* td = find(canonCsLensType, ltfl);
1818
        if (!td) {
1819
            convertFocalLength(ltfl, 1.4); // lens + 1.4x TC
1820
            td = find(canonCsLensType, ltfl);
1821
            if (!td) {
1822
                convertFocalLength(ltfl, 2.0); // lens + 2x TC
1823
                td = find(canonCsLensType, ltfl);
1824
                if (!td) return os << value;
1825
            }
1826
        }
1827
        return os << td->label_;
1828
    }
1829

    
1830
    std::ostream& CanonMakerNote::printCsLensType(std::ostream& os,
1831
                                                  const Value& value,
1832
                                                  const ExifData* metadata)
1833
    {
1834
        if (   value.typeId() != unsignedShort
1835
            || value.count() == 0) return os << "(" << value << ")";
1836

    
1837
		// #1034
1838
		const std::string undefined("undefined") ;
1839
		const std::string section  ("canon");
1840
		if ( Internal::readExiv2Config(section,value.toString(),undefined) != undefined ) {
1841
			return os << Internal::readExiv2Config(section,value.toString(),undefined);
1842
		}
1843

    
1844
        const LensIdFct* lif = find(lensIdFct, value.toLong());
1845
        if (!lif) {
1846
            return EXV_PRINT_TAG(canonCsLensType)(os, value, metadata);
1847
        }
1848
        if (metadata && lif->fct_) {
1849
            return lif->fct_(os, value, metadata);
1850
        }
1851
        return os << value;
1852
    }
1853

    
1854
    std::ostream& CanonMakerNote::printCsLens(std::ostream& os,
1855
                                              const Value& value,
1856
                                              const ExifData*)
1857
    {
1858
        std::ios::fmtflags f( os.flags() );
1859

    
1860
        if (   value.count() < 3
1861
            || value.typeId() != unsignedShort) {
1862
            os << "(" << value << ")";
1863
            os.flags(f);
1864
            return os;
1865
        }
1866

    
1867
        float fu = value.toFloat(2);
1868
        if (fu == 0.0) return os << value;
1869
        float len1 = value.toLong(0) / fu;
1870
        float len2 = value.toLong(1) / fu;
1871
        std::ostringstream oss;
1872
        oss.copyfmt(os);
1873
        os << std::fixed << std::setprecision(1);
1874
        if (len1 == len2) {
1875
            os << len1 << " mm";
1876
        } else {
1877
            os << len2 << " - " << len1 << " mm";
1878
        }
1879
        os.copyfmt(oss);
1880
        os.flags(f);
1881
        return os;
1882
    }
1883

    
1884
    std::ostream& CanonMakerNote::printSi0x0002(std::ostream& os,
1885
                                                const Value& value,
1886
                                                const ExifData*)
1887
    {
1888
        std::ios::fmtflags f( os.flags() );
1889
        if (   value.typeId() == unsignedShort
1890
            && value.count() > 0) {
1891
            // Ported from Exiftool by Will Stokes
1892
            os << exp(canonEv(value.toLong()) * log(2.0)) * 100.0 / 32.0;
1893
        }
1894
        os.flags(f);
1895
        return os;
1896
    }
1897

    
1898
    std::ostream& CanonMakerNote::printSi0x0003(std::ostream& os,
1899
                                                const Value& value,
1900
                                                const ExifData*)
1901
    {
1902
        if (   value.typeId() == unsignedShort
1903
            && value.count() > 0) {
1904
            // The offset of '5' seems to be ok for most Canons (see Exiftool)
1905
            // It might be explained by the fakt, that most Canons have a longest
1906
            // exposure of 30s which is 5 EV below 1s
1907
            // see also printSi0x0017
1908
            std::ostringstream oss;
1909
            oss.copyfmt(os);
1910
            int res = static_cast<int>(100.0 * (static_cast<short>(value.toLong()) / 32.0 + 5.0) + 0.5);
1911
            os << std::fixed << std::setprecision(2) << res / 100.0;
1912
            os.copyfmt(oss);
1913
        }
1914
        return os;
1915
    }
1916

    
1917
    std::ostream& CanonMakerNote::printSi0x0009(std::ostream& os,
1918
                                                const Value& value,
1919
                                                const ExifData*)
1920
    {
1921
        if (   value.typeId() != unsignedShort
1922
            || value.count() == 0) return os << value;
1923

    
1924
        long l = value.toLong();
1925
        os << l << "";
1926
        // Todo: determine unit
1927
        return os;
1928
    }
1929

    
1930
    std::ostream& CanonMakerNote::printSi0x000e(std::ostream& os,
1931
                                                const Value& value,
1932
                                                const ExifData* pExifData)
1933
    {
1934
        if (   value.typeId() != unsignedShort
1935
            || value.count() == 0) return os << value;
1936

    
1937
        long l = value.toLong();
1938
        long num = (l & 0xf000) >> 12;
1939
        os << num << " focus points; ";
1940
        long used = l & 0x0fff;
1941
        if (used == 0) {
1942
            os << "none";
1943
        }
1944
        else {
1945
            EXV_PRINT_TAG_BITMASK(canonSiAFPointUsed)(os, value, pExifData);
1946
        }
1947
        os << " used";
1948
        return os;
1949
    }
1950

    
1951
    std::ostream& CanonMakerNote::printSi0x0013(std::ostream& os,
1952
                                                const Value& value,
1953
                                                const ExifData*)
1954
    {
1955
        std::ios::fmtflags f( os.flags() );
1956
        if (   value.typeId() != unsignedShort
1957
            || value.count() == 0) return os << value;
1958

    
1959
        long l = value.toLong();
1960
        if (l == 0xffff) {
1961
            os << "Infinite";
1962
        }
1963
        else {
1964
            os << l << "";
1965
        }
1966
        os.flags(f);
1967
        return os;
1968
    }
1969

    
1970
    std::ostream& CanonMakerNote::printSi0x0015(std::ostream& os,
1971
                                                const Value& value,
1972
                                                const ExifData*)
1973
    {
1974
        if (   value.typeId() != unsignedShort
1975
            || value.count() == 0) return os << value;
1976

    
1977
        std::ostringstream oss;
1978
        oss.copyfmt(os);
1979
        long val = static_cast<int16_t>(value.toLong());
1980
        if (val < 0) return os << value;
1981
        os << std::setprecision(2)
1982
           << "F" << fnumber(canonEv(val));
1983
        os.copyfmt(oss);
1984
        return os;
1985
    }
1986

    
1987
    std::ostream& CanonMakerNote::printSi0x0016(std::ostream& os,
1988
                                                const Value& value,
1989
                                                const ExifData*)
1990
    {
1991
        std::ios::fmtflags f( os.flags() );
1992
        if (   value.typeId() != unsignedShort
1993
            || value.count() == 0) return os << value;
1994

    
1995
        URational ur = exposureTime(canonEv(value.toLong()));
1996
        os << ur.first;
1997
        if (ur.second > 1) {
1998
            os << "/" << ur.second;
1999
        }
2000
        os.flags(f);
2001
        return os << " s";
2002
    }
2003

    
2004
    std::ostream& CanonMakerNote::printSi0x0017(std::ostream& os,
2005
                                                const Value& value,
2006
                                                const ExifData*)
2007
    {
2008
        if (   value.typeId() != unsignedShort
2009
            || value.count() == 0) return os << value;
2010

    
2011
        std::ostringstream oss;
2012
        oss.copyfmt(os);
2013
        os << std::fixed << std::setprecision(2)
2014
           << value.toLong() / 8.0 - 6.0;
2015
        os.copyfmt(oss);
2016
        return os;
2017
    }
2018

    
2019
    std::ostream& CanonMakerNote::printFiFocusDistance(std::ostream& os,
2020
                                                       const Value& value,
2021
                                                       const ExifData*)
2022
    {
2023
       std::ios::fmtflags f( os.flags() );
2024
       if (   value.typeId() != signedShort
2025
         || value.count() == 0) return os << value;
2026

    
2027
      std::ostringstream oss;
2028
      oss.copyfmt(os);
2029
      os << std::fixed << std::setprecision(2);
2030

    
2031
      long l = value.toLong();
2032
      if (l == 0xffff) {
2033
        os << "Infinite";
2034
      }
2035
      else {
2036
        os << value.toLong()/100.0 << " m";
2037
      }
2038

    
2039
      os.copyfmt(oss);
2040
      os.flags(f);
2041
      return os;
2042
    }
2043

    
2044
    //! Print the tag value minus 128
2045
    std::ostream& CanonMakerNote::printValueMinus128(std::ostream& os, const Value& value, const ExifData*)
2046
    {
2047
        return os << value.toLong() - 128;
2048
    }
2049

    
2050
// *****************************************************************************
2051
// free functions
2052

    
2053
    float canonEv(long val)
2054
    {
2055
        // temporarily remove sign
2056
        int sign = 1;
2057
        if (val < 0) {
2058
            sign = -1;
2059
            val = -val;
2060
        }
2061
        // remove fraction
2062
        float frac = static_cast<float>(val & 0x1f);
2063
        val -= long(frac);
2064
        // convert 1/3 (0x0c) and 2/3 (0x14) codes
2065
        if (frac == 0x0c) {
2066
            frac = 32.0f / 3;
2067
        }
2068
        else if (frac == 0x14) {
2069
            frac = 64.0f / 3;
2070
        }
2071
        return sign * (val + frac) / 32.0f;
2072
    }
2073

    
2074
}}                                      // namespace Internal, Exiv2
(8-8/8)