File Coverage

blib/lib/Image/ExifTool/Canon.pm
Criterion Covered Total %
statement 271 335 80.9
branch 121 222 54.5
condition 62 140 44.2
subroutine 21 22 95.4
pod 0 18 0.0
total 475 737 64.4


line stmt bran cond sub pod time code
1             #------------------------------------------------------------------------------
2             # File: Canon.pm
3             #
4             # Description: Canon EXIF maker notes tags
5             #
6             # Revisions: 11/25/2003 - P. Harvey Created
7             # 12/03/2003 - P. Harvey Decode lots more tags and add CanonAFInfo
8             # 02/17/2004 - Michael Rommel Added IxusAFPoint
9             # 01/27/2005 - P. Harvey Disable validation of CanonAFInfo
10             # 01/30/2005 - P. Harvey Added a few more tags (ref 4)
11             # 02/10/2006 - P. Harvey Decode a lot of new tags (ref 12)
12             # [ongoing] - P. Harvey Constantly decoding new information
13             #
14             # Notes: Must check FocalPlaneX/YResolution values for each new model!
15             #
16             # References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
17             # 2) Michael Rommel private communication (Digital Ixus)
18             # 3) Daniel Pittman private communication (PowerShot S70)
19             # 4) http://www.wonderland.org/crw/
20             # 5) Juha Eskelinen private communication (20D)
21             # 6) Richard S. Smith private communication (20D)
22             # 7) Denny Priebe private communication (1DmkII)
23             # 8) Irwin Poche private communication
24             # 9) Michael Tiemann private communication (1DmkII)
25             # 10) Volker Gering private communication (1DmkII)
26             # 11) "cip" private communication
27             # 12) Rainer Honle private communication (5D)
28             # 13) http://www.cybercom.net/~dcoffin/dcraw/
29             # 14) (bozi) http://www.cpanforum.com/threads/2476 and /2563
30             # 15) http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm (2007/11/19)
31             # + http://homepage3.nifty.com/kamisaka/makernote/CanonLens.htm (2007/11/19)
32             # 16) Emil Sit private communication (30D)
33             # 17) http://www.asahi-net.or.jp/~xp8t-ymzk/s10exif.htm
34             # 18) Samson Tai private communication (G7)
35             # 19) Warren Stockton private communication
36             # 20) Bogdan private communication
37             # 21) Heiko Hinrichs private communication
38             # 22) Dave Nicholson private communication (PowerShot S30)
39             # 23) Magne Nilsen private communication (400D)
40             # 24) Wolfgang Hoffmann private communication (40D)
41             # 25) Laurent Clevy private communication
42             # 26) Steve Balcombe private communication
43             # 27) Chris Huebsch private communication (40D)
44             # 28) Hal Williamson private communication (XTi)
45             # 29) Ger Vermeulen private communication
46             # 30) David Pitcher private communication (1DmkIII)
47             # 31) Darryl Zurn private communication (A590IS)
48             # 32) Rich Taylor private communication (5D)
49             # 33) D.J. Cristi private communication
50             # 34) Andreas Huggel and Pascal de Bruijn private communication
51             # 35) Jan Boelsma private communication
52             # 36) Karl-Heinz Klotz private communication (http://www.dslr-forum.de/showthread.php?t=430900)
53             # 37) Vesa Kivisto private communication (30D)
54             # 38) Kurt Garloff private communication (5DmkII)
55             # 39) Irwin Poche private communication (5DmkII)
56             # 40) Jose Oliver-Didier private communication
57             # 41) http://www.cpanforum.com/threads/10730
58             # 42) Norbert Wasser private communication
59             # 43) Karsten Sote private communication
60             # 44) Hugh Griffiths private communication (5DmkII)
61             # 45) Mark Berger private communication (5DmkII)
62             # 46) Dieter Steiner private communication (7D)
63             # 47) http://www.exiv2.org/
64             # 48) Tomasz A. Kawecki private communication (550D, firmware 1.0.6, 1.0.8)
65             # 49) http://www.listware.net/201101/digikam-users/49795-digikam-users-re-lens-recognition.html
66             # 50) https://exiftool.org/forum/index.php/topic,3833.0.html
67             # 51) https://exiftool.org/forum/index.php/topic,4110.0.html
68             # 52) Kai Harrekilde-Petersen private communication
69             # 53) Anton Reiser private communication
70             # 54) https://github.com/lclevy/canon_cr3
71             # IB) Iliah Borg private communication (LibRaw)
72             # JD) Jens Duttke private communication
73             # JR) Jos Roost private communication
74             # NJ) Niels Kristian Bech Jensen private communication
75             #------------------------------------------------------------------------------
76              
77             package Image::ExifTool::Canon;
78              
79 33     33   4956 use strict;
  33         65  
  33         1153  
80 33     33   163 use vars qw($VERSION %canonModelID %canonLensTypes);
  33         57  
  33         1712  
81 33     33   176 use Image::ExifTool qw(:DataAccess :Utils);
  33         57  
  33         6548  
82 33     33   3390 use Image::ExifTool::Exif;
  33         104  
  33         624405  
83              
84             sub WriteCanon($$$);
85             sub ProcessSerialData($$$);
86             sub ProcessFilters($$$);
87             sub ProcessCTMD($$$);
88             sub ProcessExifInfo($$$);
89             sub SwapWords($);
90              
91             $VERSION = '4.58';
92              
93             # Note: Removed 'USM' from 'L' lenses since it is redundant - PH
94             # (or is it? Ref 32 shows 5 non-USM L-type lenses)
95             # --> have relaxed this for new lenses because Canon has been
96             # consistent about keeping "USM" in the model name
97             %canonLensTypes = ( #4
98             Notes => q{
99             Decimal values have been added to differentiate lenses which would otherwise
100             have the same LensType, and are used by the Composite LensID tag when
101             attempting to identify the specific lens model.
102             },
103             -1 => 'n/a',
104             1 => 'Canon EF 50mm f/1.8',
105             2 => 'Canon EF 28mm f/2.8 or Sigma Lens',
106             2.1 => 'Sigma 24mm f/2.8 Super Wide II', #ClaudeJolicoeur
107             # (3 removed in current Kamisaka list)
108             3 => 'Canon EF 135mm f/2.8 Soft', #15/32
109             4 => 'Canon EF 35-105mm f/3.5-4.5 or Sigma Lens', #28
110             4.1 => 'Sigma UC Zoom 35-135mm f/4-5.6',
111             5 => 'Canon EF 35-70mm f/3.5-4.5', #32
112             6 => 'Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens', #32
113             6.1 => 'Sigma 18-50mm f/3.5-5.6 DC', #23
114             6.2 => 'Sigma 18-125mm f/3.5-5.6 DC IF ASP',
115             6.3 => 'Tokina AF 193-2 19-35mm f/3.5-4.5',
116             6.4 => 'Sigma 28-80mm f/3.5-5.6 II Macro', #47
117             6.5 => 'Sigma 28-300mm f/3.5-6.3 DG Macro', #IB
118             7 => 'Canon EF 100-300mm f/5.6L', #15
119             8 => 'Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens', #32
120             8.1 => 'Sigma 70-300mm f/4-5.6 [APO] DG Macro', #15 (both APO and non-APO, ref forum2947)
121             8.2 => 'Tokina AT-X 242 AF 24-200mm f/3.5-5.6', #15
122             9 => 'Canon EF 70-210mm f/4', #32
123             9.1 => 'Sigma 55-200mm f/4-5.6 DC', #34
124             10 => 'Canon EF 50mm f/2.5 Macro or Sigma Lens', #10 (+ LSC Life Size Converter --> 70mm - PH)
125             10.1 => 'Sigma 50mm f/2.8 EX', #4
126             10.2 => 'Sigma 28mm f/1.8',
127             10.3 => 'Sigma 105mm f/2.8 Macro EX', #15
128             10.4 => 'Sigma 70mm f/2.8 EX DG Macro EF', #Jean-Michel Dubois
129             11 => 'Canon EF 35mm f/2', #9
130             13 => 'Canon EF 15mm f/2.8 Fisheye', #9
131             14 => 'Canon EF 50-200mm f/3.5-4.5L', #32
132             15 => 'Canon EF 50-200mm f/3.5-4.5', #32
133             16 => 'Canon EF 35-135mm f/3.5-4.5', #32
134             17 => 'Canon EF 35-70mm f/3.5-4.5A', #32
135             18 => 'Canon EF 28-70mm f/3.5-4.5', #32
136             20 => 'Canon EF 100-200mm f/4.5A', #32
137             21 => 'Canon EF 80-200mm f/2.8L',
138             22 => 'Canon EF 20-35mm f/2.8L or Tokina Lens', #32
139             22.1 => 'Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical', #15
140             23 => 'Canon EF 35-105mm f/3.5-4.5', #32
141             24 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
142             25 => 'Canon EF 35-80mm f/4-5.6 Power Zoom', #32
143             26 => 'Canon EF 100mm f/2.8 Macro or Other Lens',
144             26.1 => 'Cosina 100mm f/3.5 Macro AF',
145             26.2 => 'Tamron SP AF 90mm f/2.8 Di Macro', #15
146             26.3 => 'Tamron SP AF 180mm f/3.5 Di Macro', #15
147             26.4 => 'Carl Zeiss Planar T* 50mm f/1.4', #PH
148             26.5 => 'Voigtlander APO Lanthar 125mm F2.5 SL Macro', #JR
149             26.6 => 'Carl Zeiss Planar T 85mm f/1.4 ZE', #IB
150             27 => 'Canon EF 35-80mm f/4-5.6', #32
151             # 27 => 'Carl Zeiss Distagon T* 28mm f/2 ZF', #PH (must be with an adapter, because the ZF version is a Nikon mount)
152             # 27 => 'EMF adapter for Canon EOS digital cameras', #50 (reports MaxFocalLength of 65535)
153             # 27 => optix adapter
154             # 27 => Venus Optics Laowa 12mm f2.8 Zero-D or 105mm f2 (T3.2) Smooth Trans Focus (ref IB)
155             # 27 => Venus Optics Laowa 105mm f2 STF (ref IB)
156             28 => 'Canon EF 80-200mm f/4.5-5.6 or Tamron Lens', #32
157             28.1 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF', #15
158             28.2 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #4
159             # 28.3 => 'Tamron AF 70-300mm f/4.5-5.6 Di LD 1:2 Macro Zoom', #11
160             28.3 => 'Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro', #47
161             28.4 => 'Tamron AF Aspherical 28-200mm f/3.8-5.6', #14
162             29 => 'Canon EF 50mm f/1.8 II',
163             30 => 'Canon EF 35-105mm f/4.5-5.6', #32
164             31 => 'Canon EF 75-300mm f/4-5.6 or Tamron Lens', #32
165             31.1 => 'Tamron SP AF 300mm f/2.8 LD IF', #15
166             32 => 'Canon EF 24mm f/2.8 or Sigma Lens', #10
167             32.1 => 'Sigma 15mm f/2.8 EX Fisheye', #11
168             33 => 'Voigtlander or Carl Zeiss Lens',
169             33.1 => 'Voigtlander Ultron 40mm f/2 SLII Aspherical', #45
170             33.2 => 'Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical', #50
171             33.3 => 'Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus', #50
172             33.4 => 'Carl Zeiss Distagon T* 15mm f/2.8 ZE', #PH
173             33.5 => 'Carl Zeiss Distagon T* 18mm f/3.5 ZE', #PH
174             33.6 => 'Carl Zeiss Distagon T* 21mm f/2.8 ZE', #PH
175             33.7 => 'Carl Zeiss Distagon T* 25mm f/2 ZE', #IB
176             33.8 => 'Carl Zeiss Distagon T* 28mm f/2 ZE', #PH
177             33.9 => 'Carl Zeiss Distagon T* 35mm f/2 ZE', #PH
178             '33.10' => 'Carl Zeiss Distagon T* 35mm f/1.4 ZE', #IB
179             '33.11' => 'Carl Zeiss Planar T* 50mm f/1.4 ZE', #IB
180             '33.12' => 'Carl Zeiss Makro-Planar T* 50mm f/2 ZE', #IB
181             '33.13' => 'Carl Zeiss Makro-Planar T* 100mm f/2 ZE', #IB
182             '33.14' => 'Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE', #JR
183             35 => 'Canon EF 35-80mm f/4-5.6', #32
184             36 => 'Canon EF 38-76mm f/4.5-5.6', #32
185             37 => 'Canon EF 35-80mm f/4-5.6 or Tamron Lens', #32
186             37.1 => 'Tamron 70-200mm f/2.8 Di LD IF Macro', #PH
187             37.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #38
188             37.3 => 'Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]', #34
189             37.4 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro', #forum2937
190             38 => 'Canon EF 80-200mm f/4.5-5.6 II', #32 (II added ref https://github.com/Exiv2/exiv2/issues/1906)
191             39 => 'Canon EF 75-300mm f/4-5.6',
192             40 => 'Canon EF 28-80mm f/3.5-5.6',
193             41 => 'Canon EF 28-90mm f/4-5.6', #32
194             42 => 'Canon EF 28-200mm f/3.5-5.6 or Tamron Lens', #32
195             42.1 => 'Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro (A20)', #15
196             43 => 'Canon EF 28-105mm f/4-5.6', #10
197             44 => 'Canon EF 90-300mm f/4.5-5.6', #32
198             45 => 'Canon EF-S 18-55mm f/3.5-5.6 [II]', #PH (same ID for version II, ref 20)
199             46 => 'Canon EF 28-90mm f/4-5.6', #32
200             # 46 => 'Tamron 28-300mm f/3.5-6.3 Di VC PZD (A010)', # (also possibly?)
201             47 => 'Zeiss Milvus 35mm f/2 or 50mm f/2', #IB
202             47.1 => 'Zeiss Milvus 50mm f/2 Makro', #IB
203             47.2 => 'Zeiss Milvus 135mm f/2 ZE', #IB
204             48 => 'Canon EF-S 18-55mm f/3.5-5.6 IS', #20
205             49 => 'Canon EF-S 55-250mm f/4-5.6 IS', #23
206             50 => 'Canon EF-S 18-200mm f/3.5-5.6 IS',
207             51 => 'Canon EF-S 18-135mm f/3.5-5.6 IS', #PH
208             52 => 'Canon EF-S 18-55mm f/3.5-5.6 IS II', #PH
209             53 => 'Canon EF-S 18-55mm f/3.5-5.6 III', #Jon Charnas
210             54 => 'Canon EF-S 55-250mm f/4-5.6 IS II', #47
211             60 => 'Irix 11mm f/4', #50
212             63 => 'Irix 30mm F1.4 Dragonfly', #IB
213             80 => 'Canon TS-E 50mm f/2.8L Macro', #42
214             81 => 'Canon TS-E 90mm f/2.8L Macro', #42
215             82 => 'Canon TS-E 135mm f/4L Macro', #42
216             94 => 'Canon TS-E 17mm f/4L', #42
217             95 => 'Canon TS-E 24mm f/3.5L II', #43
218             103 => 'Samyang AF 14mm f/2.8 EF or Rokinon Lens', #IB
219             103.1 => 'Rokinon SP 14mm f/2.4', #IB
220             103.2 => 'Rokinon AF 14mm f/2.8 EF', #IB
221             106 => 'Rokinon SP / Samyang XP 35mm f/1.2', #IB
222             112 => 'Sigma 28mm f/1.5 FF High-speed Prime or other Sigma Lens', #IB
223             112.1 => 'Sigma 40mm f/1.5 FF High-speed Prime', #IB
224             112.2 => 'Sigma 105mm f/1.5 FF High-speed Prime', #IB
225             117 => 'Tamron 35-150mm f/2.8-4.0 Di VC OSD (A043) or other Tamron Lens', #IB
226             117.1 => 'Tamron SP 35mm f/1.4 Di USD (F045)', #Exiv2#1064
227             124 => 'Canon MP-E 65mm f/2.8 1-5x Macro Photo', #9
228             125 => 'Canon TS-E 24mm f/3.5L',
229             126 => 'Canon TS-E 45mm f/2.8', #15
230             127 => 'Canon TS-E 90mm f/2.8 or Tamron Lens', #15
231             127.1 => 'Tamron 18-200mm f/3.5-6.3 Di II VC (B018)', #TomLachecki
232             129 => 'Canon EF 300mm f/2.8L USM', #32
233             130 => 'Canon EF 50mm f/1.0L USM', #10/15
234             131 => 'Canon EF 28-80mm f/2.8-4L USM or Sigma Lens', #32
235             131.1 => 'Sigma 8mm f/3.5 EX DG Circular Fisheye', #15
236             131.2 => 'Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM', #15
237             131.3 => 'Sigma 17-70mm f/2.8-4.5 DC Macro', #PH (NC)
238             131.4 => 'Sigma APO 50-150mm f/2.8 [II] EX DC HSM', #15 ([II] ref PH)
239             131.5 => 'Sigma APO 120-300mm f/2.8 EX DG HSM', #15
240             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 1.4x', #15
241             # 'Sigma APO 120-300mm f/2.8 EX DG HSM + 2x', #15
242             131.6 => 'Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye', #PH
243             131.7 => 'Sigma 70-200mm f/2.8 APO EX HSM', #PH (http://www.lensrentals.com/blog/2012/08/canon-illumination-correction-and-third-party-lenses)
244             131.8 => 'Sigma 28-70mm f/2.8-4 DG', #IB
245             132 => 'Canon EF 1200mm f/5.6L USM', #32
246             134 => 'Canon EF 600mm f/4L IS USM', #15
247             135 => 'Canon EF 200mm f/1.8L USM',
248             136 => 'Canon EF 300mm f/2.8L USM',
249             136.1 => 'Tamron SP 15-30mm f/2.8 Di VC USD (A012)', #TomLachecki
250             137 => 'Canon EF 85mm f/1.2L USM or Sigma or Tamron Lens', #10
251             137.1 => 'Sigma 18-50mm f/2.8-4.5 DC OS HSM', #PH
252             137.2 => 'Sigma 50-200mm f/4-5.6 DC OS HSM', #PH
253             137.3 => 'Sigma 18-250mm f/3.5-6.3 DC OS HSM', #PH (also Sigma 18-250mm f/3.5-6.3 DC Macro OS HSM)
254             137.4 => 'Sigma 24-70mm f/2.8 IF EX DG HSM', #PH
255             137.5 => 'Sigma 18-125mm f/3.8-5.6 DC OS HSM', #PH
256             137.6 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C', #forum2819 (Contemporary version has this ID - PH)
257             137.7 => 'Sigma 17-50mm f/2.8 OS HSM', #47
258             137.8 => 'Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]', #PH
259             137.9 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD (B008)', #forum3090
260             '137.10' => 'Sigma 8-16mm f/4.5-5.6 DC HSM', #50-Zwielicht
261             '137.11' => 'Tamron SP 17-50mm f/2.8 XR Di II VC (B005)', #50
262             '137.12' => 'Tamron SP 60mm f/2 Macro Di II (G005)', #50
263             '137.13' => 'Sigma 10-20mm f/3.5 EX DC HSM', #Gerald Erdmann
264             '137.14' => 'Tamron SP 24-70mm f/2.8 Di VC USD', #PH
265             '137.15' => 'Sigma 18-35mm f/1.8 DC HSM', #David Monro
266             '137.16' => 'Sigma 12-24mm f/4.5-5.6 DG HSM II', #IB
267             '137.17' => 'Sigma 70-300mm f/4-5.6 DG OS', #IB
268             138 => 'Canon EF 28-80mm f/2.8-4L', #32
269             139 => 'Canon EF 400mm f/2.8L USM',
270             140 => 'Canon EF 500mm f/4.5L USM', #32
271             141 => 'Canon EF 500mm f/4.5L USM',
272             142 => 'Canon EF 300mm f/2.8L IS USM', #15
273             143 => 'Canon EF 500mm f/4L IS USM or Sigma Lens', #15
274             143.1 => 'Sigma 17-70mm f/2.8-4 DC Macro OS HSM', #NJ (Exiv2 #1167)
275             144 => 'Canon EF 35-135mm f/4-5.6 USM', #26
276             145 => 'Canon EF 100-300mm f/4.5-5.6 USM', #32
277             146 => 'Canon EF 70-210mm f/3.5-4.5 USM', #32
278             147 => 'Canon EF 35-135mm f/4-5.6 USM', #32
279             148 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
280             149 => 'Canon EF 100mm f/2 USM', #9
281             150 => 'Canon EF 14mm f/2.8L USM or Sigma Lens', #10
282             150.1 => 'Sigma 20mm EX f/1.8', #4
283             150.2 => 'Sigma 30mm f/1.4 DC HSM', #15
284             150.3 => 'Sigma 24mm f/1.8 DG Macro EX', #15
285             150.4 => 'Sigma 28mm f/1.8 DG Macro EX', #IB
286             150.5 => 'Sigma 18-35mm f/1.8 DC HSM | A', #IB
287             151 => 'Canon EF 200mm f/2.8L USM',
288             152 => 'Canon EF 300mm f/4L IS USM or Sigma Lens', #15
289             152.1 => 'Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM', #15
290             152.2 => 'Sigma 14mm f/2.8 EX Aspherical HSM', #15
291             152.3 => 'Sigma 10-20mm f/4-5.6', #14
292             152.4 => 'Sigma 100-300mm f/4', # (ref Bozi)
293             152.5 => 'Sigma 300-800mm f/5.6 APO EX DG HSM', #IB
294             153 => 'Canon EF 35-350mm f/3.5-5.6L USM or Sigma or Tamron Lens', #PH
295             153.1 => 'Sigma 50-500mm f/4-6.3 APO HSM EX', #15
296             153.2 => 'Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro',
297             153.3 => 'Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro (A14)', #15
298             153.4 => 'Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro', #PH
299             154 => 'Canon EF 20mm f/2.8 USM or Zeiss Lens', #15
300             154.1 => 'Zeiss Milvus 21mm f/2.8', #IB
301             154.2 => 'Zeiss Milvus 15mm f/2.8 ZE', #IB
302             154.3 => 'Zeiss Milvus 18mm f/2.8 ZE', #IB
303             155 => 'Canon EF 85mm f/1.8 USM or Sigma Lens',
304             155.1 => 'Sigma 14mm f/1.8 DG HSM | A', #IB (A017)
305             156 => 'Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens',
306             156.1 => 'Tamron SP 70-300mm f/4-5.6 Di VC USD (A005)', #PH
307             156.2 => 'Tamron SP AF 28-105mm f/2.8 LD Aspherical IF (176D)', #JR
308             160 => 'Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens',
309             160.1 => 'Tamron AF 19-35mm f/3.5-4.5', #44
310             160.2 => 'Tokina AT-X 124 AF Pro DX 12-24mm f/4', #49
311             160.3 => 'Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye', #PH (http://osdir.com/ml/digikam-devel/2011-04/msg00275.html)
312             160.4 => 'Tokina AT-X 116 AF Pro DX 11-16mm f/2.8', #forum3967
313             160.5 => 'Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8', #NJ (Exiv2 #1166)
314             161 => 'Canon EF 28-70mm f/2.8L USM or Other Lens',
315             161.1 => 'Sigma 24-70mm f/2.8 EX',
316             161.2 => 'Sigma 28-70mm f/2.8 EX', #PH (http://www.breezesys.com/forum/showthread.php?t=3718)
317             161.3 => 'Sigma 24-60mm f/2.8 EX DG', #PH (http://www.lensrentals.com/blog/2012/08/canon-illumination-correction-and-third-party-lenses)
318             161.4 => 'Tamron AF 17-50mm f/2.8 Di-II LD Aspherical', #40
319             161.5 => 'Tamron 90mm f/2.8',
320             161.6 => 'Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF (A05)', #IB
321             161.7 => 'Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro', #IB/NJ
322             161.8 => 'Tokina AT-X 24-70mm f/2.8 PRO FX (IF)', #IB
323             162 => 'Canon EF 200mm f/2.8L USM', #32
324             163 => 'Canon EF 300mm f/4L', #32
325             164 => 'Canon EF 400mm f/5.6L', #32
326             165 => 'Canon EF 70-200mm f/2.8L USM',
327             166 => 'Canon EF 70-200mm f/2.8L USM + 1.4x',
328             167 => 'Canon EF 70-200mm f/2.8L USM + 2x',
329             168 => 'Canon EF 28mm f/1.8 USM or Sigma Lens', #15
330             168.1 => 'Sigma 50-100mm f/1.8 DC HSM | A', #IB
331             169 => 'Canon EF 17-35mm f/2.8L USM or Sigma Lens', #15
332             169.1 => 'Sigma 18-200mm f/3.5-6.3 DC OS', #23
333             169.2 => 'Sigma 15-30mm f/3.5-4.5 EX DG Aspherical', #4
334             169.3 => 'Sigma 18-50mm f/2.8 Macro', #26
335             169.4 => 'Sigma 50mm f/1.4 EX DG HSM', #PH
336             169.5 => 'Sigma 85mm f/1.4 EX DG HSM', #Rolando Ruzic
337             169.6 => 'Sigma 30mm f/1.4 EX DC HSM', #Rodolfo Borges
338             169.7 => 'Sigma 35mm f/1.4 DG HSM', #PH (also "| A" version, ref 50)
339             169.8 => 'Sigma 35mm f/1.5 FF High-Speed Prime | 017', #IB
340             169.9 => 'Sigma 70mm f/2.8 Macro EX DG', #IB
341             170 => 'Canon EF 200mm f/2.8L II USM or Sigma Lens', #9
342             170.1 => 'Sigma 300mm f/2.8 APO EX DG HSM', #IB
343             170.2 => 'Sigma 800mm f/5.6 APO EX DG HSM', #IB
344             171 => 'Canon EF 300mm f/4L USM', #15
345             172 => 'Canon EF 400mm f/5.6L USM or Sigma Lens', #32
346             172.1 =>'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
347             172.2 => 'Sigma 500mm f/4.5 APO EX DG HSM', #IB
348             173 => 'Canon EF 180mm Macro f/3.5L USM or Sigma Lens', #9
349             173.1 => 'Sigma 180mm EX HSM Macro f/3.5', #14
350             173.2 => 'Sigma APO Macro 150mm f/2.8 EX DG HSM', #14
351             173.3 => 'Sigma 10mm f/2.8 EX DC Fisheye', #IB
352             173.4 => 'Sigma 15mm f/2.8 EX DG Diagonal Fisheye', #IB
353             173.5 => 'Venus Laowa 100mm F2.8 2X Ultra Macro APO', #IB
354             174 => 'Canon EF 135mm f/2L USM or Other Lens', #9
355             174.1 => 'Sigma 70-200mm f/2.8 EX DG APO OS HSM', #PH (probably version II of this lens)
356             174.2 => 'Sigma 50-500mm f/4.5-6.3 APO DG OS HSM', #forum4031
357             174.3 => 'Sigma 150-500mm f/5-6.3 APO DG OS HSM', #47
358             174.4 => 'Zeiss Milvus 100mm f/2 Makro', #IB
359             174.5 => 'Sigma APO 50-150mm f/2.8 EX DC OS HSM', #IB
360             174.6 => 'Sigma APO 120-300mm f/2.8 EX DG OS HSM', #IB
361             174.7 => 'Sigma 120-300mm f/2.8 DG OS HSM S013', #IB
362             174.8 => 'Sigma 120-400mm f/4.5-5.6 APO DG OS HSM', #IB
363             174.9 => 'Sigma 200-500mm f/2.8 APO EX DG', #IB
364             175 => 'Canon EF 400mm f/2.8L USM', #32
365             176 => 'Canon EF 24-85mm f/3.5-4.5 USM',
366             177 => 'Canon EF 300mm f/4L IS USM', #9
367             178 => 'Canon EF 28-135mm f/3.5-5.6 IS',
368             179 => 'Canon EF 24mm f/1.4L USM', #20
369             180 => 'Canon EF 35mm f/1.4L USM or Other Lens', #9
370             180.1 => 'Sigma 50mm f/1.4 DG HSM | A', #50
371             180.2 => 'Sigma 24mm f/1.4 DG HSM | A', #NJ
372             180.3 => 'Zeiss Milvus 50mm f/1.4', #IB
373             180.4 => 'Zeiss Milvus 85mm f/1.4', #IB
374             180.5 => 'Zeiss Otus 28mm f/1.4 ZE', #PH
375             180.6 => 'Sigma 24mm f/1.5 FF High-Speed Prime | 017', #IB
376             180.7 => 'Sigma 50mm f/1.5 FF High-Speed Prime | 017', #IB
377             180.8 => 'Sigma 85mm f/1.5 FF High-Speed Prime | 017', #IB
378             180.9 => 'Tokina Opera 50mm f/1.4 FF', #IB
379             '180.10' => 'Sigma 20mm f/1.4 DG HSM | A', #IB (015)
380             181 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 1.4x or Sigma Lens', #15
381             181.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x', #50
382             182 => 'Canon EF 100-400mm f/4.5-5.6L IS USM + 2x or Sigma Lens',
383             182.1 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x', #PH (NC)
384             183 => 'Canon EF 100-400mm f/4.5-5.6L IS USM or Sigma Lens',
385             183.1 => 'Sigma 150mm f/2.8 EX DG OS HSM APO Macro', #50
386             183.2 => 'Sigma 105mm f/2.8 EX DG OS HSM Macro', #50
387             183.3 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #IB
388             183.4 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | C', #47
389             183.5 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #forum7109 (Sports 014)
390             183.6 => 'Sigma 100-400mm f/5-6.3 DG OS HSM', #PH ("| C" ?)
391             183.7 => 'Sigma 180mm f/3.5 APO Macro EX DG IF HSM', #IB
392             184 => 'Canon EF 400mm f/2.8L USM + 2x', #15
393             185 => 'Canon EF 600mm f/4L IS USM', #32
394             186 => 'Canon EF 70-200mm f/4L USM', #9
395             187 => 'Canon EF 70-200mm f/4L USM + 1.4x', #26
396             188 => 'Canon EF 70-200mm f/4L USM + 2x', #PH
397             189 => 'Canon EF 70-200mm f/4L USM + 2.8x', #32
398             190 => 'Canon EF 100mm f/2.8 Macro USM', # (+USM ref 42)
399             191 => 'Canon EF 400mm f/4 DO IS or Sigma Lens', #9
400             191.1 => 'Sigma 500mm f/4 DG OS HSM', #AndrewSheih
401             193 => 'Canon EF 35-80mm f/4-5.6 USM', #32
402             194 => 'Canon EF 80-200mm f/4.5-5.6 USM', #32
403             195 => 'Canon EF 35-105mm f/4.5-5.6 USM', #32
404             196 => 'Canon EF 75-300mm f/4-5.6 USM', #15/32
405             197 => 'Canon EF 75-300mm f/4-5.6 IS USM or Sigma Lens',
406             197.1 => 'Sigma 18-300mm f/3.5-6.3 DC Macro OS HSM', #50
407             198 => 'Canon EF 50mm f/1.4 USM or Other Lens',
408             198.1 => 'Zeiss Otus 55mm f/1.4 ZE', #JR (seen only on Sony camera)
409             198.2 => 'Zeiss Otus 85mm f/1.4 ZE', #JR (NC)
410             198.3 => 'Zeiss Milvus 25mm f/1.4', #IB
411             198.4 => 'Zeiss Otus 100mm f/1.4', #IB
412             198.5 => 'Zeiss Milvus 35mm f/1.4 ZE', #IB
413             198.6 => 'Yongnuo YN 35mm f/2', #IB
414             199 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
415             200 => 'Canon EF 75-300mm f/4-5.6 USM', #32
416             201 => 'Canon EF 28-80mm f/3.5-5.6 USM', #32
417             202 => 'Canon EF 28-80mm f/3.5-5.6 USM IV',
418             208 => 'Canon EF 22-55mm f/4-5.6 USM', #32
419             209 => 'Canon EF 55-200mm f/4.5-5.6', #32 (USM mk I version? ref IB)
420             210 => 'Canon EF 28-90mm f/4-5.6 USM', #32
421             211 => 'Canon EF 28-200mm f/3.5-5.6 USM', #15
422             212 => 'Canon EF 28-105mm f/4-5.6 USM', #15
423             213 => 'Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens',
424             213.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD (A011)', #forum5565
425             213.2 => 'Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro (B016)', #PH
426             213.3 => 'Tamron SP 35mm f/1.8 Di VC USD (F012)', #PH
427             213.4 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
428             214 => 'Canon EF-S 18-55mm f/3.5-5.6 USM', #PH/34
429             215 => 'Canon EF 55-200mm f/4.5-5.6 II USM',
430             217 => 'Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD', #47
431             220 => 'Yongnuo YN 50mm f/1.8', #IB
432             224 => 'Canon EF 70-200mm f/2.8L IS USM', #11
433             225 => 'Canon EF 70-200mm f/2.8L IS USM + 1.4x', #11
434             226 => 'Canon EF 70-200mm f/2.8L IS USM + 2x', #14
435             227 => 'Canon EF 70-200mm f/2.8L IS USM + 2.8x', #32
436             228 => 'Canon EF 28-105mm f/3.5-4.5 USM', #32
437             229 => 'Canon EF 16-35mm f/2.8L USM', #PH
438             230 => 'Canon EF 24-70mm f/2.8L USM', #9
439             231 => 'Canon EF 17-40mm f/4L USM or Sigma Lens',
440             231.1 => 'Sigma 12-24mm f/4 DG HSM A016', #IB
441             232 => 'Canon EF 70-300mm f/4.5-5.6 DO IS USM', #15
442             233 => 'Canon EF 28-300mm f/3.5-5.6L IS USM', #PH
443             234 => 'Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens', #19
444             234.1 => 'Tokina AT-X 12-28 PRO DX 12-28mm f/4', #50/NJ
445             235 => 'Canon EF-S 10-22mm f/3.5-4.5 USM', #15
446             236 => 'Canon EF-S 60mm f/2.8 Macro USM', #15
447             237 => 'Canon EF 24-105mm f/4L IS USM', #15
448             238 => 'Canon EF 70-300mm f/4-5.6 IS USM', #15 (and version II? ref 42)
449             239 => 'Canon EF 85mm f/1.2L II USM or Rokinon Lens', #15
450             239.1 => 'Rokinon SP 85mm f/1.2', #IB
451             240 => 'Canon EF-S 17-55mm f/2.8 IS USM or Sigma Lens', #15
452             240.1 => 'Sigma 17-50mm f/2.8 EX DC OS HSM', #https://github.com/Exiv2/exiv2/issues/397
453             241 => 'Canon EF 50mm f/1.2L USM', #15
454             242 => 'Canon EF 70-200mm f/4L IS USM', #PH
455             243 => 'Canon EF 70-200mm f/4L IS USM + 1.4x', #15
456             244 => 'Canon EF 70-200mm f/4L IS USM + 2x', #PH
457             245 => 'Canon EF 70-200mm f/4L IS USM + 2.8x', #32
458             246 => 'Canon EF 16-35mm f/2.8L II USM', #PH
459             247 => 'Canon EF 14mm f/2.8L II USM', #32
460             248 => 'Canon EF 200mm f/2L IS USM or Sigma Lens', #42
461             248.1 => 'Sigma 24-35mm f/2 DG HSM | A', #JR
462             248.2 => 'Sigma 135mm f/2 FF High-Speed Prime | 017', #IB
463             248.3 => 'Sigma 24-35mm f/2.2 FF Zoom | 017', #IB
464             248.4 => 'Sigma 135mm f/1.8 DG HSM A017', #IB
465             249 => 'Canon EF 800mm f/5.6L IS USM', #35
466             250 => 'Canon EF 24mm f/1.4L II USM or Sigma Lens', #41
467             250.1 => 'Sigma 20mm f/1.4 DG HSM | A', #IB
468             250.2 => 'Sigma 20mm f/1.5 FF High-Speed Prime | 017', #IB
469             250.3 => 'Tokina Opera 16-28mm f/2.8 FF', #IB
470             250.4 => 'Sigma 85mm f/1.4 DG HSM A016', #IB
471             251 => 'Canon EF 70-200mm f/2.8L IS II USM',
472             251.1 => 'Canon EF 70-200mm f/2.8L IS III USM', #IB
473             252 => 'Canon EF 70-200mm f/2.8L IS II USM + 1.4x', #50 (1.4x Mk II)
474             252.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 1.4x', #PH (NC)
475             253 => 'Canon EF 70-200mm f/2.8L IS II USM + 2x', #PH (NC)
476             253.1 => 'Canon EF 70-200mm f/2.8L IS III USM + 2x', #PH (NC)
477             # 253.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025) + 2x', #forum9367
478             254 => 'Canon EF 100mm f/2.8L Macro IS USM or Tamron Lens', #42
479             254.1 => 'Tamron SP 90mm f/2.8 Di VC USD 1:1 Macro (F017)', #PH
480             255 => 'Sigma 24-105mm f/4 DG OS HSM | A or Other Lens', #50
481             255.1 => 'Sigma 180mm f/2.8 EX DG OS HSM APO Macro', #50
482             255.2 => 'Tamron SP 70-200mm f/2.8 Di VC USD', #exiv issue 1202 (A009)
483             368 => 'Sigma 14-24mm f/2.8 DG HSM | A or other Sigma Lens', #IB (A018)
484             368.1 => 'Sigma 20mm f/1.4 DG HSM | A', #50 (newer firmware)
485             368.2 => 'Sigma 50mm f/1.4 DG HSM | A', #50
486             368.3 => 'Sigma 40mm f/1.4 DG HSM | A', #IB (018)
487             368.4 => 'Sigma 60-600mm f/4.5-6.3 DG OS HSM | S', #IB (018)
488             368.5 => 'Sigma 28mm f/1.4 DG HSM | A', #IB (A019)
489             368.6 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
490             368.7 => 'Sigma 85mm f/1.4 DG HSM | A', #IB (016)
491             368.8 => 'Sigma 105mm f/1.4 DG HSM', #IB (A018)
492             368.9 => 'Sigma 14-24mm f/2.8 DG HSM', #IB (A018)
493             '368.10' => 'Sigma 35mm f/1.4 DG HSM | A', #PH (012)
494             '368.11' => 'Sigma 70mm f/2.8 DG Macro', #IB (A018)
495             '368.12' => 'Sigma 18-35mm f/1.8 DC HSM | A', #50
496             # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
497             488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
498             489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
499             490 => 'Canon EF 8-15mm f/4L Fisheye USM', #Klaus Reinfeld (PH added "Fisheye")
500             491 => 'Canon EF 300mm f/2.8L IS II USM or Tamron Lens', #42
501             491.1 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #IB
502             491.2 => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', #IB
503             491.3 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD (A035)', #IB
504             491.4 => 'Tamron 70-210mm f/4 Di VC USD (A034)', #IB
505             491.5 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 1.4x', #IB
506             491.6 => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)',
507             492 => 'Canon EF 400mm f/2.8L IS II USM', #PH
508             493 => 'Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM', #PH
509             493.1 => 'Canon EF 24-105mm f/4L IS USM', #PH (should recheck this)
510             494 => 'Canon EF 600mm f/4L IS II USM', #PH
511             495 => 'Canon EF 24-70mm f/2.8L II USM or Sigma Lens', #PH
512             495.1 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
513             496 => 'Canon EF 200-400mm f/4L IS USM', #PH
514             499 => 'Canon EF 200-400mm f/4L IS USM + 1.4x', #50
515             502 => 'Canon EF 28mm f/2.8 IS USM or Tamron Lens', #PH
516             502.1 => 'Tamron 35mm f/1.8 Di VC USD (F012)', #forum9757
517             503 => 'Canon EF 24mm f/2.8 IS USM', #PH
518             504 => 'Canon EF 24-70mm f/4L IS USM', #PH
519             505 => 'Canon EF 35mm f/2 IS USM', #PH
520             506 => 'Canon EF 400mm f/4 DO IS II USM', #42
521             507 => 'Canon EF 16-35mm f/4L IS USM', #42
522             508 => 'Canon EF 11-24mm f/4L USM or Tamron Lens', #PH
523             508.1 => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)', #PH
524             624 => 'Sigma 70-200mm f/2.8 DG OS HSM | S or other Sigma Lens', #IB (018)
525             624.1 => 'Sigma 150-600mm f/5-6.3 | C', #ChrisSkopec
526             747 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens', #JR
527             747.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #50
528             748 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x or Tamron Lens', #JR (1.4x Mk III)
529             748.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 1.4x', #IB
530             748.2 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 2x', #IB
531             749 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 2x', #IB
532             750 => 'Canon EF 35mm f/1.4L II USM or Tamron Lens', #42
533             750.1 => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #Exiv2#1072
534             750.2 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
535             751 => 'Canon EF 16-35mm f/2.8L III USM', #42
536             752 => 'Canon EF 24-105mm f/4L IS II USM', #42
537             753 => 'Canon EF 85mm f/1.4L IS USM', #42
538             754 => 'Canon EF 70-200mm f/4L IS II USM', #IB
539             757 => 'Canon EF 400mm f/2.8L IS III USM', #IB
540             758 => 'Canon EF 600mm f/4L IS III USM', #IB
541              
542             1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
543             # (STM lenses - 0x10xx)
544             4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
545             4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
546             4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
547             4144 => 'Canon EF 40mm f/2.8 STM', #50
548             4145 => 'Canon EF-M 22mm f/2 STM', #34
549             4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
550             4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
551             4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
552             4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
553             4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
554             4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
555             4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
556             4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
557             4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
558             4156 => 'Canon EF 50mm f/1.8 STM', #42
559             4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
560             4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
561             4159 => 'Canon EF-M 32mm f/1.4 STM', #42
562             4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
563             4208 => 'Sigma 56mm f/1.4 DC DN | C or other Sigma Lens', #forum10603
564             4208.1 => 'Sigma 30mm F1.4 DC DN | C', #git issue#83 (016)
565             # (Nano USM lenses - 0x90xx)
566             36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
567             36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
568             # (CN-E lenses - 0xf0xx)
569             61491 => 'Canon CN-E 14mm T3.1 L F', #PH
570             61492 => 'Canon CN-E 24mm T1.5 L F', #PH
571             # 61493 - missing CN-E 50mm T1.3 L F ?
572             61494 => 'Canon CN-E 85mm T1.3 L F', #PH
573             61495 => 'Canon CN-E 135mm T2.2 L F', #PH
574             61496 => 'Canon CN-E 35mm T1.5 L F', #PH
575             #
576             # see RFLensType tag for master list of 61182 RF lenses
577             #
578             61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
579             61182.1 => 'Canon RF 24-105mm F4L IS USM',
580             61182.2 => 'Canon RF 28-70mm F2L USM',
581             61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
582             61182.4 => 'Canon RF 85mm F1.2L USM',
583             61182.5 => 'Canon RF 85mm F1.2L USM DS',
584             61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
585             61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
586             61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
587             61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
588             '61182.10' => 'Canon RF 85mm F2 MACRO IS STM',
589             '61182.11' => 'Canon RF 600mm F11 IS STM',
590             '61182.12' => 'Canon RF 600mm F11 IS STM + RF1.4x',
591             '61182.13' => 'Canon RF 600mm F11 IS STM + RF2x',
592             '61182.14' => 'Canon RF 800mm F11 IS STM',
593             '61182.15' => 'Canon RF 800mm F11 IS STM + RF1.4x',
594             '61182.16' => 'Canon RF 800mm F11 IS STM + RF2x',
595             '61182.17' => 'Canon RF 24-105mm F4-7.1 IS STM',
596             '61182.18' => 'Canon RF 100-500mm F4.5-7.1L IS USM',
597             '61182.19' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
598             '61182.20' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
599             '61182.21' => 'Canon RF 70-200mm F4L IS USM', #42
600             '61182.22' => 'Canon RF 50mm F1.8 STM', #42
601             '61182.23' => 'Canon RF 14-35mm F4L IS USM', #IB
602             '61182.24' => 'Canon RF 100-400mm F5.6-8 IS USM', #42
603             '61182.25' => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42 (NC)
604             '61182.26' => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42 (NC)
605             '61182.27' => 'Canon RF 16mm F2.8 STM', #42
606             '61182.28' => 'Canon RF 400mm F2.8L IS USM', #IB
607             '61182.29' => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
608             '61182.30' => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
609             '61182.31' => 'Canon RF 600mm F4L IS USM', #GiaZopatti
610             # we need the RFLensType values for the following...
611             '61182.32' => 'Canon RF 800mm F5.6L IS USM', #PH (NC)
612             '61182.33' => 'Canon RF 1200mm F8L IS USM', #PH (NC)
613             '61182.34' => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH (NC)
614             '61182.35' => 'Canon RF 100mm F2.8L MACRO IS USM', #(NC)
615             65535 => 'n/a',
616             );
617              
618             # Canon model ID numbers (PH)
619             %canonModelID = (
620             0x1010000 => 'PowerShot A30',
621             0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
622             0x1060000 => 'PowerShot A20',
623             0x1080000 => 'PowerShot A10',
624             0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
625             0x1100000 => 'PowerShot G2',
626             0x1110000 => 'PowerShot S40',
627             0x1120000 => 'PowerShot S30',
628             0x1130000 => 'PowerShot A40',
629             0x1140000 => 'EOS D30',
630             0x1150000 => 'PowerShot A100',
631             0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
632             0x1170000 => 'PowerShot A200',
633             0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
634             0x1190000 => 'PowerShot G3',
635             0x1210000 => 'PowerShot S45',
636             0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
637             0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
638             0x1250000 => 'PowerShot A70',
639             0x1260000 => 'PowerShot A60',
640             0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
641             0x1290000 => 'PowerShot G5',
642             0x1300000 => 'PowerShot A300',
643             0x1310000 => 'PowerShot S50',
644             0x1340000 => 'PowerShot A80',
645             0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
646             0x1360000 => 'PowerShot S1 IS',
647             0x1370000 => 'PowerShot Pro1',
648             0x1380000 => 'PowerShot S70',
649             0x1390000 => 'PowerShot S60',
650             0x1400000 => 'PowerShot G6',
651             0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
652             0x1420000 => 'PowerShot A75',
653             0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
654             0x1450000 => 'PowerShot A400',
655             0x1470000 => 'PowerShot A310',
656             0x1490000 => 'PowerShot A85',
657             0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
658             0x1530000 => 'PowerShot A95',
659             0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
660             0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
661             0x1560000 => 'PowerShot A520',
662             0x1570000 => 'PowerShot A510',
663             0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
664             0x1640000 => 'PowerShot S2 IS',
665             0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
666             0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
667             0x1668000 => 'EOS D60',
668             0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
669             0x1740000 => 'PowerShot A430',
670             0x1750000 => 'PowerShot A410',
671             0x1760000 => 'PowerShot S80',
672             0x1780000 => 'PowerShot A620',
673             0x1790000 => 'PowerShot A610',
674             0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
675             0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
676             0x1820000 => 'PowerShot TX1',
677             0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
678             0x1880000 => 'PowerShot A420',
679             0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
680             0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
681             0x1920000 => 'PowerShot A700',
682             0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
683             0x1950000 => 'PowerShot S3 IS',
684             0x1960000 => 'PowerShot A540',
685             0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
686             0x1980000 => 'PowerShot G7',
687             0x1990000 => 'PowerShot A530',
688             0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
689             0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
690             0x2020000 => 'PowerShot A710 IS',
691             0x2030000 => 'PowerShot A640',
692             0x2040000 => 'PowerShot A630',
693             0x2090000 => 'PowerShot S5 IS',
694             0x2100000 => 'PowerShot A460',
695             0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
696             0x2130000 => 'PowerShot A570 IS',
697             0x2140000 => 'PowerShot A560',
698             0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
699             0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
700             0x2180000 => 'PowerShot A550',
701             0x2190000 => 'PowerShot A450',
702             0x2230000 => 'PowerShot G9',
703             0x2240000 => 'PowerShot A650 IS',
704             0x2260000 => 'PowerShot A720 IS',
705             0x2290000 => 'PowerShot SX100 IS',
706             0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
707             0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
708             0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
709             0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
710             0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
711             0x2380000 => 'PowerShot A590 IS',
712             0x2390000 => 'PowerShot A580',
713             0x2420000 => 'PowerShot A470',
714             0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
715             0x2460000 => 'PowerShot SX1 IS',
716             0x2470000 => 'PowerShot SX10 IS',
717             0x2480000 => 'PowerShot A1000 IS',
718             0x2490000 => 'PowerShot G10',
719             0x2510000 => 'PowerShot A2000 IS',
720             0x2520000 => 'PowerShot SX110 IS',
721             0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
722             0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
723             0x2550000 => 'PowerShot E1',
724             0x2560000 => 'PowerShot D10',
725             0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
726             0x2580000 => 'PowerShot A2100 IS',
727             0x2590000 => 'PowerShot A480',
728             0x2600000 => 'PowerShot SX200 IS',
729             0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
730             0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
731             0x2630000 => 'PowerShot A1100 IS',
732             0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
733             0x2700000 => 'PowerShot G11',
734             0x2710000 => 'PowerShot SX120 IS',
735             0x2720000 => 'PowerShot S90',
736             0x2750000 => 'PowerShot SX20 IS',
737             0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
738             0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
739             0x2800000 => 'PowerShot A495',
740             0x2810000 => 'PowerShot A490',
741             0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
742             0x2830000 => 'PowerShot A3000 IS',
743             0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
744             0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
745             0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
746             0x2870000 => 'PowerShot SX210 IS',
747             0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
748             0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
749             0x2920000 => 'PowerShot G12',
750             0x2930000 => 'PowerShot SX30 IS',
751             0x2940000 => 'PowerShot SX130 IS',
752             0x2950000 => 'PowerShot S95',
753             0x2980000 => 'PowerShot A3300 IS',
754             0x2990000 => 'PowerShot A3200 IS',
755             0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
756             0x3010000 => 'PowerShot Pro90 IS',
757             0x3010001 => 'PowerShot A800',
758             0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
759             0x3030000 => 'PowerShot SX230 HS',
760             0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
761             0x3050000 => 'PowerShot A2200',
762             0x3060000 => 'PowerShot A1200',
763             0x3070000 => 'PowerShot SX220 HS',
764             0x3080000 => 'PowerShot G1 X',
765             0x3090000 => 'PowerShot SX150 IS',
766             0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
767             0x3110000 => 'PowerShot S100 (new)',
768             0x3130000 => 'PowerShot SX40 HS',
769             0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
770             # the Canon page lists the IXY 32S as "Japan only", but many other
771             # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
772             # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
773             # is already associated with other IXUS and IXY models - PH
774             0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
775             0x3160000 => 'PowerShot A1300',
776             0x3170000 => 'PowerShot A810',
777             0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
778             0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
779             0x3200000 => 'PowerShot D20',
780             0x3210000 => 'PowerShot A4000 IS',
781             0x3220000 => 'PowerShot SX260 HS',
782             0x3230000 => 'PowerShot SX240 HS',
783             0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
784             0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
785             0x3260000 => 'PowerShot A3400 IS',
786             0x3270000 => 'PowerShot A2400 IS',
787             0x3280000 => 'PowerShot A2300',
788             0x3320000 => 'PowerShot S100V', #IB
789             0x3330000 => 'PowerShot G15', #25
790             0x3340000 => 'PowerShot SX50 HS', #25/forum8196
791             0x3350000 => 'PowerShot SX160 IS',
792             0x3360000 => 'PowerShot S110 (new)',
793             0x3370000 => 'PowerShot SX500 IS',
794             0x3380000 => 'PowerShot N',
795             0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
796             0x3400000 => 'PowerShot SX280 HS',
797             0x3410000 => 'PowerShot SX270 HS',
798             0x3420000 => 'PowerShot A3500 IS',
799             0x3430000 => 'PowerShot A2600',
800             0x3440000 => 'PowerShot SX275 HS', #forum8199
801             0x3450000 => 'PowerShot A1400',
802             0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
803             0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
804             0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
805             0x3510000 => 'PowerShot A2500',
806             0x3540000 => 'PowerShot G16',
807             0x3550000 => 'PowerShot S120',
808             0x3560000 => 'PowerShot SX170 IS',
809             0x3580000 => 'PowerShot SX510 HS',
810             0x3590000 => 'PowerShot S200 (new)',
811             0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
812             0x3610000 => 'PowerShot N100',
813             0x3640000 => 'PowerShot G1 X Mark II',
814             0x3650000 => 'PowerShot D30',
815             0x3660000 => 'PowerShot SX700 HS',
816             0x3670000 => 'PowerShot SX600 HS',
817             0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
818             0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
819             0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
820             0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
821             0x3740000 => 'EOS M3', #IB
822             0x3750000 => 'PowerShot SX60 HS', #IB/NJ
823             0x3760000 => 'PowerShot SX520 HS', #IB
824             0x3770000 => 'PowerShot SX400 IS',
825             0x3780000 => 'PowerShot G7 X', #IB
826             0x3790000 => 'PowerShot N2',
827             0x3800000 => 'PowerShot SX530 HS',
828             0x3820000 => 'PowerShot SX710 HS',
829             0x3830000 => 'PowerShot SX610 HS',
830             0x3840000 => 'EOS M10',
831             0x3850000 => 'PowerShot G3 X',
832             0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
833             0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
834             0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
835             0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
836             0x3910000 => 'PowerShot SX410 IS',
837             0x3930000 => 'PowerShot G9 X',
838             0x3940000 => 'EOS M5', #IB
839             0x3950000 => 'PowerShot G5 X',
840             0x3970000 => 'PowerShot G7 X Mark II',
841             0x3980000 => 'EOS M100', #42
842             0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
843             0x4010000 => 'PowerShot SX540 HS',
844             0x4020000 => 'PowerShot SX420 IS',
845             0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
846             0x4040000 => 'PowerShot G1',
847             0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
848             0x4050000 => 'PowerShot SX720 HS',
849             0x4060000 => 'PowerShot SX620 HS',
850             0x4070000 => 'EOS M6',
851             0x4100000 => 'PowerShot G9 X Mark II',
852             0x412 => 'EOS M50 / Kiss M', # (yes, no "0000")
853             0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
854             0x4160000 => 'PowerShot SX430 IS',
855             0x4170000 => 'PowerShot SX730 HS',
856             0x4180000 => 'PowerShot G1 X Mark III', #IB
857             0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
858             0x801 => 'PowerShot SX740 HS',
859             0x804 => 'PowerShot G5 X Mark II',
860             0x805 => 'PowerShot SX70 HS',
861             0x808 => 'PowerShot G7 X Mark III',
862             0x811 => 'EOS M6 Mark II', #IB
863             0x812 => 'EOS M200', #25
864              
865             # (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
866              
867             0x4007d673 => 'DC19/DC21/DC22',
868             0x4007d674 => 'XH A1',
869             0x4007d675 => 'HV10',
870             0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
871             0x4007d777 => 'DC50', # (iVIS)
872             0x4007d778 => 'HV20', # (iVIS)
873             0x4007d779 => 'DC211', #29
874             0x4007d77a => 'HG10',
875             0x4007d77b => 'HR10', #29 (iVIS)
876             0x4007d77d => 'MD255/ZR950',
877             0x4007d81c => 'HF11',
878             0x4007d878 => 'HV30',
879             0x4007d87c => 'XH A1S',
880             0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
881             0x4007d87f => 'FS100',
882             0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
883             0x4007d882 => 'HG20/HG21', # (VIXIA)
884             0x4007d925 => 'HF21', # (LEGRIA)
885             0x4007d926 => 'HF S11', # (LEGRIA)
886             0x4007d978 => 'HV40', # (LEGRIA)
887             0x4007d987 => 'DC410/DC411/DC420',
888             0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
889             0x4007d989 => 'HF20/HF200', # (LEGRIA)
890             0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
891             0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
892             0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
893             0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
894             0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
895             0x4007dca0 => 'EOS C300',
896             0x4007dda9 => 'HF G25', # (LEGRIA)
897             0x4007dfb4 => 'XC10',
898             0x4007e1c3 => 'EOS C200',
899              
900             # NOTE: some pre-production models may have a model name of
901             # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
902             # This has been observed for the 1DSmkIII/K215 and 400D/K236.
903             0x80000001 => 'EOS-1D',
904             0x80000167 => 'EOS-1DS',
905             0x80000168 => 'EOS 10D',
906             0x80000169 => 'EOS-1D Mark III',
907             0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
908             0x80000174 => 'EOS-1D Mark II',
909             0x80000175 => 'EOS 20D',
910             0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
911             0x80000188 => 'EOS-1Ds Mark II',
912             0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
913             0x80000190 => 'EOS 40D',
914             0x80000213 => 'EOS 5D',
915             0x80000215 => 'EOS-1Ds Mark III',
916             0x80000218 => 'EOS 5D Mark II',
917             0x80000219 => 'WFT-E1',
918             0x80000232 => 'EOS-1D Mark II N',
919             0x80000234 => 'EOS 30D',
920             0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
921             0x80000241 => 'WFT-E2',
922             0x80000246 => 'WFT-E3',
923             0x80000250 => 'EOS 7D',
924             0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
925             0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
926             0x80000261 => 'EOS 50D',
927             0x80000269 => 'EOS-1D X',
928             0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
929             0x80000271 => 'WFT-E4',
930             0x80000273 => 'WFT-E5',
931             0x80000281 => 'EOS-1D Mark IV',
932             0x80000285 => 'EOS 5D Mark III',
933             0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
934             0x80000287 => 'EOS 60D',
935             0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
936             0x80000289 => 'EOS 7D Mark II', #IB
937             0x80000297 => 'WFT-E2 II',
938             0x80000298 => 'WFT-E4 II',
939             0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
940             0x80000302 => 'EOS 6D', #25
941             0x80000324 => 'EOS-1D C', #(NC)
942             0x80000325 => 'EOS 70D',
943             0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
944             0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
945             0x80000328 => 'EOS-1D X Mark II', #42
946             0x80000331 => 'EOS M',
947             0x80000350 => 'EOS 80D', #42
948             0x80000355 => 'EOS M2',
949             0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
950             0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
951             0x80000349 => 'EOS 5D Mark IV', #42
952             0x80000382 => 'EOS 5DS',
953             0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
954             0x80000401 => 'EOS 5DS R',
955             0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
956             0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
957             0x80000406 => 'EOS 6D Mark II', #IB/42
958             0x80000408 => 'EOS 77D / 9000D',
959             0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
960             0x80000421 => 'EOS R5', #PH
961             0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
962             0x80000424 => 'EOS R', #IB
963             0x80000428 => 'EOS-1D X Mark III', #IB
964             0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
965             0x80000433 => 'EOS RP',
966             0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
967             0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
968             0x80000437 => 'EOS 90D', #IB
969             0x80000450 => 'EOS R3', #42
970             0x80000453 => 'EOS R6', #PH
971             0x80000467 => 'PowerShot ZOOM',
972             0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
973             0x80000520 => 'EOS D2000C', #IB
974             0x80000560 => 'EOS D6000C', #PH (guess)
975             );
976              
977             my %canonQuality = (
978             -1 => 'n/a', # (PH, EOS M MOV video)
979             1 => 'Economy',
980             2 => 'Normal',
981             3 => 'Fine',
982             4 => 'RAW',
983             5 => 'Superfine',
984             7 => 'CRAW', #42
985             130 => 'Light (RAW)', #github#119
986             131 => 'Standard (RAW)', #github#119
987             );
988             my %canonImageSize = (
989             -1 => 'n/a',
990             0 => 'Large',
991             1 => 'Medium',
992             2 => 'Small',
993             5 => 'Medium 1', #PH
994             6 => 'Medium 2', #PH
995             7 => 'Medium 3', #PH
996             8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
997             9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
998             10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
999             14 => 'Small 1', #PH
1000             15 => 'Small 2', #PH
1001             16 => 'Small 3', #PH
1002             128 => '640x480 Movie', #PH (7D 60fps)
1003             129 => 'Medium Movie', #22
1004             130 => 'Small Movie', #22
1005             137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
1006             142 => '1920x1080 Movie', #PH (D60 25fps)
1007             143 => '4096x2160 Movie', #PH (C200)
1008             );
1009             my %canonWhiteBalance = (
1010             # -1='Click", -2='Pasted' ?? - PH
1011             0 => 'Auto',
1012             1 => 'Daylight',
1013             2 => 'Cloudy',
1014             3 => 'Tungsten',
1015             4 => 'Fluorescent',
1016             5 => 'Flash',
1017             6 => 'Custom',
1018             7 => 'Black & White',
1019             8 => 'Shade',
1020             9 => 'Manual Temperature (Kelvin)',
1021             10 => 'PC Set1', #PH
1022             11 => 'PC Set2', #PH
1023             12 => 'PC Set3', #PH
1024             14 => 'Daylight Fluorescent', #3
1025             15 => 'Custom 1', #PH
1026             16 => 'Custom 2', #PH
1027             17 => 'Underwater', #3
1028             18 => 'Custom 3', #PH
1029             19 => 'Custom 4', #PH
1030             20 => 'PC Set4', #PH
1031             21 => 'PC Set5', #PH
1032             # 22 - Custom 2?
1033             23 => 'Auto (ambience priority)', #PH (5DS) (perhaps this needs re-thinking?: forum13295)
1034             # 30 - Click White Balance?
1035             # 31 - Shot Settings?
1036             # 137 - Tungsten?
1037             # 138 - White Fluorescent?
1038             # 139 - Fluorescent H?
1039             # 140 - Manual?
1040             );
1041              
1042             # picture styles used by the 5D
1043             # (styles 0x4X may be downloaded from Canon)
1044             # (called "ColorMatrix" in 1D owner manual)
1045             my %pictureStyles = ( #12
1046             0x00 => 'None', #PH
1047             0x01 => 'Standard', #15
1048             0x02 => 'Portrait', #15
1049             0x03 => 'High Saturation', #15
1050             0x04 => 'Adobe RGB', #15
1051             0x05 => 'Low Saturation', #15
1052             0x06 => 'CM Set 1', #PH
1053             0x07 => 'CM Set 2', #PH
1054             # "ColorMatrix" values end here
1055             0x21 => 'User Def. 1',
1056             0x22 => 'User Def. 2',
1057             0x23 => 'User Def. 3',
1058             # "External" styles currently available from Canon are Nostalgia, Clear,
1059             # Twilight and Emerald. The "User Def" styles change to these "External"
1060             # codes when these styles are installed in the camera
1061             0x41 => 'PC 1', #PH
1062             0x42 => 'PC 2', #PH
1063             0x43 => 'PC 3', #PH
1064             0x81 => 'Standard',
1065             0x82 => 'Portrait',
1066             0x83 => 'Landscape',
1067             0x84 => 'Neutral',
1068             0x85 => 'Faithful',
1069             0x86 => 'Monochrome',
1070             0x87 => 'Auto', #PH
1071             0x88 => 'Fine Detail', #PH
1072             0xff => 'n/a', #PH (guess)
1073             0xffff => 'n/a', #PH (guess)
1074             );
1075             my %userDefStyles = ( #12/48
1076             Notes => q{
1077             Base style for user-defined picture styles. PC values represent external
1078             picture styles which may be downloaded from Canon and installed in the
1079             camera.
1080             },
1081             0x41 => 'PC 1',
1082             0x42 => 'PC 2',
1083             0x43 => 'PC 3',
1084             0x81 => 'Standard',
1085             0x82 => 'Portrait',
1086             0x83 => 'Landscape',
1087             0x84 => 'Neutral',
1088             0x85 => 'Faithful',
1089             0x86 => 'Monochrome',
1090             0x87 => 'Auto', #PH
1091             );
1092              
1093             # picture style tag information for CameraInfo550D
1094             my %psConv = (
1095             -559038737 => 'n/a', # = 0xdeadbeef ! LOL
1096             OTHER => sub { shift },
1097             );
1098             my %psInfo = (
1099             Format => 'int32s',
1100             PrintHex => 1,
1101             PrintConv => \%psConv,
1102             );
1103              
1104             # ValueConv that makes long values binary type
1105             my %longBin = (
1106             ValueConv => 'length($val) > 64 ? \$val : $val',
1107             ValueConvInv => '$val',
1108             );
1109              
1110             # conversions, etc for CameraColorCalibration tags
1111             my %cameraColorCalibration = (
1112             Format => 'int16s[4]',
1113             Unknown => 1,
1114             PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
1115             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1116             );
1117              
1118             # conversions, etc for PowerShot CameraColorCalibration tags
1119             my %cameraColorCalibration2 = (
1120             Format => 'int16s[5]',
1121             Unknown => 1,
1122             PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
1123             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1124             );
1125             # conversions, etc for byte-swapped FocusDistance tags
1126             my %focusDistanceByteSwap = (
1127             # this is very odd (little-endian number on odd boundary),
1128             # but it does seem to work better with my sample images - PH
1129             Format => 'int16uRev',
1130             ValueConv => '$val / 100',
1131             ValueConvInv => '$val * 100',
1132             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
1133             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
1134             );
1135              
1136             # common attributes for writable BinaryData directories
1137             my %binaryDataAttrs = (
1138             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1139             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1140             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1141             WRITABLE => 1,
1142             );
1143              
1144             my %offOn = ( 0 => 'Off', 1 => 'On' );
1145              
1146             #------------------------------------------------------------------------------
1147             # Canon EXIF Maker Notes
1148             %Image::ExifTool::Canon::Main = (
1149             WRITE_PROC => \&WriteCanon,
1150             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1151             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1152             0x1 => {
1153             Name => 'CanonCameraSettings',
1154             SubDirectory => {
1155             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1156             TagTable => 'Image::ExifTool::Canon::CameraSettings',
1157             },
1158             },
1159             0x2 => {
1160             Name => 'CanonFocalLength',
1161             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
1162             },
1163             0x3 => {
1164             Name => 'CanonFlashInfo',
1165             Unknown => 1,
1166             },
1167             0x4 => {
1168             Name => 'CanonShotInfo',
1169             SubDirectory => {
1170             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1171             TagTable => 'Image::ExifTool::Canon::ShotInfo',
1172             },
1173             },
1174             0x5 => {
1175             Name => 'CanonPanorama',
1176             SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
1177             },
1178             0x6 => {
1179             Name => 'CanonImageType',
1180             Writable => 'string',
1181             Groups => { 2 => 'Image' },
1182             },
1183             0x7 => {
1184             Name => 'CanonFirmwareVersion',
1185             Writable => 'string',
1186             },
1187             0x8 => {
1188             Name => 'FileNumber',
1189             Writable => 'int32u',
1190             Groups => { 2 => 'Image' },
1191             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
1192             PrintConvInv => '$val=~s/-//g;$val',
1193             },
1194             0x9 => {
1195             Name => 'OwnerName',
1196             Writable => 'string',
1197             # pad to 32 bytes (including null terminator which will be added)
1198             # to avoid bug which crashes DPP if length is 4 bytes
1199             ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
1200             },
1201             0xa => {
1202             Name => 'UnknownD30',
1203             SubDirectory => {
1204             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1205             TagTable => 'Image::ExifTool::Canon::UnknownD30',
1206             },
1207             },
1208             0xc => [ # square brackets for a conditional list
1209             {
1210             # D30
1211             Name => 'SerialNumber',
1212             Condition => '$$self{Model} =~ /EOS D30\b/',
1213             Writable => 'int32u',
1214             PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
1215             PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
1216             },
1217             {
1218             # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
1219             # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
1220             Name => 'SerialNumber',
1221             Condition => '$$self{Model} =~ /EOS-1D/',
1222             Writable => 'int32u',
1223             PrintConv => 'sprintf("%.6u",$val)',
1224             PrintConvInv => '$val',
1225             },
1226             {
1227             # all other models (D60,300D,350D,REBEL,10D,20D,etc)
1228             Name => 'SerialNumber',
1229             Writable => 'int32u',
1230             PrintConv => 'sprintf("%.10u",$val)',
1231             PrintConvInv => '$val',
1232             },
1233             ],
1234             0xd => [
1235             {
1236             Name => 'CanonCameraInfo1D',
1237             # (save size of this record as "CameraInfoCount" for later tests)
1238             Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
1239             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
1240             },
1241             {
1242             Name => 'CanonCameraInfo1DmkII',
1243             Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
1244             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
1245             },
1246             {
1247             Name => 'CanonCameraInfo1DmkIIN',
1248             Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
1249             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
1250             },
1251             {
1252             Name => 'CanonCameraInfo1DmkIII',
1253             Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
1254             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
1255             },
1256             {
1257             Name => 'CanonCameraInfo1DmkIV',
1258             Condition => '$$self{Model} =~ /\b1D Mark IV$/',
1259             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
1260             },
1261             {
1262             Name => 'CanonCameraInfo1DX',
1263             Condition => '$$self{Model} =~ /EOS-1D X$/',
1264             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
1265             },
1266             {
1267             Name => 'CanonCameraInfo5D',
1268             Condition => '$$self{Model} =~ /EOS 5D$/',
1269             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
1270             },
1271             {
1272             Name => 'CanonCameraInfo5DmkII',
1273             Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
1274             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
1275             },
1276             {
1277             Name => 'CanonCameraInfo5DmkIII',
1278             Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
1279             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
1280             },
1281             {
1282             Name => 'CanonCameraInfo6D',
1283             Condition => '$$self{Model} =~ /EOS 6D$/',
1284             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
1285             },
1286             {
1287             Name => 'CanonCameraInfo7D',
1288             Condition => '$$self{Model} =~ /EOS 7D$/',
1289             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
1290             },
1291             {
1292             Name => 'CanonCameraInfo40D',
1293             Condition => '$$self{Model} =~ /EOS 40D$/',
1294             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
1295             },
1296             {
1297             Name => 'CanonCameraInfo50D',
1298             Condition => '$$self{Model} =~ /EOS 50D$/',
1299             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
1300             },
1301             {
1302             Name => 'CanonCameraInfo60D',
1303             Condition => '$$self{Model} =~ /EOS 60D$/',
1304             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1305             },
1306             {
1307             Name => 'CanonCameraInfo70D',
1308             Condition => '$$self{Model} =~ /EOS 70D$/',
1309             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
1310             },
1311             {
1312             Name => 'CanonCameraInfo80D',
1313             Condition => '$$self{Model} =~ /EOS 80D$/',
1314             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
1315             },
1316             {
1317             Name => 'CanonCameraInfo450D',
1318             Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
1319             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
1320             },
1321             {
1322             Name => 'CanonCameraInfo500D',
1323             Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
1324             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
1325             },
1326             {
1327             Name => 'CanonCameraInfo550D',
1328             Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
1329             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
1330             },
1331             {
1332             Name => 'CanonCameraInfo600D',
1333             Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
1334             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1335             },
1336             {
1337             Name => 'CanonCameraInfo650D',
1338             Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
1339             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1340             },
1341             {
1342             Name => 'CanonCameraInfo700D',
1343             Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
1344             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1345             },
1346             {
1347             Name => 'CanonCameraInfo750D',
1348             Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
1349             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1350             },
1351             {
1352             Name => 'CanonCameraInfo760D',
1353             Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
1354             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1355             },
1356             {
1357             Name => 'CanonCameraInfo1000D',
1358             Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
1359             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
1360             },
1361             {
1362             Name => 'CanonCameraInfo1100D',
1363             Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
1364             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1365             },
1366             {
1367             Name => 'CanonCameraInfo1200D',
1368             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
1369             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1370             },
1371             {
1372             Name => 'CanonCameraInfoPowerShot',
1373             # valid if format is int32u[138] or int32u[148]
1374             Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
1375             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
1376             },
1377             {
1378             Name => 'CanonCameraInfoPowerShot2',
1379             # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
1380             Condition => q{
1381             $format eq "int32u" and ($count == 156 or $count == 162 or
1382             $count == 167 or $count == 171 or $count == 264)
1383             },
1384             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
1385             },
1386             {
1387             Name => 'CanonCameraInfoUnknown32',
1388             Condition => '$format =~ /^int32/',
1389             # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
1390             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
1391             },
1392             {
1393             Name => 'CanonCameraInfoUnknown16',
1394             Condition => '$format =~ /^int16/',
1395             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
1396             },
1397             {
1398             Name => 'CanonCameraInfoUnknown',
1399             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
1400             },
1401             ],
1402             0xe => {
1403             Name => 'CanonFileLength',
1404             Writable => 'int32u',
1405             Groups => { 2 => 'Image' },
1406             },
1407             0xf => [
1408             { # used by 1DmkII, 1DSmkII and 1DmkIIN
1409             Name => 'CustomFunctions1D',
1410             Condition => '$$self{Model} =~ /EOS-1D/',
1411             SubDirectory => {
1412             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1413             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1414             },
1415             },
1416             {
1417             Name => 'CustomFunctions5D',
1418             Condition => '$$self{Model} =~ /EOS 5D/',
1419             SubDirectory => {
1420             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1421             TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1422             },
1423             },
1424             {
1425             Name => 'CustomFunctions10D',
1426             Condition => '$$self{Model} =~ /EOS 10D/',
1427             SubDirectory => {
1428             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1429             TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1430             },
1431             },
1432             {
1433             Name => 'CustomFunctions20D',
1434             Condition => '$$self{Model} =~ /EOS 20D/',
1435             SubDirectory => {
1436             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1437             TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1438             },
1439             },
1440             {
1441             Name => 'CustomFunctions30D',
1442             Condition => '$$self{Model} =~ /EOS 30D/',
1443             SubDirectory => {
1444             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1445             TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1446             },
1447             },
1448             {
1449             Name => 'CustomFunctions350D',
1450             Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1451             SubDirectory => {
1452             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1453             TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1454             },
1455             },
1456             {
1457             Name => 'CustomFunctions400D',
1458             Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1459             SubDirectory => {
1460             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1461             TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1462             },
1463             },
1464             {
1465             Name => 'CustomFunctionsD30',
1466             Condition => '$$self{Model} =~ /EOS D30\b/',
1467             SubDirectory => {
1468             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1469             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1470             },
1471             },
1472             {
1473             Name => 'CustomFunctionsD60',
1474             Condition => '$$self{Model} =~ /EOS D60\b/',
1475             SubDirectory => {
1476             # the stored size in the D60 apparently doesn't include the size word:
1477             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1478             # (D60 custom functions are basically the same as D30)
1479             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1480             },
1481             },
1482             {
1483             Name => 'CustomFunctionsUnknown',
1484             SubDirectory => {
1485             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1486             TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1487             },
1488             },
1489             ],
1490             0x10 => { #PH
1491             Name => 'CanonModelID',
1492             Writable => 'int32u',
1493             PrintHex => 1,
1494             SeparateTable => 1,
1495             PrintConv => \%canonModelID,
1496             },
1497             0x11 => { #PH
1498             Name => 'MovieInfo',
1499             SubDirectory => {
1500             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1501             TagTable => 'Image::ExifTool::Canon::MovieInfo',
1502             },
1503             },
1504             0x12 => {
1505             Name => 'CanonAFInfo',
1506             # not really a condition -- just need to store the count for later
1507             Condition => '$$self{AFInfoCount} = $count',
1508             SubDirectory => {
1509             # this record does not begin with a length word, so it
1510             # has to be validated differently
1511             Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1512             TagTable => 'Image::ExifTool::Canon::AFInfo',
1513             },
1514             },
1515             0x13 => { #PH
1516             Name => 'ThumbnailImageValidArea',
1517             # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1518             Notes => 'all zeros for full frame',
1519             Writable => 'int16u',
1520             Count => 4,
1521             },
1522             0x15 => { #PH
1523             # display format for serial number
1524             Name => 'SerialNumberFormat',
1525             Writable => 'int32u',
1526             PrintHex => 1,
1527             PrintConv => {
1528             0x90000000 => 'Format 1',
1529             0xa0000000 => 'Format 2',
1530             },
1531             },
1532             0x1a => { #15
1533             Name => 'SuperMacro',
1534             Writable => 'int16u',
1535             PrintConv => {
1536             0 => 'Off',
1537             1 => 'On (1)',
1538             2 => 'On (2)',
1539             },
1540             },
1541             0x1c => { #PH (A570IS)
1542             Name => 'DateStampMode',
1543             Writable => 'int16u',
1544             Notes => 'used only in postcard mode',
1545             PrintConv => {
1546             0 => 'Off',
1547             1 => 'Date',
1548             2 => 'Date & Time',
1549             },
1550             },
1551             0x1d => { #PH
1552             Name => 'MyColors',
1553             SubDirectory => {
1554             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1555             TagTable => 'Image::ExifTool::Canon::MyColors',
1556             },
1557             },
1558             0x1e => { #PH
1559             Name => 'FirmwareRevision',
1560             Writable => 'int32u',
1561             # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1562             # A = 'a' for alpha, 'b' for beta?
1563             # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1564             # R = revision? (01-07, except 00 for alpha/beta releases)
1565             PrintConv => q{
1566             my $rev = sprintf("%.8x", $val);
1567             my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1568             my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1569             $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1570             return "$rel$v1.$v2 rev $r1.$r2",
1571             },
1572             PrintConvInv => q{
1573             $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1574             s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1575             tr/a-fA-F0-9//dc; return hex $_;
1576             },
1577             },
1578             # 0x1f - used for red-eye-corrected images - PH (A570IS)
1579             # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1580             0x23 => { #31
1581             Name => 'Categories',
1582             Writable => 'int32u',
1583             Format => 'int32u', # (necessary to perform conversion for Condition)
1584             Notes => '2 values: 1. always 8, 2. Categories',
1585             Count => '2',
1586             Condition => '$$valPt =~ /^\x08\0\0\0/',
1587             ValueConv => '$val =~ s/^8 //; $val',
1588             ValueConvInv => '"8 $val"',
1589             PrintConvColumns => 2,
1590             PrintConv => {
1591             0 => '(none)',
1592             BITMASK => {
1593             0 => 'People',
1594             1 => 'Scenery',
1595             2 => 'Events',
1596             3 => 'User 1',
1597             4 => 'User 2',
1598             5 => 'User 3',
1599             6 => 'To Do',
1600             },
1601             },
1602             },
1603             0x24 => { #PH
1604             Name => 'FaceDetect1',
1605             SubDirectory => {
1606             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1607             TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1608             },
1609             },
1610             0x25 => { #PH
1611             Name => 'FaceDetect2',
1612             SubDirectory => {
1613             TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1614             # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
1615             },
1616             },
1617             0x26 => { #PH (A570IS,1DmkIII)
1618             Name => 'CanonAFInfo2',
1619             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1620             SubDirectory => {
1621             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1622             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1623             },
1624             },
1625             0x27 => { #PH
1626             Name => 'ContrastInfo',
1627             Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
1628             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
1629             },
1630             # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1631             # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1632             0x28 => { #JD
1633             # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1634             Name => 'ImageUniqueID',
1635             Format => 'undef',
1636             Writable => 'int8u',
1637             Groups => { 2 => 'Image' },
1638             RawConv => '$val eq "\0" x 16 ? undef : $val',
1639             ValueConv => 'unpack("H*", $val)',
1640             ValueConvInv => 'pack("H*", $val)',
1641             },
1642             0x29 => { #IB (G9)
1643             Name => 'WBInfo',
1644             SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
1645             },
1646             # 0x2d - changes with categories (ref 31)
1647             0x2f => { #PH (G12)
1648             Name => 'FaceDetect3',
1649             SubDirectory => {
1650             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1651             TagTable => 'Image::ExifTool::Canon::FaceDetect3',
1652             },
1653             },
1654             # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
1655             # daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
1656             0x35 => { #PH
1657             Name => 'TimeInfo',
1658             SubDirectory => {
1659             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1660             TagTable => 'Image::ExifTool::Canon::TimeInfo',
1661             },
1662             },
1663             0x38 => { #PH
1664             Name => 'BatteryType',
1665             Writable => 'undef',
1666             Condition => '$count == 76',
1667             RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
1668             RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
1669             },
1670             0x3c => { #PH (G1XmkII)
1671             Name => 'AFInfo3',
1672             Condition => '$$self{AFInfo3} = 1',
1673             SubDirectory => {
1674             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1675             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1676             },
1677             },
1678             # 0x44 (ShootInfo)
1679             # 0x62 (UserSetting)
1680             0x81 => { #13
1681             Name => 'RawDataOffset',
1682             # (can't yet write 1D raw files)
1683             # Writable => 'int32u',
1684             # Protected => 2,
1685             },
1686             0x83 => { #PH
1687             Name => 'OriginalDecisionDataOffset',
1688             Writable => 'int32u',
1689             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1690             # this is an offset to the original decision data block
1691             # (offset relative to start of file in JPEG images, but NOT DNG images!)
1692             IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
1693             Protected => 2,
1694             DataTag => 'OriginalDecisionData',
1695             },
1696             0x90 => { # used by 1D and 1Ds
1697             Name => 'CustomFunctions1D',
1698             SubDirectory => {
1699             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1700             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1701             },
1702             },
1703             0x91 => { #PH
1704             Name => 'PersonalFunctions',
1705             SubDirectory => {
1706             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1707             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1708             },
1709             },
1710             0x92 => { #PH
1711             Name => 'PersonalFunctionValues',
1712             SubDirectory => {
1713             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1714             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1715             },
1716             },
1717             0x93 => {
1718             Name => 'CanonFileInfo', # (ShootInfoEx)
1719             SubDirectory => {
1720             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1721             TagTable => 'Image::ExifTool::Canon::FileInfo',
1722             },
1723             },
1724             0x94 => { #PH
1725             # AF points for 1D (45 points in 5 rows)
1726             Name => 'AFPointsInFocus1D',
1727             Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1728             PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1729             },
1730             0x95 => { #PH (observed in 5D sample image)
1731             Name => 'LensModel', # (LensName)
1732             Writable => 'string',
1733             },
1734             0x96 => [ #PH (CMOSNumber)
1735             {
1736             Name => 'SerialInfo',
1737             Condition => '$$self{Model} =~ /EOS 5D/',
1738             SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1739             },
1740             {
1741             Name => 'InternalSerialNumber',
1742             Writable => 'string',
1743             # remove trailing 0xff's if they exist (Kiss X3)
1744             ValueConv => '$val=~s/\xff+$//; $val',
1745             ValueConvInv => '$val',
1746             },
1747             ],
1748             0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
1749             Name => 'DustRemovalData', # (DustDeleteData)
1750             Writable => 'undef',
1751             Flags => [ 'Binary', 'Protected' ],
1752             # 0x00: int8u - Version (0 or 1)
1753             # 0x01: int8u - LensInfo ? (1)
1754             # 0x02: int8u - AVValue ? (int8u for version 0, int16u for version 1)
1755             # 0x03: int8u - POValue ? (int8u for version 0, int16u for version 1)
1756             # 0x04: int16u - DustCount
1757             # 0x06: int16u - FocalLength ?
1758             # 0x08: int16u - LensID ?
1759             # 0x0a: int16u - Width
1760             # 0x0c: int16u - Height
1761             # 0x0e: int16u - RAW_Width
1762             # 0x10: int16u - RAW_Height
1763             # 0x12: int16u - PixelPitch [um * 1000]
1764             # 0x14: int16u - LpfDistance [mm * 1000]
1765             # 0x16: int8u - TopOffset
1766             # 0x17: int8u - BottomOffset
1767             # 0x18: int8u - LeftOffset
1768             # 0x19: int8u - RightOffset
1769             # 0x1a: int8u - Year [-1900]
1770             # 0x1b: int8u - Month
1771             # 0x1c: int8u - Day
1772             # 0x1d: int8u - Hour
1773             # 0x1e: int8u - Minutes
1774             # 0x1f: int8u - BrightDiff
1775             # Table with DustCount entries:
1776             # 0x22: int16u - DustX
1777             # 0x24: int16u - DustY
1778             # 0x26: int16u - DustSize
1779             },
1780             0x98 => { #PH
1781             Name => 'CropInfo', # (ImageSizeOffset)
1782             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
1783             },
1784             0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1785             Name => 'CustomFunctions2', # (CustomFunEx)
1786             SubDirectory => {
1787             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1788             TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1789             },
1790             },
1791             0x9a => { #PH
1792             Name => 'AspectInfo', # (AspectRatioInfo)
1793             SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
1794             },
1795             0xa0 => {
1796             Name => 'ProcessingInfo', # (DevelopParam)
1797             SubDirectory => {
1798             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1799             TagTable => 'Image::ExifTool::Canon::Processing',
1800             },
1801             },
1802             0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1803             0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1804             0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1805             0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1806             0xa9 => {
1807             Name => 'ColorBalance',
1808             SubDirectory => {
1809             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1810             TagTable => 'Image::ExifTool::Canon::ColorBalance',
1811             },
1812             },
1813             0xaa => {
1814             Name => 'MeasuredColor', # (PresetWBDS)
1815             SubDirectory => {
1816             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1817             TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1818             },
1819             },
1820             0xae => {
1821             Name => 'ColorTemperature',
1822             Writable => 'int16u',
1823             },
1824             0xb0 => { #PH
1825             Name => 'CanonFlags',
1826             SubDirectory => {
1827             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1828             TagTable => 'Image::ExifTool::Canon::Flags',
1829             },
1830             },
1831             0xb1 => { #PH
1832             Name => 'ModifiedInfo',
1833             SubDirectory => {
1834             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1835             TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1836             },
1837             },
1838             0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1839             0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1840             0xb4 => { #PH
1841             Name => 'ColorSpace',
1842             Writable => 'int16u',
1843             PrintConv => {
1844             1 => 'sRGB',
1845             2 => 'Adobe RGB',
1846             65535 => 'n/a',
1847             },
1848             },
1849             0xb6 => {
1850             Name => 'PreviewImageInfo',
1851             SubDirectory => {
1852             # Note: the first word of this block gives the correct block size in bytes, but
1853             # the size is wrong by a factor of 2 in the IFD, so we must account for this
1854             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1855             TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1856             },
1857             },
1858             0xd0 => { #PH
1859             Name => 'VRDOffset',
1860             Writable => 'int32u',
1861             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1862             Protected => 2,
1863             DataTag => 'CanonVRD',
1864             Notes => 'offset of VRD "recipe data" if it exists',
1865             },
1866             0xe0 => { #12
1867             Name => 'SensorInfo', # (ImageAreaDesc)
1868             SubDirectory => {
1869             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1870             TagTable => 'Image::ExifTool::Canon::SensorInfo',
1871             },
1872             },
1873             0x4001 => [ #13 (WBPacket)
1874             { # (int16u[582]) - 20D and 350D
1875             Condition => '$count == 582',
1876             Name => 'ColorData1',
1877             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
1878             },
1879             { # (int16u[653]) - 1DmkII and 1DSmkII
1880             Condition => '$count == 653',
1881             Name => 'ColorData2',
1882             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
1883             },
1884             { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1885             Condition => '$count == 796',
1886             Name => 'ColorData3',
1887             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
1888             },
1889             { # (int16u[692|674|702|1227|1250|1251|1337])
1890             # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1891             # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1892             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
1893             Condition => q{
1894             $count == 692 or $count == 674 or $count == 702 or
1895             $count == 1227 or $count == 1250 or $count == 1251 or
1896             $count == 1337 or $count == 1338 or $count == 1346
1897             },
1898             Name => 'ColorData4',
1899             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
1900             },
1901             { # (int16u[5120]) - G10, G7X
1902             Condition => '$count == 5120',
1903             Name => 'ColorData5',
1904             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
1905             },
1906             { # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
1907             Condition => '$count == 1273 or $count == 1275',
1908             Name => 'ColorData6',
1909             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
1910             },
1911             { # (int16u[1312|1313|1316])
1912             # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
1913             # 1DX firmware 1.x (1316), 7DmkII (1506)
1914             Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
1915             $count == 1506',
1916             Name => 'ColorData7',
1917             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
1918             },
1919             { # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
1920             Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
1921             Name => 'ColorData8',
1922             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
1923             },
1924             { # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
1925             Condition => '$count == 1816 or $count == 1820 or $count == 1824',
1926             Name => 'ColorData9',
1927             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
1928             },
1929             { # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
1930             Condition => '$count == 2024 or $count == 3656',
1931             Name => 'ColorData10',
1932             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
1933             },
1934             { # (int16u[3973]) - R3 ref IB
1935             Condition => '$count == 3973',
1936             Name => 'ColorData11',
1937             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData11' },
1938             },
1939             {
1940             Name => 'ColorDataUnknown',
1941             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
1942             },
1943             ],
1944             0x4002 => { #PH
1945             # unknown data block in some JPEG and CR2 images
1946             # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
1947             Name => 'CRWParam',
1948             Format => 'undef',
1949             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1950             },
1951             0x4003 => { #PH
1952             Name => 'ColorInfo',
1953             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
1954             },
1955             0x4005 => { #PH
1956             Name => 'Flavor',
1957             Notes => 'unknown 49kB block, not copied to JPEG images',
1958             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
1959             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1960             },
1961             0x4008 => { #53
1962             Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
1963             Writable => 'int16u',
1964             Count => 3, # UserDef1, UserDef2, UserDef3
1965             PrintHex => 1,
1966             SeparateTable => 'PictureStyle',
1967             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1968             },
1969             0x4009 => { #53
1970             Name => 'PictureStylePC', # (BasePictStyleOfUser)
1971             Writable => 'int16u',
1972             Count => 3, # PC1, PC2, PC3
1973             PrintHex => 1,
1974             SeparateTable => 'PictureStyle',
1975             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1976             },
1977             0x4010 => { #forum2933
1978             Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
1979             Writable => 'string',
1980             },
1981             # 0x4011 (PictStyleAppendInfo)
1982             # 0x4012 (CustomWBCaption)
1983             0x4013 => { #PH
1984             Name => 'AFMicroAdj', # (AFMicroAdjust)
1985             SubDirectory => {
1986             # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
1987             # so specifically check for 0x2c to avoid giving a warning in this case
1988             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
1989             TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
1990             },
1991             },
1992             # 0x4014 (similar to 0x83?)
1993             0x4015 => [{
1994             Name => 'VignettingCorr', # (LensPacket)
1995             Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
1996             SubDirectory => {
1997             # (the size word is at byte 2 in this structure)
1998             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
1999             TagTable => 'Image::ExifTool::Canon::VignettingCorr',
2000             },
2001             },{
2002             Name => 'VignettingCorrUnknown1',
2003             Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^\0\0\0\0/',
2004             SubDirectory => {
2005             # (the size word is at byte 2 in this structure)
2006             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2007             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2008             },
2009             },{
2010             Name => 'VignettingCorrUnknown2',
2011             Condition => '$$valPt !~ /^\0\0\0\0/',
2012             SubDirectory => {
2013             # (the size word is at byte 4 for version 3 of this structure, but not always!)
2014             # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
2015             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2016             },
2017             }],
2018             0x4016 => {
2019             Name => 'VignettingCorr2', # (ImageCorrectActual)
2020             SubDirectory => {
2021             # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
2022             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2023             TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
2024             },
2025             },
2026             0x4018 => { #PH
2027             Name => 'LightingOpt', # (ImageCorrect)
2028             SubDirectory => {
2029             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2030             TagTable => 'Image::ExifTool::Canon::LightingOpt',
2031             }
2032             },
2033             0x4019 => { #20
2034             Name => 'LensInfo', # (LensInfoForService)
2035             SubDirectory => {
2036             TagTable => 'Image::ExifTool::Canon::LensInfo',
2037             }
2038             },
2039             0x4020 => { #PH
2040             Name => 'AmbienceInfo',
2041             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2042             SubDirectory => {
2043             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2044             TagTable => 'Image::ExifTool::Canon::Ambience',
2045             }
2046             },
2047             0x4021 => { #PH
2048             Name => 'MultiExp', # (ExifDSTagMultipleExposure)
2049             SubDirectory => {
2050             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2051             TagTable => 'Image::ExifTool::Canon::MultiExp',
2052             }
2053             },
2054             0x4024 => { #PH
2055             Name => 'FilterInfo',
2056             SubDirectory => {
2057             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2058             TagTable => 'Image::ExifTool::Canon::FilterInfo',
2059             }
2060             },
2061             0x4025 => { #PH
2062             Name => 'HDRInfo', # (HighDynamicRange)
2063             SubDirectory => {
2064             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2065             TagTable => 'Image::ExifTool::Canon::HDRInfo',
2066             }
2067             },
2068             0x4026 => { #github#119
2069             Name => 'LogInfo',
2070             SubDirectory => {
2071             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2072             TagTable => 'Image::ExifTool::Canon::LogInfo',
2073             }
2074             },
2075             0x4028 => { #PH
2076             Name => 'AFConfig', # (AFTabInfo)
2077             SubDirectory => {
2078             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2079             TagTable => 'Image::ExifTool::Canon::AFConfig',
2080             }
2081             },
2082             0x403f => { #25
2083             Name => 'RawBurstModeRoll',
2084             SubDirectory => {
2085             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2086             TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
2087             }
2088             },
2089             );
2090              
2091             #..............................................................................
2092             # Canon camera settings (MakerNotes tag 0x01)
2093             # BinaryData (keys are indices into the int16s array)
2094             %Image::ExifTool::Canon::CameraSettings = (
2095             %binaryDataAttrs,
2096             FORMAT => 'int16s',
2097             FIRST_ENTRY => 1,
2098             DATAMEMBER => [ 22, 25 ], # necessary for writing
2099             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2100             1 => {
2101             Name => 'MacroMode',
2102             PrintConv => {
2103             1 => 'Macro',
2104             2 => 'Normal',
2105             },
2106             },
2107             2 => {
2108             Name => 'SelfTimer',
2109             # Custom timer mode if bit 0x4000 is set - PH (A570IS)
2110             PrintConv => q{
2111             return 'Off' unless $val;
2112             return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
2113             },
2114             PrintConvInv => q{
2115             return 0 if $val =~ /^Off/i;
2116             $val =~ s/\s*s(ec)?\b//i;
2117             $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
2118             },
2119             },
2120             3 => {
2121             Name => 'Quality',
2122             PrintConv => \%canonQuality,
2123             },
2124             4 => {
2125             Name => 'CanonFlashMode',
2126             PrintConv => {
2127             -1 => 'n/a', # (PH, EOS M MOV video)
2128             0 => 'Off',
2129             1 => 'Auto',
2130             2 => 'On',
2131             3 => 'Red-eye reduction',
2132             4 => 'Slow-sync',
2133             5 => 'Red-eye reduction (Auto)',
2134             6 => 'Red-eye reduction (On)',
2135             16 => 'External flash', # not set in D30 or 300D
2136             },
2137             },
2138             5 => {
2139             Name => 'ContinuousDrive',
2140             PrintConv => {
2141             0 => 'Single',
2142             1 => 'Continuous',
2143             2 => 'Movie', #PH
2144             3 => 'Continuous, Speed Priority', #PH
2145             4 => 'Continuous, Low', #PH
2146             5 => 'Continuous, High', #PH
2147             6 => 'Silent Single', #PH
2148             8 => 'Continuous, High+', #WolfgangGulcker
2149             # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
2150             9 => 'Single, Silent', #A
2151             10 => 'Continuous, Silent', #A
2152             # 11 - seen for SX260
2153             # 32-34 - Self-timer?
2154             },
2155             },
2156             7 => {
2157             Name => 'FocusMode',
2158             PrintConv => {
2159             0 => 'One-shot AF',
2160             1 => 'AI Servo AF',
2161             2 => 'AI Focus AF',
2162             3 => 'Manual Focus (3)',
2163             4 => 'Single',
2164             5 => 'Continuous',
2165             6 => 'Manual Focus (6)',
2166             16 => 'Pan Focus', #PH
2167             # 137 - Single?
2168             256 => 'AF + MF', #PH (NC, EOS M)
2169             257 => 'Live View', #forum12082
2170             512 => 'Movie Snap Focus', #48
2171             519 => 'Movie Servo AF', #PH (NC, EOS M)
2172             },
2173             },
2174             9 => { #PH
2175             Name => 'RecordMode',
2176             RawConv => '$val==-1 ? undef : $val', #22
2177             PrintConv => {
2178             1 => 'JPEG',
2179             2 => 'CRW+THM', # (300D,etc)
2180             3 => 'AVI+THM', # (30D)
2181             4 => 'TIF', # +THM? (1Ds) (unconfirmed)
2182             5 => 'TIF+JPEG', # (1D) (unconfirmed)
2183             6 => 'CR2', # +THM? (1D,30D,350D)
2184             7 => 'CR2+JPEG', # (S30)
2185             9 => 'MOV', # (S95 MOV)
2186             10 => 'MP4', # (SX280 MP4)
2187             11 => 'CRM', #PH (C200 CRM)
2188             12 => 'CR3', #PH (EOS R)
2189             13 => 'CR3+JPEG', #PH (EOS R)
2190             14 => 'HIF', #PH (NC)
2191             15 => 'CR3+HIF', #PH (1DXmkIII)
2192             },
2193             },
2194             10 => {
2195             Name => 'CanonImageSize',
2196             PrintConvColumns => 2,
2197             PrintConv => \%canonImageSize,
2198             },
2199             11 => {
2200             Name => 'EasyMode',
2201             PrintConvColumns => 3,
2202             PrintConv => {
2203             # references:
2204             # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
2205             # B = http://www.burren.cx/david/canon.html
2206             # C = DPP 3.11.26
2207             0 => 'Full auto',
2208             1 => 'Manual',
2209             2 => 'Landscape',
2210             3 => 'Fast shutter',
2211             4 => 'Slow shutter',
2212             5 => 'Night', # (C='Night Scene')
2213             6 => 'Gray Scale', #PH (A/B/C='Black & White')
2214             7 => 'Sepia',
2215             8 => 'Portrait',
2216             9 => 'Sports',
2217             10 => 'Macro',
2218             11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
2219             12 => 'Pan focus', # (A='Pan focus', C='Vivid')
2220             13 => 'Vivid', #PH (A='Vivid', C='Neutral')
2221             14 => 'Neutral', #PH (A='Natural', C='Black & White')
2222             15 => 'Flash Off', #8 (C=)
2223             16 => 'Long Shutter', #PH
2224             17 => 'Super Macro', #PH (C='Macro')
2225             18 => 'Foliage', #PH
2226             19 => 'Indoor', #PH
2227             20 => 'Fireworks', #PH
2228             21 => 'Beach', #PH
2229             22 => 'Underwater', #PH
2230             23 => 'Snow', #PH
2231             24 => 'Kids & Pets', #PH
2232             25 => 'Night Snapshot', #PH
2233             26 => 'Digital Macro', #PH
2234             27 => 'My Colors', #PH
2235             28 => 'Movie Snap', #PH
2236             29 => 'Super Macro 2', #PH
2237             30 => 'Color Accent', #18
2238             31 => 'Color Swap', #18
2239             32 => 'Aquarium', #18
2240             33 => 'ISO 3200', #18
2241             34 => 'ISO 6400', #PH
2242             35 => 'Creative Light Effect', #PH
2243             36 => 'Easy', #PH
2244             37 => 'Quick Shot', #PH
2245             38 => 'Creative Auto', #39
2246             39 => 'Zoom Blur', #PH
2247             40 => 'Low Light', #PH
2248             41 => 'Nostalgic', #PH
2249             42 => 'Super Vivid', #PH (SD4500)
2250             43 => 'Poster Effect', #PH (SD4500)
2251             44 => 'Face Self-timer', #PH
2252             45 => 'Smile', #PH
2253             46 => 'Wink Self-timer', #PH
2254             47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
2255             48 => 'Miniature Effect', #PH (SD4500)
2256             49 => 'High-speed Burst', #PH
2257             50 => 'Best Image Selection', #PH
2258             51 => 'High Dynamic Range', #PH (S95)
2259             52 => 'Handheld Night Scene', #PH
2260             53 => 'Movie Digest', #PH
2261             54 => 'Live View Control', #PH
2262             55 => 'Discreet', #PH
2263             56 => 'Blur Reduction', #PH
2264             57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
2265             58 => 'Toy Camera Effect', #51
2266             59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
2267             60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
2268             61 => 'Smooth Skin', #51
2269             62 => 'Soft Focus', #PH (SX260,IXUS240)
2270             68 => 'Food', #PH (250D)
2271             # 83 - seen for EOS M200 (ref PH)
2272             84 => 'HDR Art Standard', #PH (80D)
2273             85 => 'HDR Art Vivid', #PH (80D)
2274             93 => 'HDR Art Bold', #PH (80D)
2275             # 83 - seen for EOS M3 night shot (PH)
2276             257 => 'Spotlight', #PH
2277             258 => 'Night 2', #PH
2278             259 => 'Night+',
2279             260 => 'Super Night', #PH
2280             261 => 'Sunset', #PH (SX10IS)
2281             263 => 'Night Scene', #PH
2282             264 => 'Surface', #PH
2283             265 => 'Low Light 2', #PH
2284             },
2285             },
2286             12 => {
2287             Name => 'DigitalZoom',
2288             PrintConv => {
2289             0 => 'None',
2290             1 => '2x',
2291             2 => '4x',
2292             3 => 'Other', # value obtained from 2*$val[37]/$val[36]
2293             },
2294             },
2295             13 => {
2296             Name => 'Contrast',
2297             RawConv => '$val == 0x7fff ? undef : $val',
2298             %Image::ExifTool::Exif::printParameter,
2299             },
2300             14 => {
2301             Name => 'Saturation',
2302             RawConv => '$val == 0x7fff ? undef : $val',
2303             %Image::ExifTool::Exif::printParameter,
2304             },
2305             15 => {
2306             Name => 'Sharpness',
2307             RawConv => '$val == 0x7fff ? undef : $val',
2308             Notes => q{
2309             some models use a range of -2 to +2 where 0 is normal sharpening, and
2310             others use a range of 0 to 7 where 0 is no sharpening
2311             },
2312             PrintConv => '$val > 0 ? "+$val" : $val',
2313             PrintConvInv => '$val',
2314             },
2315             16 => {
2316             Name => 'CameraISO',
2317             RawConv => '$val == 0x7fff ? undef : $val',
2318             ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
2319             ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
2320             },
2321             17 => {
2322             Name => 'MeteringMode',
2323             PrintConv => {
2324             0 => 'Default', # older Ixus
2325             1 => 'Spot',
2326             2 => 'Average', #PH
2327             3 => 'Evaluative',
2328             4 => 'Partial',
2329             5 => 'Center-weighted average',
2330             },
2331             },
2332             18 => {
2333             # this is always 2 for the 300D - PH
2334             Name => 'FocusRange',
2335             PrintConv => {
2336             0 => 'Manual',
2337             1 => 'Auto',
2338             2 => 'Not Known',
2339             3 => 'Macro',
2340             4 => 'Very Close', #PH
2341             5 => 'Close', #PH
2342             6 => 'Middle Range', #PH
2343             7 => 'Far Range',
2344             8 => 'Pan Focus',
2345             9 => 'Super Macro', #PH
2346             10=> 'Infinity', #PH
2347             },
2348             },
2349             19 => {
2350             Name => 'AFPoint',
2351             Flags => 'PrintHex',
2352             RawConv => '$val==0 ? undef : $val',
2353             PrintConv => {
2354             0x2005 => 'Manual AF point selection',
2355             0x3000 => 'None (MF)',
2356             0x3001 => 'Auto AF point selection',
2357             0x3002 => 'Right',
2358             0x3003 => 'Center',
2359             0x3004 => 'Left',
2360             0x4001 => 'Auto AF point selection',
2361             0x4006 => 'Face Detect', #PH (A570IS)
2362             },
2363             },
2364             20 => {
2365             Name => 'CanonExposureMode',
2366             PrintConv => {
2367             0 => 'Easy',
2368             1 => 'Program AE',
2369             2 => 'Shutter speed priority AE',
2370             3 => 'Aperture-priority AE',
2371             4 => 'Manual',
2372             5 => 'Depth-of-field AE',
2373             6 => 'M-Dep', #PH
2374             7 => 'Bulb', #30
2375             8 => 'Flexible-priority AE', #ArnoldVanOostrum
2376             },
2377             },
2378             22 => { #4
2379             Name => 'LensType',
2380             Format => 'int16u',
2381             RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
2382             Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
2383             SeparateTable => 1,
2384             DataMember => 'LensType',
2385             ValueConvInv => 'int($val)', # (must truncate decimal part)
2386             PrintConv => \%canonLensTypes,
2387             },
2388             23 => {
2389             Name => 'MaxFocalLength',
2390             Format => 'int16u',
2391             # this is a bit tricky, but we need the FocalUnits to convert this to mm
2392             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2393             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2394             ValueConvInv => '$val',
2395             PrintConv => '"$val mm"',
2396             PrintConvInv => '$val=~s/\s*mm//;$val',
2397             },
2398             24 => {
2399             Name => 'MinFocalLength',
2400             Format => 'int16u',
2401             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2402             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2403             ValueConvInv => '$val',
2404             PrintConv => '"$val mm"',
2405             PrintConvInv => '$val=~s/\s*mm//;$val',
2406             },
2407             25 => {
2408             Name => 'FocalUnits',
2409             # conversion from raw focal length values to mm
2410             DataMember => 'FocalUnits',
2411             RawConv => '$$self{FocalUnits} = $val',
2412             PrintConv => '"$val/mm"',
2413             PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
2414             },
2415             26 => { #9
2416             Name => 'MaxAperture',
2417             RawConv => '$val > 0 ? $val : undef',
2418             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2419             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2420             PrintConv => 'sprintf("%.2g",$val)',
2421             PrintConvInv => '$val',
2422             },
2423             27 => { #PH
2424             Name => 'MinAperture',
2425             RawConv => '$val > 0 ? $val : undef',
2426             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2427             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2428             PrintConv => 'sprintf("%.2g",$val)',
2429             PrintConvInv => '$val',
2430             },
2431             28 => {
2432             Name => 'FlashActivity',
2433             RawConv => '$val==-1 ? undef : $val',
2434             },
2435             29 => {
2436             Name => 'FlashBits',
2437             PrintConvColumns => 2,
2438             PrintConv => {
2439             0 => '(none)',
2440             BITMASK => {
2441             0 => 'Manual', #PH
2442             1 => 'TTL', #PH
2443             2 => 'A-TTL', #PH
2444             3 => 'E-TTL', #PH
2445             4 => 'FP sync enabled',
2446             7 => '2nd-curtain sync used',
2447             11 => 'FP sync used',
2448             13 => 'Built-in',
2449             14 => 'External', #(may not be set in manual mode - ref 37)
2450             },
2451             },
2452             },
2453             32 => {
2454             Name => 'FocusContinuous',
2455             RawConv => '$val==-1 ? undef : $val',
2456             PrintConv => {
2457             0 => 'Single',
2458             1 => 'Continuous',
2459             8 => 'Manual', #22
2460             },
2461             },
2462             33 => { #PH
2463             Name => 'AESetting',
2464             RawConv => '$val==-1 ? undef : $val',
2465             PrintConv => {
2466             0 => 'Normal AE',
2467             1 => 'Exposure Compensation',
2468             2 => 'AE Lock',
2469             3 => 'AE Lock + Exposure Comp.',
2470             4 => 'No AE',
2471             },
2472             },
2473             34 => { #PH
2474             Name => 'ImageStabilization',
2475             RawConv => '$val==-1 ? undef : $val',
2476             PrintConv => {
2477             0 => 'Off',
2478             1 => 'On',
2479             2 => 'Shoot Only', #15
2480             3 => 'Panning', # (A570IS)
2481             4 => 'Dynamic', # (SX30IS) (was 'On, Video')
2482             # (don't know what bit 0x100 indicates)
2483             256 => 'Off (2)',
2484             257 => 'On (2)',
2485             258 => 'Shoot Only (2)',
2486             259 => 'Panning (2)',
2487             260 => 'Dynamic (2)',
2488             },
2489             },
2490             35 => { #PH
2491             Name => 'DisplayAperture',
2492             RawConv => '$val ? $val : undef',
2493             ValueConv => '$val / 10',
2494             ValueConvInv => '$val * 10',
2495             },
2496             36 => 'ZoomSourceWidth', #PH
2497             37 => 'ZoomTargetWidth', #PH
2498             39 => { #22
2499             Name => 'SpotMeteringMode',
2500             RawConv => '$val==-1 ? undef : $val',
2501             PrintConv => {
2502             0 => 'Center',
2503             1 => 'AF Point',
2504             },
2505             },
2506             40 => { #PH
2507             Name => 'PhotoEffect',
2508             RawConv => '$val==-1 ? undef : $val',
2509             PrintConvColumns => 2,
2510             PrintConv => {
2511             0 => 'Off',
2512             1 => 'Vivid',
2513             2 => 'Neutral',
2514             3 => 'Smooth',
2515             4 => 'Sepia',
2516             5 => 'B&W',
2517             6 => 'Custom',
2518             100 => 'My Color Data',
2519             },
2520             },
2521             41 => { #PH (A570IS)
2522             Name => 'ManualFlashOutput',
2523             PrintHex => 1,
2524             PrintConv => {
2525             0 => 'n/a',
2526             0x500 => 'Full',
2527             0x502 => 'Medium',
2528             0x504 => 'Low',
2529             0x7fff => 'n/a', # (EOS models)
2530             },
2531             },
2532             # 41 => non-zero for manual flash intensity - PH (A570IS)
2533             42 => {
2534             Name => 'ColorTone',
2535             RawConv => '$val == 0x7fff ? undef : $val',
2536             %Image::ExifTool::Exif::printParameter,
2537             },
2538             46 => { #PH
2539             Name => 'SRAWQuality',
2540             RawConv => '$val==-1 ? undef : $val',
2541             PrintConv => {
2542             0 => 'n/a',
2543             1 => 'sRAW1 (mRAW)',
2544             2 => 'sRAW2 (sRAW)',
2545             },
2546             },
2547             # 47 - related to aspect ratio: 100=4:3,70=1:1/16:9,90=3:2,60=4:5 (PH G12)
2548             # (roughly image area in percent - 4:3=100%,1:1/16:9=75%,3:2=89%,4:5=60%)
2549             );
2550              
2551             # focal length information (MakerNotes tag 0x02)
2552             %Image::ExifTool::Canon::FocalLength = (
2553             %binaryDataAttrs,
2554             FORMAT => 'int16u',
2555             FIRST_ENTRY => 0,
2556             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2557             0 => { #9
2558             Name => 'FocalType',
2559             RawConv => '$val ? $val : undef', # don't use if value is zero
2560             PrintConv => {
2561             1 => 'Fixed',
2562             2 => 'Zoom',
2563             },
2564             },
2565             1 => {
2566             Name => 'FocalLength',
2567             # the EXIF FocalLength is more reliable, so set this priority to zero
2568             Priority => 0,
2569             RawConv => '$val ? $val : undef', # don't use if value is zero
2570             RawConvInv => q{
2571             my $focalUnits = $$self{FocalUnits};
2572             unless ($focalUnits) {
2573             $focalUnits = 1;
2574             # (this happens when writing FocalLength to CRW images)
2575             $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
2576             }
2577             return $val * $focalUnits;
2578             },
2579             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2580             ValueConvInv => '$val',
2581             PrintConv => '"$val mm"',
2582             PrintConvInv => '$val=~s/\s*mm//;$val',
2583             },
2584             2 => [ #4
2585             {
2586             Name => 'FocalPlaneXSize',
2587             Notes => q{
2588             these focal plane sizes are only valid for some models, and are affected by
2589             digital zoom if applied
2590             },
2591             # this conversion is valid only for PowerShot models and these EOS models:
2592             # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
2593             Condition => q{
2594             $$self{Model} !~ /EOS/ or
2595             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2596             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2597             },
2598             # focal plane image dimensions in 1/1000 inch -- convert to mm
2599             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2600             ValueConv => '$val * 25.4 / 1000',
2601             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2602             PrintConv => 'sprintf("%.2f mm",$val)',
2603             PrintConvInv => '$val=~s/\s*mm$//;$val',
2604             },{
2605             Name => 'FocalPlaneXUnknown',
2606             Unknown => 1,
2607             },
2608             ],
2609             3 => [ #4
2610             {
2611             Name => 'FocalPlaneYSize',
2612             Condition => q{
2613             $$self{Model} !~ /EOS/ or
2614             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2615             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2616             },
2617             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2618             ValueConv => '$val * 25.4 / 1000',
2619             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2620             PrintConv => 'sprintf("%.2f mm",$val)',
2621             PrintConvInv => '$val=~s/\s*mm$//;$val',
2622             },{
2623             Name => 'FocalPlaneYUnknown',
2624             Unknown => 1,
2625             },
2626             ],
2627             );
2628              
2629             # Canon shot information (MakerNotes tag 0x04)
2630             # BinaryData (keys are indices into the int16s array)
2631             %Image::ExifTool::Canon::ShotInfo = (
2632             %binaryDataAttrs,
2633             FORMAT => 'int16s',
2634             FIRST_ENTRY => 1,
2635             DATAMEMBER => [ 19 ],
2636             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2637             1 => { #PH
2638             Name => 'AutoISO',
2639             Notes => 'actual ISO used = BaseISO * AutoISO / 100',
2640             ValueConv => 'exp($val/32*log(2))*100',
2641             ValueConvInv => '32*log($val/100)/log(2)',
2642             PrintConv => 'sprintf("%.0f",$val)',
2643             PrintConvInv => '$val',
2644             },
2645             2 => {
2646             Name => 'BaseISO',
2647             Priority => 0,
2648             RawConv => '$val ? $val : undef',
2649             ValueConv => 'exp($val/32*log(2))*100/32',
2650             ValueConvInv => '32*log($val*32/100)/log(2)',
2651             PrintConv => 'sprintf("%.0f",$val)',
2652             PrintConvInv => '$val',
2653             },
2654             3 => { #9/PH
2655             Name => 'MeasuredEV',
2656             Notes => q{
2657             this is the Canon name for what could better be called MeasuredLV, and
2658             should be close to the calculated LightValue for a proper exposure with most
2659             models
2660             },
2661             # empirical offset of +5 seems to be good for EOS models, but maybe
2662             # the offset should be less by up to 1 EV for some PowerShot models
2663             ValueConv => '$val / 32 + 5',
2664             ValueConvInv => '($val - 5) * 32',
2665             PrintConv => 'sprintf("%.2f",$val)',
2666             PrintConvInv => '$val',
2667             },
2668             4 => { #2, 9
2669             Name => 'TargetAperture',
2670             RawConv => '$val > 0 ? $val : undef',
2671             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2672             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2673             PrintConv => 'sprintf("%.2g",$val)',
2674             PrintConvInv => '$val',
2675             },
2676             5 => { #2
2677             Name => 'TargetExposureTime',
2678             # ignore obviously bad values (also, -32768 may be used for n/a)
2679             # (note that a few models always write 0: DC211, and video models)
2680             RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
2681             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2682             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2683             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2684             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2685             },
2686             6 => {
2687             Name => 'ExposureCompensation',
2688             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2689             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2690             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2691             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2692             },
2693             7 => {
2694             Name => 'WhiteBalance',
2695             PrintConv => \%canonWhiteBalance,
2696             SeparateTable => 1,
2697             },
2698             8 => { #PH
2699             Name => 'SlowShutter',
2700             PrintConv => {
2701             -1 => 'n/a',
2702             0 => 'Off',
2703             1 => 'Night Scene',
2704             2 => 'On',
2705             3 => 'None',
2706             },
2707             },
2708             9 => {
2709             Name => 'SequenceNumber',
2710             Description => 'Shot Number In Continuous Burst',
2711             Notes => 'valid only for some models', #PH (eg. not the 5DmkIII)
2712             },
2713             10 => { #PH/17
2714             Name => 'OpticalZoomCode',
2715             Groups => { 2 => 'Camera' },
2716             Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
2717             # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
2718             # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
2719             # - set to 8 for "n/a" by Canon software (ref 22)
2720             PrintConv => '$val == 8 ? "n/a" : $val',
2721             PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
2722             },
2723             # 11 - (8 for all EOS samples, [0,8] for other models - PH)
2724             12 => { #37
2725             Name => 'CameraTemperature',
2726             Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
2727             Groups => { 2 => 'Camera' },
2728             Notes => 'newer EOS models only',
2729             # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
2730             RawConv => '$val ? $val : undef',
2731             ValueConv => '$val - 128',
2732             ValueConvInv => '$val + 128',
2733             PrintConv => '"$val C"',
2734             PrintConvInv => '$val=~s/ ?C//; $val',
2735             },
2736             13 => { #PH
2737             Name => 'FlashGuideNumber',
2738             RawConv => '$val==-1 ? undef : $val',
2739             ValueConv => '$val / 32',
2740             ValueConvInv => '$val * 32',
2741             },
2742             # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
2743             14 => { #2
2744             Name => 'AFPointsInFocus',
2745             Notes => 'used by D30, D60 and some PowerShot/Ixus models',
2746             Groups => { 2 => 'Camera' },
2747             Flags => 'PrintHex',
2748             RawConv => '$val==0 ? undef : $val',
2749             PrintConvColumns => 2,
2750             PrintConv => {
2751             0x3000 => 'None (MF)',
2752             0x3001 => 'Right',
2753             0x3002 => 'Center',
2754             0x3003 => 'Center+Right',
2755             0x3004 => 'Left',
2756             0x3005 => 'Left+Right',
2757             0x3006 => 'Left+Center',
2758             0x3007 => 'All',
2759             },
2760             },
2761             15 => {
2762             Name => 'FlashExposureComp',
2763             Description => 'Flash Exposure Compensation',
2764             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2765             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2766             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2767             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2768             },
2769             16 => {
2770             Name => 'AutoExposureBracketing',
2771             PrintConv => {
2772             -1 => 'On',
2773             0 => 'Off',
2774             1 => 'On (shot 1)',
2775             2 => 'On (shot 2)',
2776             3 => 'On (shot 3)',
2777             },
2778             },
2779             17 => {
2780             Name => 'AEBBracketValue',
2781             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2782             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2783             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2784             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2785             },
2786             18 => { #22
2787             Name => 'ControlMode',
2788             PrintConv => {
2789             0 => 'n/a',
2790             1 => 'Camera Local Control',
2791             # 2 - have seen this for EOS M studio picture
2792             3 => 'Computer Remote Control',
2793             },
2794             },
2795             19 => {
2796             Name => 'FocusDistanceUpper',
2797             DataMember => 'FocusDistanceUpper',
2798             Format => 'int16u',
2799             Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
2800             RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
2801             ValueConv => '$val / 100',
2802             ValueConvInv => '$val * 100',
2803             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2804             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2805             },
2806             20 => {
2807             Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
2808             Condition => '$$self{FocusDistanceUpper}',
2809             Format => 'int16u',
2810             ValueConv => '$val / 100',
2811             ValueConvInv => '$val * 100',
2812             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2813             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2814             },
2815             21 => {
2816             Name => 'FNumber',
2817             Priority => 0,
2818             RawConv => '$val ? $val : undef',
2819             # approximate big translation table by simple calculation - PH
2820             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2821             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2822             PrintConv => 'sprintf("%.2g",$val)',
2823             PrintConvInv => '$val',
2824             },
2825             22 => [
2826             {
2827             Name => 'ExposureTime',
2828             # encoding is different for 20D and 350D (darn!)
2829             # (but note that encoding is the same for TargetExposureTime - PH)
2830             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
2831             Priority => 0,
2832             # many models write 0 here in JPEG images (even though 0 is the
2833             # value for an exposure time of 1 sec), but apparently a value of 0
2834             # is valid in a CRW image (=1s, D60 sample)
2835             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2836             # approximate big translation table by simple calculation - PH
2837             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
2838             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
2839             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2840             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2841             },
2842             {
2843             Name => 'ExposureTime',
2844             Priority => 0,
2845             # many models write 0 here in JPEG images (even though 0 is the
2846             # value for an exposure time of 1 sec), but apparently a value of 0
2847             # is valid in a CRW image (=1s, D60 sample)
2848             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2849             # approximate big translation table by simple calculation - PH
2850             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2851             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2852             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2853             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2854             },
2855             ],
2856             23 => { #37
2857             Name => 'MeasuredEV2',
2858             Description => 'Measured EV 2',
2859             RawConv => '$val ? $val : undef',
2860             ValueConv => '$val / 8 - 6',
2861             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2862             },
2863             24 => {
2864             Name => 'BulbDuration',
2865             ValueConv => '$val / 10',
2866             ValueConvInv => '$val * 10',
2867             },
2868             # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
2869             # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
2870             26 => { #15
2871             Name => 'CameraType',
2872             Groups => { 2 => 'Camera' },
2873             PrintConv => {
2874             0 => 'n/a',
2875             248 => 'EOS High-end',
2876             250 => 'Compact',
2877             252 => 'EOS Mid-range',
2878             255 => 'DV Camera', #PH
2879             },
2880             },
2881             27 => {
2882             Name => 'AutoRotate',
2883             RawConv => '$val >= 0 ? $val : undef',
2884             PrintConv => {
2885             -1 => 'n/a', # (set to -1 when rotated by Canon software)
2886             0 => 'None',
2887             1 => 'Rotate 90 CW',
2888             2 => 'Rotate 180',
2889             3 => 'Rotate 270 CW',
2890             },
2891             },
2892             28 => { #15
2893             Name => 'NDFilter',
2894             PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
2895             },
2896             29 => {
2897             Name => 'SelfTimer2',
2898             RawConv => '$val >= 0 ? $val : undef',
2899             ValueConv => '$val / 10',
2900             ValueConvInv => '$val * 10',
2901             },
2902             33 => { #PH (A570IS)
2903             Name => 'FlashOutput',
2904             RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
2905             Notes => q{
2906             used only for PowerShot models, this has a maximum value of 500 for models
2907             like the A570IS
2908             },
2909             },
2910             );
2911              
2912             # Canon panorama information (MakerNotes tag 0x05)
2913             %Image::ExifTool::Canon::Panorama = (
2914             %binaryDataAttrs,
2915             FORMAT => 'int16s',
2916             FIRST_ENTRY => 0,
2917             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2918             # 0 - values: always 1
2919             # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
2920             2 => 'PanoramaFrameNumber', #(some models this is always 0)
2921             # 3 - values: 160(SX10IS,A570IS); 871(S30)
2922             # 4 - values: always 0
2923             5 => {
2924             Name => 'PanoramaDirection',
2925             PrintConv => {
2926             0 => 'Left to Right',
2927             1 => 'Right to Left',
2928             2 => 'Bottom to Top',
2929             3 => 'Top to Bottom',
2930             4 => '2x2 Matrix (Clockwise)',
2931             },
2932             },
2933             );
2934              
2935             # D30 color information (MakerNotes tag 0x0a)
2936             %Image::ExifTool::Canon::UnknownD30 = (
2937             %binaryDataAttrs,
2938             FORMAT => 'int16s',
2939             FIRST_ENTRY => 1,
2940             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2941             );
2942              
2943             #..............................................................................
2944             # common CameraInfo tag definitions
2945             my %ciFNumber = (
2946             Name => 'FNumber',
2947             Format => 'int8u',
2948             Groups => { 2 => 'Image' },
2949             RawConv => '$val ? $val : undef',
2950             ValueConv => 'exp(($val-8)/16*log(2))',
2951             ValueConvInv => 'log($val)*16/log(2)+8',
2952             PrintConv => 'sprintf("%.2g",$val)',
2953             PrintConvInv => '$val',
2954             );
2955             my %ciExposureTime = (
2956             Name => 'ExposureTime',
2957             Format => 'int8u',
2958             Groups => { 2 => 'Image' },
2959             RawConv => '$val ? $val : undef',
2960             ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
2961             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
2962             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2963             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2964             );
2965             my %ciISO = (
2966             Name => 'ISO',
2967             Format => 'int8u',
2968             Groups => { 2 => 'Image' },
2969             ValueConv => '100*exp(($val/8-9)*log(2))',
2970             ValueConvInv => '(log($val/100)/log(2)+9)*8',
2971             PrintConv => 'sprintf("%.0f",$val)',
2972             PrintConvInv => '$val',
2973             );
2974             my %ciCameraTemperature = (
2975             Name => 'CameraTemperature',
2976             Format => 'int8u',
2977             ValueConv => '$val - 128',
2978             ValueConvInv => '$val + 128',
2979             PrintConv => '"$val C"',
2980             PrintConvInv => '$val=~s/ ?C//; $val',
2981             );
2982             my %ciMacroMagnification = (
2983             Name => 'MacroMagnification',
2984             Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
2985             Condition => '$$self{LensType} and $$self{LensType} == 124',
2986             # 75=1x, 44=5x, log relationship
2987             ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
2988             ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
2989             PrintConv => 'sprintf("%.1fx",$val)',
2990             PrintConvInv => '$val=~s/\s*x//; $val',
2991             );
2992             my %ciFocalLength = (
2993             Name => 'FocalLength',
2994             Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
2995             # ignore if zero
2996             RawConv => '$val ? $val : undef',
2997             PrintConv => '"$val mm"',
2998             PrintConvInv => '$val=~s/\s*mm//;$val',
2999             );
3000             my %ciMinFocal = (
3001             Name => 'MinFocalLength',
3002             Format => 'int16uRev', # byte order is big-endian
3003             PrintConv => '"$val mm"',
3004             PrintConvInv => '$val=~s/\s*mm//;$val',
3005             );
3006             my %ciMaxFocal = (
3007             Name => 'MaxFocalLength',
3008             Format => 'int16uRev', # byte order is big-endian
3009             PrintConv => '"$val mm"',
3010             PrintConvInv => '$val=~s/\s*mm//;$val',
3011             );
3012              
3013             #..............................................................................
3014             # Camera information for 1D and 1DS (MakerNotes tag 0x0d)
3015             # (ref 15 unless otherwise noted)
3016             %Image::ExifTool::Canon::CameraInfo1D = (
3017             %binaryDataAttrs,
3018             FORMAT => 'int8u',
3019             FIRST_ENTRY => 0,
3020             PRIORITY => 0, # these tags are not reliable since they change with firmware version
3021             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3022             NOTES => q{
3023             Information in the "CameraInfo" records is tricky to decode because the
3024             encodings are very different than in other Canon records (even sometimes
3025             switching endianness between values within a single camera), plus there is
3026             considerable variation in format from model to model. The first table below
3027             lists CameraInfo tags for the 1D and 1DS.
3028             },
3029             0x04 => { %ciExposureTime }, #9
3030             0x0a => {
3031             Name => 'FocalLength',
3032             Format => 'int16u',
3033             # ignore if zero
3034             RawConv => '$val ? $val : undef',
3035             PrintConv => '"$val mm"',
3036             PrintConvInv => '$val=~s/\s*mm//;$val',
3037             },
3038             0x0d => { #9
3039             Name => 'LensType',
3040             Format => 'int16uRev', # value is little-endian
3041             SeparateTable => 1,
3042             RawConv => '$val ? $val : undef', # don't use if value is zero
3043             ValueConvInv => 'int($val)', # (must truncate decimal part)
3044             PrintConv => \%canonLensTypes,
3045             },
3046             0x0e => {
3047             Name => 'MinFocalLength',
3048             Format => 'int16u',
3049             PrintConv => '"$val mm"',
3050             PrintConvInv => '$val=~s/\s*mm//;$val',
3051             },
3052             0x10 => {
3053             Name => 'MaxFocalLength',
3054             Format => 'int16u',
3055             PrintConv => '"$val mm"',
3056             PrintConvInv => '$val=~s/\s*mm//;$val',
3057             },
3058             0x41 => {
3059             Name => 'SharpnessFrequency', # PatternSharpness?
3060             Condition => '$$self{Model} =~ /\b1D$/',
3061             Notes => '1D only',
3062             PrintConvColumns => 2,
3063             PrintConv => {
3064             0 => 'n/a',
3065             1 => 'Lowest',
3066             2 => 'Low',
3067             3 => 'Standard',
3068             4 => 'High',
3069             5 => 'Highest',
3070             },
3071             },
3072             0x42 => {
3073             Name => 'Sharpness',
3074             Format => 'int8s',
3075             Condition => '$$self{Model} =~ /\b1D$/',
3076             Notes => '1D only',
3077             },
3078             0x44 => {
3079             Name => 'WhiteBalance',
3080             Condition => '$$self{Model} =~ /\b1D$/',
3081             Notes => '1D only',
3082             SeparateTable => 1,
3083             PrintConv => \%canonWhiteBalance,
3084             },
3085             0x47 => {
3086             Name => 'SharpnessFrequency', # PatternSharpness?
3087             Condition => '$$self{Model} =~ /\b1DS$/',
3088             Notes => '1DS only',
3089             PrintConvColumns => 2,
3090             PrintConv => {
3091             0 => 'n/a',
3092             1 => 'Lowest',
3093             2 => 'Low',
3094             3 => 'Standard',
3095             4 => 'High',
3096             5 => 'Highest',
3097             },
3098             },
3099             0x48 => [
3100             {
3101             Name => 'ColorTemperature',
3102             Format => 'int16u',
3103             Condition => '$$self{Model} =~ /\b1D$/',
3104             Notes => '1D only',
3105             },
3106             {
3107             Name => 'Sharpness',
3108             Format => 'int8s',
3109             Condition => '$$self{Model} =~ /\b1DS$/',
3110             Notes => '1DS only',
3111             },
3112             ],
3113             0x4a => {
3114             Name => 'WhiteBalance',
3115             Condition => '$$self{Model} =~ /\b1DS$/',
3116             Notes => '1DS only',
3117             SeparateTable => 1,
3118             PrintConv => \%canonWhiteBalance,
3119             },
3120             0x4b => {
3121             Name => 'PictureStyle',
3122             Condition => '$$self{Model} =~ /\b1D$/',
3123             Notes => "1D only, called 'Color Matrix' in owner's manual",
3124             Flags => ['PrintHex','SeparateTable'],
3125             PrintConv => \%pictureStyles,
3126             },
3127             0x4e => {
3128             Name => 'ColorTemperature',
3129             Format => 'int16u',
3130             Condition => '$$self{Model} =~ /\b1DS$/',
3131             Notes => '1DS only',
3132             },
3133             0x51 => {
3134             Name => 'PictureStyle',
3135             Condition => '$$self{Model} =~ /\b1DS$/',
3136             Notes => '1DS only',
3137             Flags => ['PrintHex','SeparateTable'],
3138             PrintConv => \%pictureStyles,
3139             },
3140             );
3141              
3142             # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
3143             # (ref 15 unless otherwise noted)
3144             %Image::ExifTool::Canon::CameraInfo1DmkII = (
3145             %binaryDataAttrs,
3146             FORMAT => 'int8u',
3147             FIRST_ENTRY => 0,
3148             PRIORITY => 0,
3149             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3150             NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
3151             0x04 => { %ciExposureTime }, #9
3152             0x09 => { %ciFocalLength }, #9
3153             0x0c => { #9
3154             Name => 'LensType',
3155             Format => 'int16uRev', # value is big-endian
3156             SeparateTable => 1,
3157             RawConv => '$val ? $val : undef', # don't use if value is zero
3158             ValueConvInv => 'int($val)', # (must truncate decimal part)
3159             PrintConv => \%canonLensTypes,
3160             },
3161             0x11 => { %ciMinFocal }, #9
3162             0x13 => { %ciMaxFocal }, #9
3163             0x2d => { #9
3164             Name => 'FocalType',
3165             PrintConv => {
3166             0 => 'Fixed',
3167             2 => 'Zoom',
3168             },
3169             },
3170             0x36 => {
3171             Name => 'WhiteBalance',
3172             SeparateTable => 1,
3173             PrintConv => \%canonWhiteBalance,
3174             },
3175             0x37 => {
3176             Name => 'ColorTemperature',
3177             Format => 'int16uRev',
3178             },
3179             0x39 => {
3180             Name => 'CanonImageSize',
3181             Format => 'int16u',
3182             PrintConvColumns => 2,
3183             PrintConv => \%canonImageSize,
3184             },
3185             0x66 => {
3186             Name => 'JPEGQuality',
3187             Notes => 'a number from 1 to 10',
3188             },
3189             0x6c => { #12
3190             Name => 'PictureStyle',
3191             Flags => ['PrintHex','SeparateTable'],
3192             PrintConv => \%pictureStyles,
3193             },
3194             0x6e => {
3195             Name => 'Saturation',
3196             Format => 'int8s',
3197             %Image::ExifTool::Exif::printParameter,
3198             },
3199             0x6f => {
3200             Name => 'ColorTone',
3201             Format => 'int8s',
3202             %Image::ExifTool::Exif::printParameter,
3203             },
3204             0x72 => {
3205             Name => 'Sharpness',
3206             Format => 'int8s',
3207             },
3208             0x73 => {
3209             Name => 'Contrast',
3210             Format => 'int8s',
3211             %Image::ExifTool::Exif::printParameter,
3212             },
3213             0x75 => {
3214             Name => 'ISO',
3215             Format => 'string[5]',
3216             },
3217             );
3218              
3219             # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
3220             # (ref 9 unless otherwise noted)
3221             %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
3222             %binaryDataAttrs,
3223             FORMAT => 'int8u',
3224             FIRST_ENTRY => 0,
3225             PRIORITY => 0,
3226             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3227             NOTES => 'CameraInfo tags for the 1DmkIIN.',
3228             0x04 => { %ciExposureTime },
3229             0x09 => { %ciFocalLength },
3230             0x0c => {
3231             Name => 'LensType',
3232             Format => 'int16uRev', # value is big-endian
3233             SeparateTable => 1,
3234             RawConv => '$val ? $val : undef', # don't use if value is zero
3235             ValueConvInv => 'int($val)', # (must truncate decimal part)
3236             PrintConv => \%canonLensTypes,
3237             },
3238             0x11 => { %ciMinFocal },
3239             0x13 => { %ciMaxFocal },
3240             0x36 => { #15
3241             Name => 'WhiteBalance',
3242             SeparateTable => 1,
3243             PrintConv => \%canonWhiteBalance,
3244             },
3245             0x37 => { #15
3246             Name => 'ColorTemperature',
3247             Format => 'int16uRev',
3248             },
3249             0x73 => { #15
3250             Name => 'PictureStyle',
3251             Flags => ['PrintHex','SeparateTable'],
3252             PrintConv => \%pictureStyles,
3253             },
3254             0x74 => { #15
3255             Name => 'Sharpness',
3256             Format => 'int8s',
3257             },
3258             0x75 => { #15
3259             Name => 'Contrast',
3260             Format => 'int8s',
3261             %Image::ExifTool::Exif::printParameter,
3262             },
3263             0x76 => { #15
3264             Name => 'Saturation',
3265             Format => 'int8s',
3266             %Image::ExifTool::Exif::printParameter,
3267             },
3268             0x77 => { #15
3269             Name => 'ColorTone',
3270             Format => 'int8s',
3271             %Image::ExifTool::Exif::printParameter,
3272             },
3273             0x79 => { #15
3274             Name => 'ISO',
3275             Format => 'string[5]',
3276             },
3277             );
3278              
3279             # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
3280             %Image::ExifTool::Canon::CameraInfo1DmkIII = (
3281             %binaryDataAttrs,
3282             FORMAT => 'int8u',
3283             FIRST_ENTRY => 0,
3284             PRIORITY => 0,
3285             IS_SUBDIR => [ 0x2aa ],
3286             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3287             NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
3288             0x03 => { %ciFNumber },
3289             0x04 => { %ciExposureTime }, #9
3290             0x06 => { %ciISO },
3291             0x18 => { %ciCameraTemperature }, #36
3292             0x1b => { %ciMacroMagnification }, #(NC)
3293             0x1d => { %ciFocalLength },
3294             0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
3295             Name => 'CameraOrientation',
3296             PrintConv => {
3297             0 => 'Horizontal (normal)',
3298             1 => 'Rotate 90 CW',
3299             2 => 'Rotate 270 CW',
3300             },
3301             },
3302             0x43 => { #21/24
3303             Name => 'FocusDistanceUpper',
3304             # (it looks like the focus distances are also odd-byte big-endian)
3305             %focusDistanceByteSwap,
3306             },
3307             0x45 => { #21/24
3308             Name => 'FocusDistanceLower',
3309             %focusDistanceByteSwap,
3310             },
3311             0x5e => { #15
3312             Name => 'WhiteBalance',
3313             Format => 'int16u',
3314             PrintConv => \%canonWhiteBalance,
3315             SeparateTable => 1,
3316             },
3317             0x62 => { #15
3318             Name => 'ColorTemperature',
3319             Format => 'int16u',
3320             },
3321             0x86 => {
3322             Name => 'PictureStyle',
3323             Flags => ['PrintHex','SeparateTable'],
3324             PrintConv => \%pictureStyles,
3325             },
3326             0x111 => { #15
3327             Name => 'LensType',
3328             Format => 'int16uRev', # value is big-endian
3329             SeparateTable => 1,
3330             ValueConvInv => 'int($val)', # (must truncate decimal part)
3331             PrintConv => \%canonLensTypes,
3332             },
3333             0x113 => { %ciMinFocal },
3334             0x115 => { %ciMaxFocal },
3335             0x136 => { #15
3336             Name => 'FirmwareVersion',
3337             Format => 'string[6]',
3338             },
3339             0x172 => {
3340             Name => 'FileIndex',
3341             Groups => { 2 => 'Image' },
3342             Format => 'int32u',
3343             ValueConv => '$val + 1',
3344             ValueConvInv => '$val - 1',
3345             },
3346             0x176 => {
3347             Name => 'ShutterCount',
3348             Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
3349             Format => 'int32u',
3350             ValueConv => '$val + 1',
3351             ValueConvInv => '$val - 1',
3352             },
3353             0x17e => { #(NC)
3354             Name => 'DirectoryIndex',
3355             Groups => { 2 => 'Image' },
3356             Format => 'int32u',
3357             ValueConv => '$val - 1',
3358             ValueConvInv => '$val + 1',
3359             },
3360             0x2aa => { #48
3361             Name => 'PictureStyleInfo',
3362             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3363             },
3364             0x45a => { #29
3365             Name => 'TimeStamp1',
3366             Condition => '$$self{Model} =~ /\b1D Mark III$/',
3367             Format => 'int32u',
3368             Groups => { 2 => 'Time' },
3369             # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
3370             Notes => 'only valid for some versions of the 1DmkIII firmware',
3371             Shift => 'Time',
3372             RawConv => '$val ? $val : undef',
3373             ValueConv => 'ConvertUnixTime($val)',
3374             ValueConvInv => 'GetUnixTime($val)',
3375             PrintConv => '$self->ConvertDateTime($val)',
3376             PrintConvInv => '$self->InverseDateTime($val)',
3377             },
3378             0x45e => {
3379             Name => 'TimeStamp',
3380             Format => 'int32u',
3381             Groups => { 2 => 'Time' },
3382             # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
3383             # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
3384             Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
3385             Shift => 'Time',
3386             RawConv => '$val ? $val : undef',
3387             ValueConv => 'ConvertUnixTime($val)',
3388             ValueConvInv => 'GetUnixTime($val)',
3389             PrintConv => '$self->ConvertDateTime($val)',
3390             PrintConvInv => '$self->InverseDateTime($val)',
3391             },
3392             );
3393              
3394             # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
3395             %Image::ExifTool::Canon::CameraInfo1DmkIV = (
3396             %binaryDataAttrs,
3397             FIRST_ENTRY => 0,
3398             PRIORITY => 0,
3399             DATAMEMBER => [ 0x00, 0x56, 0x153 ],
3400             IS_SUBDIR => [ 0x368 ],
3401             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3402             NOTES => q{
3403             CameraInfo tags for the EOS 1D Mark IV. Indices shown are for firmware
3404             versions 1.0.x, but they may be different for other firmware versions.
3405             },
3406             0x00 => {
3407             Name => 'FirmwareVersionLookAhead',
3408             Hidden => 1,
3409             # look ahead to check location of FirmwareVersion string
3410             Format => 'undef[0x1fd]',
3411             RawConv => q{
3412             my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
3413             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3414             $t = substr($val, 0x1ed, 6); # 2 = firmware 1.0.4
3415             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3416             $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
3417             $$self{CanonFirm} = 0;
3418             return undef; # not a real tag
3419             },
3420             },
3421             0x03 => { %ciFNumber },
3422             0x04 => { %ciExposureTime },
3423             0x06 => { %ciISO },
3424             0x07 => {
3425             Name => 'HighlightTonePriority',
3426             PrintConv => \%offOn,
3427             },
3428             0x08 => {
3429             Name => 'MeasuredEV2',
3430             Description => 'Measured EV 2',
3431             RawConv => '$val ? $val : undef',
3432             ValueConv => '$val / 8 - 6',
3433             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3434             },
3435             0x09 => {
3436             Name => 'MeasuredEV3',
3437             Description => 'Measured EV 3',
3438             RawConv => '$val ? $val : undef',
3439             ValueConv => '$val / 8 - 6',
3440             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3441             },
3442             0x15 => {
3443             Name => 'FlashMeteringMode',
3444             PrintConv => {
3445             0 => 'E-TTL',
3446             3 => 'TTL',
3447             4 => 'External Auto',
3448             5 => 'External Manual',
3449             6 => 'Off',
3450             },
3451             },
3452             0x19 => { %ciCameraTemperature },
3453             0x1e => { %ciFocalLength },
3454             0x35 => {
3455             Name => 'CameraOrientation',
3456             PrintConv => {
3457             0 => 'Horizontal (normal)',
3458             1 => 'Rotate 90 CW',
3459             2 => 'Rotate 270 CW',
3460             },
3461             },
3462             0x54 => {
3463             Name => 'FocusDistanceUpper',
3464             %focusDistanceByteSwap,
3465             },
3466             0x56 => {
3467             Name => 'FocusDistanceLower',
3468             %focusDistanceByteSwap,
3469             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
3470             },
3471             0x78 => {
3472             Name => 'WhiteBalance',
3473             Format => 'int16u',
3474             SeparateTable => 1,
3475             PrintConv => \%canonWhiteBalance,
3476             },
3477             0x7c => {
3478             Name => 'ColorTemperature',
3479             Format => 'int16u',
3480             },
3481             0x14f => {
3482             Name => 'LensType',
3483             Format => 'int16uRev', # value is big-endian
3484             SeparateTable => 1,
3485             ValueConvInv => 'int($val)', # (must truncate decimal part)
3486             PrintConv => \%canonLensTypes,
3487             },
3488             0x151 => { %ciMinFocal },
3489             0x153 => { %ciMaxFocal,
3490             Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
3491             },
3492             0x1ed => {
3493             Name => 'FirmwareVersion',
3494             Format => 'string[6]',
3495             Writable => 0,
3496             },
3497             0x22c => { #(NC)
3498             Name => 'FileIndex',
3499             Groups => { 2 => 'Image' },
3500             Format => 'int32u',
3501             ValueConv => '$val + 1',
3502             ValueConvInv => '$val - 1',
3503             },
3504             0x238 => { #(NC)
3505             Name => 'DirectoryIndex',
3506             Groups => { 2 => 'Image' },
3507             Format => 'int32u',
3508             ValueConv => '$val - 1',
3509             ValueConvInv => '$val + 1',
3510             },
3511             0x368 => {
3512             Name => 'PictureStyleInfo',
3513             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3514             },
3515             );
3516              
3517             # Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
3518             %Image::ExifTool::Canon::CameraInfo1DX = (
3519             %binaryDataAttrs,
3520             FORMAT => 'int8u',
3521             FIRST_ENTRY => 0,
3522             PRIORITY => 0,
3523             DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
3524             IS_SUBDIR => [ 0x3f4 ],
3525             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3526             NOTES => q{
3527             CameraInfo tags for the EOS 1D X. Indices shown are for firmware version
3528             1.0.2, but they may be different for other firmware versions.
3529             },
3530             0x00 => {
3531             Name => 'FirmwareVersionLookAhead',
3532             Hidden => 1,
3533             # look ahead to check location of FirmwareVersion string
3534             Format => 'undef[0x28b]',
3535             RawConv => q{
3536             my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
3537             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3538             $t = substr($val, 0x279, 6); # 2 = firmware 6.5.1
3539             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3540             $t = substr($val, 0x280, 6); # 3 = firmware 0.0.8/1.0.2/1.1.1
3541             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3542             $t = substr($val, 0x285, 6); # 4 = firmware 2.1.0
3543             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3544             $self->Warn('Unrecognized CameraInfo1DX firmware version');
3545             $$self{CanonFirm} = 0;
3546             return undef; # not a real tag
3547             },
3548             },
3549             0x03 => { %ciFNumber },
3550             0x04 => { %ciExposureTime },
3551             0x06 => { %ciISO },
3552             0x1b => { %ciCameraTemperature,
3553             Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
3554             },
3555             0x23 => { %ciFocalLength },
3556             0x7d => {
3557             Name => 'CameraOrientation',
3558             PrintConv => {
3559             0 => 'Horizontal (normal)',
3560             1 => 'Rotate 90 CW',
3561             2 => 'Rotate 270 CW',
3562             },
3563             },
3564             0x8c => {
3565             Name => 'FocusDistanceUpper',
3566             %focusDistanceByteSwap,
3567             },
3568             0x8e => {
3569             Name => 'FocusDistanceLower',
3570             %focusDistanceByteSwap,
3571             Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
3572             },
3573             0xbc => {
3574             Name => 'WhiteBalance',
3575             Format => 'int16u',
3576             SeparateTable => 1,
3577             PrintConv => \%canonWhiteBalance,
3578             },
3579             0xc0 => {
3580             Name => 'ColorTemperature',
3581             Format => 'int16u',
3582             },
3583             0xf4 => {
3584             Name => 'PictureStyle',
3585             Format => 'int8u',
3586             Flags => ['PrintHex','SeparateTable'],
3587             PrintConv => \%pictureStyles,
3588             },
3589             0x1a7 => {
3590             Name => 'LensType',
3591             Format => 'int16uRev', # value is big-endian
3592             SeparateTable => 1,
3593             ValueConvInv => 'int($val)', # (must truncate decimal part)
3594             PrintConv => \%canonLensTypes,
3595             },
3596             0x1a9 => { %ciMinFocal },
3597             0x1ab => { %ciMaxFocal,
3598             # add another offset of -8 for firmware 5.7.1, and a large offset
3599             # to effectively abort processing for unknown firmware
3600             Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
3601             },
3602             0x280 => {
3603             Name => 'FirmwareVersion',
3604             Format => 'string[6]',
3605             Writable => 0,
3606             },
3607             0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
3608             Name => 'FileIndex',
3609             Groups => { 2 => 'Image' },
3610             Format => 'int32u',
3611             ValueConv => '$val + 1',
3612             ValueConvInv => '$val - 1',
3613             },
3614             0x2dc => { #(NC)
3615             Name => 'DirectoryIndex',
3616             Groups => { 2 => 'Image' },
3617             Format => 'int32u',
3618             ValueConv => '$val - 1',
3619             ValueConvInv => '$val + 1',
3620             },
3621             0x3f4 => {
3622             Name => 'PictureStyleInfo',
3623             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
3624             },
3625             );
3626              
3627             # Camera information for 5D (MakerNotes tag 0x0d)
3628             # (ref 12 unless otherwise noted)
3629             %Image::ExifTool::Canon::CameraInfo5D = (
3630             %binaryDataAttrs,
3631             FORMAT => 'int8s',
3632             FIRST_ENTRY => 0,
3633             PRIORITY => 0,
3634             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3635             NOTES => 'CameraInfo tags for the EOS 5D.',
3636             0x03 => { %ciFNumber }, #PH
3637             0x04 => { %ciExposureTime }, #9
3638             0x06 => { %ciISO }, #PH
3639             0x0c => { #9
3640             Name => 'LensType',
3641             Format => 'int16uRev', # value is big-endian
3642             SeparateTable => 1,
3643             RawConv => '$val ? $val : undef', # don't use if value is zero
3644             ValueConvInv => 'int($val)', # (must truncate decimal part)
3645             PrintConv => \%canonLensTypes,
3646             },
3647             0x17 => { %ciCameraTemperature }, #PH
3648             0x1b => { %ciMacroMagnification }, #PH
3649             0x27 => { #PH
3650             Name => 'CameraOrientation',
3651             PrintConv => {
3652             0 => 'Horizontal (normal)',
3653             1 => 'Rotate 90 CW',
3654             2 => 'Rotate 270 CW',
3655             },
3656             },
3657             0x28 => { %ciFocalLength }, #15
3658             0x38 => {
3659             Name => 'AFPointsInFocus5D',
3660             Format => 'int16uRev',
3661             PrintConvColumns => 2,
3662             PrintConv => { 0 => '(none)',
3663             BITMASK => {
3664             0 => 'Center',
3665             1 => 'Top',
3666             2 => 'Bottom',
3667             3 => 'Upper-left',
3668             4 => 'Upper-right',
3669             5 => 'Lower-left',
3670             6 => 'Lower-right',
3671             7 => 'Left',
3672             8 => 'Right',
3673             9 => 'AI Servo1',
3674             10 => 'AI Servo2',
3675             11 => 'AI Servo3',
3676             12 => 'AI Servo4',
3677             13 => 'AI Servo5',
3678             14 => 'AI Servo6',
3679             },
3680             },
3681             },
3682             0x54 => { #15
3683             Name => 'WhiteBalance',
3684             Format => 'int16u',
3685             SeparateTable => 1,
3686             PrintConv => \%canonWhiteBalance,
3687             },
3688             0x58 => { #15
3689             Name => 'ColorTemperature',
3690             Format => 'int16u',
3691             },
3692             0x6c => {
3693             Name => 'PictureStyle',
3694             Format => 'int8u',
3695             Flags => ['PrintHex','SeparateTable'],
3696             PrintConv => \%pictureStyles,
3697             },
3698             0x93 => { %ciMinFocal }, #15
3699             0x95 => { %ciMaxFocal }, #15
3700             0x97 => { #15
3701             Name => 'LensType',
3702             Format => 'int16uRev', # value is big-endian
3703             SeparateTable => 1,
3704             ValueConvInv => 'int($val)', # (must truncate decimal part)
3705             PrintConv => \%canonLensTypes,
3706             },
3707             0xa4 => { #PH
3708             Name => 'FirmwareRevision',
3709             Format => 'string[8]',
3710             },
3711             0xac => { #PH
3712             Name => 'ShortOwnerName',
3713             Format => 'string[16]',
3714             },
3715             0xcc => { #PH (NC)
3716             Name => 'DirectoryIndex',
3717             Groups => { 2 => 'Image' },
3718             Format => 'int32u',
3719             },
3720             0xd0 => {
3721             Name => 'FileIndex',
3722             Format => 'int16u',
3723             Groups => { 2 => 'Image' },
3724             ValueConv => '$val + 1',
3725             ValueConvInv => '$val - 1',
3726             },
3727             0xe8 => 'ContrastStandard',
3728             0xe9 => 'ContrastPortrait',
3729             0xea => 'ContrastLandscape',
3730             0xeb => 'ContrastNeutral',
3731             0xec => 'ContrastFaithful',
3732             0xed => 'ContrastMonochrome',
3733             0xee => 'ContrastUserDef1',
3734             0xef => 'ContrastUserDef2',
3735             0xf0 => 'ContrastUserDef3',
3736             # sharpness values are 0-7
3737             0xf1 => 'SharpnessStandard',
3738             0xf2 => 'SharpnessPortrait',
3739             0xf3 => 'SharpnessLandscape',
3740             0xf4 => 'SharpnessNeutral',
3741             0xf5 => 'SharpnessFaithful',
3742             0xf6 => 'SharpnessMonochrome',
3743             0xf7 => 'SharpnessUserDef1',
3744             0xf8 => 'SharpnessUserDef2',
3745             0xf9 => 'SharpnessUserDef3',
3746             0xfa => 'SaturationStandard',
3747             0xfb => 'SaturationPortrait',
3748             0xfc => 'SaturationLandscape',
3749             0xfd => 'SaturationNeutral',
3750             0xfe => 'SaturationFaithful',
3751             0xff => {
3752             Name => 'FilterEffectMonochrome',
3753             PrintConv => {
3754             0 => 'None',
3755             1 => 'Yellow',
3756             2 => 'Orange',
3757             3 => 'Red',
3758             4 => 'Green',
3759             -559038737 => 'n/a', # (0xdeadbeef)
3760             },
3761             },
3762             0x100 => 'SaturationUserDef1',
3763             0x101 => 'SaturationUserDef2',
3764             0x102 => 'SaturationUserDef3',
3765             0x103 => 'ColorToneStandard',
3766             0x104 => 'ColorTonePortrait',
3767             0x105 => 'ColorToneLandscape',
3768             0x106 => 'ColorToneNeutral',
3769             0x107 => 'ColorToneFaithful',
3770             0x108 => {
3771             Name => 'ToningEffectMonochrome',
3772             PrintConv => {
3773             0 => 'None',
3774             1 => 'Sepia',
3775             2 => 'Blue',
3776             3 => 'Purple',
3777             4 => 'Green',
3778             -559038737 => 'n/a', # (0xdeadbeef)
3779             },
3780             },
3781             0x109 => 'ColorToneUserDef1',
3782             0x10a => 'ColorToneUserDef2',
3783             0x10b => 'ColorToneUserDef3',
3784             0x10c => {
3785             Name => 'UserDef1PictureStyle',
3786             Format => 'int16u',
3787             PrintHex => 1, # (only needed for one tag)
3788             SeparateTable => 'UserDefStyle',
3789             PrintConv => \%userDefStyles,
3790             },
3791             0x10e => {
3792             Name => 'UserDef2PictureStyle',
3793             Format => 'int16u',
3794             SeparateTable => 'UserDefStyle',
3795             PrintConv => \%userDefStyles,
3796             },
3797             0x110 => {
3798             Name => 'UserDef3PictureStyle',
3799             Format => 'int16u',
3800             SeparateTable => 'UserDefStyle',
3801             PrintConv => \%userDefStyles,
3802             },
3803             0x11c => {
3804             Name => 'TimeStamp',
3805             Format => 'int32u',
3806             Groups => { 2 => 'Time' },
3807             Shift => 'Time',
3808             RawConv => '$val ? $val : undef',
3809             ValueConv => 'ConvertUnixTime($val)',
3810             ValueConvInv => 'GetUnixTime($val)',
3811             PrintConv => '$self->ConvertDateTime($val)',
3812             PrintConvInv => '$self->InverseDateTime($val)',
3813             },
3814             );
3815              
3816             # Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
3817             %Image::ExifTool::Canon::CameraInfo5DmkII = (
3818             %binaryDataAttrs,
3819             FORMAT => 'int8u',
3820             FIRST_ENTRY => 0,
3821             PRIORITY => 0,
3822             DATAMEMBER => [ 0x00, 0xea ],
3823             IS_SUBDIR => [ 0x2f7 ],
3824             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3825             NOTES => q{
3826             CameraInfo tags for the EOS 5D Mark II. Indices shown are for firmware
3827             version 1.0.6, but they may be different for other firmware versions.
3828             },
3829             0x00 => {
3830             Name => 'FirmwareVersionLookAhead',
3831             Hidden => 1,
3832             # look ahead to check location of FirmwareVersion string
3833             Format => 'undef[0x184]',
3834             RawConv => q{
3835             my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
3836             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3837             $t = substr($val, 0x17e, 6); # 2 = firmware 4.1.1/1.0.6
3838             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3839             $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
3840             $$self{CanonFirm} = 0;
3841             return undef; # not a real tag
3842             },
3843             },
3844             0x03 => { %ciFNumber },
3845             0x04 => { %ciExposureTime },
3846             0x06 => { %ciISO },
3847             0x07 => {
3848             Name => 'HighlightTonePriority',
3849             PrintConv => \%offOn,
3850             },
3851             0x1b => { %ciMacroMagnification }, #PH
3852             0x15 => { #PH (580 EX II)
3853             Name => 'FlashMeteringMode',
3854             PrintConv => {
3855             0 => 'E-TTL',
3856             3 => 'TTL',
3857             4 => 'External Auto',
3858             5 => 'External Manual',
3859             6 => 'Off',
3860             },
3861             },
3862             0x19 => { %ciCameraTemperature }, #36
3863             # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
3864             0x1e => { %ciFocalLength },
3865             0x31 => {
3866             Name => 'CameraOrientation',
3867             PrintConv => {
3868             0 => 'Horizontal (normal)',
3869             1 => 'Rotate 90 CW',
3870             2 => 'Rotate 270 CW',
3871             },
3872             },
3873             0x50 => {
3874             Name => 'FocusDistanceUpper',
3875             %focusDistanceByteSwap,
3876             },
3877             0x52 => {
3878             Name => 'FocusDistanceLower',
3879             %focusDistanceByteSwap,
3880             },
3881             0x6f => {
3882             Name => 'WhiteBalance',
3883             Format => 'int16u',
3884             SeparateTable => 1,
3885             PrintConv => \%canonWhiteBalance,
3886             },
3887             0x73 => {
3888             Name => 'ColorTemperature',
3889             Format => 'int16u',
3890             },
3891             0xa7 => {
3892             Name => 'PictureStyle',
3893             Format => 'int8u',
3894             Flags => ['PrintHex','SeparateTable'],
3895             PrintConv => \%pictureStyles,
3896             },
3897             0xbd => {
3898             Name => 'HighISONoiseReduction',
3899             PrintConv => {
3900             0 => 'Standard',
3901             1 => 'Low',
3902             2 => 'Strong',
3903             3 => 'Off',
3904             },
3905             },
3906             0xbf => {
3907             Name => 'AutoLightingOptimizer',
3908             PrintConv => {
3909             0 => 'Standard',
3910             1 => 'Low',
3911             2 => 'Strong',
3912             3 => 'Off',
3913             },
3914             },
3915             0xe6 => {
3916             Name => 'LensType',
3917             Format => 'int16uRev', # value is big-endian
3918             SeparateTable => 1,
3919             ValueConvInv => 'int($val)', # (must truncate decimal part)
3920             PrintConv => \%canonLensTypes,
3921             },
3922             0xe8 => { %ciMinFocal },
3923             0xea => { %ciMaxFocal,
3924             # offset changes after this for different firmware versions
3925             Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
3926             },
3927             0x17e => {
3928             Name => 'FirmwareVersion',
3929             Format => 'string[6]',
3930             Writable => 0, # not writable for logic reasons
3931             # some firmwares have a null instead of a space after the version number
3932             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3933             },
3934             0x1bb => {
3935             Name => 'FileIndex',
3936             Groups => { 2 => 'Image' },
3937             Format => 'int32u',
3938             ValueConv => '$val + 1',
3939             ValueConvInv => '$val - 1',
3940             },
3941             0x1c7 => { #(NC)
3942             Name => 'DirectoryIndex',
3943             Groups => { 2 => 'Image' },
3944             Format => 'int32u',
3945             ValueConv => '$val - 1',
3946             ValueConvInv => '$val + 1',
3947             },
3948             0x2f7 => { #48
3949             Name => 'PictureStyleInfo',
3950             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3951             },
3952             );
3953              
3954             # Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
3955             %Image::ExifTool::Canon::CameraInfo5DmkIII = (
3956             %binaryDataAttrs,
3957             FORMAT => 'int8u',
3958             FIRST_ENTRY => 0,
3959             PRIORITY => 0,
3960             DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
3961             IS_SUBDIR => [ 0x3b0 ],
3962             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3963             NOTES => q{
3964             CameraInfo tags for the EOS 5D Mark III. Indices shown are for firmware
3965             versions 1.0.x, but they may be different for other firmware versions.
3966             },
3967             0x00 => {
3968             Name => 'FirmwareVersionLookAhead',
3969             Hidden => 1,
3970             # look ahead to check location of FirmwareVersion string
3971             Format => 'undef[0x24d]',
3972             RawConv => q{
3973             my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
3974             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3975             $t = substr($val, 0x22d, 6); # 2 = firmware 5.2.2/5.3.1/5.4.2
3976             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3977             $t = substr($val, 0x23c, 6); # 3 = firmware 1.0.3/1.0.7
3978             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3979             $t = substr($val, 0x242, 6); # 4 = firmware 1.2.1
3980             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3981             $t = substr($val, 0x247, 6); # 5 = firmware 1.3.5
3982             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
3983             $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
3984             $$self{CanonFirm} = 0;
3985             return undef; # not a real tag
3986             },
3987             },
3988             0x03 => { %ciFNumber },
3989             0x04 => { %ciExposureTime },
3990             0x06 => { %ciISO },
3991             0x1b => { %ciCameraTemperature,
3992             # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
3993             # (and add large offset to effectively abort processing if unknown firmware)
3994             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
3995             },
3996             0x23 => { %ciFocalLength,
3997             Hook => q{
3998             $varSize -= 3 if $$self{CanonFirm} == 1;
3999             $varSize -= 2 if $$self{CanonFirm} == 2;
4000             $varSize += 6 if $$self{CanonFirm} >= 4;
4001             },
4002             },
4003             0x7d => {
4004             Name => 'CameraOrientation',
4005             PrintConv => {
4006             0 => 'Horizontal (normal)',
4007             1 => 'Rotate 90 CW',
4008             2 => 'Rotate 270 CW',
4009             },
4010             },
4011             0x8c => {
4012             Name => 'FocusDistanceUpper',
4013             %focusDistanceByteSwap,
4014             },
4015             0x8e => {
4016             Name => 'FocusDistanceLower',
4017             %focusDistanceByteSwap,
4018             Hook => q{
4019             $varSize -= 4 if $$self{CanonFirm} < 3;
4020             $varSize += 5 if $$self{CanonFirm} > 4;
4021             },
4022             },
4023             0xbc => {
4024             Name => 'WhiteBalance',
4025             Format => 'int16u',
4026             SeparateTable => 1,
4027             PrintConv => \%canonWhiteBalance,
4028             },
4029             0xc0 => {
4030             Name => 'ColorTemperature',
4031             Format => 'int16u',
4032             },
4033             0xf4 => {
4034             Name => 'PictureStyle',
4035             Format => 'int8u',
4036             Flags => ['PrintHex','SeparateTable'],
4037             PrintConv => \%pictureStyles,
4038             },
4039             0x153 => {
4040             Name => 'LensType',
4041             Format => 'int16uRev', # value is big-endian
4042             SeparateTable => 1,
4043             ValueConvInv => 'int($val)', # (must truncate decimal part)
4044             PrintConv => \%canonLensTypes,
4045             },
4046             0x155 => { %ciMinFocal },
4047             0x157 => { %ciMaxFocal,
4048             Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
4049             },
4050             0x164 => {
4051             Name => 'LensSerialNumber',
4052             Format => 'undef[5]',
4053             Priority => 0,
4054             ValueConv => 'unpack("H*",$val)',
4055             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
4056             },
4057             0x23c => {
4058             Name => 'FirmwareVersion',
4059             Format => 'string[6]',
4060             Writable => 0,
4061             },
4062             # the 5DmkIII has "User setting1" and "User setting2" file naming options:
4063             # - with "User setting1" 4 characters are selectable
4064             # - with "User setting2", 3 characters are selectable, and the 4th character
4065             # - in the file name corresponds to the image size:
4066             # L=large, M=medium, S=small1, T=small2, U=small3, _=movie
4067             # - as shipped, the first 4 characters of the file name are unique to the camera
4068             0x28c => { # used for file names like IMG_xxxx.JPG
4069             Name => 'FileIndex',
4070             Groups => { 2 => 'Image' },
4071             Format => 'int32u',
4072             ValueConv => '$val + 1',
4073             ValueConvInv => '$val - 1',
4074             },
4075             0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
4076             Name => 'FileIndex2',
4077             Groups => { 2 => 'Image' },
4078             Format => 'int32u',
4079             ValueConv => '$val + 1',
4080             ValueConvInv => '$val - 1',
4081             },
4082             0x298 => { #(NC)
4083             Name => 'DirectoryIndex',
4084             Groups => { 2 => 'Image' },
4085             Format => 'int32u',
4086             ValueConv => '$val - 1',
4087             ValueConvInv => '$val + 1',
4088             },
4089             0x29c => { #(NC)
4090             Name => 'DirectoryIndex2',
4091             Groups => { 2 => 'Image' },
4092             Format => 'int32u',
4093             ValueConv => '$val - 1',
4094             ValueConvInv => '$val + 1',
4095             },
4096             0x3b0 => {
4097             Name => 'PictureStyleInfo',
4098             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4099             },
4100             );
4101              
4102             # Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
4103             %Image::ExifTool::Canon::CameraInfo6D = (
4104             %binaryDataAttrs,
4105             FORMAT => 'int8u',
4106             FIRST_ENTRY => 0,
4107             PRIORITY => 0,
4108             IS_SUBDIR => [ 0x3c6 ],
4109             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4110             NOTES => 'CameraInfo tags for the EOS 6D.',
4111             0x03 => { %ciFNumber },
4112             0x04 => { %ciExposureTime },
4113             0x06 => { %ciISO },
4114             0x1b => { %ciCameraTemperature },
4115             0x23 => { %ciFocalLength },
4116             0x83 => { # (5DmkIII + 6)
4117             Name => 'CameraOrientation',
4118             PrintConv => {
4119             0 => 'Horizontal (normal)',
4120             1 => 'Rotate 90 CW',
4121             2 => 'Rotate 270 CW',
4122             },
4123             },
4124             0x92 => { # (5DmkIII + 6)
4125             Name => 'FocusDistanceUpper',
4126             %focusDistanceByteSwap,
4127             },
4128             0x94 => { # (5DmkIII + 6)
4129             Name => 'FocusDistanceLower',
4130             %focusDistanceByteSwap,
4131             },
4132             0xc2 => { # (5DmkIII + 6)
4133             Name => 'WhiteBalance',
4134             Format => 'int16u',
4135             SeparateTable => 1,
4136             PrintConv => \%canonWhiteBalance,
4137             },
4138             0xc6 => { # (5DmkIII + 6)
4139             Name => 'ColorTemperature',
4140             Format => 'int16u',
4141             },
4142             0xfa => { # (5DmkIII + 6)
4143             Name => 'PictureStyle',
4144             Format => 'int8u',
4145             Flags => ['PrintHex','SeparateTable'],
4146             PrintConv => \%pictureStyles,
4147             },
4148             0x161 => { # (5DmkIII + 0x0e)
4149             Name => 'LensType',
4150             Format => 'int16uRev', # value is big-endian
4151             SeparateTable => 1,
4152             ValueConvInv => 'int($val)', # (must truncate decimal part)
4153             PrintConv => \%canonLensTypes,
4154             },
4155             0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
4156             0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
4157             0x256 => { # (5DmkIII + 0x1a)
4158             Name => 'FirmwareVersion',
4159             Format => 'string[6]',
4160             Writable => 0,
4161             },
4162             0x2aa => { # (5DmkIII + 0x16 or 0x1e)
4163             Name => 'FileIndex',
4164             Groups => { 2 => 'Image' },
4165             Format => 'int32u',
4166             ValueConv => '$val + 1',
4167             ValueConvInv => '$val - 1',
4168             },
4169             0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
4170             Name => 'DirectoryIndex',
4171             Groups => { 2 => 'Image' },
4172             Format => 'int32u',
4173             ValueConv => '$val - 1',
4174             ValueConvInv => '$val + 1',
4175             },
4176             0x3c6 => { # (5DmkIII + 0x16)
4177             Name => 'PictureStyleInfo',
4178             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4179             },
4180             );
4181              
4182             # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
4183             %Image::ExifTool::Canon::CameraInfo7D = (
4184             %binaryDataAttrs,
4185             FORMAT => 'int8u',
4186             FIRST_ENTRY => 0,
4187             PRIORITY => 0,
4188             DATAMEMBER => [ 0x00, 0x1e ],
4189             IS_SUBDIR => [ 0x327 ],
4190             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4191             NOTES => q{
4192             CameraInfo tags for the EOS 7D. Indices shown are for firmware versions
4193             1.0.x, but they may be different for other firmware versions.
4194             },
4195             0x00 => {
4196             Name => 'FirmwareVersionLookAhead',
4197             Hidden => 1,
4198             # look ahead to check location of FirmwareVersion string
4199             Format => 'undef[0x1b2]',
4200             RawConv => q{
4201             my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
4202             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4203             $t = substr($val, 0x1ac, 6); # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
4204             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4205             $self->Warn('Unrecognized CameraInfo7D firmware version');
4206             $$self{CanonFirm} = 0;
4207             return undef; # not a real tag
4208             },
4209             },
4210             0x03 => { %ciFNumber },
4211             0x04 => { %ciExposureTime },
4212             0x06 => { %ciISO },
4213             0x07 => {
4214             Name => 'HighlightTonePriority',
4215             PrintConv => \%offOn,
4216             },
4217             0x08 => { #37
4218             Name => 'MeasuredEV2',
4219             Description => 'Measured EV 2',
4220             RawConv => '$val ? $val : undef',
4221             ValueConv => '$val / 8 - 6',
4222             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4223             },
4224             0x09 => { #37
4225             Name => 'MeasuredEV',
4226             Description => 'Measured EV',
4227             RawConv => '$val ? $val : undef',
4228             ValueConv => '$val / 8 - 6',
4229             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4230             },
4231             0x15 => { #PH (580 EX II)
4232             Name => 'FlashMeteringMode',
4233             PrintConv => {
4234             0 => 'E-TTL',
4235             3 => 'TTL',
4236             4 => 'External Auto',
4237             5 => 'External Manual',
4238             6 => 'Off',
4239             },
4240             },
4241             0x19 => { %ciCameraTemperature },
4242             0x1e => { %ciFocalLength,
4243             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4244             },
4245             0x35 => {
4246             Name => 'CameraOrientation',
4247             PrintConv => {
4248             0 => 'Horizontal (normal)',
4249             1 => 'Rotate 90 CW',
4250             2 => 'Rotate 270 CW',
4251             },
4252             },
4253             0x54 => {
4254             Name => 'FocusDistanceUpper',
4255             %focusDistanceByteSwap,
4256             },
4257             0x56 => {
4258             Name => 'FocusDistanceLower',
4259             %focusDistanceByteSwap,
4260             },
4261             0x77 => {
4262             Name => 'WhiteBalance',
4263             Format => 'int16u',
4264             SeparateTable => 1,
4265             PrintConv => \%canonWhiteBalance,
4266             },
4267             0x7b => {
4268             Name => 'ColorTemperature',
4269             Format => 'int16u',
4270             },
4271             0xaf => {
4272             Name => 'CameraPictureStyle',
4273             PrintHex => 1,
4274             PrintConv => {
4275             0x81 => 'Standard',
4276             0x82 => 'Portrait',
4277             0x83 => 'Landscape',
4278             0x84 => 'Neutral',
4279             0x85 => 'Faithful',
4280             0x86 => 'Monochrome',
4281             0x21 => 'User Defined 1',
4282             0x22 => 'User Defined 2',
4283             0x23 => 'User Defined 3',
4284             },
4285             },
4286             0xc9 => {
4287             Name => 'HighISONoiseReduction',
4288             PrintConv => {
4289             0 => 'Standard',
4290             1 => 'Low',
4291             2 => 'Strong',
4292             3 => 'Off',
4293             },
4294             },
4295             0x112 => {
4296             Name => 'LensType',
4297             Format => 'int16uRev', # value is big-endian
4298             SeparateTable => 1,
4299             ValueConvInv => 'int($val)', # (must truncate decimal part)
4300             PrintConv => \%canonLensTypes,
4301             },
4302             0x114 => { %ciMinFocal },
4303             0x116 => { %ciMaxFocal },
4304             0x1ac => {
4305             Name => 'FirmwareVersion',
4306             Format => 'string[6]',
4307             Writable => 0, # not writable for logic reasons
4308             # some firmwares have a null instead of a space after the version number
4309             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4310             },
4311             0x1eb => {
4312             Name => 'FileIndex',
4313             Groups => { 2 => 'Image' },
4314             Format => 'int32u',
4315             ValueConv => '$val + 1',
4316             ValueConvInv => '$val - 1',
4317             },
4318             0x1f7 => { #(NC)
4319             Name => 'DirectoryIndex',
4320             Groups => { 2 => 'Image' },
4321             Format => 'int32u',
4322             ValueConv => '$val - 1',
4323             ValueConvInv => '$val + 1',
4324             },
4325             0x327 => { #48
4326             Name => 'PictureStyleInfo',
4327             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4328             },
4329             );
4330              
4331             # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
4332             %Image::ExifTool::Canon::CameraInfo40D = (
4333             %binaryDataAttrs,
4334             FORMAT => 'int8u',
4335             FIRST_ENTRY => 0,
4336             PRIORITY => 0,
4337             IS_SUBDIR => [ 0x25b ],
4338             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4339             NOTES => 'CameraInfo tags for the EOS 40D.',
4340             0x03 => { %ciFNumber }, #PH
4341             0x04 => { %ciExposureTime }, #PH
4342             0x06 => { %ciISO }, #PH
4343             0x15 => { #PH (580 EX II)
4344             Name => 'FlashMeteringMode',
4345             PrintConv => {
4346             0 => 'E-TTL',
4347             3 => 'TTL',
4348             4 => 'External Auto',
4349             5 => 'External Manual',
4350             6 => 'Off',
4351             },
4352             },
4353             0x18 => { %ciCameraTemperature }, #36
4354             0x1b => { %ciMacroMagnification }, #PH
4355             0x1d => { %ciFocalLength }, #PH
4356             0x30 => { #20
4357             Name => 'CameraOrientation',
4358             PrintConv => {
4359             0 => 'Horizontal (normal)',
4360             1 => 'Rotate 90 CW',
4361             2 => 'Rotate 270 CW',
4362             },
4363             },
4364             0x43 => { #21/24
4365             Name => 'FocusDistanceUpper',
4366             # this is very odd (little-endian number on odd boundary),
4367             # but it does seem to work better with my sample images - PH
4368             %focusDistanceByteSwap,
4369             },
4370             0x45 => { #21/24
4371             Name => 'FocusDistanceLower',
4372             %focusDistanceByteSwap,
4373             },
4374             0x6f => { #15
4375             Name => 'WhiteBalance',
4376             Format => 'int16u',
4377             PrintConv => \%canonWhiteBalance,
4378             SeparateTable => 1,
4379             },
4380             0x73 => { #15
4381             Name => 'ColorTemperature',
4382             Format => 'int16u',
4383             },
4384             0xd6 => { #15
4385             Name => 'LensType',
4386             Format => 'int16uRev', # value is big-endian
4387             SeparateTable => 1,
4388             ValueConvInv => 'int($val)', # (must truncate decimal part)
4389             PrintConv => \%canonLensTypes,
4390             },
4391             0xd8 => { %ciMinFocal }, #15
4392             0xda => { %ciMaxFocal }, #15
4393             0xff => { #15
4394             Name => 'FirmwareVersion',
4395             Format => 'string[6]',
4396             },
4397             0x133 => { #27
4398             Name => 'FileIndex',
4399             Groups => { 2 => 'Image' },
4400             Format => 'int32u',
4401             Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
4402             ValueConv => '$val + 1',
4403             ValueConvInv => '$val - 1',
4404             },
4405             0x13f => { #27
4406             Name => 'DirectoryIndex',
4407             Groups => { 2 => 'Image' },
4408             Format => 'int32u',
4409             ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
4410             ValueConvInv => '$val + 1',
4411             },
4412             0x25b => {
4413             Name => 'PictureStyleInfo',
4414             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4415             },
4416             0x92b => { #33
4417             Name => 'LensModel',
4418             Format => 'string[64]',
4419             },
4420             );
4421              
4422             # Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
4423             %Image::ExifTool::Canon::CameraInfo50D = (
4424             %binaryDataAttrs,
4425             FORMAT => 'int8u',
4426             FIRST_ENTRY => 0,
4427             PRIORITY => 0,
4428             DATAMEMBER => [ 0x00, 0xee ],
4429             IS_SUBDIR => [ 0x2d7 ],
4430             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4431             NOTES => q{
4432             CameraInfo tags for the EOS 50D. Indices shown are for firmware versions
4433             1.0.x, but they may be different for other firmware versions.
4434             },
4435             0x00 => {
4436             Name => 'FirmwareVersionLookAhead',
4437             Hidden => 1,
4438             # look ahead to check location of FirmwareVersion string
4439             Format => 'undef[0x164]',
4440             RawConv => q{
4441             my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
4442             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4443             $t = substr($val, 0x15e, 6); # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
4444             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4445             $self->Warn('Unrecognized CameraInfo50D firmware version');
4446             $$self{CanonFirm} = 0;
4447             return undef; # not a real tag
4448             },
4449             },
4450             0x03 => { %ciFNumber },
4451             0x04 => { %ciExposureTime },
4452             0x06 => { %ciISO },
4453             0x07 => {
4454             Name => 'HighlightTonePriority',
4455             PrintConv => \%offOn,
4456             },
4457             0x15 => { #PH (580 EX II)
4458             Name => 'FlashMeteringMode',
4459             PrintConv => {
4460             0 => 'E-TTL',
4461             3 => 'TTL',
4462             4 => 'External Auto',
4463             5 => 'External Manual',
4464             6 => 'Off',
4465             },
4466             },
4467             0x19 => { %ciCameraTemperature }, #36
4468             0x1e => { %ciFocalLength },
4469             0x31 => {
4470             Name => 'CameraOrientation',
4471             PrintConv => {
4472             0 => 'Horizontal (normal)',
4473             1 => 'Rotate 90 CW',
4474             2 => 'Rotate 270 CW',
4475             },
4476             },
4477             0x50 => { #33
4478             Name => 'FocusDistanceUpper',
4479             %focusDistanceByteSwap,
4480             },
4481             0x52 => { #33
4482             Name => 'FocusDistanceLower',
4483             %focusDistanceByteSwap,
4484             },
4485             0x6f => {
4486             Name => 'WhiteBalance',
4487             Format => 'int16u',
4488             SeparateTable => 1,
4489             PrintConv => \%canonWhiteBalance,
4490             },
4491             0x73 => { #33
4492             Name => 'ColorTemperature',
4493             Format => 'int16u',
4494             },
4495             0xa7 => {
4496             Name => 'PictureStyle',
4497             Format => 'int8u',
4498             Flags => ['PrintHex','SeparateTable'],
4499             PrintConv => \%pictureStyles,
4500             },
4501             0xbd => {
4502             Name => 'HighISONoiseReduction',
4503             PrintConv => {
4504             0 => 'Standard',
4505             1 => 'Low',
4506             2 => 'Strong',
4507             3 => 'Off',
4508             },
4509             },
4510             0xbf => {
4511             Name => 'AutoLightingOptimizer',
4512             PrintConv => {
4513             0 => 'Standard',
4514             1 => 'Low',
4515             2 => 'Strong',
4516             3 => 'Off',
4517             },
4518             },
4519             0xea => { #33
4520             Name => 'LensType',
4521             Format => 'int16uRev', # value is big-endian
4522             SeparateTable => 1,
4523             ValueConvInv => 'int($val)', # (must truncate decimal part)
4524             PrintConv => \%canonLensTypes,
4525             },
4526             0xec => { %ciMinFocal },
4527             0xee => { %ciMaxFocal,
4528             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4529             },
4530             0x15e => { #33
4531             Name => 'FirmwareVersion',
4532             Format => 'string[6]',
4533             Writable => 0,
4534             },
4535             0x19b => {
4536             Name => 'FileIndex',
4537             Groups => { 2 => 'Image' },
4538             Format => 'int32u',
4539             ValueConv => '$val + 1',
4540             ValueConvInv => '$val - 1',
4541             },
4542             0x1a7 => { #(NC)
4543             Name => 'DirectoryIndex',
4544             Groups => { 2 => 'Image' },
4545             Format => 'int32u',
4546             ValueConv => '$val - 1',
4547             ValueConvInv => '$val + 1',
4548             },
4549             0x2d7 => {
4550             Name => 'PictureStyleInfo',
4551             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4552             },
4553             );
4554              
4555             # Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
4556             # NOTE: Can probably borrow more 50D tags here, possibly with an offset
4557             %Image::ExifTool::Canon::CameraInfo60D = (
4558             %binaryDataAttrs,
4559             FORMAT => 'int8u',
4560             FIRST_ENTRY => 0,
4561             PRIORITY => 0,
4562             IS_SUBDIR => [ 0x2f9, 0x321 ],
4563             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4564             NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
4565             0x03 => { %ciFNumber },
4566             0x04 => { %ciExposureTime },
4567             0x06 => { %ciISO },
4568             0x19 => { %ciCameraTemperature },
4569             0x1e => { %ciFocalLength },
4570             0x36 => {
4571             Name => 'CameraOrientation',
4572             Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
4573             Notes => '60D only',
4574             PrintConv => {
4575             0 => 'Horizontal (normal)',
4576             1 => 'Rotate 90 CW',
4577             2 => 'Rotate 270 CW',
4578             },
4579             },
4580             0x3a => { #IB
4581             Name => 'CameraOrientation',
4582             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4583             Notes => '1200D only',
4584             PrintConv => {
4585             0 => 'Horizontal (normal)',
4586             1 => 'Rotate 90 CW',
4587             2 => 'Rotate 270 CW',
4588             },
4589             },
4590             0x55 => {
4591             Name => 'FocusDistanceUpper',
4592             Condition => '$$self{Model} =~ /EOS 60D$/',
4593             Notes => '60D only',
4594             %focusDistanceByteSwap,
4595             },
4596             0x57 => {
4597             Name => 'FocusDistanceLower',
4598             Condition => '$$self{Model} =~ /EOS 60D$/',
4599             Notes => '60D only',
4600             %focusDistanceByteSwap,
4601             },
4602             0x7d => {
4603             Name => 'ColorTemperature',
4604             Condition => '$$self{Model} =~ /EOS 60D$/',
4605             Notes => '60D only',
4606             Format => 'int16u',
4607             },
4608             0xe8 => {
4609             Name => 'LensType',
4610             Format => 'int16uRev', # value is big-endian
4611             SeparateTable => 1,
4612             ValueConvInv => 'int($val)', # (must truncate decimal part)
4613             PrintConv => \%canonLensTypes,
4614             },
4615             0xea => { %ciMinFocal },
4616             0xec => { %ciMaxFocal },
4617             0x199 => { # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
4618             Name => 'FirmwareVersion',
4619             Format => 'string[6]',
4620             Writable => 0,
4621             },
4622             0x1d9 => {
4623             Name => 'FileIndex',
4624             Condition => '$$self{Model} =~ /EOS 60D$/',
4625             Notes => '60D only',
4626             Groups => { 2 => 'Image' },
4627             Format => 'int32u',
4628             ValueConv => '$val + 1',
4629             ValueConvInv => '$val - 1',
4630             },
4631             0x1e5 => { #(NC)
4632             Name => 'DirectoryIndex',
4633             Condition => '$$self{Model} =~ /EOS 60D$/',
4634             Notes => '60D only',
4635             Groups => { 2 => 'Image' },
4636             Format => 'int32u',
4637             ValueConv => '$val - 1',
4638             ValueConvInv => '$val + 1',
4639             },
4640             0x2f9 => {
4641             Name => 'PictureStyleInfo',
4642             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4643             Notes => '1200D',
4644             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4645             },
4646             0x321 => {
4647             Name => 'PictureStyleInfo',
4648             Condition => '$$self{Model} =~ /EOS 60D$/',
4649             Notes => '60D',
4650             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4651             },
4652             );
4653              
4654             # Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
4655             %Image::ExifTool::Canon::CameraInfo70D = (
4656             %binaryDataAttrs,
4657             FORMAT => 'int8u',
4658             FIRST_ENTRY => 0,
4659             PRIORITY => 0,
4660             IS_SUBDIR => [ 0x3cf ],
4661             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4662             NOTES => 'CameraInfo tags for the EOS 70D.',
4663             0x03 => { %ciFNumber },
4664             0x04 => { %ciExposureTime },
4665             0x06 => { %ciISO },
4666             0x1b => { %ciCameraTemperature },
4667             0x23 => { %ciFocalLength },
4668             # 0x36 - focal length again?
4669             0x84 => {
4670             Name => 'CameraOrientation',
4671             PrintConv => {
4672             0 => 'Horizontal (normal)',
4673             1 => 'Rotate 90 CW',
4674             2 => 'Rotate 270 CW',
4675             },
4676             },
4677             0x93 => {
4678             Name => 'FocusDistanceUpper',
4679             %focusDistanceByteSwap,
4680             },
4681             0x95 => {
4682             Name => 'FocusDistanceLower',
4683             %focusDistanceByteSwap,
4684             },
4685             0xc7 => {
4686             Name => 'ColorTemperature',
4687             Format => 'int16u',
4688             },
4689             0x166 => {
4690             Name => 'LensType',
4691             Format => 'int16uRev', # value is big-endian
4692             SeparateTable => 1,
4693             ValueConvInv => 'int($val)', # (must truncate decimal part)
4694             PrintConv => \%canonLensTypes,
4695             },
4696             0x168 => { %ciMinFocal },
4697             0x16a => { %ciMaxFocal },
4698             0x25e => { # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
4699             Name => 'FirmwareVersion',
4700             Format => 'string[6]',
4701             Writable => 0,
4702             },
4703             0x2b3 => {
4704             Name => 'FileIndex',
4705             Groups => { 2 => 'Image' },
4706             Format => 'int32u',
4707             ValueConv => '$val + 1',
4708             ValueConvInv => '$val - 1',
4709             },
4710             0x2bf => { #(NC)
4711             Name => 'DirectoryIndex',
4712             Groups => { 2 => 'Image' },
4713             Format => 'int32u',
4714             ValueConv => '$val - 1',
4715             ValueConvInv => '$val + 1',
4716             },
4717             0x3cf => { #48
4718             Name => 'PictureStyleInfo',
4719             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4720             },
4721             );
4722              
4723             # Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
4724             %Image::ExifTool::Canon::CameraInfo80D = (
4725             %binaryDataAttrs,
4726             FORMAT => 'int8u',
4727             FIRST_ENTRY => 0,
4728             PRIORITY => 0,
4729             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4730             NOTES => 'CameraInfo tags for the EOS 80D.',
4731             0x03 => { %ciFNumber },
4732             0x04 => { %ciExposureTime },
4733             0x06 => { %ciISO },
4734             0x1b => { %ciCameraTemperature },
4735             0x23 => { %ciFocalLength },
4736             0x96 => {
4737             Name => 'CameraOrientation',
4738             PrintConv => {
4739             0 => 'Horizontal (normal)',
4740             1 => 'Rotate 90 CW',
4741             2 => 'Rotate 270 CW',
4742             },
4743             },
4744             0xa5 => {
4745             Name => 'FocusDistanceUpper',
4746             %focusDistanceByteSwap,
4747             },
4748             0xa7 => {
4749             Name => 'FocusDistanceLower',
4750             %focusDistanceByteSwap,
4751             },
4752             0x13a => {
4753             Name => 'ColorTemperature',
4754             Format => 'int16u',
4755             },
4756             0x189 => {
4757             Name => 'LensType',
4758             Format => 'int16uRev', # value is big-endian
4759             SeparateTable => 1,
4760             ValueConvInv => 'int($val)', # (must truncate decimal part)
4761             PrintConv => \%canonLensTypes,
4762             },
4763             0x18b => { %ciMinFocal },
4764             0x18d => { %ciMaxFocal },
4765             0x45a => { # (at this location for firmware 1.0.1)
4766             Name => 'FirmwareVersion',
4767             Format => 'string[6]',
4768             Writable => 0,
4769             },
4770             0x4ae => {
4771             Name => 'FileIndex',
4772             Groups => { 2 => 'Image' },
4773             Format => 'int32u',
4774             ValueConv => '$val + 1',
4775             ValueConvInv => '$val - 1',
4776             },
4777             0x4ba => { #(NC)
4778             Name => 'DirectoryIndex',
4779             Groups => { 2 => 'Image' },
4780             Format => 'int32u',
4781             ValueConv => '$val - 1',
4782             ValueConvInv => '$val + 1',
4783             },
4784             );
4785              
4786             # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
4787             %Image::ExifTool::Canon::CameraInfo450D = (
4788             %binaryDataAttrs,
4789             FORMAT => 'int8u',
4790             FIRST_ENTRY => 0,
4791             PRIORITY => 0,
4792             IS_SUBDIR => [ 0x263 ],
4793             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4794             NOTES => 'CameraInfo tags for the EOS 450D.',
4795             0x03 => { %ciFNumber }, #PH
4796             0x04 => { %ciExposureTime }, #PH
4797             0x06 => { %ciISO }, #PH
4798             0x15 => { #PH (580 EX II)
4799             Name => 'FlashMeteringMode',
4800             PrintConv => {
4801             0 => 'E-TTL',
4802             3 => 'TTL',
4803             4 => 'External Auto',
4804             5 => 'External Manual',
4805             6 => 'Off',
4806             },
4807             },
4808             0x18 => { %ciCameraTemperature }, #36
4809             0x1b => { %ciMacroMagnification }, #PH
4810             0x1d => { %ciFocalLength }, #PH
4811             0x30 => { #20
4812             Name => 'CameraOrientation',
4813             PrintConv => {
4814             0 => 'Horizontal (normal)',
4815             1 => 'Rotate 90 CW',
4816             2 => 'Rotate 270 CW',
4817             },
4818             },
4819             0x43 => { #20
4820             Name => 'FocusDistanceUpper',
4821             # this is very odd (little-endian number on odd boundary),
4822             # but it does seem to work better with my sample images - PH
4823             %focusDistanceByteSwap,
4824             },
4825             0x45 => { #20
4826             Name => 'FocusDistanceLower',
4827             %focusDistanceByteSwap,
4828             },
4829             0x6f => { #PH
4830             Name => 'WhiteBalance',
4831             Format => 'int16u',
4832             PrintConv => \%canonWhiteBalance,
4833             SeparateTable => 1,
4834             },
4835             0x73 => { #PH
4836             Name => 'ColorTemperature',
4837             Format => 'int16u',
4838             },
4839             0xde => { #33
4840             Name => 'LensType',
4841             Format => 'int16uRev', # value is big-endian
4842             SeparateTable => 1,
4843             ValueConvInv => 'int($val)', # (must truncate decimal part)
4844             PrintConv => \%canonLensTypes,
4845             },
4846             0x107 => { #PH
4847             Name => 'FirmwareVersion',
4848             Format => 'string[6]',
4849             },
4850             0x10f => { #20
4851             Name => 'OwnerName',
4852             Format => 'string[32]',
4853             },
4854             0x133 => { #20
4855             Name => 'DirectoryIndex',
4856             Groups => { 2 => 'Image' },
4857             Format => 'int32u',
4858             },
4859             0x13f => { #20
4860             Name => 'FileIndex',
4861             Groups => { 2 => 'Image' },
4862             Format => 'int32u',
4863             ValueConv => '$val + 1',
4864             ValueConvInv => '$val - 1',
4865             },
4866             0x263 => { #PH
4867             Name => 'PictureStyleInfo',
4868             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4869             },
4870             0x933 => { #33
4871             Name => 'LensModel',
4872             Format => 'string[64]',
4873             },
4874             );
4875              
4876             # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
4877             %Image::ExifTool::Canon::CameraInfo500D = (
4878             %binaryDataAttrs,
4879             FORMAT => 'int8u',
4880             FIRST_ENTRY => 0,
4881             PRIORITY => 0,
4882             IS_SUBDIR => [ 0x30b ],
4883             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4884             NOTES => 'CameraInfo tags for the EOS 500D.',
4885             0x03 => { %ciFNumber },
4886             0x04 => { %ciExposureTime },
4887             0x06 => { %ciISO },
4888             0x07 => {
4889             Name => 'HighlightTonePriority',
4890             PrintConv => \%offOn,
4891             },
4892             0x15 => { #PH (580 EX II)
4893             Name => 'FlashMeteringMode',
4894             PrintConv => {
4895             0 => 'E-TTL',
4896             3 => 'TTL',
4897             4 => 'External Auto',
4898             5 => 'External Manual',
4899             6 => 'Off',
4900             },
4901             },
4902             0x19 => { %ciCameraTemperature },
4903             0x1e => { %ciFocalLength },
4904             0x31 => {
4905             Name => 'CameraOrientation',
4906             PrintConv => {
4907             0 => 'Horizontal (normal)',
4908             1 => 'Rotate 90 CW',
4909             2 => 'Rotate 270 CW',
4910             },
4911             },
4912             0x50 => {
4913             Name => 'FocusDistanceUpper',
4914             %focusDistanceByteSwap,
4915             },
4916             0x52 => {
4917             Name => 'FocusDistanceLower',
4918             %focusDistanceByteSwap,
4919             },
4920             0x73 => { # (50D + 4)
4921             Name => 'WhiteBalance',
4922             Format => 'int16u',
4923             SeparateTable => 1,
4924             PrintConv => \%canonWhiteBalance,
4925             },
4926             0x77 => { # (50D + 4)
4927             Name => 'ColorTemperature',
4928             Format => 'int16u',
4929             },
4930             0xab => { # (50D + 4)
4931             Name => 'PictureStyle',
4932             Format => 'int8u',
4933             Flags => ['PrintHex','SeparateTable'],
4934             PrintConv => \%pictureStyles,
4935             },
4936             0xbc => {
4937             Name => 'HighISONoiseReduction',
4938             PrintConv => {
4939             0 => 'Standard',
4940             1 => 'Low',
4941             2 => 'Strong',
4942             3 => 'Off',
4943             },
4944             },
4945             0xbe => {
4946             Name => 'AutoLightingOptimizer',
4947             PrintConv => {
4948             0 => 'Standard',
4949             1 => 'Low',
4950             2 => 'Strong',
4951             3 => 'Off',
4952             },
4953             },
4954             0xf6 => {
4955             Name => 'LensType',
4956             Format => 'int16uRev', # value is big-endian
4957             SeparateTable => 1,
4958             ValueConvInv => 'int($val)', # (must truncate decimal part)
4959             PrintConv => \%canonLensTypes,
4960             },
4961             0xf8 => { %ciMinFocal },
4962             0xfa => { %ciMaxFocal },
4963             0x190 => {
4964             Name => 'FirmwareVersion',
4965             Format => 'string[6]',
4966             Writable => 0,
4967             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4968             },
4969             0x1d3 => {
4970             Name => 'FileIndex',
4971             Groups => { 2 => 'Image' },
4972             Format => 'int32u',
4973             ValueConv => '$val + 1',
4974             ValueConvInv => '$val - 1',
4975             },
4976             0x1df => { #(NC)
4977             Name => 'DirectoryIndex',
4978             Groups => { 2 => 'Image' },
4979             Format => 'int32u',
4980             ValueConv => '$val - 1',
4981             ValueConvInv => '$val + 1',
4982             },
4983             0x30b => {
4984             Name => 'PictureStyleInfo',
4985             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4986             },
4987             );
4988              
4989             # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
4990             %Image::ExifTool::Canon::CameraInfo550D = (
4991             %binaryDataAttrs,
4992             FORMAT => 'int8u',
4993             FIRST_ENTRY => 0,
4994             PRIORITY => 0,
4995             IS_SUBDIR => [ 0x31c ],
4996             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4997             NOTES => 'CameraInfo tags for the EOS 550D.',
4998             0x03 => { %ciFNumber },
4999             0x04 => { %ciExposureTime },
5000             0x06 => { %ciISO },
5001             0x07 => { #(NC)
5002             Name => 'HighlightTonePriority',
5003             PrintConv => \%offOn,
5004             },
5005             0x15 => { #(NC)
5006             Name => 'FlashMeteringMode',
5007             PrintConv => {
5008             0 => 'E-TTL',
5009             3 => 'TTL',
5010             4 => 'External Auto',
5011             5 => 'External Manual',
5012             6 => 'Off',
5013             },
5014             },
5015             0x19 => { %ciCameraTemperature }, # (500D + 0)
5016             0x1e => { %ciFocalLength }, # (500D + 0)
5017             0x35 => { # (500D + 4)
5018             Name => 'CameraOrientation',
5019             PrintConv => {
5020             0 => 'Horizontal (normal)',
5021             1 => 'Rotate 90 CW',
5022             2 => 'Rotate 270 CW',
5023             },
5024             },
5025             0x54 => { # (500D + 4)
5026             Name => 'FocusDistanceUpper',
5027             %focusDistanceByteSwap,
5028             },
5029             0x56 => { # (500D + 4)
5030             Name => 'FocusDistanceLower',
5031             %focusDistanceByteSwap,
5032             },
5033             0x78 => { # (500D + 5) (NC)
5034             Name => 'WhiteBalance',
5035             Format => 'int16u',
5036             SeparateTable => 1,
5037             PrintConv => \%canonWhiteBalance,
5038             },
5039             0x7c => { # (500D + 5)
5040             Name => 'ColorTemperature',
5041             Format => 'int16u',
5042             },
5043             0xb0 => { # (500D + 5)
5044             Name => 'PictureStyle',
5045             Format => 'int8u',
5046             Flags => ['PrintHex','SeparateTable'],
5047             PrintConv => \%pictureStyles,
5048             },
5049             0xff => { # (500D + 9)
5050             Name => 'LensType',
5051             Format => 'int16uRev', # value is big-endian
5052             SeparateTable => 1,
5053             ValueConvInv => 'int($val)', # (must truncate decimal part)
5054             PrintConv => \%canonLensTypes,
5055             },
5056             0x101 => { %ciMinFocal }, # (500D + 9)
5057             0x103 => { %ciMaxFocal }, # (500D + 9)
5058             0x1a4 => { # (500D + 0x11)
5059             Name => 'FirmwareVersion',
5060             Format => 'string[6]',
5061             Writable => 0,
5062             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5063             },
5064             0x1e4 => { # (500D + 0x11)
5065             Name => 'FileIndex',
5066             Groups => { 2 => 'Image' },
5067             Format => 'int32u',
5068             ValueConv => '$val + 1',
5069             ValueConvInv => '$val - 1',
5070             },
5071             0x1f0 => { # (500D + 0x11) (NC)
5072             Name => 'DirectoryIndex',
5073             Groups => { 2 => 'Image' },
5074             Format => 'int32u',
5075             ValueConv => '$val - 1',
5076             ValueConvInv => '$val + 1',
5077             },
5078             0x31c => { #48
5079             Name => 'PictureStyleInfo',
5080             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5081             },
5082             );
5083              
5084             # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
5085             %Image::ExifTool::Canon::CameraInfo600D = (
5086             %binaryDataAttrs,
5087             FORMAT => 'int8u',
5088             FIRST_ENTRY => 0,
5089             PRIORITY => 0,
5090             IS_SUBDIR => [ 0x2fb ],
5091             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5092             NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
5093             0x03 => { %ciFNumber },
5094             0x04 => { %ciExposureTime },
5095             0x06 => { %ciISO },
5096             0x07 => { #(NC)
5097             Name => 'HighlightTonePriority',
5098             PrintConv => \%offOn,
5099             },
5100             0x15 => { #(NC)
5101             Name => 'FlashMeteringMode',
5102             PrintConv => {
5103             0 => 'E-TTL',
5104             3 => 'TTL',
5105             4 => 'External Auto',
5106             5 => 'External Manual',
5107             6 => 'Off',
5108             },
5109             },
5110             0x19 => { %ciCameraTemperature }, # (60D + 0)
5111             0x1e => { %ciFocalLength }, # (60D + 0)
5112             0x38 => { # (60D + 2)
5113             Name => 'CameraOrientation',
5114             PrintConv => {
5115             0 => 'Horizontal (normal)',
5116             1 => 'Rotate 90 CW',
5117             2 => 'Rotate 270 CW',
5118             },
5119             },
5120             0x57 => { # (60D + 2, 550D + 3)
5121             Name => 'FocusDistanceUpper',
5122             %focusDistanceByteSwap,
5123             },
5124             0x59 => { # (60D + 2, 550D + 3)
5125             Name => 'FocusDistanceLower',
5126             %focusDistanceByteSwap,
5127             },
5128             0x7b => { # (550D + 3)
5129             Name => 'WhiteBalance',
5130             Format => 'int16u',
5131             SeparateTable => 1,
5132             PrintConv => \%canonWhiteBalance,
5133             },
5134             0x7f => { # (60D + 2, 550D + 3)
5135             Name => 'ColorTemperature',
5136             Format => 'int16u',
5137             },
5138             0xb3 => { # (550D + 3)
5139             Name => 'PictureStyle',
5140             Format => 'int8u',
5141             Flags => ['PrintHex','SeparateTable'],
5142             PrintConv => \%pictureStyles,
5143             },
5144             0xea => { # (60D + 2, 550D + 3)
5145             Name => 'LensType',
5146             Format => 'int16uRev', # value is big-endian
5147             SeparateTable => 1,
5148             ValueConvInv => 'int($val)', # (must truncate decimal part)
5149             PrintConv => \%canonLensTypes,
5150             },
5151             0xec => { %ciMinFocal }, # (60D + 2)
5152             0xee => { %ciMaxFocal }, # (60D + 2)
5153             0x19b => { # (60D + 2)
5154             Name => 'FirmwareVersion',
5155             Format => 'string[6]',
5156             Writable => 0,
5157             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5158             },
5159             0x1db => { # (60D + 2) (NC)
5160             Name => 'FileIndex',
5161             Groups => { 2 => 'Image' },
5162             Format => 'int32u',
5163             ValueConv => '$val + 1',
5164             ValueConvInv => '$val - 1',
5165             },
5166             0x1e7 => { # (60D + 2) (NC)
5167             Name => 'DirectoryIndex',
5168             Groups => { 2 => 'Image' },
5169             Format => 'int32u',
5170             ValueConv => '$val - 1',
5171             ValueConvInv => '$val + 1',
5172             },
5173             0x2fb => {
5174             Name => 'PictureStyleInfo',
5175             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5176             },
5177             );
5178              
5179             # Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
5180             %Image::ExifTool::Canon::CameraInfo650D = (
5181             %binaryDataAttrs,
5182             FORMAT => 'int8u',
5183             FIRST_ENTRY => 0,
5184             PRIORITY => 0,
5185             IS_SUBDIR => [ 0x390 ],
5186             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5187             NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
5188             0x03 => { %ciFNumber },
5189             0x04 => { %ciExposureTime },
5190             0x06 => { %ciISO },
5191             0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
5192             0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
5193             # 0x35 - seems to be the same as 0x54
5194             0x7d => { # (1DX/5DmkIII + 3)
5195             Name => 'CameraOrientation',
5196             PrintConv => {
5197             0 => 'Horizontal (normal)',
5198             1 => 'Rotate 90 CW',
5199             2 => 'Rotate 270 CW',
5200             },
5201             },
5202             0x8c => { # (1DX + 3)
5203             Name => 'FocusDistanceUpper',
5204             %focusDistanceByteSwap,
5205             },
5206             0x8e => { # (1DX + 3)
5207             Name => 'FocusDistanceLower',
5208             %focusDistanceByteSwap,
5209             },
5210             0xbc => { # (1DX + 7)
5211             Name => 'WhiteBalance',
5212             Format => 'int16u',
5213             SeparateTable => 1,
5214             PrintConv => \%canonWhiteBalance,
5215             },
5216             0xc0 => { # (1DX + 7)
5217             Name => 'ColorTemperature',
5218             Format => 'int16u',
5219             },
5220             0xf4 => { # (1DX + 7)
5221             Name => 'PictureStyle',
5222             Format => 'int8u',
5223             Flags => ['PrintHex','SeparateTable'],
5224             PrintConv => \%pictureStyles,
5225             },
5226             0x127 => {
5227             Name => 'LensType',
5228             Format => 'int16uRev', # value is big-endian
5229             SeparateTable => 1,
5230             ValueConvInv => 'int($val)', # (must truncate decimal part)
5231             PrintConv => \%canonLensTypes,
5232             },
5233             0x129 => { %ciMinFocal },
5234             0x12b => { %ciMaxFocal },
5235             0x21b => { # (650D version 1.0.1)
5236             Name => 'FirmwareVersion',
5237             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5238             Notes => '650D',
5239             Format => 'string[6]',
5240             Writable => 0,
5241             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5242             },
5243             0x220 => { # (700D version 1.1.1/2.1.1)
5244             Name => 'FirmwareVersion',
5245             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5246             Notes => '700D',
5247             Format => 'string[6]',
5248             Writable => 0,
5249             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5250             },
5251             0x270 => { #(NC)
5252             Name => 'FileIndex',
5253             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5254             Notes => '650D',
5255             Groups => { 2 => 'Image' },
5256             Format => 'int32u',
5257             ValueConv => '$val + 1',
5258             ValueConvInv => '$val - 1',
5259             },
5260             0x274 => { #(NC)
5261             Name => 'FileIndex',
5262             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5263             Notes => '700D',
5264             Groups => { 2 => 'Image' },
5265             Format => 'int32u',
5266             ValueConv => '$val + 1',
5267             ValueConvInv => '$val - 1',
5268             },
5269             0x27c => { #(NC)
5270             Name => 'DirectoryIndex',
5271             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5272             Notes => '650D',
5273             Groups => { 2 => 'Image' },
5274             Format => 'int32u',
5275             ValueConv => '$val - 1',
5276             ValueConvInv => '$val + 1',
5277             },
5278             0x280 => { #(NC)
5279             Name => 'DirectoryIndex',
5280             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5281             Notes => '700D',
5282             Groups => { 2 => 'Image' },
5283             Format => 'int32u',
5284             ValueConv => '$val - 1',
5285             ValueConvInv => '$val + 1',
5286             },
5287             0x390 => {
5288             Name => 'PictureStyleInfo',
5289             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5290             },
5291             );
5292              
5293             # Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
5294             %Image::ExifTool::Canon::CameraInfo750D = (
5295             %binaryDataAttrs,
5296             FORMAT => 'int8u',
5297             FIRST_ENTRY => 0,
5298             PRIORITY => 0,
5299             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5300             NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
5301             0x03 => { %ciFNumber },
5302             0x04 => { %ciExposureTime },
5303             0x06 => { %ciISO },
5304             0x1b => { %ciCameraTemperature }, # (700D + 0)
5305             0x23 => { %ciFocalLength }, # (700D + 0)
5306             0x96 => { #IB (700D + 0x19)
5307             Name => 'CameraOrientation',
5308             PrintConv => {
5309             0 => 'Horizontal (normal)',
5310             1 => 'Rotate 90 CW',
5311             2 => 'Rotate 270 CW',
5312             },
5313             },
5314             0xa5 => { # (700D + 0x19)
5315             Name => 'FocusDistanceUpper',
5316             %focusDistanceByteSwap,
5317             },
5318             0xa7 => { # (700D + 0x19)
5319             Name => 'FocusDistanceLower',
5320             %focusDistanceByteSwap,
5321             },
5322             0x131 => { # (700D + 0x19)
5323             Name => 'WhiteBalance',
5324             Format => 'int16u',
5325             SeparateTable => 1,
5326             PrintConv => \%canonWhiteBalance,
5327             },
5328             0x135 => {
5329             Name => 'ColorTemperature',
5330             Format => 'int16u',
5331             },
5332             0x169 => {
5333             Name => 'PictureStyle',
5334             Format => 'int8u',
5335             Flags => ['PrintHex','SeparateTable'],
5336             PrintConv => \%pictureStyles,
5337             },
5338             0x184 => {
5339             Name => 'LensType',
5340             Format => 'int16uRev', # value is big-endian
5341             SeparateTable => 1,
5342             ValueConvInv => 'int($val)', # (must truncate decimal part)
5343             PrintConv => \%canonLensTypes,
5344             },
5345             0x186 => { %ciMinFocal },
5346             0x188 => { %ciMaxFocal },
5347             0x43d => { # (750D/760D firmware 6.7.2)
5348             Name => 'FirmwareVersion',
5349             Format => 'string[6]',
5350             Writable => 0,
5351             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5352             },
5353             0x449 => { # (750D/760D firmware 1.0.0)
5354             Name => 'FirmwareVersion',
5355             Format => 'string[6]',
5356             Writable => 0,
5357             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5358             },
5359             );
5360              
5361             # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
5362             %Image::ExifTool::Canon::CameraInfo1000D = (
5363             %binaryDataAttrs,
5364             FORMAT => 'int8u',
5365             FIRST_ENTRY => 0,
5366             PRIORITY => 0,
5367             IS_SUBDIR => [ 0x267 ],
5368             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5369             NOTES => 'CameraInfo tags for the EOS 1000D.',
5370             0x03 => { %ciFNumber }, #PH
5371             0x04 => { %ciExposureTime }, #PH
5372             0x06 => { %ciISO }, #PH
5373             0x15 => { #PH (580 EX II)
5374             Name => 'FlashMeteringMode',
5375             PrintConv => {
5376             0 => 'E-TTL',
5377             3 => 'TTL',
5378             4 => 'External Auto',
5379             5 => 'External Manual',
5380             6 => 'Off',
5381             },
5382             },
5383             0x18 => { %ciCameraTemperature }, #36
5384             0x1b => { %ciMacroMagnification }, #PH (NC)
5385             0x1d => { %ciFocalLength }, #PH
5386             0x30 => { #20
5387             Name => 'CameraOrientation',
5388             PrintConv => {
5389             0 => 'Horizontal (normal)',
5390             1 => 'Rotate 90 CW',
5391             2 => 'Rotate 270 CW',
5392             },
5393             },
5394             0x43 => { #20
5395             Name => 'FocusDistanceUpper',
5396             %focusDistanceByteSwap,
5397             },
5398             0x45 => { #20
5399             Name => 'FocusDistanceLower',
5400             %focusDistanceByteSwap,
5401             },
5402             0x6f => { #PH
5403             Name => 'WhiteBalance',
5404             Format => 'int16u',
5405             PrintConv => \%canonWhiteBalance,
5406             SeparateTable => 1,
5407             },
5408             0x73 => { #PH
5409             Name => 'ColorTemperature',
5410             Format => 'int16u',
5411             },
5412             0xe2 => { #PH
5413             Name => 'LensType',
5414             Format => 'int16uRev', # value is big-endian
5415             SeparateTable => 1,
5416             ValueConvInv => 'int($val)', # (must truncate decimal part)
5417             PrintConv => \%canonLensTypes,
5418             },
5419             0xe4 => { %ciMinFocal }, #PH
5420             0xe6 => { %ciMaxFocal }, #PH
5421             0x10b => { #PH
5422             Name => 'FirmwareVersion',
5423             Format => 'string[6]',
5424             },
5425             0x137 => { #PH (NC)
5426             Name => 'DirectoryIndex',
5427             Groups => { 2 => 'Image' },
5428             Format => 'int32u',
5429             },
5430             0x143 => { #PH
5431             Name => 'FileIndex',
5432             Groups => { 2 => 'Image' },
5433             Format => 'int32u',
5434             ValueConv => '$val + 1',
5435             ValueConvInv => '$val - 1',
5436             },
5437             0x267 => { #PH
5438             Name => 'PictureStyleInfo',
5439             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5440             },
5441             0x937 => { #PH
5442             Name => 'LensModel',
5443             Format => 'string[64]',
5444             },
5445             );
5446              
5447             # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
5448             %Image::ExifTool::Canon::CameraInfoPowerShot = (
5449             %binaryDataAttrs,
5450             FORMAT => 'int32s',
5451             FIRST_ENTRY => 0,
5452             PRIORITY => 0,
5453             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5454             NOTES => q{
5455             CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
5456             A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
5457             SD870, SD900, SD950, SD1000, SX100 and TX1.
5458             },
5459             0x00 => {
5460             Name => 'ISO',
5461             Groups => { 2 => 'Image' },
5462             ValueConv => '100*exp((($val-411)/96)*log(2))',
5463             ValueConvInv => 'log($val/100)/log(2)*96+411',
5464             PrintConv => 'sprintf("%.0f",$val)',
5465             PrintConvInv => '$val',
5466             },
5467             0x05 => {
5468             Name => 'FNumber',
5469             Groups => { 2 => 'Image' },
5470             ValueConv => 'exp($val/192*log(2))',
5471             ValueConvInv => 'log($val)*192/log(2)',
5472             PrintConv => 'sprintf("%.2g",$val)',
5473             PrintConvInv => '$val',
5474             },
5475             0x06 => {
5476             Name => 'ExposureTime',
5477             Groups => { 2 => 'Image' },
5478             ValueConv => 'exp(-$val/96*log(2))',
5479             ValueConvInv => '-log($val)*96/log(2)',
5480             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5481             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5482             },
5483             0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
5484             # 0x25 - flash fired/not fired (ref 37)
5485             # 0x26 - related to flash mode? (ref 37)
5486             # 0x37 - related to flash strength (ref 37)
5487             # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
5488             135 => { # [-3] <-- index relative to CameraInfoCount
5489             Name => 'CameraTemperature',
5490             Condition => '$$self{CameraInfoCount} == 138',
5491             Notes => 'A450, A460, A550, A630, A640 and A710',
5492             PrintConv => '"$val C"',
5493             PrintConvInv => '$val=~s/ ?C//; $val',
5494             },
5495             145 => { #37 [-3]
5496             Name => 'CameraTemperature',
5497             Condition => '$$self{CameraInfoCount} == 148',
5498             Notes => q{
5499             A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
5500             SD950, SD1000, SX100 and TX1
5501             },
5502             PrintConv => '"$val C"',
5503             PrintConvInv => '$val=~s/ ?C//; $val',
5504             },
5505             );
5506              
5507             # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
5508             %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
5509             %binaryDataAttrs,
5510             FORMAT => 'int32s',
5511             FIRST_ENTRY => 0,
5512             PRIORITY => 0,
5513             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5514             NOTES => q{
5515             CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
5516             A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
5517             S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
5518             SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
5519             SX20, SX110, SX120, SX130, SX200 and SX210.
5520             },
5521             0x01 => {
5522             Name => 'ISO',
5523             Groups => { 2 => 'Image' },
5524             ValueConv => '100*exp((($val-411)/96)*log(2))',
5525             ValueConvInv => 'log($val/100)/log(2)*96+411',
5526             PrintConv => 'sprintf("%.0f",$val)',
5527             PrintConvInv => '$val',
5528             },
5529             0x06 => {
5530             Name => 'FNumber',
5531             Groups => { 2 => 'Image' },
5532             ValueConv => 'exp($val/192*log(2))',
5533             ValueConvInv => 'log($val)*192/log(2)',
5534             PrintConv => 'sprintf("%.2g",$val)',
5535             PrintConvInv => '$val',
5536             },
5537             0x07 => {
5538             Name => 'ExposureTime',
5539             Groups => { 2 => 'Image' },
5540             ValueConv => 'exp(-$val/96*log(2))',
5541             ValueConvInv => '-log($val)*96/log(2)',
5542             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5543             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5544             },
5545             0x18 => 'Rotation',
5546             153 => { # [-3] <-- index relative to CameraInfoCount
5547             Name => 'CameraTemperature',
5548             Condition => '$$self{CameraInfoCount} == 156',
5549             Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
5550             PrintConv => '"$val C"',
5551             PrintConvInv => '$val=~s/ ?C//; $val',
5552             },
5553             159 => { # [-3]
5554             Name => 'CameraTemperature',
5555             Condition => '$$self{CameraInfoCount} == 162',
5556             Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
5557             PrintConv => '"$val C"',
5558             PrintConvInv => '$val=~s/ ?C//; $val',
5559             },
5560             164 => { # [-3]
5561             Name => 'CameraTemperature',
5562             Condition => '$$self{CameraInfoCount} == 167',
5563             Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
5564             PrintConv => '"$val C"',
5565             PrintConvInv => '$val=~s/ ?C//; $val',
5566             },
5567             168 => { # [-3]
5568             Name => 'CameraTemperature',
5569             Condition => '$$self{CameraInfoCount} == 171',
5570             Notes => q{
5571             A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
5572             SD4000, SX20, SX120 and SX210
5573             },
5574             PrintConv => '"$val C"',
5575             PrintConvInv => '$val=~s/ ?C//; $val',
5576             },
5577             261 => { # [-3]
5578             Name => 'CameraTemperature',
5579             Condition => '$$self{CameraInfoCount} == 264',
5580             Notes => 'S95, SD4500 and SX130',
5581             PrintConv => '"$val C"',
5582             PrintConvInv => '$val=~s/ ?C//; $val',
5583             },
5584             );
5585              
5586             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5587             %Image::ExifTool::Canon::CameraInfoUnknown32 = (
5588             %binaryDataAttrs,
5589             FORMAT => 'int32s',
5590             FIRST_ENTRY => 0,
5591             PRIORITY => 0,
5592             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5593             NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
5594             # This tag may be uncommented, and is useful for generating
5595             # lists of models in the "Notes" below...
5596             # 0 => {
5597             # Name => 'CameraInfoCount',
5598             # ValueConv => '$$self{CameraInfoCount}',
5599             # },
5600             71 => { # [-1] <-- index relative to CameraInfoCount
5601             Name => 'CameraTemperature',
5602             Condition => '$$self{CameraInfoCount} == 72',
5603             Notes => 'S1',
5604             PrintConv => '"$val C"',
5605             PrintConvInv => '$val=~s/ ?C//; $val',
5606             },
5607             83 => { # [-2]
5608             Name => 'CameraTemperature',
5609             Condition => '$$self{CameraInfoCount} == 85',
5610             Notes => 'S2',
5611             PrintConv => '"$val C"',
5612             PrintConvInv => '$val=~s/ ?C//; $val',
5613             },
5614             91 => { # [-2 or -3]
5615             Name => 'CameraTemperature',
5616             Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
5617             Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
5618             PrintConv => '"$val C"',
5619             PrintConvInv => '$val=~s/ ?C//; $val',
5620             },
5621             92 => { # [-4]
5622             Name => 'CameraTemperature',
5623             Condition => '$$self{CameraInfoCount} == 96',
5624             Notes => 'S3',
5625             PrintConv => '"$val C"',
5626             PrintConvInv => '$val=~s/ ?C//; $val',
5627             },
5628             100 => { # [-4]
5629             Name => 'CameraTemperature',
5630             Condition => '$$self{CameraInfoCount} == 104',
5631             Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
5632             PrintConv => '"$val C"',
5633             PrintConvInv => '$val=~s/ ?C//; $val',
5634             },
5635             -3 => {
5636             Name => 'CameraTemperature',
5637             Condition => '$$self{CameraInfoCount} > 400',
5638             Notes => '3 entries from end of record for most newer camera models',
5639             PrintConv => '"$val C"',
5640             PrintConvInv => '$val=~s/ ?C//; $val',
5641             },
5642             # 466 => { # [-3]
5643             # Name => 'CameraTemperature',
5644             # Condition => '$$self{CameraInfoCount} == 469',
5645             # Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
5646             # PrintConv => '"$val C"',
5647             # PrintConvInv => '$val=~s/ ?C//; $val',
5648             # },
5649             # 503 => { # [-3]
5650             # Name => 'CameraTemperature',
5651             # Condition => '$$self{CameraInfoCount} == 506',
5652             # Notes => 'A800',
5653             # PrintConv => '"$val C"',
5654             # PrintConvInv => '$val=~s/ ?C//; $val',
5655             # },
5656             # 506 => { # [-3]
5657             # Name => 'CameraTemperature',
5658             # Condition => '$$self{CameraInfoCount} == 509',
5659             # Notes => 'SX230HS',
5660             # PrintConv => '"$val C"',
5661             # PrintConvInv => '$val=~s/ ?C//; $val',
5662             # },
5663             # 520 => { # [-3]
5664             # Name => 'CameraTemperature',
5665             # Condition => '$$self{CameraInfoCount} == 523',
5666             # Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
5667             # PrintConv => '"$val C"',
5668             # PrintConvInv => '$val=~s/ ?C//; $val',
5669             # },
5670             # 524 => { # [-3]
5671             # Name => 'CameraTemperature',
5672             # Condition => '$$self{CameraInfoCount} == 527',
5673             # Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
5674             # PrintConv => '"$val C"',
5675             # PrintConvInv => '$val=~s/ ?C//; $val',
5676             # },
5677             # 532 => { # [-3]
5678             # Name => 'CameraTemperature',
5679             # Condition => '$$self{CameraInfoCount} == 535',
5680             # Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
5681             # PrintConv => '"$val C"',
5682             # PrintConvInv => '$val=~s/ ?C//; $val',
5683             # },
5684             # 547 => { # [-3]
5685             # Name => 'CameraTemperature',
5686             # Condition => '$$self{CameraInfoCount} == 550',
5687             # Notes => '130IS, A1400, A2500 and A2600',
5688             # PrintConv => '"$val C"',
5689             # PrintConvInv => '$val=~s/ ?C//; $val',
5690             # },
5691             # 549 => { # [-3]
5692             # Name => 'CameraTemperature',
5693             # Condition => '$$self{CameraInfoCount} == 552',
5694             # Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
5695             # PrintConv => '"$val C"',
5696             # PrintConvInv => '$val=~s/ ?C//; $val',
5697             # },
5698             # 552 => { # [-3]
5699             # Name => 'CameraTemperature',
5700             # Condition => '$$self{CameraInfoCount} == 555',
5701             # Notes => 'S200 (new)',
5702             # PrintConv => '"$val C"',
5703             # PrintConvInv => '$val=~s/ ?C//; $val',
5704             # },
5705             # 850 => { # [-3]
5706             # Name => 'CameraTemperature',
5707             # Condition => '$$self{CameraInfoCount} == 853',
5708             # Notes => 'N',
5709             # PrintConv => '"$val C"',
5710             # PrintConvInv => '$val=~s/ ?C//; $val',
5711             # },
5712             # 895 => { # [-3]
5713             # Name => 'CameraTemperature',
5714             # Condition => '$$self{CameraInfoCount} == 898',
5715             # Notes => 'G1XmkII, N100, SX600HS and SX700HS',
5716             # PrintConv => '"$val C"',
5717             # PrintConvInv => '$val=~s/ ?C//; $val',
5718             # },
5719             );
5720              
5721             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5722             %Image::ExifTool::Canon::CameraInfoUnknown16 = (
5723             %binaryDataAttrs,
5724             FORMAT => 'int16s',
5725             FIRST_ENTRY => 0,
5726             PRIORITY => 0,
5727             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5728             );
5729              
5730             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5731             %Image::ExifTool::Canon::CameraInfoUnknown = (
5732             %binaryDataAttrs,
5733             FORMAT => 'int8s',
5734             FIRST_ENTRY => 0,
5735             PRIORITY => 0,
5736             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5737             0x16b => {
5738             Name => 'LensSerialNumber',
5739             Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
5740             Format => 'undef[5]',
5741             Priority => 0,
5742             ValueConv => 'unpack("H*",$val)',
5743             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
5744             },
5745             0x5c1 => {
5746             Name => 'FirmwareVersion',
5747             Format => 'string[6]',
5748             Writable => 0,
5749             Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
5750             Notes => 'M50', # (firmware 1.0.0)
5751             },
5752             );
5753              
5754             # Picture Style information for various cameras (ref 48)
5755             %Image::ExifTool::Canon::PSInfo = (
5756             %binaryDataAttrs,
5757             FIRST_ENTRY => 0,
5758             PRIORITY => 0,
5759             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5760             NOTES => 'Custom picture style information for various models.',
5761             # (values expected to be "n/a" are flagged as Unknown)
5762             0x00 => { Name => 'ContrastStandard', %psInfo },
5763             0x04 => { Name => 'SharpnessStandard', %psInfo },
5764             0x08 => { Name => 'SaturationStandard', %psInfo },
5765             0x0c => { Name => 'ColorToneStandard', %psInfo },
5766             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5767             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5768             0x18 => { Name => 'ContrastPortrait', %psInfo },
5769             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5770             0x20 => { Name => 'SaturationPortrait', %psInfo },
5771             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5772             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5773             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5774             0x30 => { Name => 'ContrastLandscape', %psInfo },
5775             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5776             0x38 => { Name => 'SaturationLandscape', %psInfo },
5777             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5778             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5779             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5780             0x48 => { Name => 'ContrastNeutral', %psInfo },
5781             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5782             0x50 => { Name => 'SaturationNeutral', %psInfo },
5783             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5784             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5785             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5786             0x60 => { Name => 'ContrastFaithful', %psInfo },
5787             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5788             0x68 => { Name => 'SaturationFaithful', %psInfo },
5789             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5790             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5791             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5792             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5793             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5794             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5795             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5796             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
5797             PrintConv => {
5798             0 => 'None',
5799             1 => 'Yellow',
5800             2 => 'Orange',
5801             3 => 'Red',
5802             4 => 'Green',
5803             -559038737 => 'n/a', # (0xdeadbeef)
5804             },
5805             },
5806             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
5807             PrintConv => {
5808             0 => 'None',
5809             1 => 'Sepia',
5810             2 => 'Blue',
5811             3 => 'Purple',
5812             4 => 'Green',
5813             -559038737 => 'n/a', # (0xdeadbeef)
5814             },
5815             },
5816             0x90 => { Name => 'ContrastUserDef1', %psInfo },
5817             0x94 => { Name => 'SharpnessUserDef1', %psInfo },
5818             0x98 => { Name => 'SaturationUserDef1', %psInfo },
5819             0x9c => { Name => 'ColorToneUserDef1', %psInfo },
5820             0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
5821             PrintConv => {
5822             0 => 'None',
5823             1 => 'Yellow',
5824             2 => 'Orange',
5825             3 => 'Red',
5826             4 => 'Green',
5827             -559038737 => 'n/a', # (0xdeadbeef)
5828             },
5829             },
5830             0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
5831             PrintConv => {
5832             0 => 'None',
5833             1 => 'Sepia',
5834             2 => 'Blue',
5835             3 => 'Purple',
5836             4 => 'Green',
5837             -559038737 => 'n/a', # (0xdeadbeef)
5838             },
5839             },
5840             0xa8 => { Name => 'ContrastUserDef2', %psInfo },
5841             0xac => { Name => 'SharpnessUserDef2', %psInfo },
5842             0xb0 => { Name => 'SaturationUserDef2', %psInfo },
5843             0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
5844             0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
5845             PrintConv => {
5846             0 => 'None',
5847             1 => 'Yellow',
5848             2 => 'Orange',
5849             3 => 'Red',
5850             4 => 'Green',
5851             -559038737 => 'n/a', # (0xdeadbeef)
5852             },
5853             },
5854             0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
5855             PrintConv => {
5856             0 => 'None',
5857             1 => 'Sepia',
5858             2 => 'Blue',
5859             3 => 'Purple',
5860             4 => 'Green',
5861             -559038737 => 'n/a', # (0xdeadbeef)
5862             },
5863             },
5864             0xc0 => { Name => 'ContrastUserDef3', %psInfo },
5865             0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
5866             0xc8 => { Name => 'SaturationUserDef3', %psInfo },
5867             0xcc => { Name => 'ColorToneUserDef3', %psInfo },
5868             0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
5869             PrintConv => {
5870             0 => 'None',
5871             1 => 'Yellow',
5872             2 => 'Orange',
5873             3 => 'Red',
5874             4 => 'Green',
5875             -559038737 => 'n/a', # (0xdeadbeef)
5876             },
5877             },
5878             0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
5879             PrintConv => {
5880             0 => 'None',
5881             1 => 'Sepia',
5882             2 => 'Blue',
5883             3 => 'Purple',
5884             4 => 'Green',
5885             -559038737 => 'n/a', # (0xdeadbeef)
5886             },
5887             },
5888             # base picture style names:
5889             0xd8 => {
5890             Name => 'UserDef1PictureStyle',
5891             Format => 'int16u',
5892             SeparateTable => 'UserDefStyle',
5893             PrintConv => \%userDefStyles,
5894             },
5895             0xda => {
5896             Name => 'UserDef2PictureStyle',
5897             Format => 'int16u',
5898             SeparateTable => 'UserDefStyle',
5899             PrintConv => \%userDefStyles,
5900             },
5901             0xdc => {
5902             Name => 'UserDef3PictureStyle',
5903             Format => 'int16u',
5904             SeparateTable => 'UserDefStyle',
5905             PrintConv => \%userDefStyles,
5906             },
5907             );
5908              
5909             # Picture Style information for the 60D, etc (ref 48)
5910             %Image::ExifTool::Canon::PSInfo2 = (
5911             %binaryDataAttrs,
5912             FIRST_ENTRY => 0,
5913             PRIORITY => 0,
5914             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5915             NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
5916             # (values expected to be "n/a" are flagged as Unknown)
5917             0x00 => { Name => 'ContrastStandard', %psInfo },
5918             0x04 => { Name => 'SharpnessStandard', %psInfo },
5919             0x08 => { Name => 'SaturationStandard', %psInfo },
5920             0x0c => { Name => 'ColorToneStandard', %psInfo },
5921             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5922             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5923             0x18 => { Name => 'ContrastPortrait', %psInfo },
5924             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5925             0x20 => { Name => 'SaturationPortrait', %psInfo },
5926             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5927             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5928             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5929             0x30 => { Name => 'ContrastLandscape', %psInfo },
5930             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5931             0x38 => { Name => 'SaturationLandscape', %psInfo },
5932             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5933             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5934             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5935             0x48 => { Name => 'ContrastNeutral', %psInfo },
5936             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5937             0x50 => { Name => 'SaturationNeutral', %psInfo },
5938             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5939             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5940             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5941             0x60 => { Name => 'ContrastFaithful', %psInfo },
5942             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5943             0x68 => { Name => 'SaturationFaithful', %psInfo },
5944             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5945             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5946             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5947             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5948             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5949             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5950             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5951             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
5952             PrintConv => {
5953             0 => 'None',
5954             1 => 'Yellow',
5955             2 => 'Orange',
5956             3 => 'Red',
5957             4 => 'Green',
5958             -559038737 => 'n/a', # (0xdeadbeef)
5959             },
5960             },
5961             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
5962             PrintConv => {
5963             0 => 'None',
5964             1 => 'Sepia',
5965             2 => 'Blue',
5966             3 => 'Purple',
5967             4 => 'Green',
5968             -559038737 => 'n/a', # (0xdeadbeef)
5969             },
5970             },
5971             0x90 => { Name => 'ContrastAuto', %psInfo },
5972             0x94 => { Name => 'SharpnessAuto', %psInfo },
5973             0x98 => { Name => 'SaturationAuto', %psInfo },
5974             0x9c => { Name => 'ColorToneAuto', %psInfo },
5975             0xa0 => { Name => 'FilterEffectAuto', %psInfo,
5976             PrintConv => {
5977             0 => 'None',
5978             1 => 'Yellow',
5979             2 => 'Orange',
5980             3 => 'Red',
5981             4 => 'Green',
5982             -559038737 => 'n/a', # (0xdeadbeef)
5983             },
5984             },
5985             0xa4 => { Name => 'ToningEffectAuto', %psInfo,
5986             PrintConv => {
5987             0 => 'None',
5988             1 => 'Sepia',
5989             2 => 'Blue',
5990             3 => 'Purple',
5991             4 => 'Green',
5992             -559038737 => 'n/a', # (0xdeadbeef)
5993             },
5994             },
5995             0xa8 => { Name => 'ContrastUserDef1', %psInfo },
5996             0xac => { Name => 'SharpnessUserDef1', %psInfo },
5997             0xb0 => { Name => 'SaturationUserDef1', %psInfo },
5998             0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
5999             0xb8 => { Name => 'FilterEffectUserDef1', %psInfo,
6000             PrintConv => {
6001             0 => 'None',
6002             1 => 'Yellow',
6003             2 => 'Orange',
6004             3 => 'Red',
6005             4 => 'Green',
6006             -559038737 => 'n/a', # (0xdeadbeef)
6007             },
6008             },
6009             0xbc => { Name => 'ToningEffectUserDef1', %psInfo,
6010             PrintConv => {
6011             0 => 'None',
6012             1 => 'Sepia',
6013             2 => 'Blue',
6014             3 => 'Purple',
6015             4 => 'Green',
6016             -559038737 => 'n/a', # (0xdeadbeef)
6017             },
6018             },
6019             0xc0 => { Name => 'ContrastUserDef2', %psInfo },
6020             0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
6021             0xc8 => { Name => 'SaturationUserDef2', %psInfo },
6022             0xcc => { Name => 'ColorToneUserDef2', %psInfo },
6023             0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
6024             PrintConv => {
6025             0 => 'None',
6026             1 => 'Yellow',
6027             2 => 'Orange',
6028             3 => 'Red',
6029             4 => 'Green',
6030             -559038737 => 'n/a', # (0xdeadbeef)
6031             },
6032             },
6033             0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
6034             PrintConv => {
6035             0 => 'None',
6036             1 => 'Sepia',
6037             2 => 'Blue',
6038             3 => 'Purple',
6039             4 => 'Green',
6040             -559038737 => 'n/a', # (0xdeadbeef)
6041             },
6042             },
6043             0xd8 => { Name => 'ContrastUserDef3', %psInfo },
6044             0xdc => { Name => 'SharpnessUserDef3', %psInfo },
6045             0xe0 => { Name => 'SaturationUserDef3', %psInfo },
6046             0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
6047             0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
6048             PrintConv => {
6049             0 => 'None',
6050             1 => 'Yellow',
6051             2 => 'Orange',
6052             3 => 'Red',
6053             4 => 'Green',
6054             -559038737 => 'n/a', # (0xdeadbeef)
6055             },
6056             },
6057             0xec => { Name => 'ToningEffectUserDef3', %psInfo,
6058             PrintConv => {
6059             0 => 'None',
6060             1 => 'Sepia',
6061             2 => 'Blue',
6062             3 => 'Purple',
6063             4 => 'Green',
6064             -559038737 => 'n/a', # (0xdeadbeef)
6065             },
6066             },
6067             # base picture style names:
6068             0xf0 => {
6069             Name => 'UserDef1PictureStyle',
6070             Format => 'int16u',
6071             SeparateTable => 'UserDefStyle',
6072             PrintConv => \%userDefStyles,
6073             },
6074             0xf2 => {
6075             Name => 'UserDef2PictureStyle',
6076             Format => 'int16u',
6077             SeparateTable => 'UserDefStyle',
6078             PrintConv => \%userDefStyles,
6079             },
6080             0xf4 => {
6081             Name => 'UserDef3PictureStyle',
6082             Format => 'int16u',
6083             SeparateTable => 'UserDefStyle',
6084             PrintConv => \%userDefStyles,
6085             },
6086             );
6087              
6088             # Movie information (MakerNotes tag 0x11) (ref PH)
6089             %Image::ExifTool::Canon::MovieInfo = (
6090             %binaryDataAttrs,
6091             FORMAT => 'int16u',
6092             FIRST_ENTRY => 1,
6093             GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
6094             NOTES => 'Tags written by some Canon cameras when recording video.',
6095             1 => { # (older PowerShot AVI)
6096             Name => 'FrameRate',
6097             RawConv => '$val == 65535 ? undef: $val',
6098             ValueConvInv => '$val > 65535 ? 65535 : $val',
6099             },
6100             2 => { # (older PowerShot AVI)
6101             Name => 'FrameCount',
6102             RawConv => '$val == 65535 ? undef: $val',
6103             ValueConvInv => '$val > 65535 ? 65535 : $val',
6104             },
6105             # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
6106             4 => {
6107             Name => 'FrameCount',
6108             Format => 'int32u',
6109             },
6110             6 => {
6111             Name => 'FrameRate',
6112             Format => 'rational32u',
6113             PrintConv => 'int($val * 1000 + 0.5) / 1000',
6114             PrintConvInv => '$val',
6115             },
6116             # 9/10 - same as 6/7 (FrameRate)
6117             106 => {
6118             Name => 'Duration',
6119             Format => 'int32u',
6120             ValueConv => '$val / 1000',
6121             ValueConvInv => '$val * 1000',
6122             PrintConv => 'ConvertDuration($val)',
6123             PrintConvInv => q{
6124             my @a = ($val =~ /\d+(?:\.\d*)?/g);
6125             $val = pop(@a) || 0; # seconds
6126             $val += pop(@a) * 60 if @a; # minutes
6127             $val += pop(@a) * 3600 if @a; # hours
6128             return $val;
6129             },
6130             },
6131             108 => {
6132             Name => 'AudioBitrate',
6133             Groups => { 2 => 'Audio' },
6134             Format => 'int32u',
6135             PrintConv => 'ConvertBitrate($val)',
6136             PrintConvInv => q{
6137             $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
6138             return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
6139             },
6140             },
6141             110 => {
6142             Name => 'AudioSampleRate',
6143             Groups => { 2 => 'Audio' },
6144             Format => 'int32u',
6145             },
6146             112 => { # (guess)
6147             Name => 'AudioChannels',
6148             Groups => { 2 => 'Audio' },
6149             Format => 'int32u',
6150             },
6151             # 114 - values: 0 (60D), 1 (S95)
6152             116 => {
6153             Name => 'VideoCodec',
6154             Format => 'undef[4]',
6155             # swap bytes if little endian
6156             RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6157             RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6158             },
6159             # 125 - same as 10
6160             );
6161              
6162             # AF information (MakerNotes tag 0x12) - PH
6163             %Image::ExifTool::Canon::AFInfo = (
6164             PROCESS_PROC => \&ProcessSerialData,
6165             VARS => { ID_LABEL => 'Sequence' },
6166             FORMAT => 'int16u',
6167             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6168             NOTES => q{
6169             Auto-focus information used by many older Canon models. The values in this
6170             record are sequential, and some have variable sizes based on the value of
6171             NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
6172             given in a system where the image has dimensions given by AFImageWidth and
6173             AFImageHeight, and 0,0 is the image center. The direction of the Y axis
6174             depends on the camera model, with positive Y upwards for EOS models, but
6175             apparently downwards for PowerShot models.
6176             },
6177             0 => {
6178             Name => 'NumAFPoints',
6179             },
6180             1 => {
6181             Name => 'ValidAFPoints',
6182             Notes => 'number of AF points valid in the following information',
6183             },
6184             2 => {
6185             Name => 'CanonImageWidth',
6186             Groups => { 2 => 'Image' },
6187             },
6188             3 => {
6189             Name => 'CanonImageHeight',
6190             Groups => { 2 => 'Image' },
6191             },
6192             4 => {
6193             Name => 'AFImageWidth',
6194             Notes => 'size of image in AF coordinates',
6195             },
6196             5 => 'AFImageHeight',
6197             6 => 'AFAreaWidth',
6198             7 => 'AFAreaHeight',
6199             8 => {
6200             Name => 'AFAreaXPositions',
6201             Format => 'int16s[$val{0}]',
6202             },
6203             9 => {
6204             Name => 'AFAreaYPositions',
6205             Format => 'int16s[$val{0}]',
6206             },
6207             10 => {
6208             Name => 'AFPointsInFocus',
6209             Format => 'int16s[int(($val{0}+15)/16)]',
6210             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6211             },
6212             11 => [
6213             {
6214             Name => 'PrimaryAFPoint',
6215             Condition => q{
6216             $$self{Model} !~ /EOS/ and
6217             (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
6218             },
6219             },
6220             {
6221             # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
6222             Name => 'Canon_AFInfo_0x000b',
6223             Condition => '$$self{Model} !~ /EOS/',
6224             Format => 'int16u[8]',
6225             Unknown => 1,
6226             },
6227             # (serial processing stops here for EOS cameras)
6228             ],
6229             12 => 'PrimaryAFPoint',
6230             );
6231              
6232             # newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
6233             # (Note: this tag is out of sequence in A570IS maker notes)
6234             %Image::ExifTool::Canon::AFInfo2 = (
6235             PROCESS_PROC => \&ProcessSerialData,
6236             VARS => { ID_LABEL => 'Sequence' },
6237             FORMAT => 'int16u',
6238             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6239             NOTES => q{
6240             Newer version of the AFInfo record containing much of the same information
6241             (and coordinate confusion) as the older version. In this record, NumAFPoints
6242             may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
6243             },
6244             0 => {
6245             Name => 'AFInfoSize',
6246             Unknown => 1, # normally don't print this out
6247             },
6248             1 => {
6249             Name => 'AFAreaMode',
6250             PrintConv => {
6251             0 => 'Off (Manual Focus)',
6252             1 => 'AF Point Expansion (surround)', #PH
6253             2 => 'Single-point AF',
6254             # 3 - n/a
6255             4 => 'Auto', #forum6237 (AiAF on A570IS)
6256             5 => 'Face Detect AF',
6257             6 => 'Face + Tracking', #PH (NC, EOS M, live view)
6258             7 => 'Zone AF', #46
6259             8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
6260             9 => 'Spot AF', #46
6261             10 => 'AF Point Expansion (8 point)', #forum6237
6262             11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
6263             12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
6264             13 => 'Flexizone Single', #PH (EOS M default, live view)
6265             14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
6266             },
6267             },
6268             2 => {
6269             Name => 'NumAFPoints',
6270             RawConv => '$$self{NumAFPoints} = $val', # save for later
6271             },
6272             3 => {
6273             Name => 'ValidAFPoints',
6274             Notes => 'number of AF points valid in the following information',
6275             },
6276             4 => {
6277             Name => 'CanonImageWidth',
6278             Groups => { 2 => 'Image' },
6279             },
6280             5 => {
6281             Name => 'CanonImageHeight',
6282             Groups => { 2 => 'Image' },
6283             },
6284             6 => {
6285             Name => 'AFImageWidth',
6286             Notes => 'size of image in AF coordinates',
6287             },
6288             7 => 'AFImageHeight',
6289             8 => {
6290             Name => 'AFAreaWidths',
6291             Format => 'int16s[$val{2}]',
6292             },
6293             9 => {
6294             Name => 'AFAreaHeights',
6295             Format => 'int16s[$val{2}]',
6296             },
6297             10 => {
6298             Name => 'AFAreaXPositions',
6299             Format => 'int16s[$val{2}]',
6300             },
6301             11 => {
6302             Name => 'AFAreaYPositions',
6303             Format => 'int16s[$val{2}]',
6304             },
6305             12 => {
6306             Name => 'AFPointsInFocus',
6307             Format => 'int16s[int(($val{2}+15)/16)]',
6308             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6309             },
6310             13 => [
6311             {
6312             Name => 'AFPointsSelected',
6313             Condition => '$$self{Model} =~ /EOS/',
6314             Format => 'int16s[int(($val{2}+15)/16)]',
6315             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6316             },
6317             {
6318             Name => 'Canon_AFInfo2_0x000d',
6319             Format => 'int16s[int(($val{2}+15)/16)+1]',
6320             Unknown => 1,
6321             },
6322             ],
6323             14 => {
6324             # usually, but not always, the lowest number AF point in focus
6325             Name => 'PrimaryAFPoint',
6326             Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
6327             },
6328             );
6329              
6330             # contrast information (MakerNotes tag 0x27) - PH
6331             %Image::ExifTool::Canon::ContrastInfo = (
6332             %binaryDataAttrs,
6333             FORMAT => 'int16u',
6334             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6335             4 => {
6336             Name => 'IntelligentContrast',
6337             PrintHex => 1,
6338             PrintConv => {
6339             0x00 => 'Off',
6340             0x08 => 'On',
6341             0xffff => 'n/a',
6342             OTHER => sub {
6343             # DPP shows "On" for any value except 0xffff when bit 0x08 is set
6344             my ($val, $inv) = @_;
6345             if ($inv) {
6346             $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
6347             return $1;
6348             } else {
6349             return sprintf("On (0x%.2x)",$val) if $val & 0x08;
6350             return sprintf("Off (0x%.2x)",$val);
6351             }
6352             },
6353             },
6354             },
6355             # 6 - 0=normal, 257=i-Contrast On
6356             );
6357              
6358             # time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
6359             %Image::ExifTool::Canon::TimeInfo = (
6360             %binaryDataAttrs,
6361             FORMAT => 'int32s',
6362             FIRST_ENTRY => 1,
6363             GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
6364             # 0 - size (16 bytes)
6365             1 => {
6366             Name => 'TimeZone',
6367             PrintConv => 'Image::ExifTool::TimeZoneString($val)',
6368             PrintConvInv => sub {
6369             my $val = shift;
6370             $val =~ /^([-+]?)(\d{1,2}):?(\d{2})$/ or return undef;
6371             return(($1 eq '-' ? -1 : 1) * ($2 * 60 + $3));
6372             },
6373             },
6374             2 => {
6375             Name => 'TimeZoneCity',
6376             PrintConvColumns => 3,
6377             PrintConv => {
6378             # [square brackets] = actual time zone for each city
6379             # (round brackets) = observed time zone values from sample images
6380             # --> unobserved entries have not been confirmed!
6381             0 => 'n/a', # (PowerShot models)
6382             1 => 'Chatham Islands', # [+12:45]
6383             2 => 'Wellington', # [+12] (+12:00,DST+0)
6384             3 => 'Solomon Islands', # [+11]
6385             4 => 'Sydney', # [+10] (+11:00,DST+1)
6386             5 => 'Adelaide', # [+9:30]
6387             6 => 'Tokyo', # [+9] (+09:00,DST+0)
6388             7 => 'Hong Kong', # [+8] (+08:00,DST+0)
6389             8 => 'Bangkok', # [+7] (+08:00,DST+1)
6390             9 => 'Yangon', # [+6:30]
6391             10 => 'Dhaka', # [+6] (Canon uses old "Dacca" spelling)
6392             11 => 'Kathmandu', # [+5:45]
6393             12 => 'Delhi', # [+5:30]
6394             13 => 'Karachi', # [+5]
6395             14 => 'Kabul', # [+4:30]
6396             15 => 'Dubai', # [+4]
6397             16 => 'Tehran', # [+3:30]
6398             17 => 'Moscow', # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
6399             18 => 'Cairo', # [+2]
6400             19 => 'Paris', # [+1] (+01:10,DST+0; +02:00,DST+1)
6401             20 => 'London', # [0] (+00:00,DST+0)
6402             21 => 'Azores', # [-1]
6403             22 => 'Fernando de Noronha', # [-2]
6404             23 => 'Sao Paulo', # [-3]
6405             24 => 'Newfoundland', # [-3:30]
6406             25 => 'Santiago', # [-4]
6407             26 => 'Caracas', # [-4:30]
6408             27 => 'New York', # [-5] (-05:00,DST+0; -04:00,DST+1)
6409             28 => 'Chicago', # [-6]
6410             29 => 'Denver', # [-7]
6411             30 => 'Los Angeles', # [-8] (-08:00,DST+0; -07:00,DST+1)
6412             31 => 'Anchorage', # [-9]
6413             32 => 'Honolulu', # [-10]
6414             33 => 'Samoa', # [+13]
6415             32766 => '(not set)', #(NC)
6416             },
6417             },
6418             3 => {
6419             Name => 'DaylightSavings',
6420             PrintConv => {
6421             0 => 'Off',
6422             60 => 'On',
6423             },
6424             },
6425             );
6426              
6427             # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
6428             %Image::ExifTool::Canon::MyColors = (
6429             %binaryDataAttrs,
6430             FORMAT => 'int16u',
6431             FIRST_ENTRY => 0,
6432             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6433             0x02 => {
6434             Name => 'MyColorMode',
6435             PrintConvColumns => 2,
6436             PrintConv => {
6437             0 => 'Off',
6438             1 => 'Positive Film', #15 (SD600)
6439             2 => 'Light Skin Tone', #15
6440             3 => 'Dark Skin Tone', #15
6441             4 => 'Vivid Blue', #15
6442             5 => 'Vivid Green', #15
6443             6 => 'Vivid Red', #15
6444             7 => 'Color Accent', #15 (A610) (NC)
6445             8 => 'Color Swap', #15 (A610)
6446             9 => 'Custom',
6447             12 => 'Vivid',
6448             13 => 'Neutral',
6449             14 => 'Sepia',
6450             15 => 'B&W',
6451             },
6452             },
6453             );
6454              
6455             # face detect information (MakerNotes tag 0x24) - PH (A570IS)
6456             %Image::ExifTool::Canon::FaceDetect1 = (
6457             %binaryDataAttrs,
6458             FORMAT => 'int16u',
6459             FIRST_ENTRY => 0,
6460             DATAMEMBER => [ 0x02 ],
6461             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6462             0x02 => {
6463             Name => 'FacesDetected',
6464             DataMember => 'FacesDetected',
6465             RawConv => '$$self{FacesDetected} = $val',
6466             },
6467             0x03 => {
6468             Name => 'FaceDetectFrameSize',
6469             Format => 'int16u[2]',
6470             },
6471             0x08 => {
6472             Name => 'Face1Position',
6473             Format => 'int16s[2]',
6474             RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
6475             Notes => q{
6476             X-Y coordinates for the center of each face in the Face Detect frame at the
6477             time of focus lock. "0 0" is the center, and positive X and Y are to the
6478             right and downwards respectively
6479             },
6480             },
6481             0x0a => {
6482             Name => 'Face2Position',
6483             Format => 'int16s[2]',
6484             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
6485             },
6486             0x0c => {
6487             Name => 'Face3Position',
6488             Format => 'int16s[2]',
6489             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
6490             },
6491             0x0e => {
6492             Name => 'Face4Position',
6493             Format => 'int16s[2]',
6494             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
6495             },
6496             0x10 => {
6497             Name => 'Face5Position',
6498             Format => 'int16s[2]',
6499             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
6500             },
6501             0x12 => {
6502             Name => 'Face6Position',
6503             Format => 'int16s[2]',
6504             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
6505             },
6506             0x14 => {
6507             Name => 'Face7Position',
6508             Format => 'int16s[2]',
6509             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
6510             },
6511             0x16 => {
6512             Name => 'Face8Position',
6513             Format => 'int16s[2]',
6514             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
6515             },
6516             0x18 => {
6517             Name => 'Face9Position',
6518             Format => 'int16s[2]',
6519             RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
6520             },
6521             );
6522              
6523             # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
6524             %Image::ExifTool::Canon::FaceDetect2 = (
6525             %binaryDataAttrs,
6526             FORMAT => 'int8u',
6527             FIRST_ENTRY => 0,
6528             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6529             0x01 => 'FaceWidth',
6530             0x02 => 'FacesDetected',
6531             );
6532              
6533             # G9 white balance information (MakerNotes tag 0x29) (ref IB)
6534             %Image::ExifTool::Canon::WBInfo = (
6535             %binaryDataAttrs,
6536             NOTES => 'WB tags for the Canon G9.',
6537             FORMAT => 'int32u',
6538             FIRST_ENTRY => 1,
6539             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6540             0x02 => { Name => 'WB_GRGBLevelsAuto', Format => 'int32s[4]' },
6541             0x0a => { Name => 'WB_GRGBLevelsDaylight', Format => 'int32s[4]' },
6542             0x12 => { Name => 'WB_GRGBLevelsCloudy', Format => 'int32s[4]' },
6543             0x1a => { Name => 'WB_GRGBLevelsTungsten', Format => 'int32s[4]' },
6544             0x22 => { Name => 'WB_GRGBLevelsFluorescent', Format => 'int32s[4]' },
6545             0x2a => { Name => 'WB_GRGBLevelsFluorHigh', Format => 'int32s[4]' },
6546             0x32 => { Name => 'WB_GRGBLevelsFlash', Format => 'int32s[4]' },
6547             0x3a => { Name => 'WB_GRGBLevelsUnderwater', Format => 'int32s[4]' },
6548             0x42 => { Name => 'WB_GRGBLevelsCustom1', Format => 'int32s[4]' },
6549             0x4a => { Name => 'WB_GRGBLevelsCustom2', Format => 'int32s[4]' },
6550             );
6551              
6552             # yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
6553             %Image::ExifTool::Canon::FaceDetect3 = (
6554             %binaryDataAttrs,
6555             FORMAT => 'int16u',
6556             FIRST_ENTRY => 1,
6557             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6558             # 0 - size (34 bytes)
6559             # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
6560             # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
6561             3 => 'FacesDetected',
6562             # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
6563             );
6564              
6565             # File number information (MakerNotes tag 0x93)
6566             %Image::ExifTool::Canon::FileInfo = (
6567             %binaryDataAttrs,
6568             FORMAT => 'int16s',
6569             FIRST_ENTRY => 1,
6570             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6571             DATAMEMBER => [ 20 ],
6572             1 => [
6573             { #5
6574             Name => 'FileNumber',
6575             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6576             Format => 'int32u',
6577             # Thanks to Juha Eskelinen for figuring this out:
6578             # [this is an odd bit mapping -- it looks like the file number exists as
6579             # a 16-bit integer containing the high bits, followed by an 8-bit integer
6580             # with the low bits. But it is more convenient to have this in a single
6581             # word, so some bit manipulations are necessary... - PH]
6582             # The bit pattern of the 32-bit word is:
6583             # 31....24 23....16 15.....8 7......0
6584             # 00000000 ffffffff DDDDDDDD ddFFFFFF
6585             # 0 = zero bits (not part of the file number?)
6586             # f/F = low/high bits of file number
6587             # d/D = low/high bits of directory number
6588             # The directory and file number are then converted into decimal
6589             # and separated by a '-' to give the file number used in the 20D
6590             ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
6591             ValueConvInv => q{
6592             my $d = int($val/10000);
6593             my $f = $val - $d * 10000;
6594             return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
6595             },
6596             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6597             PrintConvInv => '$val=~s/-//g;$val',
6598             },
6599             { #16
6600             Name => 'FileNumber',
6601             Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
6602             Format => 'int32u',
6603             Notes => q{
6604             the location of the upper 4 bits of the directory number is a mystery for
6605             the EOS 30D, so the reported directory number will be incorrect for original
6606             images with a directory number of 164 or greater
6607             },
6608             # Thanks to Emil Sit for figuring this out:
6609             # [more insane bit maniplations like the 20D/350D above, but this time we
6610             # appear to have lost the upper 4 bits of the directory number (this was
6611             # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
6612             # The bit pattern for the 30D is: (see 20D notes above for more information)
6613             # 31....24 23....16 15.....8 7......0
6614             # 00000000 ffff0000 ddddddFF FFFFFFFF
6615             # [NOTE: the 4 high order directory bits don't appear in this record, but
6616             # I have chosen to write them into bits 16-19 since these 4 zero bits look
6617             # very suspicious, and are a convenient place to store this information - PH]
6618             ValueConv => q{
6619             my $d = ($val & 0xffc00) >> 10;
6620             # we know there are missing bits if directory number is < 100
6621             $d += 0x40 while $d < 100; # (repair the damage as best we can)
6622             return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
6623             },
6624             ValueConvInv => q{
6625             my $d = int($val/10000);
6626             my $f = $val - $d * 10000;
6627             return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
6628             },
6629             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6630             PrintConvInv => '$val=~s/-//g;$val',
6631             },
6632             { #7 (1D, 1Ds)
6633             Name => 'ShutterCount',
6634             Condition => 'GetByteOrder() eq "MM"',
6635             Format => 'int32u',
6636             },
6637             { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
6638             Name => 'ShutterCount',
6639             # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
6640             Notes => q{
6641             there are reports that the ShutterCount changed when loading a settings file
6642             on the 1DSmkII
6643             },
6644             Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
6645             Format => 'int32u',
6646             ValueConv => '($val>>16)|(($val&0xffff)<<16)',
6647             ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
6648             },
6649             # 5D gives a single byte value (unknown)
6650             # 40D stores all zeros
6651             ],
6652             3 => { #PH
6653             Name => 'BracketMode',
6654             PrintConv => {
6655             0 => 'Off',
6656             1 => 'AEB',
6657             2 => 'FEB',
6658             3 => 'ISO',
6659             4 => 'WB',
6660             },
6661             },
6662             4 => 'BracketValue', #PH
6663             5 => 'BracketShotNumber', #PH
6664             6 => { #PH
6665             Name => 'RawJpgQuality',
6666             RawConv => '$val<=0 ? undef : $val',
6667             PrintConv => \%canonQuality,
6668             },
6669             7 => { #PH
6670             Name => 'RawJpgSize',
6671             RawConv => '$val<0 ? undef : $val',
6672             PrintConv => \%canonImageSize,
6673             },
6674             8 => { #PH
6675             Name => 'LongExposureNoiseReduction2',
6676             Notes => q{
6677             for some modules this gives the long exposure noise reduction applied to the
6678             image, but for other models this just reflects the setting independent of
6679             whether or not it was applied
6680             },
6681             RawConv => '$val<0 ? undef : $val',
6682             PrintConv => {
6683             0 => 'Off',
6684             1 => 'On (1D)',
6685             3 => 'On',
6686             4 => 'Auto',
6687             },
6688             },
6689             9 => { #PH
6690             Name => 'WBBracketMode',
6691             PrintConv => {
6692             0 => 'Off',
6693             1 => 'On (shift AB)',
6694             2 => 'On (shift GM)',
6695             },
6696             },
6697             12 => 'WBBracketValueAB', #PH
6698             13 => 'WBBracketValueGM', #PH
6699             14 => { #PH
6700             Name => 'FilterEffect',
6701             RawConv => '$val==-1 ? undef : $val',
6702             PrintConv => {
6703             0 => 'None',
6704             1 => 'Yellow',
6705             2 => 'Orange',
6706             3 => 'Red',
6707             4 => 'Green',
6708             },
6709             },
6710             15 => { #PH
6711             Name => 'ToningEffect',
6712             RawConv => '$val==-1 ? undef : $val',
6713             PrintConv => {
6714             0 => 'None',
6715             1 => 'Sepia',
6716             2 => 'Blue',
6717             3 => 'Purple',
6718             4 => 'Green',
6719             },
6720             },
6721             16 => { #PH
6722             %ciMacroMagnification,
6723             # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
6724             # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
6725             Condition => q{
6726             $$self{LensType} and $$self{LensType} == 124 and
6727             $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
6728             },
6729             Notes => q{
6730             currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
6731             valid for all camera models
6732             },
6733             },
6734             # 17 - values: 0, 3, 4
6735             # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
6736             19 => { #PH
6737             # Note: this value is not displayed by Canon ImageBrowser for the following
6738             # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
6739             # (this tag could be valid only for some firmware versions:
6740             # http://www.breezesys.com/forum/showthread.php?p=16980)
6741             Name => 'LiveViewShooting',
6742             PrintConv => \%offOn,
6743             },
6744             20 => { #47
6745             Name => 'FocusDistanceUpper',
6746             DataMember => 'FocusDistanceUpper2',
6747             Format => 'int16u',
6748             RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
6749             ValueConv => '$val / 100',
6750             ValueConvInv => '$val * 100',
6751             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6752             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6753             },
6754             21 => { #47
6755             Name => 'FocusDistanceLower',
6756             Condition => '$$self{FocusDistanceUpper2}',
6757             Format => 'int16u',
6758             ValueConv => '$val / 100',
6759             ValueConvInv => '$val * 100',
6760             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6761             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6762             },
6763             # 22 - values: 0, 1
6764             23 => { #JohnMoyer (forum12925)
6765             Name => 'ShutterMode',
6766             PrintConv => {
6767             0 => 'Mechanical',
6768             1 => 'Electronic First Curtain',
6769             2 => 'Electronic',
6770             # 3 => ?
6771             # 21 => ?
6772             # 22 => ?
6773             },
6774             },
6775             25 => { #PH
6776             Name => 'FlashExposureLock',
6777             PrintConv => \%offOn,
6778             },
6779             0x3d => { #IB
6780             Name => 'RFLensType',
6781             Format => 'int16u',
6782             PrintConv => {
6783             0 => 'n/a',
6784             257 => 'Canon RF 50mm F1.2L USM',
6785             258 => 'Canon RF 24-105mm F4L IS USM',
6786             259 => 'Canon RF 28-70mm F2L USM',
6787             260 => 'Canon RF 35mm F1.8 MACRO IS STM',
6788             261 => 'Canon RF 85mm F1.2L USM',
6789             262 => 'Canon RF 85mm F1.2L USM DS',
6790             263 => 'Canon RF 24-70mm F2.8L IS USM',
6791             264 => 'Canon RF 15-35mm F2.8L IS USM',
6792             265 => 'Canon RF 24-240mm F4-6.3 IS USM',
6793             266 => 'Canon RF 70-200mm F2.8L IS USM',
6794             267 => 'Canon RF 85mm F2 MACRO IS STM',
6795             268 => 'Canon RF 600mm F11 IS STM',
6796             269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
6797             270 => 'Canon RF 600mm F11 IS STM + RF2x',
6798             271 => 'Canon RF 800mm F11 IS STM',
6799             272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
6800             273 => 'Canon RF 800mm F11 IS STM + RF2x',
6801             274 => 'Canon RF 24-105mm F4-7.1 IS STM',
6802             275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
6803             276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
6804             277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
6805             278 => 'Canon RF 70-200mm F4L IS USM', #42
6806             280 => 'Canon RF 50mm F1.8 STM', #42
6807             281 => 'Canon RF 14-35mm F4L IS USM', #42/IB
6808             283 => 'Canon RF 100-400mm F5.6-8 IS USM', #42
6809             284 => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42 (NC)
6810             285 => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42 (NC)
6811             288 => 'Canon RF 16mm F2.8 STM', #42
6812             289 => 'Canon RF 400mm F2.8L IS USM', #IB
6813             290 => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
6814             291 => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
6815             292 => 'Canon RF 600mm F4L IS USM', #GiaZopatti
6816             #xxx => 'Canon RF 100mm F2.8L MACRO IS USM',
6817             # Note: add new RF lenses to %canonLensTypes with ID 61182
6818             },
6819             },
6820             );
6821              
6822             # Internal serial number information (MakerNotes tag 0x96) (ref PH)
6823             %Image::ExifTool::Canon::SerialInfo = (
6824             %binaryDataAttrs,
6825             FIRST_ENTRY => 0,
6826             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6827             9 => {
6828             Name => 'InternalSerialNumber',
6829             Format => 'string',
6830             },
6831             );
6832              
6833             # Cropping information (MakerNotes tag 0x98) (ref PH)
6834             %Image::ExifTool::Canon::CropInfo = (
6835             %binaryDataAttrs,
6836             FORMAT => 'int16u',
6837             FIRST_ENTRY => 0,
6838             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6839             0 => 'CropLeftMargin', # (NC, may be right)
6840             1 => 'CropRightMargin',
6841             2 => 'CropTopMargin', # (NC, may be bottom)
6842             3 => 'CropBottomMargin',
6843             );
6844              
6845             # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
6846             %Image::ExifTool::Canon::AspectInfo = (
6847             %binaryDataAttrs,
6848             FORMAT => 'int32u',
6849             FIRST_ENTRY => 0,
6850             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6851             0 => {
6852             Name => 'AspectRatio',
6853             PrintConv => {
6854             0 => '3:2',
6855             1 => '1:1',
6856             2 => '4:3',
6857             7 => '16:9',
6858             8 => '4:5',
6859             12 => '3:2 (APS-H crop)', #IB
6860             13 => '3:2 (APS-C crop)', #IB
6861             },
6862             },
6863             # (could use better names for these, or the Crop tags above, or both)
6864             1 => 'CroppedImageWidth',
6865             2 => 'CroppedImageHeight',
6866             3 => 'CroppedImageLeft', #forum4138
6867             4 => 'CroppedImageTop', #ditto
6868             );
6869              
6870             # Color information (MakerNotes tag 0xa0)
6871             %Image::ExifTool::Canon::Processing = (
6872             %binaryDataAttrs,
6873             FORMAT => 'int16s',
6874             FIRST_ENTRY => 1,
6875             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6876             1 => { #PH
6877             Name => 'ToneCurve',
6878             PrintConv => {
6879             0 => 'Standard',
6880             1 => 'Manual',
6881             2 => 'Custom',
6882             },
6883             },
6884             2 => { #12
6885             Name => 'Sharpness',
6886             Notes => 'all models except the 20D and 350D',
6887             Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6888             Priority => 0, # (maybe not as reliable as other sharpness values)
6889             },
6890             3 => { #PH
6891             Name => 'SharpnessFrequency', # PatternSharpness?
6892             PrintConvColumns => 2,
6893             PrintConv => {
6894             0 => 'n/a',
6895             1 => 'Lowest',
6896             2 => 'Low',
6897             3 => 'Standard',
6898             4 => 'High',
6899             5 => 'Highest',
6900             },
6901             },
6902             4 => 'SensorRedLevel', #PH
6903             5 => 'SensorBlueLevel', #PH
6904             6 => 'WhiteBalanceRed', #PH
6905             7 => 'WhiteBalanceBlue', #PH
6906             8 => { #PH
6907             Name => 'WhiteBalance',
6908             RawConv => '$val < 0 ? undef : $val',
6909             PrintConv => \%canonWhiteBalance,
6910             SeparateTable => 1,
6911             },
6912             9 => 'ColorTemperature', #6
6913             10 => { #12
6914             Name => 'PictureStyle',
6915             Flags => ['PrintHex','SeparateTable'],
6916             PrintConv => \%pictureStyles,
6917             },
6918             11 => { #PH
6919             Name => 'DigitalGain',
6920             ValueConv => '$val / 10',
6921             ValueConvInv => '$val * 10',
6922             },
6923             12 => { #PH
6924             Name => 'WBShiftAB',
6925             Notes => 'positive is a shift toward amber',
6926             },
6927             13 => { #PH
6928             Name => 'WBShiftGM',
6929             Notes => 'positive is a shift toward green',
6930             },
6931             );
6932              
6933             # Color balance information (MakerNotes tag 0xa9) (ref PH)
6934             %Image::ExifTool::Canon::ColorBalance = (
6935             %binaryDataAttrs,
6936             NOTES => 'These tags are used by the 10D and 300D.',
6937             FORMAT => 'int16s',
6938             FIRST_ENTRY => 0,
6939             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6940             # red,green1,green2,blue (ref 2)
6941             1 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
6942             5 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
6943             9 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
6944             13 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
6945             17 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
6946             21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
6947             25 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
6948             29 => [{
6949             Name => 'WB_RGGBLevelsCustom',
6950             Notes => 'black levels for the D60',
6951             Condition => '$$self{Model} !~ /EOS D60\b/',
6952             Format => 'int16s[4]',
6953             },{ # (black levels for D60, ref IB)
6954             Name => 'BlackLevels',
6955             Format => 'int16s[4]',
6956             }],
6957             33 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
6958             37 => { Name => 'WB_RGGBBlackLevels', Format => 'int16s[4]' }, #IB
6959             );
6960              
6961             # Measured color levels (MakerNotes tag 0xaa) (ref 37)
6962             %Image::ExifTool::Canon::MeasuredColor = (
6963             %binaryDataAttrs,
6964             FORMAT => 'int16u',
6965             FIRST_ENTRY => 1,
6966             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6967             1 => {
6968             # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
6969             Name => 'MeasuredRGGB',
6970             Format => 'int16u[4]',
6971             },
6972             # 5 - observed values: 0, 1 - PH
6973             );
6974              
6975             # Flags information (MakerNotes tag 0xb0) (ref PH)
6976             %Image::ExifTool::Canon::Flags = (
6977             %binaryDataAttrs,
6978             FORMAT => 'int16s',
6979             FIRST_ENTRY => 1,
6980             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6981             1 => 'ModifiedParamFlag',
6982             );
6983              
6984             # Modified information (MakerNotes tag 0xb1) (ref PH)
6985             %Image::ExifTool::Canon::ModifiedInfo = (
6986             %binaryDataAttrs,
6987             FORMAT => 'int16s',
6988             FIRST_ENTRY => 1,
6989             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6990             1 => {
6991             Name => 'ModifiedToneCurve',
6992             PrintConv => {
6993             0 => 'Standard',
6994             1 => 'Manual',
6995             2 => 'Custom',
6996             },
6997             },
6998             2 => {
6999             Name => 'ModifiedSharpness',
7000             Notes => '1D and 5D only',
7001             Condition => '$$self{Model} =~ /\b(1D|5D)/',
7002             },
7003             3 => {
7004             Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
7005             PrintConv => {
7006             0 => 'n/a',
7007             1 => 'Lowest',
7008             2 => 'Low',
7009             3 => 'Standard',
7010             4 => 'High',
7011             5 => 'Highest',
7012             },
7013             },
7014             4 => 'ModifiedSensorRedLevel',
7015             5 => 'ModifiedSensorBlueLevel',
7016             6 => 'ModifiedWhiteBalanceRed',
7017             7 => 'ModifiedWhiteBalanceBlue',
7018             8 => {
7019             Name => 'ModifiedWhiteBalance',
7020             PrintConv => \%canonWhiteBalance,
7021             SeparateTable => 'WhiteBalance',
7022             },
7023             9 => 'ModifiedColorTemp',
7024             10 => {
7025             Name => 'ModifiedPictureStyle',
7026             PrintHex => 1,
7027             SeparateTable => 'PictureStyle',
7028             PrintConv => \%pictureStyles,
7029             },
7030             11 => {
7031             Name => 'ModifiedDigitalGain',
7032             ValueConv => '$val / 10',
7033             ValueConvInv => '$val * 10',
7034             },
7035             );
7036              
7037             # Preview image information (MakerNotes tag 0xb6)
7038             # - The 300D writes a 1536x1024 preview image that is accessed
7039             # through this information - decoded by PH 12/14/03
7040             %Image::ExifTool::Canon::PreviewImageInfo = (
7041             %binaryDataAttrs,
7042             FORMAT => 'int32u',
7043             FIRST_ENTRY => 1,
7044             IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
7045             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7046             # the size of the preview block in 2-byte increments
7047             # 0 => {
7048             # Name => 'PreviewImageInfoWords',
7049             # },
7050             1 => {
7051             Name => 'PreviewQuality',
7052             PrintConv => \%canonQuality,
7053             },
7054             2 => {
7055             Name => 'PreviewImageLength',
7056             OffsetPair => 5, # point to associated offset
7057             DataTag => 'PreviewImage',
7058             WriteGroup => 'MakerNotes',
7059             Protected => 2,
7060             },
7061             3 => 'PreviewImageWidth',
7062             4 => 'PreviewImageHeight',
7063             5 => {
7064             Name => 'PreviewImageStart',
7065             Flags => 'IsOffset',
7066             OffsetPair => 2, # associated byte count tagID
7067             DataTag => 'PreviewImage',
7068             WriteGroup => 'MakerNotes',
7069             Protected => 2,
7070             },
7071             # NOTE: The size of the PreviewImageInfo structure is incorrectly
7072             # written as 48 bytes (Count=12, Format=int32u), but only the first
7073             # 6 int32u values actually exist
7074             );
7075              
7076             # Sensor information (MakerNotes tag 0xe0) (ref 12)
7077             %Image::ExifTool::Canon::SensorInfo = (
7078             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
7079             FORMAT => 'int16s',
7080             FIRST_ENTRY => 1,
7081             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7082             # Note: Don't make these writable because it confuses Canon decoding software
7083             # if these are changed
7084             1 => 'SensorWidth',
7085             2 => 'SensorHeight',
7086             5 => 'SensorLeftBorder', #2
7087             6 => 'SensorTopBorder', #2
7088             7 => 'SensorRightBorder', #2
7089             8 => 'SensorBottomBorder', #2
7090             9 => { #22
7091             Name => 'BlackMaskLeftBorder',
7092             Notes => q{
7093             coordinates for the area to the left or right of the image used to calculate
7094             the average black level
7095             },
7096             },
7097             10 => 'BlackMaskTopBorder', #22
7098             11 => 'BlackMaskRightBorder', #22
7099             12 => 'BlackMaskBottomBorder', #22
7100             );
7101              
7102             # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
7103             %Image::ExifTool::Canon::ColorData1 = (
7104             %binaryDataAttrs,
7105             NOTES => 'These tags are used by the 20D and 350D.',
7106             FORMAT => 'int16s',
7107             FIRST_ENTRY => 0,
7108             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7109             IS_SUBDIR => [ 0x4b ],
7110             # 0x00: size of record in bytes - PH
7111             # (dcraw 8.81 uses index 0x19 for WB)
7112             0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7113             0x1d => 'ColorTempAsShot',
7114             0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7115             0x22 => 'ColorTempAuto',
7116             0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7117             0x27 => 'ColorTempDaylight',
7118             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7119             0x2c => 'ColorTempShade',
7120             0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7121             0x31 => 'ColorTempCloudy',
7122             0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7123             0x36 => 'ColorTempTungsten',
7124             0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7125             0x3b => 'ColorTempFluorescent',
7126             0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7127             0x40 => 'ColorTempFlash',
7128             0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
7129             0x45 => 'ColorTempCustom1',
7130             0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
7131             0x4a => 'ColorTempCustom2',
7132             0x4b => { #PH
7133             Name => 'ColorCalib',
7134             Format => 'undef[120]',
7135             Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
7136             Notes => 'A, B, C, Temperature',
7137             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7138             },
7139             );
7140              
7141             # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
7142             %Image::ExifTool::Canon::ColorData2 = (
7143             %binaryDataAttrs,
7144             NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
7145             FORMAT => 'int16s',
7146             FIRST_ENTRY => 0,
7147             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7148             IS_SUBDIR => [ 0xa4 ],
7149             0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7150             0x1c => 'ColorTempAuto',
7151             0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7152             0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
7153             # (dcraw 8.81 uses index 0x22 for WB)
7154             0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7155             0x26 => 'ColorTempAsShot',
7156             0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7157             0x2b => 'ColorTempDaylight',
7158             0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7159             0x30 => 'ColorTempShade',
7160             0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7161             0x35 => 'ColorTempCloudy',
7162             0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7163             0x3a => 'ColorTempTungsten',
7164             0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7165             0x3f => 'ColorTempFluorescent',
7166             0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7167             0x44 => 'ColorTempKelvin',
7168             0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7169             0x49 => 'ColorTempFlash',
7170             0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7171             0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
7172             0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7173             0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7174             0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7175             0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7176             0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7177             0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
7178             0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7179             0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
7180             0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7181             0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7182             0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7183             0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
7184             0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7185             0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7186             0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7187             0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7188             0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7189             0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
7190             0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7191             0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
7192             0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7193             0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7194             0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7195             0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
7196             0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7197             0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
7198             0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7199             0x94 => 'ColorTempPC1',
7200             0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7201             0x99 => 'ColorTempPC2',
7202             0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7203             0x9e => 'ColorTempPC3',
7204             0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7205             0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7206             0xa4 => { #PH
7207             Name => 'ColorCalib',
7208             Format => 'undef[120]',
7209             Unknown => 1,
7210             Notes => 'A, B, C, Temperature',
7211             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7212             },
7213             0x26a => { #PH
7214             Name => 'RawMeasuredRGGB',
7215             Format => 'int32u[4]',
7216             Notes => 'raw MeasuredRGGB values, before normalization',
7217             # swap words because the word ordering is big-endian, opposite to the byte ordering
7218             ValueConv => \&SwapWords,
7219             ValueConvInv => \&SwapWords,
7220             },
7221             );
7222              
7223             # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
7224             %Image::ExifTool::Canon::ColorData3 = (
7225             %binaryDataAttrs,
7226             NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
7227             FORMAT => 'int16s',
7228             FIRST_ENTRY => 0,
7229             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7230             IS_SUBDIR => [ 0x85 ],
7231             0x00 => { #PH
7232             Name => 'ColorDataVersion',
7233             PrintConv => {
7234             1 => '1 (1DmkIIN/5D/30D/400D)',
7235             },
7236             },
7237             # 0x01-0x3e: RGGB coefficients, apparently specific to the
7238             # individual camera and possibly used for color calibration (ref 37)
7239             # (dcraw 8.81 uses index 0x3f for WB)
7240             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7241             0x43 => 'ColorTempAsShot',
7242             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7243             0x48 => 'ColorTempAuto',
7244             # not sure exactly what 'Measured' values mean...
7245             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7246             0x4d => 'ColorTempMeasured',
7247             0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7248             0x52 => 'ColorTempDaylight',
7249             0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7250             0x57 => 'ColorTempShade',
7251             0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7252             0x5c => 'ColorTempCloudy',
7253             0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7254             0x61 => 'ColorTempTungsten',
7255             0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7256             0x66 => 'ColorTempFluorescent',
7257             0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7258             0x6b => 'ColorTempKelvin',
7259             0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7260             0x70 => 'ColorTempFlash',
7261             0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7262             0x75 => 'ColorTempPC1',
7263             0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7264             0x7a => 'ColorTempPC2',
7265             0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7266             0x7f => 'ColorTempPC3',
7267             0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
7268             0x84 => 'ColorTempCustom',
7269             0x85 => { #37
7270             Name => 'ColorCalib',
7271             Format => 'undef[120]',
7272             Unknown => 1,
7273             Notes => 'B, C, A, Temperature',
7274             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7275             },
7276             0xc4 => { #IB
7277             Name => 'PerChannelBlackLevel',
7278             Format => 'int16u[4]',
7279             },
7280             # 0xc8-0x1c7: some sort of color table (ref 37)
7281             0x248 => { #37
7282             Name => 'FlashOutput',
7283             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7284             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7285             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7286             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7287             },
7288             0x249 => { #37
7289             Name => 'FlashBatteryLevel',
7290             # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
7291             # - have seen a value of 201 with internal flash
7292             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7293             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7294             },
7295             0x24a => { #37
7296             Name => 'ColorTempFlashData',
7297             # 0 for no external flash, 35980 for 'Strobe or Misfire'
7298             # (lower than ColorTempFlash by up to 200 degrees)
7299             RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
7300             },
7301             # 0x24b: inverse relationship with flash power (ref 37)
7302             # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
7303             0x287 => { #37
7304             Name => 'MeasuredRGGBData',
7305             Format => 'int32u[4]',
7306             Notes => 'MeasuredRGGB may be derived from these data values',
7307             # swap words because the word ordering is big-endian, opposite to the byte ordering
7308             ValueConv => \&SwapWords,
7309             ValueConvInv => \&SwapWords,
7310             },
7311             # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
7312             );
7313              
7314             # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
7315             %Image::ExifTool::Canon::ColorData4 = (
7316             %binaryDataAttrs,
7317             NOTES => q{
7318             These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
7319             60D, 450D, 500D, 550D, 1000D and 1100D.
7320             },
7321             FORMAT => 'int16s',
7322             FIRST_ENTRY => 0,
7323             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7324             IS_SUBDIR => [ 0x3f, 0xa8 ],
7325             DATAMEMBER => [ 0x00 ],
7326             0x00 => {
7327             Name => 'ColorDataVersion',
7328             DataMember => 'ColorDataVersion',
7329             RawConv => '$$self{ColorDataVersion} = $val',
7330             PrintConv => {
7331             2 => '2 (1DmkIII)',
7332             3 => '3 (40D)',
7333             4 => '4 (1DSmkIII)',
7334             5 => '5 (450D/1000D)',
7335             6 => '6 (50D/5DmkII)',
7336             7 => '7 (500D/550D/7D/1DmkIV)',
7337             9 => '9 (60D/1100D)',
7338             },
7339             },
7340             # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
7341             # (dcraw 8.81 uses index 0x3f for WB)
7342             0x3f => {
7343             Name => 'ColorCoefs',
7344             Format => 'undef[210]', # ColorTempUnknown11 is last entry
7345             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7346             },
7347             0xa8 => {
7348             Name => 'ColorCalib',
7349             Format => 'undef[120]',
7350             Unknown => 1,
7351             Notes => 'B, C, A, Temperature',
7352             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7353             },
7354             0x0e7 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7355             0x280 => { #PH
7356             Name => 'RawMeasuredRGGB',
7357             Format => 'int32u[4]',
7358             Notes => 'raw MeasuredRGGB values, before normalization',
7359             # swap words because the word ordering is big-endian, opposite to the byte ordering
7360             ValueConv => \&SwapWords,
7361             ValueConvInv => \&SwapWords,
7362             },
7363             0x2b4 => { #IB
7364             Name => 'PerChannelBlackLevel',
7365             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7366             Format => 'int16u[4]',
7367             },
7368             0x2b8 => { #IB
7369             Name => 'NormalWhiteLevel',
7370             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7371             Format => 'int16u',
7372             RawConv => '$val || undef',
7373             },
7374             0x2b9 => { #IB
7375             Name => 'SpecularWhiteLevel',
7376             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7377             Format => 'int16u',
7378             },
7379             0x2ba => { #IB
7380             Name => 'LinearityUpperMargin',
7381             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7382             Format => 'int16u',
7383             },
7384             0x2cb => { #IB
7385             Name => 'PerChannelBlackLevel',
7386             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7387             Format => 'int16u[4]',
7388             },
7389             0x2cf => [{ #IB
7390             Name => 'NormalWhiteLevel',
7391             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7392             Format => 'int16u',
7393             RawConv => '$val || undef',
7394             },{
7395             Name => 'PerChannelBlackLevel',
7396             Condition => '$$self{ColorDataVersion} == 9',
7397             Format => 'int16u[4]',
7398             }],
7399             0x2d0 => { #IB
7400             Name => 'SpecularWhiteLevel',
7401             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7402             Format => 'int16u',
7403             },
7404             0x2d1 => { #IB
7405             Name => 'LinearityUpperMargin',
7406             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7407             Format => 'int16u',
7408             },
7409             0x2d3 => { #IB
7410             Name => 'NormalWhiteLevel',
7411             Condition => '$$self{ColorDataVersion} == 9',
7412             Format => 'int16u',
7413             RawConv => '$val || undef',
7414             },
7415             0x2d4 => { #IB
7416             Name => 'SpecularWhiteLevel',
7417             Condition => '$$self{ColorDataVersion} == 9',
7418             Format => 'int16u',
7419             },
7420             0x2d5 => { #IB
7421             Name => 'LinearityUpperMargin',
7422             Condition => '$$self{ColorDataVersion} == 9',
7423             Format => 'int16u',
7424             },
7425             );
7426              
7427             # color coefficients (ref PH)
7428             %Image::ExifTool::Canon::ColorCoefs = (
7429             %binaryDataAttrs,
7430             FORMAT => 'int16s',
7431             FIRST_ENTRY => 0,
7432             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7433             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7434             0x04 => 'ColorTempAsShot',
7435             0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7436             0x09 => 'ColorTempAuto',
7437             0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7438             0x0e => 'ColorTempMeasured',
7439             # the following Unknown values are set for the 50D and 5DmkII, and the
7440             # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
7441             # and conversion for all modes of the 40D
7442             0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7443             0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
7444             0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7445             0x18 => 'ColorTempDaylight',
7446             0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7447             0x1d => 'ColorTempShade',
7448             0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7449             0x22 => 'ColorTempCloudy',
7450             0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7451             0x27 => 'ColorTempTungsten',
7452             0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7453             0x2c => 'ColorTempFluorescent',
7454             # (changing the Kelvin values has no effect on image in DPP... why not?)
7455             0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7456             0x31 => 'ColorTempKelvin',
7457             0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7458             0x36 => 'ColorTempFlash',
7459             0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7460             0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
7461             0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7462             0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7463             0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7464             0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7465             0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7466             0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
7467             0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7468             0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7469             0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7470             0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7471             0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7472             0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7473             0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7474             0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
7475             0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7476             0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7477             0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7478             0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7479             0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7480             0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
7481             0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7482             0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7483             );
7484              
7485             # color coefficients (ref PH/IB)
7486             %Image::ExifTool::Canon::ColorCoefs2 = (
7487             %binaryDataAttrs,
7488             FORMAT => 'int16s',
7489             FIRST_ENTRY => 0,
7490             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7491             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7492             0x07 => 'ColorTempAsShot',
7493             0x08 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7494             0x0f => 'ColorTempAuto',
7495             0x10 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7496             0x17 => 'ColorTempMeasured',
7497             0x18 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7498             0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
7499             0x20 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7500             0x27 => 'ColorTempDaylight',
7501             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7502             0x2f => 'ColorTempShade',
7503             0x30 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7504             0x37 => 'ColorTempCloudy',
7505             0x38 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7506             0x3f => 'ColorTempTungsten',
7507             0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7508             0x47 => 'ColorTempFluorescent',
7509             0x48 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7510             0x4f => 'ColorTempKelvin',
7511             0x50 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7512             0x57 => 'ColorTempFlash',
7513             0x58 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7514             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
7515             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7516             0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7517             0x68 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7518             0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
7519             0x70 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7520             0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7521             0x78 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7522             0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7523             0x80 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7524             0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7525             0x88 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7526             0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
7527             0x90 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7528             0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7529             0x98 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7530             0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7531             0xa0 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7532             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7533             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7534             0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
7535             0xb0 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7536             0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7537             );
7538              
7539             # color calibration (ref 37)
7540             %Image::ExifTool::Canon::ColorCalib = (
7541             %binaryDataAttrs,
7542             FORMAT => 'int16s',
7543             FIRST_ENTRY => 0,
7544             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7545             # these coefficients are in a different order compared to older
7546             # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
7547             # Coefficient A most closely matches the blue curvature, and
7548             # coefficient B most closely matches the red curvature, but the match
7549             # is not perfect, and I don't know what coefficient C is for (certainly
7550             # not a green coefficient) - PH
7551             NOTES => q{
7552             Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
7553             order of the coefficients is A, B, C, Temperature, but for newer models it
7554             is B, C, A, Temperature. These tags are extracted only when the L
7555             option is used.
7556             },
7557             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
7558             0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
7559             0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
7560             0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
7561             0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
7562             0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
7563             0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
7564             0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
7565             0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
7566             0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
7567             0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
7568             0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
7569             0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
7570             0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
7571             0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
7572             );
7573              
7574             # color calibration2
7575             %Image::ExifTool::Canon::ColorCalib2 = (
7576             %binaryDataAttrs,
7577             FORMAT => 'int16s',
7578             FIRST_ENTRY => 0,
7579             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7580             NOTES => 'B, C, A, D, Temperature.',
7581             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
7582             0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
7583             0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
7584             0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
7585             0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
7586             0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
7587             0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
7588             0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
7589             0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
7590             0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
7591             0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
7592             0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
7593             0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
7594             0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
7595             0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
7596             );
7597              
7598             # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
7599             %Image::ExifTool::Canon::ColorData5 = (
7600             %binaryDataAttrs,
7601             NOTES => 'These tags are used by many EOS M and PowerShot models.',
7602             FORMAT => 'int16s',
7603             FIRST_ENTRY => 0,
7604             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7605             DATAMEMBER => [ 0x00 ],
7606             IS_SUBDIR => [ 0x47, 0xba, 0xff ],
7607             0x00 => {
7608             Name => 'ColorDataVersion',
7609             DataMember => 'ColorDataVersion',
7610             RawConv => '$$self{ColorDataVersion} = $val',
7611             PrintConv => {
7612             -3 => '-3 (M10/M3)', # (and PowerShot G1X/G1XmkII/G10/G11/G12/G15/G16/G3X/G5X/G7X/G9X/S100/S110/S120/S90/S95/SX1IS/SX50HS/SX60HS)
7613             -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
7614             },
7615             },
7616             0x47 => [{
7617             Name => 'ColorCoefs',
7618             Condition => '$$self{ColorDataVersion} == -3',
7619             Format => 'undef[230]', # ColorTempUnknown13 is last entry
7620             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7621             },{
7622             Name => 'ColorCoefs2',
7623             Condition => '$$self{ColorDataVersion} == -4',
7624             Format => 'undef[368]',
7625             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
7626             }],
7627             0xba => {
7628             Name => 'ColorCalib2',
7629             Condition => '$$self{ColorDataVersion} == -3',
7630             Format => 'undef[150]',
7631             Unknown => 1,
7632             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7633             },
7634             0xff => {
7635             Name => 'ColorCalib2',
7636             Condition => '$$self{ColorDataVersion} == -4',
7637             Format => 'undef[150]',
7638             Unknown => 1,
7639             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7640             },
7641             0x108=> { #IB
7642             Name => 'PerChannelBlackLevel',
7643             Condition => '$$self{ColorDataVersion} == -3',
7644             Format => 'int16s[4]',
7645             },
7646             0x14d=> { #IB
7647             Name => 'PerChannelBlackLevel',
7648             Condition => '$$self{ColorDataVersion} == -4',
7649             Format => 'int16s[4]',
7650             },
7651             0x0569 => { #PH (NC)
7652             Name => 'NormalWhiteLevel',
7653             Condition => '$$self{ColorDataVersion} == -4',
7654             Format => 'int16u',
7655             },
7656             0x056a => { #PH (NC)
7657             Name => 'SpecularWhiteLevel',
7658             Condition => '$$self{ColorDataVersion} == -4',
7659             Format => 'int16u',
7660             },
7661             );
7662              
7663             # Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
7664             %Image::ExifTool::Canon::ColorData6 = (
7665             %binaryDataAttrs,
7666             NOTES => 'These tags are used by the EOS 600D and 1200D.',
7667             FORMAT => 'int16s',
7668             FIRST_ENTRY => 0,
7669             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7670             IS_SUBDIR => [ 0xbc ],
7671             0x00 => {
7672             Name => 'ColorDataVersion',
7673             PrintConv => {
7674             10 => '10 (600D/1200D)',
7675             },
7676             },
7677             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7678             0x43 => 'ColorTempAsShot',
7679             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7680             0x48 => 'ColorTempAuto',
7681             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7682             0x4d => 'ColorTempMeasured',
7683             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7684             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7685             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7686             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7687             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7688             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7689             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7690             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7691             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7692             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7693             0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7694             0x6b => 'ColorTempDaylight',
7695             0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7696             0x70 => 'ColorTempShade',
7697             0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7698             0x75 => 'ColorTempCloudy',
7699             0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7700             0x7a => 'ColorTempTungsten',
7701             0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7702             0x7f => 'ColorTempFluorescent',
7703             0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7704             0x84 => 'ColorTempKelvin',
7705             0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7706             0x89 => 'ColorTempFlash',
7707             0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7708             0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
7709             0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7710             0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7711             0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7712             0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7713             0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7714             0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
7715             0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7716             0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7717             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7718             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7719             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7720             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7721             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7722             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7723             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7724             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7725             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7726             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7727             0xbc => {
7728             Name => 'ColorCalib',
7729             Format => 'undef[120]',
7730             Unknown => 1,
7731             Notes => 'B, C, A, Temperature',
7732             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7733             },
7734             0x0fb => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7735             0x194 => { #PH
7736             Name => 'RawMeasuredRGGB',
7737             Format => 'int32u[4]',
7738             Notes => 'raw MeasuredRGGB values, before normalization',
7739             # swap words because the word ordering is big-endian, opposite to the byte ordering
7740             ValueConv => \&SwapWords,
7741             ValueConvInv => \&SwapWords,
7742             },
7743             0x1df => { Name => 'PerChannelBlackLevel', Format => 'int16u[4]' }, #IB
7744             0x1e3 => { Name => 'NormalWhiteLevel', Format => 'int16u', RawConv => '$val || undef' }, #IB
7745             0x1e4 => { Name => 'SpecularWhiteLevel', Format => 'int16u' }, #IB
7746             0x1e5 => { Name => 'LinearityUpperMargin', Format => 'int16u' }, #IB
7747             );
7748              
7749             # Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
7750             %Image::ExifTool::Canon::ColorData7 = (
7751             %binaryDataAttrs,
7752             NOTES => q{
7753             These tags are used by the EOS 1DX, 5DmkIII, 6D, 7DmkII, 100D, 650D, 700D,
7754             8000D, M and M2.
7755             },
7756             FORMAT => 'int16s',
7757             FIRST_ENTRY => 0,
7758             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7759             DATAMEMBER => [ 0x00 ],
7760             IS_SUBDIR => [ 0xd5 ],
7761             0x00 => {
7762             Name => 'ColorDataVersion',
7763             DataMember => 'ColorDataVersion',
7764             RawConv => '$$self{ColorDataVersion} = $val',
7765             PrintConv => {
7766             10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M/M2)',
7767             11 => '11 (7DmkII/750D/760D/8000D)',
7768             },
7769             },
7770             # not really sure about the AsShot, Auto and Measured values any more - PH
7771             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7772             0x43 => 'ColorTempAsShot',
7773             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7774             0x48 => 'ColorTempAuto',
7775             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7776             0x4d => 'ColorTempMeasured',
7777             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7778             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7779             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7780             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7781             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7782             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7783             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7784             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7785             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7786             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7787             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7788             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7789             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7790             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7791             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7792             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7793             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7794             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7795             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7796             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7797             0x80 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7798             0x84 => 'ColorTempDaylight',
7799             0x85 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7800             0x89 => 'ColorTempShade',
7801             0x8a => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7802             0x8e => 'ColorTempCloudy',
7803             0x8f => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7804             0x93 => 'ColorTempTungsten',
7805             0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7806             0x98 => 'ColorTempFluorescent',
7807             0x99 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7808             0x9d => 'ColorTempKelvin',
7809             0x9e => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7810             0xa2 => 'ColorTempFlash',
7811             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7812             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7813             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7814             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7815             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7816             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7817             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7818             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7819             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7820             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7821             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7822             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7823             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
7824             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
7825             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
7826             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
7827             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
7828             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
7829             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
7830             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
7831             0xd5 => {
7832             Name => 'ColorCalib',
7833             Format => 'undef[120]',
7834             Unknown => 1,
7835             Notes => 'B, C, A, Temperature',
7836             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7837             },
7838             0x114 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7839             0x1ad => {
7840             Name => 'RawMeasuredRGGB',
7841             Condition => '$$self{ColorDataVersion} == 10',
7842             Format => 'int32u[4]',
7843             Notes => 'raw MeasuredRGGB values, before normalization',
7844             # swap words because the word ordering is big-endian, opposite to the byte ordering
7845             ValueConv => \&SwapWords,
7846             ValueConvInv => \&SwapWords,
7847             },
7848             0x1f8 => { #IB
7849             Name => 'PerChannelBlackLevel',
7850             Condition => '$$self{ColorDataVersion} == 10',
7851             Format => 'int16u[4]',
7852             },
7853             0x1fc => { #IB
7854             Name => 'NormalWhiteLevel',
7855             Condition => '$$self{ColorDataVersion} == 10',
7856             Format => 'int16u',
7857             RawConv => '$val || undef',
7858             },
7859             0x1fd => { #IB
7860             Name => 'SpecularWhiteLevel',
7861             Condition => '$$self{ColorDataVersion} == 10',
7862             Format => 'int16u',
7863             },
7864             0x1fe => { #IB
7865             Name => 'LinearityUpperMargin',
7866             Condition => '$$self{ColorDataVersion} == 10',
7867             Format => 'int16u',
7868             },
7869             0x26b => {
7870             Name => 'RawMeasuredRGGB',
7871             Condition => '$$self{ColorDataVersion} == 11',
7872             Format => 'int32u[4]',
7873             ValueConv => \&SwapWords,
7874             ValueConvInv => \&SwapWords,
7875             },
7876             0x2d8 => {
7877             Name => 'PerChannelBlackLevel',
7878             Condition => '$$self{ColorDataVersion} == 11',
7879             Format => 'int16u[4]',
7880             },
7881             0x2dc => {
7882             Name => 'NormalWhiteLevel',
7883             Condition => '$$self{ColorDataVersion} == 11',
7884             Format => 'int16u',
7885             RawConv => '$val || undef',
7886             },
7887             0x2dd => {
7888             Name => 'SpecularWhiteLevel',
7889             Condition => '$$self{ColorDataVersion} == 11',
7890             Format => 'int16u',
7891             },
7892             0x2de => {
7893             Name => 'LinearityUpperMargin',
7894             Condition => '$$self{ColorDataVersion} == 11',
7895             Format => 'int16u',
7896             },
7897             );
7898              
7899             # Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
7900             %Image::ExifTool::Canon::ColorData8 = (
7901             %binaryDataAttrs,
7902             NOTES => q{
7903             These tags are used by the EOS 1DXmkII, 5DS, 5DSR, 5DmkIV, 6DmkII, 77D, 80D,
7904             200D, 800D, 1300D, 2000D, 4000D and 9000D.
7905             },
7906             FORMAT => 'int16s',
7907             FIRST_ENTRY => 0,
7908             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7909             DATAMEMBER => [ 0 ],
7910             IS_SUBDIR => [ 0x107 ],
7911             0x00 => {
7912             Name => 'ColorDataVersion',
7913             DataMember => 'ColorDataVersion',
7914             RawConv => '$$self{ColorDataVersion} = $val',
7915             PrintConv => {
7916             12 => '12 (1DXmkII/5DS/5DSR)',
7917             13 => '13 (80D/5DmkIV)', #PH
7918             14 => '14 (1300D/2000D/4000D)', #IB
7919             15 => '15 (6DmkII/77D/200D/800D,9000D)', #IB
7920             },
7921             },
7922             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7923             0x43 => 'ColorTempAsShot',
7924             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7925             0x48 => 'ColorTempAuto',
7926             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7927             0x4d => 'ColorTempMeasured',
7928             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7929             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7930             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7931             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7932             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7933             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7934             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7935             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7936             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7937             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7938             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7939             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7940             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7941             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7942             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7943             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7944             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7945             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7946             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7947             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7948             0x80 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7949             0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7950             0x85 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7951             0x89 => 'ColorTempDaylight',
7952             0x8a => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7953             0x8e => 'ColorTempShade',
7954             0x8f => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7955             0x93 => 'ColorTempCloudy',
7956             0x94 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7957             0x98 => 'ColorTempTungsten',
7958             0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7959             0x9d => 'ColorTempFluorescent',
7960             0x9e => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7961             0xa2 => 'ColorTempKelvin',
7962             0xa3 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7963             0xa7 => 'ColorTempFlash',
7964             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7965             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7966             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7967             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7968             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7969             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7970             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7971             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7972             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7973             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7974             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
7975             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
7976             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
7977             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
7978             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
7979             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
7980             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
7981             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
7982             0xd5 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
7983             0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
7984             0xda => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
7985             0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
7986             0xdf => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
7987             0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
7988             0xe4 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
7989             0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
7990             0xe9 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
7991             0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
7992             0xee => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
7993             0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
7994             0xf3 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
7995             0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
7996             0xf8 => { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
7997             0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
7998             0xfd => { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
7999             0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8000             0x102 => { Name => 'WB_RGGBLevelsUnknown30', Format => 'int16s[4]', Unknown => 1 },
8001             0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
8002              
8003             0x107 => {
8004             Name => 'ColorCalib',
8005             Format => 'undef[120]',
8006             Unknown => 1,
8007             Notes => 'B, C, A, Temperature',
8008             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8009             },
8010             0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
8011             0x22c => {
8012             Name => 'PerChannelBlackLevel',
8013             Condition => '$$self{ColorDataVersion} == 14',
8014             Format => 'int16u[4]',
8015             Notes => '1300D',
8016             },
8017             0x230 => {
8018             Name => 'NormalWhiteLevel',
8019             Condition => '$$self{ColorDataVersion} == 14',
8020             Format => 'int16u',
8021             Notes => '1300D',
8022             RawConv => '$val || undef',
8023             },
8024             0x231 => {
8025             Name => 'SpecularWhiteLevel',
8026             Condition => '$$self{ColorDataVersion} == 14',
8027             Format => 'int16u',
8028             Notes => '1300D',
8029             },
8030             0x232 => {
8031             Name => 'LinearityUpperMargin',
8032             Condition => '$$self{ColorDataVersion} == 14',
8033             Format => 'int16u',
8034             Notes => '1300D',
8035             },
8036             0x30a => {
8037             Name => 'PerChannelBlackLevel',
8038             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8039             Format => 'int16u[4]',
8040             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8041             },
8042             0x30e => {
8043             Name => 'NormalWhiteLevel',
8044             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8045             Format => 'int16u',
8046             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8047             RawConv => '$val || undef',
8048             },
8049             0x30f => {
8050             Name => 'SpecularWhiteLevel',
8051             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8052             Format => 'int16u',
8053             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8054             },
8055             0x310 => {
8056             Name => 'LinearityUpperMargin',
8057             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8058             Format => 'int16u',
8059             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8060             },
8061             );
8062              
8063             # Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
8064             %Image::ExifTool::Canon::ColorData9 = (
8065             %binaryDataAttrs,
8066             NOTES => 'These tags are used by the M6mkII, M50, M200, EOS R, RP, 90D, 250D and 850D',
8067             FORMAT => 'int16s',
8068             FIRST_ENTRY => 0,
8069             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8070             DATAMEMBER => [ 0 ],
8071             IS_SUBDIR => [ 0x10a ],
8072             0x00 => {
8073             Name => 'ColorDataVersion',
8074             DataMember => 'ColorDataVersion',
8075             RawConv => '$$self{ColorDataVersion} = $val',
8076             PrintConv => {
8077             16 => '16 (M50)',
8078             17 => '17 (EOS R)', # (and PowerShot SX740HS)
8079             18 => '18 (EOS RP/250D)', # (and PowerShot SX70HS)
8080             19 => '19 (90D/850D/M6mkII/M200)',# (and PowerShot G7XmkIII)
8081             },
8082             },
8083             0x47 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8084             0x4b => 'ColorTempAsShot',
8085             0x4c => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8086             0x50 => 'ColorTempAuto',
8087             0x51 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8088             0x55 => 'ColorTempMeasured',
8089             0x56 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8090             0x5a => { Name => 'ColorTempUnknown', Unknown => 1 },
8091             0x5b => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8092             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
8093             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8094             0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8095             0x65 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8096             0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8097             0x6a => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8098             0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
8099             0x6f => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8100             0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8101             0x74 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8102             0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8103             0x79 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8104             0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
8105             0x7e => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8106             0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8107             0x83 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8108             0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8109             0x88 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8110             0x8c => 'ColorTempDaylight',
8111             0x8d => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8112             0x91 => 'ColorTempShade',
8113             0x92 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8114             0x96 => 'ColorTempCloudy',
8115             0x97 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8116             0x9b => 'ColorTempTungsten',
8117             0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8118             0xa0 => 'ColorTempFluorescent',
8119             0xa1 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8120             0xa5 => 'ColorTempKelvin',
8121             0xa6 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8122             0xaa => 'ColorTempFlash',
8123             0xab => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8124             0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
8125             0xb0 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8126             0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8127             0xb5 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8128             0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8129             0xba => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8130             0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
8131             0xbf => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8132             0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8133             0xc4 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8134             0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8135             0xc9 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8136             0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
8137             0xce => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8138             0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8139             0xd3 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8140             0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8141             0xd8 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8142             0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
8143             0xdd => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8144             0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8145             0xe2 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8146             0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8147             0xe7 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8148             0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
8149             0xec => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8150             0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8151             0xf1 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8152             0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8153             0xf6 => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8154             0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
8155             0xfb => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8156             0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
8157             0x100=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8158             0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8159             0x105=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8160             0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8161             0x10a => { #IB
8162             Name => 'ColorCalib',
8163             Format => 'undef[120]',
8164             Unknown => 1,
8165             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8166             },
8167             0x149 => { #IB
8168             Name => 'PerChannelBlackLevel',
8169             Format => 'int16u[4]',
8170             },
8171             # 0x318 - PerChannelBlackLevel again (ref IB)
8172             0x31c => { #IB
8173             Name => 'NormalWhiteLevel',
8174             Format => 'int16u',
8175             RawConv => '$val || undef',
8176             },
8177             0x31d => { #IB
8178             Name => 'SpecularWhiteLevel',
8179             Format => 'int16u',
8180             },
8181             0x31e => { #IB
8182             Name => 'LinearityUpperMargin',
8183             Format => 'int16u',
8184             },
8185             );
8186              
8187             # Color data (MakerNotes tag 0x4001, count=2024,3656)
8188             # (same as ColorData9 but shifted up by 0x0e, ref PH)
8189             %Image::ExifTool::Canon::ColorData10 = (
8190             %binaryDataAttrs,
8191             NOTES => 'These tags are used by the R5, R5 and EOS 1DXmkIII.',
8192             FORMAT => 'int16s',
8193             FIRST_ENTRY => 0,
8194             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8195             DATAMEMBER => [ 0 ],
8196             IS_SUBDIR => [ 0x118 ],
8197             0x00 => {
8198             Name => 'ColorDataVersion',
8199             DataMember => 'ColorDataVersion',
8200             RawConv => '$$self{ColorDataVersion} = $val',
8201             PrintConv => {
8202             32 => '32 (1DXmkIII)', #IB
8203             33 => '33 (R5/R6)',
8204             },
8205             },
8206             0x55 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8207             0x59 => 'ColorTempAsShot',
8208             0x5a => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8209             0x5e => 'ColorTempAuto',
8210             0x5f => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8211             0x63 => 'ColorTempMeasured',
8212             0x64 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8213             0x68 => { Name => 'ColorTempUnknown', Unknown => 1 },
8214             0x69 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8215             0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
8216             0x6e => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8217             0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8218             0x73 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8219             0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8220             0x78 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8221             0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
8222             0x7d => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8223             0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8224             0x82 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8225             0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8226             0x87 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8227             0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
8228             0x8c => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8229             0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8230             0x91 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8231             0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8232             0x96 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8233             0x9a => 'ColorTempDaylight',
8234             0x9b => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8235             0x9f => 'ColorTempShade',
8236             0xa0 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8237             0xa4 => 'ColorTempCloudy',
8238             0xa5 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8239             0xa9 => 'ColorTempTungsten',
8240             0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8241             0xae => 'ColorTempFluorescent',
8242             0xaf => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8243             0xb3 => 'ColorTempKelvin',
8244             0xb4 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8245             0xb8 => 'ColorTempFlash',
8246             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8247             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8248             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8249             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8250             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8251             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8252             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8253             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8254             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8255             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8256             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8257             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8258             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8259             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8260             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8261             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8262             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8263             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8264             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8265             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8266             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8267             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8268             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8269             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8270             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8271             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8272             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8273             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8274             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8275             0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
8276             0x104=> { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8277             0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
8278             0x109=> { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8279             0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
8280             0x10e=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8281             0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8282             0x113=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8283             0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8284             0x118 => {
8285             Name => 'ColorCalib',
8286             Format => 'undef[120]',
8287             Unknown => 1,
8288             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8289             },
8290             0x157 => {
8291             Name => 'PerChannelBlackLevel',
8292             Format => 'int16u[4]',
8293             },
8294             # 0x326 - PerChannelBlackLevel again
8295             0x32a => {
8296             Name => 'NormalWhiteLevel',
8297             Format => 'int16u',
8298             RawConv => '$val || undef',
8299             },
8300             0x32b => {
8301             Name => 'SpecularWhiteLevel',
8302             Format => 'int16u',
8303             },
8304             0x32c => {
8305             Name => 'LinearityUpperMargin',
8306             Format => 'int16u',
8307             },
8308             );
8309              
8310             # Color data (MakerNotes tag 0x4001, count=3973, ref IB)
8311             %Image::ExifTool::Canon::ColorData11 = (
8312             %binaryDataAttrs,
8313             NOTES => 'These tags are used by the EOS R3',
8314             FORMAT => 'int16s',
8315             FIRST_ENTRY => 0,
8316             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8317             DATAMEMBER => [ 0 ],
8318             IS_SUBDIR => [ 0x12c ],
8319             0x00 => {
8320             Name => 'ColorDataVersion',
8321             DataMember => 'ColorDataVersion',
8322             RawConv => '$$self{ColorDataVersion} = $val',
8323             PrintConv => {
8324             34 => '34 (R3)', #IB
8325             },
8326             },
8327             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8328             0x6d => 'ColorTempAsShot',
8329             0x6e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8330             0x72 => 'ColorTempAuto',
8331             0x73 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8332             0x77 => 'ColorTempMeasured',
8333             0x78 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8334             0x7c => { Name => 'ColorTempUnknown', Unknown => 1 },
8335             0x7d => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8336             0x81 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8337             0x82 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8338             0x86 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8339             0x87 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8340             0x8b => { Name => 'ColorTempUnknown4', Unknown => 1 },
8341             0x8c => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8342             0x90 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8343             0x91 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8344             0x95 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8345             0x96 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8346             0x9a => { Name => 'ColorTempUnknown7', Unknown => 1 },
8347             0x9b => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8348             0x9f => { Name => 'ColorTempUnknown8', Unknown => 1 },
8349             0xa0 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8350             0xa4 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8351             0xa5 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8352             0xa9 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8353             0xaa => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8354             0xae => { Name => 'ColorTempUnknown11', Unknown => 1 },
8355             0xaf => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8356             0xb3 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8357             0xb4 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8358             0xb8 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8359             0xb9 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8360             0xbd => { Name => 'ColorTempUnknown13', Unknown => 1 },
8361             0xbe => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8362             0xc2 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8363             0xc3 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8364             0xc7 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8365             0xc8 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8366             0xcc => { Name => 'ColorTempUnknown16', Unknown => 1 },
8367             0xcd => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8368             0xd1 => 'ColorTempDaylight',
8369             0xd2 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8370             0xd6 => 'ColorTempShade',
8371             0xd7 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8372             0xdb => 'ColorTempCloudy',
8373             0xdc => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8374             0xe0 => 'ColorTempTungsten',
8375             0xe1 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8376             0xe5 => 'ColorTempFluorescent',
8377             0xe6 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8378             0xea => 'ColorTempKelvin',
8379             0xeb => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8380             0xef => 'ColorTempFlash',
8381             0xf0 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8382             0xf4 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8383             0xf5 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8384             0xf9 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8385             0xfa => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8386             0xfe => { Name => 'ColorTempUnknown19', Unknown => 1 },
8387             0xff => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8388             0x103 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8389             0x104 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8390             0x108 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8391             0x109 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8392             0x10d => { Name => 'ColorTempUnknown22', Unknown => 1 },
8393             0x10e => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8394             0x112 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8395             0x113 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8396             0x117 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8397             0x118 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8398             0x11c => { Name => 'ColorTempUnknown25', Unknown => 1 },
8399             0x11d => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8400             0x121 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8401             0x122 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8402             0x126 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8403             0x12c => {
8404             Name => 'ColorCalib',
8405             Format => 'undef[120]',
8406             Unknown => 1,
8407             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8408             },
8409             0x16b => {
8410             Name => 'PerChannelBlackLevel',
8411             Format => 'int16u[4]',
8412             },
8413             # 0x27c - PerChannelBlackLevel again
8414             0x280 => {
8415             Name => 'NormalWhiteLevel',
8416             Format => 'int16u',
8417             RawConv => '$val || undef',
8418             },
8419             0x281 => {
8420             Name => 'SpecularWhiteLevel',
8421             Format => 'int16u',
8422             },
8423             0x282 => {
8424             Name => 'LinearityUpperMargin',
8425             Format => 'int16u',
8426             },
8427             );
8428              
8429             # Unknown color data (MakerNotes tag 0x4001)
8430             %Image::ExifTool::Canon::ColorDataUnknown = (
8431             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
8432             FORMAT => 'int16s',
8433             FIRST_ENTRY => 0,
8434             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8435             0x00 => 'ColorDataVersion',
8436             );
8437              
8438             # Color information (MakerNotes tag 0x4003) (ref PH)
8439             %Image::ExifTool::Canon::ColorInfo = (
8440             %binaryDataAttrs,
8441             FORMAT => 'int16s',
8442             FIRST_ENTRY => 1,
8443             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8444             1 => {
8445             Condition => '$$self{Model} =~ /EOS-1D/',
8446             Name => 'Saturation',
8447             %Image::ExifTool::Exif::printParameter,
8448             },
8449             2 => {
8450             Name => 'ColorTone',
8451             %Image::ExifTool::Exif::printParameter,
8452             },
8453             3 => {
8454             Name => 'ColorSpace',
8455             RawConv => '$val ? $val : undef', # ignore tag if zero
8456             PrintConv => {
8457             1 => 'sRGB',
8458             2 => 'Adobe RGB',
8459             },
8460             },
8461             );
8462              
8463             # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
8464             %Image::ExifTool::Canon::AFMicroAdj = (
8465             %binaryDataAttrs,
8466             FORMAT => 'int32s',
8467             FIRST_ENTRY => 1,
8468             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8469             1 => {
8470             Name => 'AFMicroAdjMode',
8471             PrintConv => {
8472             0 => 'Disable',
8473             1 => 'Adjust all by the same amount',
8474             2 => 'Adjust by lens',
8475             # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
8476             },
8477             },
8478             2 => {
8479             Name => 'AFMicroAdjValue',
8480             Format => 'rational64s',
8481             },
8482             );
8483              
8484             # Vignetting correction information (MakerNotes tag 0x4015)
8485             %Image::ExifTool::Canon::VignettingCorr = (
8486             %binaryDataAttrs,
8487             FORMAT => 'int16s',
8488             FIRST_ENTRY => 1,
8489             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8490             NOTES => 'This information is found in images from newer EOS models.',
8491             0 => {
8492             Name => 'VignettingCorrVersion',
8493             Format => 'int8u',
8494             Writable => 0,
8495             },
8496             2 => {
8497             Name => 'PeripheralLighting',
8498             PrintConv => \%offOn,
8499             },
8500             3 => {
8501             Name => 'DistortionCorrection',
8502             PrintConv => \%offOn,
8503             },
8504             4 => {
8505             Name => 'ChromaticAberrationCorr',
8506             PrintConv => \%offOn,
8507             },
8508             5 => {
8509             Name => 'ChromaticAberrationCorr',
8510             PrintConv => \%offOn,
8511             },
8512             6 => 'PeripheralLightingValue',
8513             9 => 'DistortionCorrectionValue',
8514             # 10 - flags?
8515             11 => {
8516             Name => 'OriginalImageWidth',
8517             Notes => 'full size of original image before being rotated or scaled in camera',
8518             },
8519             12 => 'OriginalImageHeight',
8520             );
8521              
8522             %Image::ExifTool::Canon::VignettingCorrUnknown = (
8523             %binaryDataAttrs,
8524             FORMAT => 'int16s',
8525             FIRST_ENTRY => 1,
8526             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8527             NOTES => 'Vignetting correction from PowerShot models.',
8528             0 => {
8529             Name => 'VignettingCorrVersion',
8530             Format => 'int8u',
8531             Writable => 0,
8532             },
8533             );
8534              
8535             # More Vignetting correction information (MakerNotes tag 0x4016)
8536             %Image::ExifTool::Canon::VignettingCorr2 = (
8537             %binaryDataAttrs,
8538             FORMAT => 'int32s',
8539             FIRST_ENTRY => 1,
8540             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8541             5 => {
8542             Name => 'PeripheralLightingSetting',
8543             PrintConv => \%offOn,
8544             },
8545             6 => {
8546             Name => 'ChromaticAberrationSetting',
8547             PrintConv => \%offOn,
8548             },
8549             7 => {
8550             Name => 'DistortionCorrectionSetting',
8551             PrintConv => \%offOn,
8552             },
8553             );
8554              
8555             # Auto Lighting Optimizater information (MakerNotes tag 0x4018) (ref PH)
8556             %Image::ExifTool::Canon::LightingOpt = (
8557             %binaryDataAttrs,
8558             FORMAT => 'int32s',
8559             FIRST_ENTRY => 1,
8560             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8561             NOTES => 'This information is new in images from the EOS 7D.',
8562             1 => {
8563             Name => 'PeripheralIlluminationCorr',
8564             PrintConv => \%offOn,
8565             },
8566             2 => {
8567             Name => 'AutoLightingOptimizer',
8568             PrintConv => {
8569             0 => 'Standard',
8570             1 => 'Low',
8571             2 => 'Strong',
8572             3 => 'Off',
8573             },
8574             },
8575             3 => {
8576             Name => 'HighlightTonePriority',
8577             PrintConv => \%offOn,
8578             },
8579             4 => {
8580             Name => 'LongExposureNoiseReduction',
8581             PrintConv => {
8582             0 => 'Off',
8583             1 => 'Auto',
8584             2 => 'On',
8585             },
8586             },
8587             5 => {
8588             Name => 'HighISONoiseReduction',
8589             PrintConv => {
8590             0 => 'Standard',
8591             1 => 'Low',
8592             2 => 'Strong',
8593             3 => 'Off',
8594             },
8595             },
8596             # 6 - related to ChromaticAberrationCorr
8597             # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
8598             # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
8599             );
8600              
8601             # Lens information (MakerNotes tag 0x4019) (ref 20)
8602             %Image::ExifTool::Canon::LensInfo = (
8603             %binaryDataAttrs,
8604             FIRST_ENTRY => 0,
8605             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8606             0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
8607             Name => 'LensSerialNumber',
8608             Notes => q{
8609             apparently this is an internal serial number because it doesn't correspond
8610             to the one printed on the lens
8611             },
8612             Format => 'undef[5]',
8613             Priority => 0,
8614             RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
8615             ValueConv => 'unpack("H*", $val)',
8616             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
8617             },
8618             );
8619              
8620             # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
8621             %Image::ExifTool::Canon::Ambience = (
8622             %binaryDataAttrs,
8623             FORMAT => 'int32s',
8624             FIRST_ENTRY => 1,
8625             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8626             1 => {
8627             Name => 'AmbienceSelection',
8628             PrintConv => {
8629             0 => 'Standard',
8630             1 => 'Vivid',
8631             2 => 'Warm',
8632             3 => 'Soft',
8633             4 => 'Cool',
8634             5 => 'Intense',
8635             6 => 'Brighter',
8636             7 => 'Darker',
8637             8 => 'Monochrome',
8638             },
8639             },
8640             );
8641              
8642             # Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
8643             %Image::ExifTool::Canon::MultiExp = (
8644             %binaryDataAttrs,
8645             FORMAT => 'int32s',
8646             FIRST_ENTRY => 1,
8647             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8648             1 => {
8649             Name => 'MultiExposure',
8650             PrintConv => {
8651             0 => 'Off',
8652             1 => 'On',
8653             2 => 'On (RAW)', #IB
8654             },
8655             },
8656             2 => {
8657             Name => 'MultiExposureControl',
8658             PrintConv => {
8659             0 => 'Additive',
8660             1 => 'Average',
8661             2 => 'Bright (comparative)',
8662             3 => 'Dark (comparative)',
8663             },
8664             },
8665             3 => 'MultiExposureShots',
8666             );
8667              
8668             my %filterConv = (
8669             PrintConv => {
8670             -1 => 'Off',
8671             OTHER => sub { my $val=shift; return "On ($val)" },
8672             },
8673             );
8674             # Creative filter information (MakerNotes tag 0x4024) (ref PH)
8675             %Image::ExifTool::Canon::FilterInfo = (
8676             PROCESS_PROC => \&ProcessFilters,
8677             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8678             NOTES => 'Information about creative filter settings.',
8679             0x101 => {
8680             Name => 'GrainyBWFilter',
8681             Description => 'Grainy B/W Filter',
8682             %filterConv,
8683             },
8684             0x201 => { Name => 'SoftFocusFilter', %filterConv },
8685             0x301 => { Name => 'ToyCameraFilter', %filterConv },
8686             0x401 => { Name => 'MiniatureFilter', %filterConv },
8687             0x402 => {
8688             Name => 'MiniatureFilterOrientation',
8689             PrintConv => {
8690             0 => 'Horizontal',
8691             1 => 'Vertical',
8692             },
8693             },
8694             0x403 => 'MiniatureFilterPosition',
8695             0x404 => 'MiniatureFilterParameter', # but what is the meaning?
8696             0x501 => { Name => 'FisheyeFilter', %filterConv }, # (M2)
8697             0x601 => { Name => 'PaintingFilter', %filterConv }, # (M2)
8698             0x701 => { Name => 'WatercolorFilter', %filterConv }, # (M2)
8699             );
8700              
8701             # HDR information (MakerNotes tag 0x4025) (ref PH)
8702             %Image::ExifTool::Canon::HDRInfo = (
8703             %binaryDataAttrs,
8704             FORMAT => 'int32s',
8705             FIRST_ENTRY => 1,
8706             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8707             1 => {
8708             Name => 'HDR',
8709             PrintConv => {
8710             0 => 'Off',
8711             1 => 'Auto',
8712             2 => 'On',
8713             },
8714             },
8715             2 => {
8716             Name => 'HDREffect',
8717             PrintConv => {
8718             0 => 'Natural',
8719             1 => 'Art (standard)',
8720             2 => 'Art (vivid)',
8721             3 => 'Art (bold)',
8722             4 => 'Art (embossed)',
8723             },
8724             },
8725             # 3 - maybe related to AutoImageAlign?
8726             );
8727              
8728             # More color information (MakerNotes tag 0x4026) (ref github issue #119)
8729             %Image::ExifTool::Canon::LogInfo = (
8730             %binaryDataAttrs,
8731             FORMAT => 'int32s',
8732             FIRST_ENTRY => 1,
8733             PRIORITY => 0,
8734             4 => {
8735             Name => 'CompressionFormat',
8736             PrintConv => {
8737             0 => 'Editing (ALL-I)',
8738             1 => 'Standard (IPB)',
8739             2 => 'Light (IPB)',
8740             3 => 'Motion JPEG',
8741             4 => 'RAW', # either Standard or Light, depending on Quality
8742             },
8743             },
8744             6 => { # 0 to 7
8745             Name => 'Sharpness',
8746             RawConv => '$val == 0x7fffffff ? undef : $val',
8747             },
8748             7 => { # -4 to 4
8749             Name => 'Saturation',
8750             RawConv => '$val == 0x7fffffff ? undef : $val',
8751             %Image::ExifTool::Exif::printParameter,
8752             },
8753             8 => { # -4 to 4
8754             Name => 'ColorTone',
8755             RawConv => '$val == 0x7fffffff ? undef : $val',
8756             %Image::ExifTool::Exif::printParameter,
8757             },
8758             9 => {
8759             Name => 'ColorSpace2',
8760             RawConv => '$val == 0x7fffffff ? undef : $val',
8761             PrintConv => {
8762             0 => 'BT.709',
8763             1 => 'BT.2020',
8764             2 => 'CinemaGamut',
8765             },
8766             },
8767             10 => {
8768             Name => 'ColorMatrix',
8769             RawConv => '$val == 0x7fffffff ? undef : $val',
8770             PrintConv => {
8771             0 => 'EOS Original',
8772             1 => 'Neutral',
8773             },
8774             },
8775             11 => {
8776             Name => 'CanonLogVersion', # (increases dynamic range of sensor data)
8777             RawConv => '$val == 0x7fffffff ? undef : $val',
8778             PrintConv => {
8779             0 => 'OFF',
8780             1 => 'CLogV1',
8781             2 => 'CLogV2', # (NC)
8782             3 => 'CLogV3',
8783             },
8784             },
8785             );
8786              
8787             # AF configuration info (MakerNotes tag 0x4028) (ref PH)
8788             %Image::ExifTool::Canon::AFConfig = (
8789             %binaryDataAttrs,
8790             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8791             FORMAT => 'int32s',
8792             FIRST_ENTRY => 1,
8793             1 => {
8794             Name => 'AFConfigTool',
8795             ValueConv => '$val + 1',
8796             ValueConvInv => '$val - 1',
8797             PrintConv => '"Case $val"',
8798             PrintConvInv => '$val=~/(\d+)/ ? $1 : undef',
8799             },
8800             2 => 'AFTrackingSensitivity',
8801             3 => {
8802             Name => 'AFAccelDecelTracking',
8803             Description => 'AF Accel/Decel Tracking',
8804             },
8805             4 => 'AFPointSwitching',
8806             5 => { #52
8807             Name => 'AIServoFirstImage',
8808             PrintConv => {
8809             0 => 'Equal Priority',
8810             1 => 'Release Priority',
8811             2 => 'Focus Priority',
8812             },
8813             },
8814             6 => { #52
8815             Name => 'AIServoSecondImage',
8816             PrintConv => {
8817             0 => 'Equal Priority',
8818             1 => 'Release Priority',
8819             2 => 'Focus Priority',
8820             3 => 'Release High Priority',
8821             4 => 'Focus High Priority',
8822             },
8823             },
8824             7 => { #52
8825             Name => 'USMLensElectronicMF',
8826             PrintConv => {
8827             0 => 'Enable After AF',
8828             1 => 'Disable After AF',
8829             2 => 'Disable in AF Mode',
8830             },
8831             },
8832             8 => { #52
8833             Name => 'AFAssistBeam',
8834             PrintConv => {
8835             0 => 'Enable',
8836             1 => 'Disable',
8837             2 => 'IR AF Assist Beam Only',
8838             },
8839             },
8840             9 => { #52
8841             Name => 'OneShotAFRelease',
8842             PrintConv => {
8843             0 => 'Focus Priority',
8844             1 => 'Release Priority',
8845             },
8846             },
8847             10 => { #52
8848             Name => 'AutoAFPointSelEOSiTRAF',
8849             Description => 'Auto AF Point Sel EOS iTR AF',
8850             # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
8851             # not valid for: 5DmkIII
8852             Notes => 'only valid for some models',
8853             Condition => '$$self{Model} !~ /5D /',
8854             PrintConv => {
8855             0 => 'Enable',
8856             1 => 'Disable',
8857             },
8858             },
8859             11 => { #52
8860             Name => 'LensDriveWhenAFImpossible',
8861             PrintConv => {
8862             0 => 'Continue Focus Search',
8863             1 => 'Stop Focus Search',
8864             },
8865             },
8866             12 => { #52
8867             Name => 'SelectAFAreaSelectionMode',
8868             PrintConv => { BITMASK => {
8869             0 => 'Single-point AF',
8870             1 => 'Auto', # (61 point)
8871             2 => 'Zone AF',
8872             3 => 'AF Point Expansion (4 point)',
8873             4 => 'Spot AF',
8874             5 => 'AF Point Expansion (8 point)',
8875             }},
8876             },
8877             13 => { #52
8878             Name => 'AFAreaSelectionMethod',
8879             PrintConv => {
8880             0 => 'M-Fn Button',
8881             1 => 'Main Dial',
8882             },
8883             },
8884             14 => { #52
8885             Name => 'OrientationLinkedAF',
8886             PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
8887             0 => 'Same for Vert/Horiz Points',
8888             1 => 'Separate Vert/Horiz Points',
8889             2 => 'Separate Area+Points',
8890             },
8891             },
8892             15 => { #52
8893             Name => 'ManualAFPointSelPattern',
8894             PrintConv => {
8895             0 => 'Stops at AF Area Edges',
8896             1 => 'Continuous',
8897             },
8898             },
8899             16 => { #52
8900             Name => 'AFPointDisplayDuringFocus',
8901             PrintConv => {
8902             0 => 'Selected (constant)',
8903             1 => 'All (constant)',
8904             2 => 'Selected (pre-AF, focused)',
8905             3 => 'Selected (focused)',
8906             4 => 'Disabled',
8907             },
8908             },
8909             17 => { #52
8910             Name => 'VFDisplayIllumination',
8911             PrintConv => {
8912             0 => 'Auto',
8913             1 => 'Enable',
8914             2 => 'Disable',
8915             },
8916             },
8917             18 => { #52
8918             Name => 'AFStatusViewfinder',
8919             Condition => '$$self{Model} =~ /1D X/',
8920             Notes => '1D X only',
8921             PrintConv => {
8922             0 => 'Show in Field of View',
8923             1 => 'Show Outside View',
8924             },
8925             },
8926             19 => { #52
8927             Name => 'InitialAFPointInServo',
8928             Condition => '$$self{Model} =~ /1D X/',
8929             Notes => '1D X only',
8930             PrintConv => {
8931             0 => 'Initial AF Point Selected',
8932             1 => 'Manual AF Point',
8933             2 => 'Auto', #PH (1DXmkII)
8934             },
8935             },
8936             );
8937              
8938             # RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
8939             %Image::ExifTool::Canon::RawBurstInfo = (
8940             %binaryDataAttrs,
8941             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8942             FORMAT => 'int32u',
8943             FIRST_ENTRY => 1,
8944             1 => 'RawBurstImageNum',
8945             2 => 'RawBurstImageCount',
8946             );
8947              
8948             # Canon UUID atoms (ref PH, SX280)
8949             %Image::ExifTool::Canon::uuid = (
8950             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
8951             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
8952             NOTES => q{
8953             Tags extracted from the uuid atom of MP4 videos from cameras such as the
8954             SX280, and CR3 images from cameras such as the EOS M50.
8955             },
8956             CNCV => {
8957             Name => 'CompressorVersion',
8958             # use this to recognize the specific type of Canon RAW (CR3 or CRM)
8959             RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
8960             },
8961             # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
8962             CNTH => {
8963             Name => 'CanonCNTH',
8964             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
8965             },
8966             CCTP => { # (CR3 files)
8967             Name => 'CanonCCTP',
8968             SubDirectory => {
8969             TagTable => 'Image::ExifTool::Canon::CCTP',
8970             Start => '12',
8971             },
8972             },
8973             # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
8974             # index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
8975             # --> ignored when reading, but offsets are updated when writing
8976             CMT1 => { # (CR3 files)
8977             Name => 'IFD0',
8978             PreservePadding => 1,
8979             SubDirectory => {
8980             TagTable => 'Image::ExifTool::Exif::Main',
8981             ProcessProc => \&Image::ExifTool::ProcessTIFF,
8982             WriteProc => \&Image::ExifTool::WriteTIFF,
8983             },
8984             },
8985             CMT2 => { # (CR3 files)
8986             Name => 'ExifIFD',
8987             PreservePadding => 1,
8988             SubDirectory => {
8989             TagTable => 'Image::ExifTool::Exif::Main',
8990             ProcessProc => \&Image::ExifTool::ProcessTIFF,
8991             WriteProc => \&Image::ExifTool::WriteTIFF,
8992             },
8993             },
8994             CMT3 => { # (CR3 files)
8995             Name => 'MakerNoteCanon',
8996             PreservePadding => 1,
8997             SubDirectory => {
8998             TagTable => 'Image::ExifTool::Canon::Main',
8999             ProcessProc => \&ProcessCMT3,
9000             WriteProc => \&Image::ExifTool::WriteTIFF,
9001             },
9002             },
9003             CMT4 => { # (CR3 files)
9004             Name => 'GPSInfo',
9005             PreservePadding => 1,
9006             SubDirectory => {
9007             TagTable => 'Image::ExifTool::GPS::Main',
9008             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9009             WriteProc => \&Image::ExifTool::WriteTIFF,
9010             DirName => 'GPS',
9011             },
9012             },
9013             THMB => {
9014             Name => 'ThumbnailImage',
9015             Groups => { 2 => 'Preview' },
9016             PreservePadding => 1,
9017             RawConv => 'substr($val, 16)',
9018             Binary => 1,
9019             },
9020             CNOP => { #PH (M50)
9021             Name => 'CanonCNOP',
9022             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
9023             },
9024             );
9025              
9026             # Canon top-level uuid atoms (ref PH, written by DPP4)
9027             %Image::ExifTool::Canon::uuid2 = (
9028             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9029             CNOP => {
9030             Name => 'CanonVRD',
9031             PreservePadding => 1,
9032             SubDirectory => {
9033             TagTable => 'Image::ExifTool::CanonVRD::Main',
9034             WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
9035             },
9036             },
9037             );
9038              
9039             %Image::ExifTool::Canon::UnknownIFD = (
9040             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9041             );
9042              
9043             # Canon CCTP atoms (ref PH, CR3 files)
9044             %Image::ExifTool::Canon::CCTP = (
9045             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9046             # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
9047             );
9048              
9049             # 'CMP1' atom information (ref 54, CR3 files)
9050             %Image::ExifTool::Canon::CMP1 = (
9051             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9052             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9053             FORMAT => 'int16u',
9054             FIRST_ENTRY => 0,
9055             PRIORITY => 0,
9056             8 => { Name => 'ImageWidth', Format => 'int32u' },
9057             10 => { Name => 'ImageHeight', Format => 'int32u' },
9058             # (the rest of the documented tags don't seem to produced good values with my samples - PH)
9059             );
9060              
9061             # 'CDI1' atom information (ref PH, CR3 files)
9062             %Image::ExifTool::Canon::CDI1 = (
9063             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9064             IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
9065             );
9066              
9067             # 'IAD1' atom information (ref 54, CR3 files)
9068             %Image::ExifTool::Canon::IAD1 = (
9069             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9070             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9071             FORMAT => 'int16u',
9072             FIRST_ENTRY => 0,
9073             );
9074              
9075             # Canon Timed MetaData (ref PH, CR3 files)
9076             %Image::ExifTool::Canon::CTMD = (
9077             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9078             PROCESS_PROC => \&ProcessCTMD,
9079             NOTES => q{
9080             Canon Timed MetaData tags found in CR3 images. The L option
9081             is automatically applied when reading CR3 files to be able to extract this
9082             information.
9083             },
9084             1 => {
9085             Name => 'TimeStamp',
9086             Groups => { 2 => 'Time' },
9087             RawConv => q{
9088             my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
9089             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
9090             },
9091             PrintConv => '$self->ConvertDateTime($val)',
9092             },
9093             # 3 - 4 bytes, seen: ff ff ff ff
9094             4 => {
9095             Name => 'FocalInfo',
9096             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
9097             },
9098             5 => {
9099             Name => 'ExposureInfo',
9100             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
9101             },
9102             7 => {
9103             Name => 'ExifInfo7',
9104             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9105             },
9106             8 => {
9107             Name => 'ExifInfo8',
9108             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9109             },
9110             9 => {
9111             Name => 'ExifInfo9',
9112             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9113             },
9114             # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
9115             # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
9116             );
9117              
9118             # Canon Timed MetaData (ref PH, CR3 files)
9119             %Image::ExifTool::Canon::ExifInfo = (
9120             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9121             PROCESS_PROC => \&ProcessExifInfo,
9122             0x8769 => {
9123             Name => 'ExifIFD',
9124             SubDirectory => {
9125             TagTable => 'Image::ExifTool::Exif::Main',
9126             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9127             },
9128             },
9129             0x927c => {
9130             Name => 'MakerNoteCanon',
9131             SubDirectory => {
9132             TagTable => 'Image::ExifTool::Canon::Main',
9133             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9134             },
9135             },
9136             );
9137              
9138             # timed focal length information (ref PH, CR3 files)
9139             %Image::ExifTool::Canon::FocalInfo = (
9140             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9141             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9142             FORMAT => 'int32u',
9143             FIRST_ENTRY => 0,
9144             0 => {
9145             Name => 'FocalLength',
9146             Format => 'rational32u',
9147             PrintConv => 'sprintf("%.1f mm",$val)',
9148             },
9149             );
9150              
9151             # timed exposure information (ref PH, CR3 files)
9152             %Image::ExifTool::Canon::ExposureInfo = (
9153             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9154             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9155             FORMAT => 'int32u',
9156             FIRST_ENTRY => 0,
9157             0 => {
9158             Name => 'FNumber',
9159             Format => 'rational32u',
9160             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
9161             },
9162             1 => {
9163             Name => 'ExposureTime',
9164             Format => 'rational32u',
9165             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
9166             },
9167             2 => {
9168             Name => 'ISO',
9169             Format => 'int32u',
9170             ValueConv => '$val & 0x7fffffff', # (not sure what high bit indicates)
9171             },
9172             );
9173              
9174             %Image::ExifTool::Canon::CNTH = (
9175             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9176             VARS => { ATOM_COUNT => 1 }, # only one contained atom
9177             WRITABLE => 1,
9178             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9179             NOTES => q{
9180             Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
9181             some cameras.
9182             },
9183             CNDA => {
9184             Name => 'ThumbnailImage',
9185             Groups => { 2 => 'Preview' },
9186             Format => 'undef',
9187             Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
9188             SetBase => 1,
9189             RawConv => q{
9190             $$self{DOC_NUM} = ++$$self{DOC_COUNT};
9191             $self->ExtractInfo(\$val, { ReEntry => 1 });
9192             $$self{DOC_NUM} = 0;
9193             return \$val;
9194             },
9195             RawConvInv => '$val',
9196             },
9197             );
9198              
9199             # Canon CNOP atoms (ref PH)
9200             %Image::ExifTool::Canon::CNOP = (
9201             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9202             # CNFB - 52 bytes (7DmkII,M50,C200)
9203             # CNMI - 4 bytes: "0x20000001" (C200)
9204             # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
9205             );
9206              
9207             # 'skip' atom of Canon MOV videos (ref PH)
9208             %Image::ExifTool::Canon::Skip = (
9209             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9210             NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
9211             CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
9212             );
9213              
9214             # Canon composite tags
9215             %Image::ExifTool::Canon::Composite = (
9216             GROUPS => { 2 => 'Camera' },
9217             DriveMode => {
9218             Require => {
9219             0 => 'ContinuousDrive',
9220             1 => 'SelfTimer',
9221             },
9222             ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
9223             PrintConv => {
9224             0 => 'Continuous Shooting',
9225             1 => 'Self-timer Operation',
9226             2 => 'Single-frame Shooting',
9227             },
9228             },
9229             Lens => {
9230             Require => {
9231             0 => 'Canon:MinFocalLength',
9232             1 => 'Canon:MaxFocalLength',
9233             },
9234             ValueConv => '$val[0]',
9235             PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
9236             },
9237             Lens35efl => {
9238             Description => 'Lens',
9239             Require => {
9240             0 => 'Canon:MinFocalLength',
9241             1 => 'Canon:MaxFocalLength',
9242             3 => 'Lens',
9243             },
9244             Desire => {
9245             2 => 'ScaleFactor35efl',
9246             },
9247             ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
9248             PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
9249             },
9250             ShootingMode => {
9251             Require => {
9252             0 => 'CanonExposureMode',
9253             1 => 'EasyMode',
9254             },
9255             Desire => {
9256             2 => 'BulbDuration',
9257             },
9258             # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
9259             # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
9260             # models too (Note that Canon DPP reports "Manual Exposure" here)
9261             ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
9262             PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
9263             },
9264             FlashType => {
9265             Notes => q{
9266             may report "Built-in Flash" for some Canon cameras with external flash in
9267             manual mode
9268             },
9269             Require => {
9270             0 => 'FlashBits',
9271             },
9272             RawConv => '$val[0] ? $val : undef',
9273             ValueConv => '$val[0]&(1<<14)? 1 : 0',
9274             PrintConv => {
9275             0 => 'Built-In Flash',
9276             1 => 'External',
9277             },
9278             },
9279             RedEyeReduction => {
9280             Require => {
9281             0 => 'CanonFlashMode',
9282             1 => 'FlashBits',
9283             },
9284             RawConv => '$val[1] ? $val : undef',
9285             ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
9286             PrintConv => {
9287             0 => 'Off',
9288             1 => 'On',
9289             },
9290             },
9291             # same as FlashExposureComp, but undefined if no flash
9292             ConditionalFEC => {
9293             Description => 'Flash Exposure Compensation',
9294             Require => {
9295             0 => 'FlashExposureComp',
9296             1 => 'FlashBits',
9297             },
9298             RawConv => '$val[1] ? $val : undef',
9299             ValueConv => '$val[0]',
9300             PrintConv => '$prt[0]',
9301             },
9302             # hack to assume 1st curtain unless we see otherwise
9303             ShutterCurtainHack => {
9304             Description => 'Shutter Curtain Sync',
9305             Desire => {
9306             0 => 'ShutterCurtainSync',
9307             },
9308             Require => {
9309             1 => 'FlashBits',
9310             },
9311             RawConv => '$val[1] ? $val : undef',
9312             ValueConv => 'defined($val[0]) ? $val[0] : 0',
9313             PrintConv => {
9314             0 => '1st-curtain sync',
9315             1 => '2nd-curtain sync',
9316             },
9317             },
9318             WB_RGGBLevels => {
9319             Require => {
9320             0 => 'Canon:WhiteBalance',
9321             },
9322             Desire => {
9323             1 => 'WB_RGGBLevelsAsShot',
9324             # indices of the following entries correspond to Canon:WhiteBalance + 2
9325             2 => 'WB_RGGBLevelsAuto',
9326             3 => 'WB_RGGBLevelsDaylight',
9327             4 => 'WB_RGGBLevelsCloudy',
9328             5 => 'WB_RGGBLevelsTungsten',
9329             6 => 'WB_RGGBLevelsFluorescent',
9330             7 => 'WB_RGGBLevelsFlash',
9331             8 => 'WB_RGGBLevelsCustom',
9332             10 => 'WB_RGGBLevelsShade',
9333             11 => 'WB_RGGBLevelsKelvin',
9334             },
9335             ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
9336             },
9337             ISO => {
9338             Priority => 0, # let EXIF:ISO take priority
9339             Desire => {
9340             0 => 'Canon:CameraISO',
9341             1 => 'Canon:BaseISO',
9342             2 => 'Canon:AutoISO',
9343             },
9344             Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
9345             ValueConv => q{
9346             return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
9347             return undef unless $val[1] and $val[2];
9348             return $val[1] * $val[2] / 100;
9349             },
9350             PrintConv => 'sprintf("%.0f",$val)',
9351             },
9352             DigitalZoom => {
9353             Require => {
9354             0 => 'Canon:ZoomSourceWidth',
9355             1 => 'Canon:ZoomTargetWidth',
9356             2 => 'Canon:DigitalZoom',
9357             },
9358             RawConv => q{
9359             ToFloat(@val);
9360             return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
9361             return $val[1] / $val[0];
9362             },
9363             PrintConv => 'sprintf("%.2fx",$val)',
9364             },
9365             OriginalDecisionData => {
9366             Flags => ['Writable','Protected'],
9367             WriteGroup => 'MakerNotes',
9368             Require => 'OriginalDecisionDataOffset',
9369             RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
9370             },
9371             FileNumber => {
9372             Groups => { 2 => 'Image' },
9373             Writable => 1,
9374             WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
9375             DelCheck => '"Can\'t delete"',
9376             Require => {
9377             0 => 'DirectoryIndex',
9378             1 => 'FileIndex',
9379             },
9380             WriteAlso => {
9381             DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
9382             FileIndex => '$val=~/(\d+)-(\d+)/; $2',
9383             },
9384             ValueConv => q{
9385             # fix the funny things that these numbers do when they wrap over 9999
9386             # (it seems that FileIndex and DirectoryIndex actually store the
9387             # numbers from the previous image, so we need special logic
9388             # to handle the FileIndex wrap properly)
9389             $val[1] == 10000 and $val[1] = 1, ++$val[0];
9390             return sprintf("%.3d-%.4d",@val);
9391             },
9392             },
9393             );
9394              
9395             # add our composite tags
9396             Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
9397              
9398             #------------------------------------------------------------------------------
9399             # Return lens name with teleconverter if applicable
9400             # Inputs: 0) lens name string, 1) short focal length
9401             # Returns: lens string with tc if appropriate
9402             sub LensWithTC($$)
9403             {
9404 5     5 0 17 my ($lens, $shortFocal) = @_;
9405              
9406             # add teleconverter multiplication factor if applicable
9407             # (and if the LensType doesn't already include one)
9408 5 50 33     40 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
9409 5         15 my $sf = $1; # short focal length
9410 5         9 my $tc;
9411 5         14 foreach $tc (1, 1.4, 2, 2.8) {
9412 5 50       27 next if abs($shortFocal - $sf * $tc) > 0.9;
9413 5 50       18 $lens .= " + ${tc}x" if $tc > 1;
9414 5         10 last;
9415             }
9416             }
9417 5         107 return $lens;
9418             }
9419              
9420             #------------------------------------------------------------------------------
9421             # Attempt to calculate sensor size for Canon cameras
9422             # Inputs: 0/1) rational values for FocalPlaneX/YResolution
9423             # Returns: Sensor diagonal size in mm, or undef
9424             # Notes: This algorithm is fairly reliable, but has been found to give incorrect
9425             # values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
9426             # (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
9427             sub CalcSensorDiag($$)
9428             {
9429 51     51 0 182 my ($xres, $yres) = @_;
9430             # most Canon cameras store the sensor size in the denominator
9431 51 100 66     225 if ($xres and $yres) {
9432             # assumptions: 1) numerators are image width/height * 1000
9433             # 2) denominators are sensor width/height in inches * 1000
9434 39         221 my @xres = split /[ \/]/, $xres;
9435 39         136 my @yres = split /[ \/]/, $yres;
9436             # verify assumptions as best we can:
9437             # numerators are always divisible by 1000
9438 39 50 66     745 if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
      66        
      66        
      66        
      66        
      33        
      33        
      33        
      33        
      33        
9439             # at least 640x480 pixels (DC models - PH)
9440             $xres[0] >= 640000 and $yres[0] >= 480000 and
9441             # ... but not too big!
9442             $xres[0] < 10000000 and $yres[0] < 10000000 and
9443             # minimum sensor size is 0.061 inches (DC models - PH)
9444             $xres[1] >= 61 and $xres[1] < 1500 and
9445             $yres[1] >= 61 and $yres[1] < 1000 and
9446             # sensor isn't square (may happen if rationals have been reduced)
9447             $xres[1] != $yres[1])
9448             {
9449 25         140 return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
9450             }
9451             }
9452 26         73 return undef;
9453             }
9454              
9455             #------------------------------------------------------------------------------
9456             # Attempt to identify the specific lens if multiple lenses have the same LensType
9457             # Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
9458             # 4) MaxAperture, 5) LensModel
9459             # Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
9460             # Other inputs are optional.
9461             sub PrintLensID(@)
9462             {
9463 28     28 0 100 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
9464 28         59 my $lens;
9465 28 100 66     191 $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
9466 28 100 33     195 if ($lens) {
    50          
9467             # return this lens unless other lenses have the same LensType
9468 6 100       32 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
9469 1         3 $lens =~ s/ or .*//s; # remove everything after "or"
9470             # make list of all possible matching lenses
9471 1         3 my @lenses = ( $lens );
9472 1         2 my $i;
9473 1         5 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
9474 3         11 push @lenses, $$printConv{"$lensType.$i"};
9475             }
9476 1         1 my ($tc, @user, @maybe, @likely, @matches);
9477             # look for lens in user-defined lenses
9478 1         3 foreach $lens (@lenses) {
9479 4 50       8 push @user, $lens if $Image::ExifTool::userLens{$lens};
9480             }
9481             # attempt to determine actual lens
9482 1         3 foreach $tc (1, 1.4, 2, 2.8) { # loop through teleconverter scaling factors
9483 1         2 foreach $lens (@lenses) {
9484 4 100       20 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
9485             # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
9486 3         10 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
9487             # see if we can rule out this lens by focal length or aperture
9488 3 50 33     16 $lf = $sf if $sf and not $lf;
9489 3 100 66     16 $la = $sa if $sa and not $la;
9490             # account for converter-specific LensType's (ie. end with " + #.#x")
9491 3 50       9 if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
9492 0         0 $sf *= $1; $lf *= $1;
  0         0  
9493 0         0 $sa *= $1; $la *= $1;
  0         0  
9494             }
9495 3 100       9 next if abs($shortFocal - $sf * $tc) > 0.9;
9496 1         2 my $tclens = $lens;
9497 1 50       3 $tclens .= " + ${tc}x" if $tc > 1;
9498 1         3 push @maybe, $tclens;
9499 1 50       3 next if abs($longFocal - $lf * $tc) > 0.9;
9500 1         2 push @likely, $tclens;
9501 1 50       3 if ($maxAperture) {
9502             # (not 100% sure that TC affects MaxAperture, but it should!)
9503             # (RF 24-105mm F4L IS USM shows a MaxAperture of 4.177)
9504 0 0       0 next if $maxAperture < $sa * $tc - 0.18;
9505 0 0       0 next if $maxAperture > $la * $tc + 0.18;
9506             }
9507 1         2 push @matches, $tclens;
9508             }
9509 1 50       3 last if @maybe;
9510             }
9511 1 50       3 if (@user) {
9512             # choose the best match if we have more than one
9513 0 0       0 if (@user > 1) {
9514 0         0 my ($try, @good);
9515 0         0 foreach $try (\@matches, \@likely, \@maybe) {
9516 0         0 foreach (@$try) {
9517 0 0       0 $Image::ExifTool::userLens{$_} and push(@good, $_), next;
9518             # check for match with TC string removed
9519 0 0       0 next unless /^(.*) \+ \d+(\.\d+)?x$/;
9520 0 0       0 $Image::ExifTool::userLens{$1} and push(@good, $_);
9521             }
9522 0 0       0 return join(' or ', @good) if @good;
9523             }
9524             }
9525             # default to returning the first user-defined lens
9526 0         0 return LensWithTC($user[0], $shortFocal);
9527             }
9528             # differentiate Sigma Art/Contemporary/Sports models
9529 1 0 33     10 if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
      33        
9530 0         0 my $type = $1;
9531 0         0 my @best;
9532 0         0 foreach $lens (@matches) {
9533 0 0       0 push @best, $lens if $lens =~ /\Q$type/;
9534             }
9535 0 0       0 @matches = @best if @best;
9536             }
9537 1 50       4 @matches = @likely unless @matches;
9538 1 50       7 @matches = @maybe unless @matches;
9539 1         7 Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
9540 1 50       26 return join(' or ', @matches) if @matches;
9541             } elsif ($lensModel and $lensModel =~ /\d/) {
9542             # use lens model as written by the camera
9543 0 0       0 if ($printConv eq \%canonLensTypes) {
9544             # add "Canon" to the start since the Canon cameras only understand Canon lenses
9545 0         0 return "Canon $lensModel";
9546             } else {
9547 0         0 return $lensModel;
9548             }
9549             }
9550 22         59 my $str = '';
9551 22 50       68 if ($shortFocal) {
9552 22         102 $str .= sprintf(' %d', $shortFocal);
9553 22 50 33     192 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
9554 22         52 $str .= 'mm';
9555             }
9556             # (careful because Sigma LensType's may not be integer, so use string comparison)
9557 22 50 33     554 return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
9558 0         0 return "Unknown ($lensType)$str";
9559             }
9560              
9561             #------------------------------------------------------------------------------
9562             # Swap 16-bit words in 32-bit integers
9563             # Inputs: 0) string of integers
9564             # Returns: string of word-swapped integers
9565             sub SwapWords($)
9566             {
9567 7     7 0 18 my @a = split(' ', shift);
9568 7         24 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
9569 7         55 return "@a";
9570             }
9571              
9572             #------------------------------------------------------------------------------
9573             # Validate first word of Canon binary data
9574             # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
9575             # Returns: true if data value is the same
9576             sub Validate($$@)
9577             {
9578 349     349 0 1060 my ($dataPt, $offset, @vals) = @_;
9579             # the first 16-bit value is the length of the data in bytes
9580 349         916 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
9581 349         566 my $val;
9582 349         693 foreach $val (@vals) {
9583 349 50       3403 return 1 if $val == $dataVal;
9584             }
9585 0         0 return undef;
9586             }
9587              
9588             #------------------------------------------------------------------------------
9589             # Validate CanonAFInfo
9590             # Inputs: 0) data pointer, 1) offset, 2) size
9591             # Returns: true if data appears valid
9592             sub ValidateAFInfo($$$)
9593             {
9594 41     41 0 140 my ($dataPt, $offset, $size) = @_;
9595 41 50       143 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
9596 41         140 my $af = Get16u($dataPt, $offset);
9597 41 50       297 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
9598 41         141 my $w1 = Get16u($dataPt, $offset + 4);
9599 41         151 my $h1 = Get16u($dataPt, $offset + 6);
9600 41 50 33     224 return 0 unless $h1 and $w1;
9601 41         108 my $f1 = $w1 / $h1;
9602             # check for normal aspect ratio
9603 41 50 33     275 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
9604             # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
9605 41 50 33     227 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
9606 41         118 my $w2 = Get16u($dataPt, $offset + 8);
9607 41         136 my $h2 = Get16u($dataPt, $offset + 10);
9608 41 50 33     196 return 0 unless $h2 and $w2;
9609             # compare aspect ratio with AF image size
9610             # (but the Powershot AFImageHeight is odd, hence the test above)
9611 41 50       127 return 0 if $w1 eq $h1;
9612 41         88 my $f2 = $w2 / $h2;
9613 41 50       461 return 1 if abs(1-$f1/$f2) < 0.01;
9614 0 0       0 return 1 if abs(1-$f1*$f2) < 0.01;
9615 0         0 return 0;
9616             }
9617              
9618             #------------------------------------------------------------------------------
9619             # Read original decision data from file (variable length)
9620             # Inputs: 0) ExifTool object ref, 1) offset in file
9621             # Returns: reference to original decision data (or undef if no data)
9622             sub ReadODD($$)
9623             {
9624 12     12 0 41 my ($et, $offset) = @_;
9625 12 100       93 return undef unless $offset;
9626 4         11 my ($raf, $buff, $buf2, $i, $warn);
9627 4 50       17 return undef unless defined($raf = $$et{RAF});
9628             # the data block is a variable length and starts with 0xffffffff
9629             # followed a 4-byte (int32u) version number
9630 4         17 my $pos = $raf->Tell();
9631 4 50 33     17 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
      33        
9632 4         10 my $err = 1;
9633             # must set byte order in case it is different than current byte order
9634             # (we could be reading this after byte order was changed)
9635 4         17 my $oldOrder = GetByteOrder();
9636 4         17 my $version = Get32u(\$buff, 4);
9637 4 100       22 if ($version > 20) {
9638 1         5 ToggleByteOrder();
9639 1         6 $version = unpack('N',pack('V',$version));
9640             }
9641 4 50 33     135 if ($version == 1 or # 1Ds (big endian)
    50          
9642             $version == 2) # 5D/20D (little endian)
9643             {
9644             # this data is structured as follows:
9645             # 4 bytes: all 0xff
9646             # 4 bytes: version number (=1 or 2)
9647             # 20 bytes: sha1
9648             # 4 bytes: record count
9649             # for each record:
9650             # | 4 bytes: record number (beginning at 0)
9651             # | 4 bytes: block offset
9652             # | 4 bytes: block length
9653             # | 20 bytes: block sha1
9654 0 0       0 if ($raf->Read($buf2, 24) == 24) {
9655 0         0 $buff .= $buf2;
9656 0         0 my $count = Get32u(\$buf2, 20);
9657             # read all records if the count is reasonable
9658 0 0 0     0 if ($count and $count < 20 and
      0        
9659             $raf->Read($buf2, $count * 32) == $count * 32)
9660             {
9661 0         0 $buff .= $buf2;
9662 0         0 undef $err;
9663             }
9664             }
9665             } elsif ($version == 3) { # newer models (little endian)
9666             # this data is structured as follows:
9667             # 4 bytes: all 0xff
9668             # 4 bytes: version number (=3)
9669             # 24 bytes: sha1 A length (=20) + sha1 A
9670             # 24 bytes: sha1 B length (=20) + sha1 B
9671             # 4 bytes: length of remaining data (including this length word!)
9672             # 8 bytes: salt length (=4) + salt ?
9673             # 4 bytes: unknown (=3)
9674             # 4 bytes: size of file
9675             # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
9676             # 4 bytes: unknown (=1)
9677             # 4 bytes: unknown (always the same for a given firmware version)
9678             # 4 bytes: unknown (random)
9679             # 4 bytes: record count
9680             # for each record:
9681             # | 4 bytes: record number (beginning at 1)
9682             # | 8 bytes: salt length (=4) + salt ?
9683             # | 24 bytes: sha1 length (=20) + sha1
9684             # | 4 bytes: block count
9685             # | for each block:
9686             # | | 4 bytes: block offset
9687             # | | 4 bytes: block length
9688             # followed by zero padding to end of ODD data (~72 bytes)
9689 4         11 for ($i=0; ; ++$i) {
9690 16 100       38 $i == 3 and undef $err, last; # success!
9691 12 50       31 $raf->Read($buf2, 4) == 4 or last;
9692 12         26 $buff .= $buf2;
9693 12         30 my $len = Get32u(\$buf2, 0);
9694             # (the data length includes the length word itself - doh!)
9695 12 100 66     118 $len -= 4 if $i == 2 and $len >= 4;
9696             # make sure records are a reasonable size (<= 64kB)
9697 12 50 33     39 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
9698 12         24 $buff .= $buf2;
9699             }
9700             } else {
9701 0         0 $warn = "Unsupported original decision data version $version";
9702             }
9703 4         19 SetByteOrder($oldOrder);
9704 4 50       11 unless ($err) {
9705 4 50       18 if ($et->Options('HtmlDump')) {
9706 0         0 $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
9707             }
9708 4         44 $raf->Seek($pos, 0); # restore original file position
9709 4         68 return \$buff;
9710             }
9711             }
9712 0   0     0 $et->Warn($warn || 'Invalid original decision data');
9713 0         0 $raf->Seek($pos, 0); # restore original file position
9714 0         0 return undef;
9715             }
9716              
9717             #------------------------------------------------------------------------------
9718             # Convert the CameraISO value
9719             # Inputs: 0) value, 1) set for inverse conversion
9720             sub CameraISO($;$)
9721             {
9722 49     49 0 161 my ($val, $inv) = @_;
9723 49         79 my $rtnVal;
9724 49         383 my %isoLookup = (
9725             0 => 'n/a',
9726             14 => 'Auto High', #PH (S3IS)
9727             15 => 'Auto',
9728             16 => 50,
9729             17 => 100,
9730             18 => 200,
9731             19 => 400,
9732             20 => 800, #PH
9733             );
9734 49 100       206 if ($inv) {
    50          
9735 5         21 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
9736 5 50 66     31 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
9737 0         0 $rtnVal = ($val & 0x3fff) | 0x4000;
9738             }
9739             } elsif ($val != 0x7fff) {
9740 44 50       105 if ($val & 0x4000) {
9741 0         0 $rtnVal = $val & 0x3fff;
9742             } else {
9743 44   33     135 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
9744             }
9745             }
9746 49         363 return $rtnVal;
9747             }
9748              
9749             #------------------------------------------------------------------------------
9750             # Print range of focal lengths
9751             # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
9752             sub PrintFocalRange(@)
9753             {
9754 63     63 0 175 my ($short, $long, $scale) = @_;
9755              
9756 63 100       156 $scale or $scale = 1;
9757 63 50       169 if ($short == $long) {
9758 0         0 return sprintf("%.1f mm", $short * $scale);
9759             } else {
9760 63         865 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
9761             }
9762             }
9763              
9764             #------------------------------------------------------------------------------
9765             # Process a serial stream of binary data
9766             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
9767             # Returns: 1 on success
9768             # Notes: The tagID's for serial stream tags are consecutive indices beginning
9769             # at 0, and the corresponding values must be contiguous in memory.
9770             # "Unknown" tags must be used to skip padding or unknown values.
9771             # (does not yet extract Rational values)
9772             sub ProcessSerialData($$$)
9773             {
9774 63     63 0 188 my ($et, $dirInfo, $tagTablePtr) = @_;
9775 63         143 my $dataPt = $$dirInfo{DataPt};
9776 63         164 my $offset = $$dirInfo{DirStart};
9777 63         124 my $size = $$dirInfo{DirLen};
9778 63   100     216 my $base = $$dirInfo{Base} || 0;
9779 63         193 my $verbose = $et->Options('Verbose');
9780 63   100     300 my $dataPos = $$dirInfo{DataPos} || 0;
9781              
9782             # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
9783             # (require to maintain serial data synchronization)
9784 63         204 my $unknown = $et->Options(Unknown => 1);
9785             # but disable unknown tag generation (because processing ends when we run out of tags)
9786 63         165 $$et{NO_UNKNOWN} = 1;
9787              
9788 63 100       194 $verbose and $et->VerboseDir('SerialData', undef, $size);
9789              
9790             # get default format ('int8u' unless specified)
9791 63   50     343 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
9792              
9793 63         129 my ($index, %val);
9794 63         118 my $pos = 0;
9795 63   66     389 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
9796 812 100       1858 my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
9797 753         1249 my $format = $$tagInfo{Format};
9798 753         961 my $count = 1;
9799 753 100       1175 if ($format) {
9800 248 100       1098 if ($format =~ /(.*)\[(.*)\]/) {
    50          
9801 223         569 $format = $1;
9802 223         404 $count = $2;
9803             # evaluate count to allow count to be based on previous values
9804             #### eval Format (%val, $size)
9805 223         11173 $count = eval $count;
9806 223 50       833 $@ and warn("Format $$tagInfo{Name}: $@"), last;
9807             } elsif ($format eq 'string') {
9808             # allow string with no specified count to run to end of block
9809 0 0       0 $count = ($size > $pos) ? $size - $pos : 0;
9810             }
9811             } else {
9812 505         625 $format = $defaultFormat;
9813             }
9814 753   50     1582 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
9815 753 50       1416 last if $pos + $len > $size;
9816 753         1564 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
9817 753 50       1420 last unless defined $val;
9818 753 100       1199 if ($verbose) {
9819 22         71 $et->VerboseInfo($index, $tagInfo,
9820             Index => $index,
9821             Table => $tagTablePtr,
9822             Value => $val,
9823             DataPt => $dataPt,
9824             Size => $len,
9825             Start => $pos+$offset,
9826             Addr => $pos+$offset+$base+$dataPos,
9827             Format => $format,
9828             Count => $count,
9829             );
9830             }
9831 753         1796 $val{$index} = $val;
9832 753 100 100     2252 if ($$tagInfo{SubDirectory}) {
    100          
9833 1         4 my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
9834 1         7 my %dirInfo = (
9835             DataPt => \$val,
9836             DataPos => $dataPos + $pos,
9837             DirStart => 0,
9838             DirLen => length($val),
9839             );
9840 1         8 $et->ProcessDirectory(\%dirInfo, $subTablePtr);
9841             } elsif (not $$tagInfo{Unknown} or $unknown) {
9842             # don't extract zero-length information
9843 707 100       1884 $et->FoundTag($tagInfo, $val) if $count;
9844             }
9845 753         2728 $pos += $len;
9846             }
9847 63         273 $et->Options(Unknown => $unknown); # restore Unknown option
9848 63         151 delete $$et{NO_UNKNOWN};
9849 63         303 return 1;
9850             }
9851              
9852             #------------------------------------------------------------------------------
9853             # Print 1D AF points
9854             # Inputs: 0) value to convert
9855             # Focus point pattern:
9856             # A1 A2 A3 A4 A5 A6 A7
9857             # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
9858             # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
9859             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
9860             # E1 E2 E3 E4 E5 E6 E7
9861             sub PrintAFPoints1D($)
9862             {
9863 0     0 0 0 my $val = shift;
9864 0 0       0 return 'Unknown' unless length $val == 8;
9865             # list of focus point values for decoding the first byte of the 8-byte record.
9866             # they are the x/y positions of each bit in the AF point mask
9867             # (y is upper 3 bits / x is lower 5 bits)
9868 0         0 my @focusPts = (0,0,
9869             0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
9870             0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
9871             0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
9872             0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
9873             0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
9874             );
9875 0         0 my $focus = unpack('C',$val);
9876 0         0 my @bits = split //, unpack('b*',substr($val,1));
9877 0         0 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
9878 0         0 my ($focusing, $focusPt, @points);
9879 0         0 my $lastRow = '';
9880 0         0 my $col = 0;
9881 0         0 foreach $focusPt (@focusPts) {
9882 0         0 my $row = shift @rows;
9883 0 0       0 $col = ($row eq $lastRow) ? $col + 1 : 1;
9884 0         0 $lastRow = $row;
9885 0 0       0 $focusing = "$row$col" if $focus eq $focusPt;
9886 0 0       0 push @points, "$row$col" if shift @bits;
9887             }
9888 0 0       0 $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    0          
9889 0         0 return "$focusing (" . join(',',@points) . ')';
9890             }
9891              
9892             #------------------------------------------------------------------------------
9893             # Convert Canon hex-based EV (modulo 0x20) to real number
9894             # Inputs: 0) value to convert
9895             # eg) 0x00 -> 0
9896             # 0x0c -> 0.33333
9897             # 0x10 -> 0.5
9898             # 0x14 -> 0.66666
9899             # 0x20 -> 1 ... etc
9900             sub CanonEv($)
9901             {
9902 320     320 0 665 my $val = shift;
9903 320         423 my $sign;
9904             # temporarily make the number positive
9905 320 100       722 if ($val < 0) {
9906 25         56 $val = -$val;
9907 25         47 $sign = -1;
9908             } else {
9909 295         420 $sign = 1;
9910             }
9911 320         515 my $frac = $val & 0x1f;
9912 320         449 $val -= $frac; # remove fraction
9913             # Convert 1/3 and 2/3 codes
9914 320 100       820 if ($frac == 0x0c) {
    100          
9915 5         8 $frac = 0x20 / 3;
9916             } elsif ($frac == 0x14) {
9917 76         135 $frac = 0x40 / 3;
9918             }
9919 320         2391 return $sign * ($val + $frac) / 0x20;
9920             }
9921              
9922             #------------------------------------------------------------------------------
9923             # Convert number to Canon hex-based EV (modulo 0x20)
9924             # Inputs: 0) number
9925             # Returns: Canon EV code
9926             sub CanonEvInv($)
9927             {
9928 433     433 0 843 my $num = shift;
9929 433         587 my $sign;
9930             # temporarily make the number positive
9931 433 100       905 if ($num < 0) {
9932 81         127 $num = -$num;
9933 81         109 $sign = -1;
9934             } else {
9935 352         571 $sign = 1;
9936             }
9937 433         641 my $val = int($num);
9938 433         690 my $frac = $num - $val;
9939 433 100       1158 if (abs($frac - 0.33) < 0.05) {
    100          
9940 2         5 $frac = 0x0c
9941             } elsif (abs($frac - 0.67) < 0.05) {
9942 57         85 $frac = 0x14;
9943             } else {
9944 374         670 $frac = int($frac * 0x20 + 0.5);
9945             }
9946 433         2741 return $sign * ($val * 0x20 + $frac);
9947             }
9948              
9949             #------------------------------------------------------------------------------
9950             # Read CMT3 maker notes from CR3 file
9951             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
9952             # Returns: data block (may be empty if no Exif data) or undef on error
9953             sub ProcessCMT3($$$)
9954             {
9955 4     4 0 11 my ($et, $dirInfo, $tagTablePtr) = @_;
9956              
9957             # extract the static maker notes to copying to other file types if requested
9958             # Note: this won't copy makernotes in the timed metadata since these are stored
9959             # separately, but the only records they have that aren't in the static maker notes
9960             # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
9961             # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
9962 4 50 33     18 if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
      33        
9963             $$dirInfo{DirLen} > 8)
9964             {
9965 0         0 my $dataPt = $$dirInfo{DataPt};
9966             # remove old (unused) trailer
9967 0         0 $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
9968             # remove TIFF header and append as the Canon makernote trailer
9969             # (so offsets will be interpreted correctly)
9970 0         0 my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
9971 0         0 $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
9972             }
9973 4         27 return $et->ProcessTIFF($dirInfo, $tagTablePtr);
9974             }
9975              
9976             #------------------------------------------------------------------------------
9977             # Process CTMD EXIF information
9978             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
9979             # Returns: 1 on success
9980             sub ProcessExifInfo($$$)
9981             {
9982 12     12 0 28 my ($et, $dirInfo, $tagTablePtr) = @_;
9983 12         25 my $dataPt = $$dirInfo{DataPt};
9984 12   50     34 my $start = $$dirInfo{DirStart} || 0;
9985 12   33     28 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
9986 12         24 my $dirEnd = $start + $dirLen;
9987             # loop through TIFF-format EXIF/MakerNote records
9988 12         19 my ($pos, $len, $tag);
9989 12         34 for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
9990 16         40 $len = Get32u($dataPt, $pos);
9991 16         44 $tag = Get32u($dataPt, $pos + 4);
9992             # test size/tag for valid ExifInfo (not EXIF in CRM files)
9993 16 50 33     111 last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
      33        
9994 16 100       76 $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
9995             $et->HandleTag($tagTablePtr, $tag, undef,
9996             DataPt => $dataPt,
9997 16         79 Base => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
9998             DataPos => -($pos + 8), # (relative to Base)
9999             Start => $pos + 8,
10000             Size => $len - 8,
10001             );
10002             }
10003 12         29 return 1;
10004             }
10005              
10006             #------------------------------------------------------------------------------
10007             # Process Canon Timed MetaData (ref PH)
10008             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10009             # Returns: 1 on success
10010             sub ProcessCTMD($$$)
10011             {
10012 4     4 0 12 my ($et, $dirInfo, $tagTablePtr) = @_;
10013 4         10 my $dataPt = $$dirInfo{DataPt};
10014 4         14 my $verbose = $et->Options('Verbose');
10015 4         10 my $dirLen = length $$dataPt;
10016 4         8 my $pos = 0;
10017 4         12 SetByteOrder('II');
10018 4         23 while ($pos + 6 < $dirLen) {
10019 28         69 my $size = Get32u($dataPt, $pos);
10020 28         70 my $type = Get16u($dataPt, $pos + 4);
10021             # what is the meaning of the 6-byte header of these records?:
10022             # type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
10023             # type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
10024             # type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
10025             # type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
10026             # type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
10027             # type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
10028             # type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
10029             # type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
10030             # type 10- 01 00 00 01 ff ff - ? (CRM)
10031             # type 11- 01 00 00 01 ff ff - ? (CRM)
10032             # --> maybe yy == 01 for ExifInfo?
10033 28 50       64 $size < 12 and $et->Warn('Short CTMD record'), last;
10034 28 50       70 $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
10035 28         110 $et->VerboseDir("CTMD type $type", undef, $size - 6);
10036             HexDump($dataPt, 6, # dump 6-byte header
10037             Start => $pos + 6,
10038             Addr => $$dirInfo{Base} + $pos + 6,
10039             Prefix => $$et{INDENT},
10040 28 50       63 ) if $verbose > 2;
10041 28 100       67 if ($$tagTablePtr{$type}) {
    50          
10042             $et->HandleTag($tagTablePtr, $type, undef,
10043             DataPt => $dataPt,
10044             Base => $$dirInfo{Base},
10045 24         93 Start => $pos + 12,
10046             Size => $size - 12,
10047             );
10048             } elsif ($verbose) {
10049 0         0 $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
10050             }
10051 28         75 $pos += $size;
10052             }
10053 4 50       15 $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
10054 4         12 return 1;
10055             }
10056              
10057             #------------------------------------------------------------------------------
10058             # Process a creative filter data
10059             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10060             # Returns: 1 on success
10061             sub ProcessFilters($$$)
10062             {
10063 4     4 0 10 my ($et, $dirInfo, $tagTablePtr) = @_;
10064 4         10 my $dataPt = $$dirInfo{DataPt};
10065 4         9 my $pos = $$dirInfo{DirStart};
10066 4         8 my $dirLen = $$dirInfo{DirLen};
10067 4   50     20 my $dataPos = $$dirInfo{DataPos} || 0;
10068 4         8 my $end = $pos + $dirLen;
10069 4         14 my $verbose = $et->Options('Verbose');
10070              
10071 4 50       13 return 0 if $dirLen < 8;
10072 4         15 my $numFilters = Get32u($dataPt, $pos + 4);
10073 4 50       14 $verbose and $et->VerboseDir('Creative Filter', $numFilters);
10074 4         10 $pos += 8;
10075 4         9 my ($i, $j, $err);
10076 4         16 for ($i=0; $i<$numFilters; ++$i) {
10077             # read filter structure:
10078             # 4 bytes - filter number
10079             # 4 bytes - filter data length
10080             # 4 bytes - number of parameters:
10081             # | 4 bytes - parameter ID
10082             # | 4 bytes - parameter value count
10083             # | 4 bytes * count - parameter values (NC)
10084 28 50       56 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
10085 28         57 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
10086 28         58 my $size = Get32u($dataPt, $pos + 4);
10087 28         58 my $nparm = Get32u($dataPt, $pos + 8);
10088 28         43 my $nxt = $pos + 4 + $size;
10089 28 50       54 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
10090 28 50       49 $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
10091 28         36 $pos += 12;
10092 28         73 for ($j=0; $j<$nparm; ++$j) {
10093 40 50       74 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
10094 40         75 my $tag = Get32u($dataPt, $pos);
10095 40         84 my $count = Get32u($dataPt, $pos + 4);
10096 40         59 $pos += 8;
10097 40 50       73 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
10098 40         87 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
10099 40         112 $et->HandleTag($tagTablePtr, $tag, $val,
10100             DataPt => $dataPt,
10101             DataPos => $dataPos,
10102             Start => $pos,
10103             Size => 4 * $count,
10104             );
10105 40         92 $pos += 4 * $count;
10106             }
10107 28         59 $pos = $nxt; # step to next filter
10108             }
10109 4 50       13 $err and $et->Warn($err, 1);
10110 4         14 return 1;
10111             }
10112              
10113             #------------------------------------------------------------------------------
10114             # Write Canon maker notes
10115             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10116             # Returns: data block (may be empty if no Exif data) or undef on error
10117             sub WriteCanon($$$)
10118             {
10119 151     151 0 369 my ($et, $dirInfo, $tagTablePtr) = @_;
10120 151 100       608 $et or return 1; # allow dummy access to autoload this package
10121 23         317 my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
10122             # add footer which is written by some Canon models (format of a TIFF header)
10123 23 100 33     249 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
      66        
10124 20         71 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
10125 20         114 $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
10126             }
10127 23         147 return $dirData;
10128             }
10129              
10130             #------------------------------------------------------------------------------
10131             1; # end
10132              
10133             __END__