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 34     34   6058 use strict;
  34         90  
  34         1402  
80 34     34   236 use vars qw($VERSION %canonModelID %canonLensTypes);
  34         79  
  34         2320  
81 34     34   237 use Image::ExifTool qw(:DataAccess :Utils);
  34         87  
  34         8287  
82 34     34   4183 use Image::ExifTool::Exif;
  34         156  
  34         797037  
83              
84             sub WriteCanon($$$);
85             sub ProcessSerialData($$$);
86             sub ProcessFilters($$$);
87             sub ProcessCTMD($$$);
88             sub ProcessExifInfo($$$);
89             sub SwapWords($);
90              
91             $VERSION = '4.63';
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             255.3 => 'Yongnuo YN 50mm f/1.8', #50
484             368 => 'Sigma 14-24mm f/2.8 DG HSM | A or other Sigma Lens', #IB (A018)
485             368.1 => 'Sigma 20mm f/1.4 DG HSM | A', #50 (newer firmware)
486             368.2 => 'Sigma 50mm f/1.4 DG HSM | A', #50
487             368.3 => 'Sigma 40mm f/1.4 DG HSM | A', #IB (018)
488             368.4 => 'Sigma 60-600mm f/4.5-6.3 DG OS HSM | S', #IB (018)
489             368.5 => 'Sigma 28mm f/1.4 DG HSM | A', #IB (A019)
490             368.6 => 'Sigma 150-600mm f/5-6.3 DG OS HSM | S', #50
491             368.7 => 'Sigma 85mm f/1.4 DG HSM | A', #IB (016)
492             368.8 => 'Sigma 105mm f/1.4 DG HSM', #IB (A018)
493             368.9 => 'Sigma 14-24mm f/2.8 DG HSM', #IB (A018)
494             '368.10' => 'Sigma 35mm f/1.4 DG HSM | A', #PH (012)
495             '368.11' => 'Sigma 70mm f/2.8 DG Macro', #IB (A018)
496             '368.12' => 'Sigma 18-35mm f/1.8 DC HSM | A', #50
497             '368.13' => 'Sigma 24-105mm f/4 DG OS HSM | A', #forum3833
498             # Note: LensType 488 (0x1e8) is reported as 232 (0xe8) in 7D CameraSettings
499             488 => 'Canon EF-S 15-85mm f/3.5-5.6 IS USM', #PH
500             489 => 'Canon EF 70-300mm f/4-5.6L IS USM', #Gerald Kapounek
501             490 => 'Canon EF 8-15mm f/4L Fisheye USM', #Klaus Reinfeld (PH added "Fisheye")
502             491 => 'Canon EF 300mm f/2.8L IS II USM or Tamron Lens', #42
503             491.1 => 'Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)', #IB
504             491.2 => 'Tamron 18-400mm f/3.5-6.3 Di II VC HLD (B028)', #IB
505             491.3 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD (A035)', #IB
506             491.4 => 'Tamron 70-210mm f/4 Di VC USD (A034)', #IB
507             491.5 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 1.4x', #IB
508             491.6 => 'Tamron SP 24-70mm f/2.8 Di VC USD G2 (A032)',
509             492 => 'Canon EF 400mm f/2.8L IS II USM', #PH
510             493 => 'Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM', #PH
511             493.1 => 'Canon EF 24-105mm f/4L IS USM', #PH (should recheck this)
512             494 => 'Canon EF 600mm f/4L IS II USM', #PH
513             495 => 'Canon EF 24-70mm f/2.8L II USM or Sigma Lens', #PH
514             495.1 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
515             496 => 'Canon EF 200-400mm f/4L IS USM', #PH
516             499 => 'Canon EF 200-400mm f/4L IS USM + 1.4x', #50
517             502 => 'Canon EF 28mm f/2.8 IS USM or Tamron Lens', #PH
518             502.1 => 'Tamron 35mm f/1.8 Di VC USD (F012)', #forum9757
519             503 => 'Canon EF 24mm f/2.8 IS USM', #PH
520             504 => 'Canon EF 24-70mm f/4L IS USM', #PH
521             505 => 'Canon EF 35mm f/2 IS USM', #PH
522             506 => 'Canon EF 400mm f/4 DO IS II USM', #42
523             507 => 'Canon EF 16-35mm f/4L IS USM', #42
524             508 => 'Canon EF 11-24mm f/4L USM or Tamron Lens', #PH
525             508.1 => 'Tamron 10-24mm f/3.5-4.5 Di II VC HLD (B023)', #PH
526             624 => 'Sigma 70-200mm f/2.8 DG OS HSM | S or other Sigma Lens', #IB (018)
527             624.1 => 'Sigma 150-600mm f/5-6.3 | C', #ChrisSkopec
528             747 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens', #JR
529             747.1 => 'Tamron SP 150-600mm f/5-6.3 Di VC USD G2', #50
530             748 => 'Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x or Tamron Lens', #JR (1.4x Mk III)
531             748.1 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 1.4x', #IB
532             748.2 => 'Tamron 70-210mm f/4 Di VC USD (A034) + 2x', #IB
533             749 => 'Tamron 100-400mm f/4.5-6.3 Di VC USD A035E + 2x', #IB
534             750 => 'Canon EF 35mm f/1.4L II USM or Tamron Lens', #42
535             750.1 => 'Tamron SP 85mm f/1.8 Di VC USD (F016)', #Exiv2#1072
536             750.2 => 'Tamron SP 45mm f/1.8 Di VC USD (F013)', #PH
537             751 => 'Canon EF 16-35mm f/2.8L III USM', #42
538             752 => 'Canon EF 24-105mm f/4L IS II USM', #42
539             753 => 'Canon EF 85mm f/1.4L IS USM', #42
540             754 => 'Canon EF 70-200mm f/4L IS II USM', #IB
541             757 => 'Canon EF 400mm f/2.8L IS III USM', #IB
542             758 => 'Canon EF 600mm f/4L IS III USM', #IB
543              
544             1136 => 'Sigma 24-70mm f/2.8 DG OS HSM | A', #IB (017)
545             # (STM lenses - 0x10xx)
546             4142 => 'Canon EF-S 18-135mm f/3.5-5.6 IS STM',
547             4143 => 'Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens',
548             4143.1 => 'Tamron 18-200mm f/3.5-6.3 Di III VC', #42
549             4144 => 'Canon EF 40mm f/2.8 STM', #50
550             4145 => 'Canon EF-M 22mm f/2 STM', #34
551             4146 => 'Canon EF-S 18-55mm f/3.5-5.6 IS STM', #PH
552             4147 => 'Canon EF-M 11-22mm f/4-5.6 IS STM', #42
553             4148 => 'Canon EF-S 55-250mm f/4-5.6 IS STM', #42
554             4149 => 'Canon EF-M 55-200mm f/4.5-6.3 IS STM', #42
555             4150 => 'Canon EF-S 10-18mm f/4.5-5.6 IS STM', #42
556             4152 => 'Canon EF 24-105mm f/3.5-5.6 IS STM', #42
557             4153 => 'Canon EF-M 15-45mm f/3.5-6.3 IS STM', #PH
558             4154 => 'Canon EF-S 24mm f/2.8 STM', #IB
559             4155 => 'Canon EF-M 28mm f/3.5 Macro IS STM', #42
560             4156 => 'Canon EF 50mm f/1.8 STM', #42
561             4157 => 'Canon EF-M 18-150mm f/3.5-6.3 IS STM', #42
562             4158 => 'Canon EF-S 18-55mm f/4-5.6 IS STM', #PH
563             4159 => 'Canon EF-M 32mm f/1.4 STM', #42
564             4160 => 'Canon EF-S 35mm f/2.8 Macro IS STM', #42
565             4208 => 'Sigma 56mm f/1.4 DC DN | C or other Sigma Lens', #forum10603
566             4208.1 => 'Sigma 30mm F1.4 DC DN | C', #git issue#83 (016)
567             # (Nano USM lenses - 0x90xx)
568             36910 => 'Canon EF 70-300mm f/4-5.6 IS II USM', #42
569             36912 => 'Canon EF-S 18-135mm f/3.5-5.6 IS USM', #42
570             # (CN-E lenses - 0xf0xx)
571             61491 => 'Canon CN-E 14mm T3.1 L F', #PH
572             61492 => 'Canon CN-E 24mm T1.5 L F', #PH
573             # 61493 - missing CN-E 50mm T1.3 L F ?
574             61494 => 'Canon CN-E 85mm T1.3 L F', #PH
575             61495 => 'Canon CN-E 135mm T2.2 L F', #PH
576             61496 => 'Canon CN-E 35mm T1.5 L F', #PH
577             #
578             # see RFLensType tag for master list of 61182 RF lenses
579             #
580             61182 => 'Canon RF 50mm F1.2L USM or other Canon RF Lens',
581             61182.1 => 'Canon RF 24-105mm F4L IS USM',
582             61182.2 => 'Canon RF 28-70mm F2L USM',
583             61182.3 => 'Canon RF 35mm F1.8 MACRO IS STM',
584             61182.4 => 'Canon RF 85mm F1.2L USM',
585             61182.5 => 'Canon RF 85mm F1.2L USM DS',
586             61182.6 => 'Canon RF 24-70mm F2.8L IS USM',
587             61182.7 => 'Canon RF 15-35mm F2.8L IS USM',
588             61182.8 => 'Canon RF 24-240mm F4-6.3 IS USM',
589             61182.9 => 'Canon RF 70-200mm F2.8L IS USM',
590             '61182.10' => 'Canon RF 85mm F2 MACRO IS STM',
591             '61182.11' => 'Canon RF 600mm F11 IS STM',
592             '61182.12' => 'Canon RF 600mm F11 IS STM + RF1.4x',
593             '61182.13' => 'Canon RF 600mm F11 IS STM + RF2x',
594             '61182.14' => 'Canon RF 800mm F11 IS STM',
595             '61182.15' => 'Canon RF 800mm F11 IS STM + RF1.4x',
596             '61182.16' => 'Canon RF 800mm F11 IS STM + RF2x',
597             '61182.17' => 'Canon RF 24-105mm F4-7.1 IS STM',
598             '61182.18' => 'Canon RF 100-500mm F4.5-7.1L IS USM',
599             '61182.19' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
600             '61182.20' => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
601             '61182.21' => 'Canon RF 70-200mm F4L IS USM', #42
602             '61182.22' => 'Canon RF 100mm F2.8L MACRO IS USM', #42
603             '61182.23' => 'Canon RF 50mm F1.8 STM', #42
604             '61182.24' => 'Canon RF 14-35mm F4L IS USM', #IB
605             '61182.25' => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
606             '61182.26' => 'Canon RF 100-400mm F5.6-8 IS USM', #42
607             '61182.27' => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
608             '61182.28' => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
609             '61182.29' => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
610             '61182.30' => 'Canon RF 24mm F1.8 MACRO IS STM', #42
611             '61182.31' => 'Canon RF 16mm F2.8 STM', #42
612             '61182.32' => 'Canon RF 400mm F2.8L IS USM', #IB
613             '61182.33' => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
614             '61182.34' => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
615             '61182.35' => 'Canon RF 600mm F4L IS USM', #GiaZopatti
616             '61182.36' => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
617             '61182.37' => 'Canon RF 800mm F5.6L IS USM', #42
618             '61182.38' => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
619             '61182.39' => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
620             '61182.40' => 'Canon RF 1200mm F8L IS USM', #42
621             '61182.41' => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
622             '61182.42' => 'Canon RF 1200mm F8L IS USM + RF2x', #42
623             '61182.43' => 'Canon RF 135mm F1.8 L IS USM', #42
624             # we need the RFLensType values for the following...
625             '61182.44' => 'Canon RF 5.2mm F2.8L Dual Fisheye 3D VR', #PH (NC)
626             65535 => 'n/a',
627             );
628              
629             # Canon model ID numbers (PH)
630             %canonModelID = (
631             0x1010000 => 'PowerShot A30',
632             0x1040000 => 'PowerShot S300 / Digital IXUS 300 / IXY Digital 300',
633             0x1060000 => 'PowerShot A20',
634             0x1080000 => 'PowerShot A10',
635             0x1090000 => 'PowerShot S110 / Digital IXUS v / IXY Digital 200',
636             0x1100000 => 'PowerShot G2',
637             0x1110000 => 'PowerShot S40',
638             0x1120000 => 'PowerShot S30',
639             0x1130000 => 'PowerShot A40',
640             0x1140000 => 'EOS D30',
641             0x1150000 => 'PowerShot A100',
642             0x1160000 => 'PowerShot S200 / Digital IXUS v2 / IXY Digital 200a',
643             0x1170000 => 'PowerShot A200',
644             0x1180000 => 'PowerShot S330 / Digital IXUS 330 / IXY Digital 300a',
645             0x1190000 => 'PowerShot G3',
646             0x1210000 => 'PowerShot S45',
647             0x1230000 => 'PowerShot SD100 / Digital IXUS II / IXY Digital 30',
648             0x1240000 => 'PowerShot S230 / Digital IXUS v3 / IXY Digital 320',
649             0x1250000 => 'PowerShot A70',
650             0x1260000 => 'PowerShot A60',
651             0x1270000 => 'PowerShot S400 / Digital IXUS 400 / IXY Digital 400',
652             0x1290000 => 'PowerShot G5',
653             0x1300000 => 'PowerShot A300',
654             0x1310000 => 'PowerShot S50',
655             0x1340000 => 'PowerShot A80',
656             0x1350000 => 'PowerShot SD10 / Digital IXUS i / IXY Digital L',
657             0x1360000 => 'PowerShot S1 IS',
658             0x1370000 => 'PowerShot Pro1',
659             0x1380000 => 'PowerShot S70',
660             0x1390000 => 'PowerShot S60',
661             0x1400000 => 'PowerShot G6',
662             0x1410000 => 'PowerShot S500 / Digital IXUS 500 / IXY Digital 500',
663             0x1420000 => 'PowerShot A75',
664             0x1440000 => 'PowerShot SD110 / Digital IXUS IIs / IXY Digital 30a',
665             0x1450000 => 'PowerShot A400',
666             0x1470000 => 'PowerShot A310',
667             0x1490000 => 'PowerShot A85',
668             0x1520000 => 'PowerShot S410 / Digital IXUS 430 / IXY Digital 450',
669             0x1530000 => 'PowerShot A95',
670             0x1540000 => 'PowerShot SD300 / Digital IXUS 40 / IXY Digital 50',
671             0x1550000 => 'PowerShot SD200 / Digital IXUS 30 / IXY Digital 40',
672             0x1560000 => 'PowerShot A520',
673             0x1570000 => 'PowerShot A510',
674             0x1590000 => 'PowerShot SD20 / Digital IXUS i5 / IXY Digital L2',
675             0x1640000 => 'PowerShot S2 IS',
676             0x1650000 => 'PowerShot SD430 / Digital IXUS Wireless / IXY Digital Wireless',
677             0x1660000 => 'PowerShot SD500 / Digital IXUS 700 / IXY Digital 600',
678             0x1668000 => 'EOS D60',
679             0x1700000 => 'PowerShot SD30 / Digital IXUS i Zoom / IXY Digital L3',
680             0x1740000 => 'PowerShot A430',
681             0x1750000 => 'PowerShot A410',
682             0x1760000 => 'PowerShot S80',
683             0x1780000 => 'PowerShot A620',
684             0x1790000 => 'PowerShot A610',
685             0x1800000 => 'PowerShot SD630 / Digital IXUS 65 / IXY Digital 80',
686             0x1810000 => 'PowerShot SD450 / Digital IXUS 55 / IXY Digital 60',
687             0x1820000 => 'PowerShot TX1',
688             0x1870000 => 'PowerShot SD400 / Digital IXUS 50 / IXY Digital 55',
689             0x1880000 => 'PowerShot A420',
690             0x1890000 => 'PowerShot SD900 / Digital IXUS 900 Ti / IXY Digital 1000',
691             0x1900000 => 'PowerShot SD550 / Digital IXUS 750 / IXY Digital 700',
692             0x1920000 => 'PowerShot A700',
693             0x1940000 => 'PowerShot SD700 IS / Digital IXUS 800 IS / IXY Digital 800 IS',
694             0x1950000 => 'PowerShot S3 IS',
695             0x1960000 => 'PowerShot A540',
696             0x1970000 => 'PowerShot SD600 / Digital IXUS 60 / IXY Digital 70',
697             0x1980000 => 'PowerShot G7',
698             0x1990000 => 'PowerShot A530',
699             0x2000000 => 'PowerShot SD800 IS / Digital IXUS 850 IS / IXY Digital 900 IS',
700             0x2010000 => 'PowerShot SD40 / Digital IXUS i7 / IXY Digital L4',
701             0x2020000 => 'PowerShot A710 IS',
702             0x2030000 => 'PowerShot A640',
703             0x2040000 => 'PowerShot A630',
704             0x2090000 => 'PowerShot S5 IS',
705             0x2100000 => 'PowerShot A460',
706             0x2120000 => 'PowerShot SD850 IS / Digital IXUS 950 IS / IXY Digital 810 IS',
707             0x2130000 => 'PowerShot A570 IS',
708             0x2140000 => 'PowerShot A560',
709             0x2150000 => 'PowerShot SD750 / Digital IXUS 75 / IXY Digital 90',
710             0x2160000 => 'PowerShot SD1000 / Digital IXUS 70 / IXY Digital 10',
711             0x2180000 => 'PowerShot A550',
712             0x2190000 => 'PowerShot A450',
713             0x2230000 => 'PowerShot G9',
714             0x2240000 => 'PowerShot A650 IS',
715             0x2260000 => 'PowerShot A720 IS',
716             0x2290000 => 'PowerShot SX100 IS',
717             0x2300000 => 'PowerShot SD950 IS / Digital IXUS 960 IS / IXY Digital 2000 IS',
718             0x2310000 => 'PowerShot SD870 IS / Digital IXUS 860 IS / IXY Digital 910 IS',
719             0x2320000 => 'PowerShot SD890 IS / Digital IXUS 970 IS / IXY Digital 820 IS',
720             0x2360000 => 'PowerShot SD790 IS / Digital IXUS 90 IS / IXY Digital 95 IS',
721             0x2370000 => 'PowerShot SD770 IS / Digital IXUS 85 IS / IXY Digital 25 IS',
722             0x2380000 => 'PowerShot A590 IS',
723             0x2390000 => 'PowerShot A580',
724             0x2420000 => 'PowerShot A470',
725             0x2430000 => 'PowerShot SD1100 IS / Digital IXUS 80 IS / IXY Digital 20 IS',
726             0x2460000 => 'PowerShot SX1 IS',
727             0x2470000 => 'PowerShot SX10 IS',
728             0x2480000 => 'PowerShot A1000 IS',
729             0x2490000 => 'PowerShot G10',
730             0x2510000 => 'PowerShot A2000 IS',
731             0x2520000 => 'PowerShot SX110 IS',
732             0x2530000 => 'PowerShot SD990 IS / Digital IXUS 980 IS / IXY Digital 3000 IS',
733             0x2540000 => 'PowerShot SD880 IS / Digital IXUS 870 IS / IXY Digital 920 IS',
734             0x2550000 => 'PowerShot E1',
735             0x2560000 => 'PowerShot D10',
736             0x2570000 => 'PowerShot SD960 IS / Digital IXUS 110 IS / IXY Digital 510 IS',
737             0x2580000 => 'PowerShot A2100 IS',
738             0x2590000 => 'PowerShot A480',
739             0x2600000 => 'PowerShot SX200 IS',
740             0x2610000 => 'PowerShot SD970 IS / Digital IXUS 990 IS / IXY Digital 830 IS',
741             0x2620000 => 'PowerShot SD780 IS / Digital IXUS 100 IS / IXY Digital 210 IS',
742             0x2630000 => 'PowerShot A1100 IS',
743             0x2640000 => 'PowerShot SD1200 IS / Digital IXUS 95 IS / IXY Digital 110 IS',
744             0x2700000 => 'PowerShot G11',
745             0x2710000 => 'PowerShot SX120 IS',
746             0x2720000 => 'PowerShot S90',
747             0x2750000 => 'PowerShot SX20 IS',
748             0x2760000 => 'PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS',
749             0x2770000 => 'PowerShot SD940 IS / Digital IXUS 120 IS / IXY Digital 220 IS',
750             0x2800000 => 'PowerShot A495',
751             0x2810000 => 'PowerShot A490',
752             0x2820000 => 'PowerShot A3100/A3150 IS', # (different cameras, same ID)
753             0x2830000 => 'PowerShot A3000 IS',
754             0x2840000 => 'PowerShot SD1400 IS / IXUS 130 / IXY 400F',
755             0x2850000 => 'PowerShot SD1300 IS / IXUS 105 / IXY 200F',
756             0x2860000 => 'PowerShot SD3500 IS / IXUS 210 / IXY 10S',
757             0x2870000 => 'PowerShot SX210 IS',
758             0x2880000 => 'PowerShot SD4000 IS / IXUS 300 HS / IXY 30S',
759             0x2890000 => 'PowerShot SD4500 IS / IXUS 1000 HS / IXY 50S',
760             0x2920000 => 'PowerShot G12',
761             0x2930000 => 'PowerShot SX30 IS',
762             0x2940000 => 'PowerShot SX130 IS',
763             0x2950000 => 'PowerShot S95',
764             0x2980000 => 'PowerShot A3300 IS',
765             0x2990000 => 'PowerShot A3200 IS',
766             0x3000000 => 'PowerShot ELPH 500 HS / IXUS 310 HS / IXY 31S',
767             0x3010000 => 'PowerShot Pro90 IS',
768             0x3010001 => 'PowerShot A800',
769             0x3020000 => 'PowerShot ELPH 100 HS / IXUS 115 HS / IXY 210F',
770             0x3030000 => 'PowerShot SX230 HS',
771             0x3040000 => 'PowerShot ELPH 300 HS / IXUS 220 HS / IXY 410F',
772             0x3050000 => 'PowerShot A2200',
773             0x3060000 => 'PowerShot A1200',
774             0x3070000 => 'PowerShot SX220 HS',
775             0x3080000 => 'PowerShot G1 X',
776             0x3090000 => 'PowerShot SX150 IS',
777             0x3100000 => 'PowerShot ELPH 510 HS / IXUS 1100 HS / IXY 51S',
778             0x3110000 => 'PowerShot S100 (new)',
779             0x3130000 => 'PowerShot SX40 HS',
780             0x3120000 => 'PowerShot ELPH 310 HS / IXUS 230 HS / IXY 600F',
781             # the Canon page lists the IXY 32S as "Japan only", but many other
782             # sites list the ELPH 500 HS and IXUS 320 HS as being the same model.
783             # I haven't been able to find an IXUS 320 sample, and the ELPH 500 HS
784             # is already associated with other IXUS and IXY models - PH
785             0x3140000 => 'IXY 32S', # (PowerShot ELPH 500 HS / IXUS 320 HS ??)
786             0x3160000 => 'PowerShot A1300',
787             0x3170000 => 'PowerShot A810',
788             0x3180000 => 'PowerShot ELPH 320 HS / IXUS 240 HS / IXY 420F',
789             0x3190000 => 'PowerShot ELPH 110 HS / IXUS 125 HS / IXY 220F',
790             0x3200000 => 'PowerShot D20',
791             0x3210000 => 'PowerShot A4000 IS',
792             0x3220000 => 'PowerShot SX260 HS',
793             0x3230000 => 'PowerShot SX240 HS',
794             0x3240000 => 'PowerShot ELPH 530 HS / IXUS 510 HS / IXY 1',
795             0x3250000 => 'PowerShot ELPH 520 HS / IXUS 500 HS / IXY 3',
796             0x3260000 => 'PowerShot A3400 IS',
797             0x3270000 => 'PowerShot A2400 IS',
798             0x3280000 => 'PowerShot A2300',
799             0x3320000 => 'PowerShot S100V', #IB
800             0x3330000 => 'PowerShot G15', #25
801             0x3340000 => 'PowerShot SX50 HS', #25/forum8196
802             0x3350000 => 'PowerShot SX160 IS',
803             0x3360000 => 'PowerShot S110 (new)',
804             0x3370000 => 'PowerShot SX500 IS',
805             0x3380000 => 'PowerShot N',
806             0x3390000 => 'IXUS 245 HS / IXY 430F', # (no PowerShot)
807             0x3400000 => 'PowerShot SX280 HS',
808             0x3410000 => 'PowerShot SX270 HS',
809             0x3420000 => 'PowerShot A3500 IS',
810             0x3430000 => 'PowerShot A2600',
811             0x3440000 => 'PowerShot SX275 HS', #forum8199
812             0x3450000 => 'PowerShot A1400',
813             0x3460000 => 'PowerShot ELPH 130 IS / IXUS 140 / IXY 110F',
814             0x3470000 => 'PowerShot ELPH 115/120 IS / IXUS 132/135 / IXY 90F/100F',
815             0x3490000 => 'PowerShot ELPH 330 HS / IXUS 255 HS / IXY 610F',
816             0x3510000 => 'PowerShot A2500',
817             0x3540000 => 'PowerShot G16',
818             0x3550000 => 'PowerShot S120',
819             0x3560000 => 'PowerShot SX170 IS',
820             0x3580000 => 'PowerShot SX510 HS',
821             0x3590000 => 'PowerShot S200 (new)',
822             0x3600000 => 'IXY 620F', # (no PowerShot or IXUS?)
823             0x3610000 => 'PowerShot N100',
824             0x3640000 => 'PowerShot G1 X Mark II',
825             0x3650000 => 'PowerShot D30',
826             0x3660000 => 'PowerShot SX700 HS',
827             0x3670000 => 'PowerShot SX600 HS',
828             0x3680000 => 'PowerShot ELPH 140 IS / IXUS 150 / IXY 130',
829             0x3690000 => 'PowerShot ELPH 135 / IXUS 145 / IXY 120',
830             0x3700000 => 'PowerShot ELPH 340 HS / IXUS 265 HS / IXY 630',
831             0x3710000 => 'PowerShot ELPH 150 IS / IXUS 155 / IXY 140',
832             0x3740000 => 'EOS M3', #IB
833             0x3750000 => 'PowerShot SX60 HS', #IB/NJ
834             0x3760000 => 'PowerShot SX520 HS', #IB
835             0x3770000 => 'PowerShot SX400 IS',
836             0x3780000 => 'PowerShot G7 X', #IB
837             0x3790000 => 'PowerShot N2',
838             0x3800000 => 'PowerShot SX530 HS',
839             0x3820000 => 'PowerShot SX710 HS',
840             0x3830000 => 'PowerShot SX610 HS',
841             0x3840000 => 'EOS M10',
842             0x3850000 => 'PowerShot G3 X',
843             0x3860000 => 'PowerShot ELPH 165 HS / IXUS 165 / IXY 160',
844             0x3870000 => 'PowerShot ELPH 160 / IXUS 160',
845             0x3880000 => 'PowerShot ELPH 350 HS / IXUS 275 HS / IXY 640',
846             0x3890000 => 'PowerShot ELPH 170 IS / IXUS 170',
847             0x3910000 => 'PowerShot SX410 IS',
848             0x3930000 => 'PowerShot G9 X',
849             0x3940000 => 'EOS M5', #IB
850             0x3950000 => 'PowerShot G5 X',
851             0x3970000 => 'PowerShot G7 X Mark II',
852             0x3980000 => 'EOS M100', #42
853             0x3990000 => 'PowerShot ELPH 360 HS / IXUS 285 HS / IXY 650',
854             0x4010000 => 'PowerShot SX540 HS',
855             0x4020000 => 'PowerShot SX420 IS',
856             0x4030000 => 'PowerShot ELPH 190 IS / IXUS 180 / IXY 190',
857             0x4040000 => 'PowerShot G1',
858             0x4040001 => 'PowerShot ELPH 180 IS / IXUS 175 / IXY 180', #forum10402
859             0x4050000 => 'PowerShot SX720 HS',
860             0x4060000 => 'PowerShot SX620 HS',
861             0x4070000 => 'EOS M6',
862             0x4100000 => 'PowerShot G9 X Mark II',
863             0x412 => 'EOS M50 / Kiss M', # (yes, no "0000")
864             0x4150000 => 'PowerShot ELPH 185 / IXUS 185 / IXY 200',
865             0x4160000 => 'PowerShot SX430 IS',
866             0x4170000 => 'PowerShot SX730 HS',
867             0x4180000 => 'PowerShot G1 X Mark III', #IB
868             0x6040000 => 'PowerShot S100 / Digital IXUS / IXY Digital',
869             0x801 => 'PowerShot SX740 HS',
870             0x804 => 'PowerShot G5 X Mark II',
871             0x805 => 'PowerShot SX70 HS',
872             0x808 => 'PowerShot G7 X Mark III',
873             0x811 => 'EOS M6 Mark II', #IB
874             0x812 => 'EOS M200', #25
875              
876             # (see http://cweb.canon.jp/e-support/faq/answer/digitalcamera/10447-1.html for PowerShot/IXUS/IXY names)
877              
878             0x4007d673 => 'DC19/DC21/DC22',
879             0x4007d674 => 'XH A1',
880             0x4007d675 => 'HV10',
881             0x4007d676 => 'MD130/MD140/MD150/MD160/ZR850',
882             0x4007d777 => 'DC50', # (iVIS)
883             0x4007d778 => 'HV20', # (iVIS)
884             0x4007d779 => 'DC211', #29
885             0x4007d77a => 'HG10',
886             0x4007d77b => 'HR10', #29 (iVIS)
887             0x4007d77d => 'MD255/ZR950',
888             0x4007d81c => 'HF11',
889             0x4007d878 => 'HV30',
890             0x4007d87c => 'XH A1S',
891             0x4007d87e => 'DC301/DC310/DC311/DC320/DC330',
892             0x4007d87f => 'FS100',
893             0x4007d880 => 'HF10', #29 (iVIS/VIXIA)
894             0x4007d882 => 'HG20/HG21', # (VIXIA)
895             0x4007d925 => 'HF21', # (LEGRIA)
896             0x4007d926 => 'HF S11', # (LEGRIA)
897             0x4007d978 => 'HV40', # (LEGRIA)
898             0x4007d987 => 'DC410/DC411/DC420',
899             0x4007d988 => 'FS19/FS20/FS21/FS22/FS200', # (LEGRIA)
900             0x4007d989 => 'HF20/HF200', # (LEGRIA)
901             0x4007d98a => 'HF S10/S100', # (LEGRIA/VIXIA)
902             0x4007da8e => 'HF R10/R16/R17/R18/R100/R106', # (LEGRIA/VIXIA)
903             0x4007da8f => 'HF M30/M31/M36/M300/M306', # (LEGRIA/VIXIA)
904             0x4007da90 => 'HF S20/S21/S200', # (LEGRIA/VIXIA)
905             0x4007da92 => 'FS31/FS36/FS37/FS300/FS305/FS306/FS307',
906             0x4007dca0 => 'EOS C300',
907             0x4007dda9 => 'HF G25', # (LEGRIA)
908             0x4007dfb4 => 'XC10',
909             0x4007e1c3 => 'EOS C200',
910              
911             # NOTE: some pre-production models may have a model name of
912             # "Canon EOS Kxxx", where "xxx" is the last 3 digits of the model ID below.
913             # This has been observed for the 1DSmkIII/K215 and 400D/K236.
914             0x80000001 => 'EOS-1D',
915             0x80000167 => 'EOS-1DS',
916             0x80000168 => 'EOS 10D',
917             0x80000169 => 'EOS-1D Mark III',
918             0x80000170 => 'EOS Digital Rebel / 300D / Kiss Digital',
919             0x80000174 => 'EOS-1D Mark II',
920             0x80000175 => 'EOS 20D',
921             0x80000176 => 'EOS Digital Rebel XSi / 450D / Kiss X2',
922             0x80000188 => 'EOS-1Ds Mark II',
923             0x80000189 => 'EOS Digital Rebel XT / 350D / Kiss Digital N',
924             0x80000190 => 'EOS 40D',
925             0x80000213 => 'EOS 5D',
926             0x80000215 => 'EOS-1Ds Mark III',
927             0x80000218 => 'EOS 5D Mark II',
928             0x80000219 => 'WFT-E1',
929             0x80000232 => 'EOS-1D Mark II N',
930             0x80000234 => 'EOS 30D',
931             0x80000236 => 'EOS Digital Rebel XTi / 400D / Kiss Digital X',
932             0x80000241 => 'WFT-E2',
933             0x80000246 => 'WFT-E3',
934             0x80000250 => 'EOS 7D',
935             0x80000252 => 'EOS Rebel T1i / 500D / Kiss X3',
936             0x80000254 => 'EOS Rebel XS / 1000D / Kiss F',
937             0x80000261 => 'EOS 50D',
938             0x80000269 => 'EOS-1D X',
939             0x80000270 => 'EOS Rebel T2i / 550D / Kiss X4',
940             0x80000271 => 'WFT-E4',
941             0x80000273 => 'WFT-E5',
942             0x80000281 => 'EOS-1D Mark IV',
943             0x80000285 => 'EOS 5D Mark III',
944             0x80000286 => 'EOS Rebel T3i / 600D / Kiss X5',
945             0x80000287 => 'EOS 60D',
946             0x80000288 => 'EOS Rebel T3 / 1100D / Kiss X50',
947             0x80000289 => 'EOS 7D Mark II', #IB
948             0x80000297 => 'WFT-E2 II',
949             0x80000298 => 'WFT-E4 II',
950             0x80000301 => 'EOS Rebel T4i / 650D / Kiss X6i',
951             0x80000302 => 'EOS 6D', #25
952             0x80000324 => 'EOS-1D C', #(NC)
953             0x80000325 => 'EOS 70D',
954             0x80000326 => 'EOS Rebel T5i / 700D / Kiss X7i',
955             0x80000327 => 'EOS Rebel T5 / 1200D / Kiss X70 / Hi',
956             0x80000328 => 'EOS-1D X Mark II', #42
957             0x80000331 => 'EOS M',
958             0x80000350 => 'EOS 80D', #42
959             0x80000355 => 'EOS M2',
960             0x80000346 => 'EOS Rebel SL1 / 100D / Kiss X7',
961             0x80000347 => 'EOS Rebel T6s / 760D / 8000D',
962             0x80000349 => 'EOS 5D Mark IV', #42
963             0x80000382 => 'EOS 5DS',
964             0x80000393 => 'EOS Rebel T6i / 750D / Kiss X8i',
965             0x80000401 => 'EOS 5DS R',
966             0x80000404 => 'EOS Rebel T6 / 1300D / Kiss X80',
967             0x80000405 => 'EOS Rebel T7i / 800D / Kiss X9i',
968             0x80000406 => 'EOS 6D Mark II', #IB/42
969             0x80000408 => 'EOS 77D / 9000D',
970             0x80000417 => 'EOS Rebel SL2 / 200D / Kiss X9', #IB/42
971             0x80000421 => 'EOS R5', #PH
972             0x80000422 => 'EOS Rebel T100 / 4000D / 3000D', #IB (3000D in China; Kiss? - PH)
973             0x80000424 => 'EOS R', #IB
974             0x80000428 => 'EOS-1D X Mark III', #IB
975             0x80000432 => 'EOS Rebel T7 / 2000D / 1500D / Kiss X90', #IB
976             0x80000433 => 'EOS RP',
977             0x80000435 => 'EOS Rebel T8i / 850D / X10i', #JR/PH
978             0x80000436 => 'EOS SL3 / 250D / Kiss X10', #25
979             0x80000437 => 'EOS 90D', #IB
980             0x80000450 => 'EOS R3', #42
981             0x80000453 => 'EOS R6', #PH
982             0x80000464 => 'EOS R7', #42
983             0x80000465 => 'EOS R10', #42
984             0x80000467 => 'PowerShot ZOOM',
985             0x80000468 => 'EOS M50 Mark II / Kiss M2', #IB
986             0x80000481 => 'EOS R6 Mark II', #42
987             0x80000520 => 'EOS D2000C', #IB
988             0x80000560 => 'EOS D6000C', #PH (guess)
989             );
990              
991             my %canonQuality = (
992             -1 => 'n/a', # (PH, EOS M MOV video)
993             1 => 'Economy',
994             2 => 'Normal',
995             3 => 'Fine',
996             4 => 'RAW',
997             5 => 'Superfine',
998             7 => 'CRAW', #42
999             130 => 'Light (RAW)', #github#119
1000             131 => 'Standard (RAW)', #github#119
1001             );
1002             my %canonImageSize = (
1003             -1 => 'n/a',
1004             0 => 'Large',
1005             1 => 'Medium',
1006             2 => 'Small',
1007             5 => 'Medium 1', #PH
1008             6 => 'Medium 2', #PH
1009             7 => 'Medium 3', #PH
1010             8 => 'Postcard', #PH (SD200 1600x1200 with DateStamp option)
1011             9 => 'Widescreen', #PH (SD900 3648x2048), 22 (HFS200 3264x1840)
1012             10 => 'Medium Widescreen', #22 (HFS200 1920x1080)
1013             14 => 'Small 1', #PH
1014             15 => 'Small 2', #PH
1015             16 => 'Small 3', #PH
1016             128 => '640x480 Movie', #PH (7D 60fps)
1017             129 => 'Medium Movie', #22
1018             130 => 'Small Movie', #22
1019             137 => '1280x720 Movie', #PH (S95 24fps; D60 50fps)
1020             142 => '1920x1080 Movie', #PH (D60 25fps)
1021             143 => '4096x2160 Movie', #PH (C200)
1022             );
1023             my %canonWhiteBalance = (
1024             # -1='Click", -2='Pasted' ?? - PH
1025             0 => 'Auto',
1026             1 => 'Daylight',
1027             2 => 'Cloudy',
1028             3 => 'Tungsten',
1029             4 => 'Fluorescent',
1030             5 => 'Flash',
1031             6 => 'Custom',
1032             7 => 'Black & White',
1033             8 => 'Shade',
1034             9 => 'Manual Temperature (Kelvin)',
1035             10 => 'PC Set1', #PH
1036             11 => 'PC Set2', #PH
1037             12 => 'PC Set3', #PH
1038             14 => 'Daylight Fluorescent', #3
1039             15 => 'Custom 1', #PH
1040             16 => 'Custom 2', #PH
1041             17 => 'Underwater', #3
1042             18 => 'Custom 3', #PH
1043             19 => 'Custom 4', #PH
1044             20 => 'PC Set4', #PH
1045             21 => 'PC Set5', #PH
1046             # 22 - Custom 2?
1047             23 => 'Auto (ambience priority)', #PH (5DS) (perhaps this needs re-thinking?: forum13295)
1048             # 30 - Click White Balance?
1049             # 31 - Shot Settings?
1050             # 137 - Tungsten?
1051             # 138 - White Fluorescent?
1052             # 139 - Fluorescent H?
1053             # 140 - Manual?
1054             );
1055              
1056             # picture styles used by the 5D
1057             # (styles 0x4X may be downloaded from Canon)
1058             # (called "ColorMatrix" in 1D owner manual)
1059             my %pictureStyles = ( #12
1060             0x00 => 'None', #PH
1061             0x01 => 'Standard', #15
1062             0x02 => 'Portrait', #15
1063             0x03 => 'High Saturation', #15
1064             0x04 => 'Adobe RGB', #15
1065             0x05 => 'Low Saturation', #15
1066             0x06 => 'CM Set 1', #PH
1067             0x07 => 'CM Set 2', #PH
1068             # "ColorMatrix" values end here
1069             0x21 => 'User Def. 1',
1070             0x22 => 'User Def. 2',
1071             0x23 => 'User Def. 3',
1072             # "External" styles currently available from Canon are Nostalgia, Clear,
1073             # Twilight and Emerald. The "User Def" styles change to these "External"
1074             # codes when these styles are installed in the camera
1075             0x41 => 'PC 1', #PH
1076             0x42 => 'PC 2', #PH
1077             0x43 => 'PC 3', #PH
1078             0x81 => 'Standard',
1079             0x82 => 'Portrait',
1080             0x83 => 'Landscape',
1081             0x84 => 'Neutral',
1082             0x85 => 'Faithful',
1083             0x86 => 'Monochrome',
1084             0x87 => 'Auto', #PH
1085             0x88 => 'Fine Detail', #PH
1086             0xff => 'n/a', #PH (guess)
1087             0xffff => 'n/a', #PH (guess)
1088             );
1089             my %userDefStyles = ( #12/48
1090             Notes => q{
1091             Base style for user-defined picture styles. PC values represent external
1092             picture styles which may be downloaded from Canon and installed in the
1093             camera.
1094             },
1095             0x41 => 'PC 1',
1096             0x42 => 'PC 2',
1097             0x43 => 'PC 3',
1098             0x81 => 'Standard',
1099             0x82 => 'Portrait',
1100             0x83 => 'Landscape',
1101             0x84 => 'Neutral',
1102             0x85 => 'Faithful',
1103             0x86 => 'Monochrome',
1104             0x87 => 'Auto', #PH
1105             );
1106              
1107             # picture style tag information for CameraInfo550D
1108             my %psConv = (
1109             -559038737 => 'n/a', # = 0xdeadbeef ! LOL
1110             OTHER => sub { shift },
1111             );
1112             my %psInfo = (
1113             Format => 'int32s',
1114             PrintHex => 1,
1115             PrintConv => \%psConv,
1116             );
1117              
1118             # ValueConv that makes long values binary type
1119             my %longBin = (
1120             ValueConv => 'length($val) > 64 ? \$val : $val',
1121             ValueConvInv => '$val',
1122             );
1123              
1124             # conversions, etc for CameraColorCalibration tags
1125             my %cameraColorCalibration = (
1126             Format => 'int16s[4]',
1127             Unknown => 1,
1128             PrintConv => 'sprintf("%4d %4d %4d (%dK)", split(" ",$val))',
1129             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1130             );
1131              
1132             # conversions, etc for PowerShot CameraColorCalibration tags
1133             my %cameraColorCalibration2 = (
1134             Format => 'int16s[5]',
1135             Unknown => 1,
1136             PrintConv => 'sprintf("%4d %4d %4d %4d (%dK)", split(" ",$val))',
1137             PrintConvInv => '$val=~s/\s+/ /g; $val=~tr/()K//d; $val',
1138             );
1139             # conversions, etc for byte-swapped FocusDistance tags
1140             my %focusDistanceByteSwap = (
1141             # this is very odd (little-endian number on odd boundary),
1142             # but it does seem to work better with my sample images - PH
1143             Format => 'int16uRev',
1144             ValueConv => '$val / 100',
1145             ValueConvInv => '$val * 100',
1146             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
1147             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
1148             );
1149              
1150             # common attributes for writable BinaryData directories
1151             my %binaryDataAttrs = (
1152             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
1153             WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
1154             CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
1155             WRITABLE => 1,
1156             );
1157              
1158             my %offOn = ( 0 => 'Off', 1 => 'On' );
1159              
1160             #------------------------------------------------------------------------------
1161             # Canon EXIF Maker Notes
1162             %Image::ExifTool::Canon::Main = (
1163             WRITE_PROC => \&WriteCanon,
1164             CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
1165             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
1166             0x1 => {
1167             Name => 'CanonCameraSettings',
1168             SubDirectory => {
1169             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1170             TagTable => 'Image::ExifTool::Canon::CameraSettings',
1171             },
1172             },
1173             0x2 => {
1174             Name => 'CanonFocalLength',
1175             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalLength' },
1176             },
1177             0x3 => {
1178             Name => 'CanonFlashInfo',
1179             Unknown => 1,
1180             },
1181             0x4 => {
1182             Name => 'CanonShotInfo',
1183             SubDirectory => {
1184             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1185             TagTable => 'Image::ExifTool::Canon::ShotInfo',
1186             },
1187             },
1188             0x5 => {
1189             Name => 'CanonPanorama',
1190             SubDirectory => { TagTable => 'Image::ExifTool::Canon::Panorama' },
1191             },
1192             0x6 => {
1193             Name => 'CanonImageType',
1194             Writable => 'string',
1195             Groups => { 2 => 'Image' },
1196             },
1197             0x7 => {
1198             Name => 'CanonFirmwareVersion',
1199             Writable => 'string',
1200             },
1201             0x8 => {
1202             Name => 'FileNumber',
1203             Writable => 'int32u',
1204             Groups => { 2 => 'Image' },
1205             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
1206             PrintConvInv => '$val=~s/-//g;$val',
1207             },
1208             0x9 => {
1209             Name => 'OwnerName',
1210             Writable => 'string',
1211             # pad to 32 bytes (including null terminator which will be added)
1212             # to avoid bug which crashes DPP if length is 4 bytes
1213             ValueConvInv => '$val .= "\0" x (31 - length $val) if length $val < 31; $val',
1214             },
1215             0xa => {
1216             Name => 'UnknownD30',
1217             SubDirectory => {
1218             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1219             TagTable => 'Image::ExifTool::Canon::UnknownD30',
1220             },
1221             },
1222             0xc => [ # square brackets for a conditional list
1223             {
1224             # D30
1225             Name => 'SerialNumber',
1226             Condition => '$$self{Model} =~ /EOS D30\b/',
1227             Writable => 'int32u',
1228             PrintConv => 'sprintf("%.4x%.5d",$val>>16,$val&0xffff)',
1229             PrintConvInv => '$val=~/(.*)-?(\d{5})$/ ? (hex($1)<<16)+$2 : undef',
1230             },
1231             {
1232             # serial number of 1D/1Ds/1D Mark II/1Ds Mark II is usually
1233             # displayed w/o leeding zeros (ref 7) (1D uses 6 digits - PH)
1234             Name => 'SerialNumber',
1235             Condition => '$$self{Model} =~ /EOS-1D/',
1236             Writable => 'int32u',
1237             PrintConv => 'sprintf("%.6u",$val)',
1238             PrintConvInv => '$val',
1239             },
1240             {
1241             # all other models (D60,300D,350D,REBEL,10D,20D,etc)
1242             Name => 'SerialNumber',
1243             Writable => 'int32u',
1244             PrintConv => 'sprintf("%.10u",$val)',
1245             PrintConvInv => '$val',
1246             },
1247             ],
1248             0xd => [
1249             {
1250             Name => 'CanonCameraInfo1D',
1251             # (save size of this record as "CameraInfoCount" for later tests)
1252             Condition => '($$self{CameraInfoCount} = $count) and $$self{Model} =~ /\b1DS?$/',
1253             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1D' },
1254             },
1255             {
1256             Name => 'CanonCameraInfo1DmkII',
1257             Condition => '$$self{Model} =~ /\b1Ds? Mark II$/',
1258             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkII' },
1259             },
1260             {
1261             Name => 'CanonCameraInfo1DmkIIN',
1262             Condition => '$$self{Model} =~ /\b1Ds? Mark II N$/',
1263             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIIN' },
1264             },
1265             {
1266             Name => 'CanonCameraInfo1DmkIII',
1267             Condition => '$$self{Model} =~ /\b1Ds? Mark III$/',
1268             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIII' },
1269             },
1270             {
1271             Name => 'CanonCameraInfo1DmkIV',
1272             Condition => '$$self{Model} =~ /\b1D Mark IV$/',
1273             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DmkIV' },
1274             },
1275             {
1276             Name => 'CanonCameraInfo1DX',
1277             Condition => '$$self{Model} =~ /EOS-1D X$/',
1278             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1DX' },
1279             },
1280             {
1281             Name => 'CanonCameraInfo5D',
1282             Condition => '$$self{Model} =~ /EOS 5D$/',
1283             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5D' },
1284             },
1285             {
1286             Name => 'CanonCameraInfo5DmkII',
1287             Condition => '$$self{Model} =~ /EOS 5D Mark II$/',
1288             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkII' },
1289             },
1290             {
1291             Name => 'CanonCameraInfo5DmkIII',
1292             Condition => '$$self{Model} =~ /EOS 5D Mark III$/',
1293             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo5DmkIII' },
1294             },
1295             {
1296             Name => 'CanonCameraInfo6D',
1297             Condition => '$$self{Model} =~ /EOS 6D$/',
1298             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo6D' },
1299             },
1300             {
1301             Name => 'CanonCameraInfo7D',
1302             Condition => '$$self{Model} =~ /EOS 7D$/',
1303             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo7D' },
1304             },
1305             {
1306             Name => 'CanonCameraInfo40D',
1307             Condition => '$$self{Model} =~ /EOS 40D$/',
1308             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo40D' },
1309             },
1310             {
1311             Name => 'CanonCameraInfo50D',
1312             Condition => '$$self{Model} =~ /EOS 50D$/',
1313             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo50D' },
1314             },
1315             {
1316             Name => 'CanonCameraInfo60D',
1317             Condition => '$$self{Model} =~ /EOS 60D$/',
1318             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1319             },
1320             {
1321             Name => 'CanonCameraInfo70D',
1322             Condition => '$$self{Model} =~ /EOS 70D$/',
1323             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo70D' },
1324             },
1325             {
1326             Name => 'CanonCameraInfo80D',
1327             Condition => '$$self{Model} =~ /EOS 80D$/',
1328             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo80D' },
1329             },
1330             {
1331             Name => 'CanonCameraInfo450D',
1332             Condition => '$$self{Model} =~ /\b(450D|REBEL XSi|Kiss X2)\b/',
1333             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo450D' },
1334             },
1335             {
1336             Name => 'CanonCameraInfo500D',
1337             Condition => '$$self{Model} =~ /\b(500D|REBEL T1i|Kiss X3)\b/',
1338             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo500D' },
1339             },
1340             {
1341             Name => 'CanonCameraInfo550D',
1342             Condition => '$$self{Model} =~ /\b(550D|REBEL T2i|Kiss X4)\b/',
1343             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo550D' },
1344             },
1345             {
1346             Name => 'CanonCameraInfo600D',
1347             Condition => '$$self{Model} =~ /\b(600D|REBEL T3i|Kiss X5)\b/',
1348             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1349             },
1350             {
1351             Name => 'CanonCameraInfo650D',
1352             Condition => '$$self{Model} =~ /\b(650D|REBEL T4i|Kiss X6i)\b/',
1353             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1354             },
1355             {
1356             Name => 'CanonCameraInfo700D',
1357             Condition => '$$self{Model} =~ /\b(700D|REBEL T5i|Kiss X7i)\b/',
1358             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo650D' },
1359             },
1360             {
1361             Name => 'CanonCameraInfo750D',
1362             Condition => '$$self{Model} =~ /\b(750D|Rebel T6i|Kiss X8i)\b/',
1363             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1364             },
1365             {
1366             Name => 'CanonCameraInfo760D',
1367             Condition => '$$self{Model} =~ /\b(760D|Rebel T6s|8000D)\b/',
1368             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo750D' },
1369             },
1370             {
1371             Name => 'CanonCameraInfo1000D',
1372             Condition => '$$self{Model} =~ /\b(1000D|REBEL XS|Kiss F)\b/',
1373             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo1000D' },
1374             },
1375             {
1376             Name => 'CanonCameraInfo1100D',
1377             Condition => '$$self{Model} =~ /\b(1100D|REBEL T3|Kiss X50)\b/',
1378             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo600D' },
1379             },
1380             {
1381             Name => 'CanonCameraInfo1200D',
1382             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
1383             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfo60D' },
1384             },
1385             {
1386             Name => 'CanonCameraInfoPowerShot',
1387             # valid if format is int32u[138] or int32u[148]
1388             Condition => '$format eq "int32u" and ($count == 138 or $count == 148)',
1389             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot' },
1390             },
1391             {
1392             Name => 'CanonCameraInfoPowerShot2',
1393             # valid if format is int32u[162], int32u[167], int32u[171] or int32u[264]
1394             Condition => q{
1395             $format eq "int32u" and ($count == 156 or $count == 162 or
1396             $count == 167 or $count == 171 or $count == 264)
1397             },
1398             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoPowerShot2' },
1399             },
1400             {
1401             Name => 'CanonCameraInfoUnknown32',
1402             Condition => '$format =~ /^int32/',
1403             # (counts of 72, 85, 86, 93, 94, 96, 104) - PH
1404             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown32' },
1405             },
1406             {
1407             Name => 'CanonCameraInfoUnknown16',
1408             Condition => '$format =~ /^int16/',
1409             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown16' },
1410             },
1411             {
1412             Name => 'CanonCameraInfoUnknown',
1413             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CameraInfoUnknown' },
1414             },
1415             ],
1416             0xe => {
1417             Name => 'CanonFileLength',
1418             Writable => 'int32u',
1419             Groups => { 2 => 'Image' },
1420             },
1421             0xf => [
1422             { # used by 1DmkII, 1DSmkII and 1DmkIIN
1423             Name => 'CustomFunctions1D',
1424             Condition => '$$self{Model} =~ /EOS-1D/',
1425             SubDirectory => {
1426             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1427             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1428             },
1429             },
1430             {
1431             Name => 'CustomFunctions5D',
1432             Condition => '$$self{Model} =~ /EOS 5D/',
1433             SubDirectory => {
1434             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1435             TagTable => 'Image::ExifTool::CanonCustom::Functions5D',
1436             },
1437             },
1438             {
1439             Name => 'CustomFunctions10D',
1440             Condition => '$$self{Model} =~ /EOS 10D/',
1441             SubDirectory => {
1442             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1443             TagTable => 'Image::ExifTool::CanonCustom::Functions10D',
1444             },
1445             },
1446             {
1447             Name => 'CustomFunctions20D',
1448             Condition => '$$self{Model} =~ /EOS 20D/',
1449             SubDirectory => {
1450             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1451             TagTable => 'Image::ExifTool::CanonCustom::Functions20D',
1452             },
1453             },
1454             {
1455             Name => 'CustomFunctions30D',
1456             Condition => '$$self{Model} =~ /EOS 30D/',
1457             SubDirectory => {
1458             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1459             TagTable => 'Image::ExifTool::CanonCustom::Functions30D',
1460             },
1461             },
1462             {
1463             Name => 'CustomFunctions350D',
1464             Condition => '$$self{Model} =~ /\b(350D|REBEL XT|Kiss Digital N)\b/',
1465             SubDirectory => {
1466             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1467             TagTable => 'Image::ExifTool::CanonCustom::Functions350D',
1468             },
1469             },
1470             {
1471             Name => 'CustomFunctions400D',
1472             Condition => '$$self{Model} =~ /\b(400D|REBEL XTi|Kiss Digital X|K236)\b/',
1473             SubDirectory => {
1474             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1475             TagTable => 'Image::ExifTool::CanonCustom::Functions400D',
1476             },
1477             },
1478             {
1479             Name => 'CustomFunctionsD30',
1480             Condition => '$$self{Model} =~ /EOS D30\b/',
1481             SubDirectory => {
1482             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1483             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1484             },
1485             },
1486             {
1487             Name => 'CustomFunctionsD60',
1488             Condition => '$$self{Model} =~ /EOS D60\b/',
1489             SubDirectory => {
1490             # the stored size in the D60 apparently doesn't include the size word:
1491             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size-2,$size)',
1492             # (D60 custom functions are basically the same as D30)
1493             TagTable => 'Image::ExifTool::CanonCustom::FunctionsD30',
1494             },
1495             },
1496             {
1497             Name => 'CustomFunctionsUnknown',
1498             SubDirectory => {
1499             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1500             TagTable => 'Image::ExifTool::CanonCustom::FuncsUnknown',
1501             },
1502             },
1503             ],
1504             0x10 => { #PH
1505             Name => 'CanonModelID',
1506             Writable => 'int32u',
1507             PrintHex => 1,
1508             SeparateTable => 1,
1509             PrintConv => \%canonModelID,
1510             },
1511             0x11 => { #PH
1512             Name => 'MovieInfo',
1513             SubDirectory => {
1514             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1515             TagTable => 'Image::ExifTool::Canon::MovieInfo',
1516             },
1517             },
1518             0x12 => {
1519             Name => 'CanonAFInfo',
1520             # not really a condition -- just need to store the count for later
1521             Condition => '$$self{AFInfoCount} = $count',
1522             SubDirectory => {
1523             # this record does not begin with a length word, so it
1524             # has to be validated differently
1525             Validate => 'Image::ExifTool::Canon::ValidateAFInfo($dirData,$subdirStart,$size)',
1526             TagTable => 'Image::ExifTool::Canon::AFInfo',
1527             },
1528             },
1529             0x13 => { #PH
1530             Name => 'ThumbnailImageValidArea',
1531             # left,right,top,bottom edges of image in thumbnail, or all zeros for full frame
1532             Notes => 'all zeros for full frame',
1533             Writable => 'int16u',
1534             Count => 4,
1535             },
1536             0x15 => { #PH
1537             # display format for serial number
1538             Name => 'SerialNumberFormat',
1539             Writable => 'int32u',
1540             PrintHex => 1,
1541             PrintConv => {
1542             0x90000000 => 'Format 1',
1543             0xa0000000 => 'Format 2',
1544             },
1545             },
1546             0x1a => { #15
1547             Name => 'SuperMacro',
1548             Writable => 'int16u',
1549             PrintConv => {
1550             0 => 'Off',
1551             1 => 'On (1)',
1552             2 => 'On (2)',
1553             },
1554             },
1555             0x1c => { #PH (A570IS)
1556             Name => 'DateStampMode',
1557             Writable => 'int16u',
1558             Notes => 'used only in postcard mode',
1559             PrintConv => {
1560             0 => 'Off',
1561             1 => 'Date',
1562             2 => 'Date & Time',
1563             },
1564             },
1565             0x1d => { #PH
1566             Name => 'MyColors',
1567             SubDirectory => {
1568             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1569             TagTable => 'Image::ExifTool::Canon::MyColors',
1570             },
1571             },
1572             0x1e => { #PH
1573             Name => 'FirmwareRevision',
1574             Writable => 'int32u',
1575             # as a hex number: 0xAVVVRR00, where (a bit of guessing here...)
1576             # A = 'a' for alpha, 'b' for beta?
1577             # V = version? (100,101 for normal releases, 100,110,120,130,170 for alpha/beta)
1578             # R = revision? (01-07, except 00 for alpha/beta releases)
1579             PrintConv => q{
1580             my $rev = sprintf("%.8x", $val);
1581             my ($rel, $v1, $v2, $r1, $r2) = ($rev =~ /^(.)(.)(..)0?(.+)(..)$/);
1582             my %r = ( a => 'Alpha ', b => 'Beta ', '0' => '' );
1583             $rel = defined $r{$rel} ? $r{$rel} : "Unknown($rel) ";
1584             return "$rel$v1.$v2 rev $r1.$r2",
1585             },
1586             PrintConvInv => q{
1587             $_=$val; s/Alpha ?/a/i; s/Beta ?/b/i;
1588             s/Unknown ?\((.)\)/$1/i; s/ ?rev ?(.)\./0$1/; s/ ?rev ?//;
1589             tr/a-fA-F0-9//dc; return hex $_;
1590             },
1591             },
1592             # 0x1f - used for red-eye-corrected images - PH (A570IS)
1593             # 0x22 - values 1 and 2 are 2 and 1 for flash pics, 0 otherwise - PH (A570IS)
1594             0x23 => { #31
1595             Name => 'Categories',
1596             Writable => 'int32u',
1597             Format => 'int32u', # (necessary to perform conversion for Condition)
1598             Notes => '2 values: 1. always 8, 2. Categories',
1599             Count => '2',
1600             Condition => '$$valPt =~ /^\x08\0\0\0/',
1601             ValueConv => '$val =~ s/^8 //; $val',
1602             ValueConvInv => '"8 $val"',
1603             PrintConvColumns => 2,
1604             PrintConv => {
1605             0 => '(none)',
1606             BITMASK => {
1607             0 => 'People',
1608             1 => 'Scenery',
1609             2 => 'Events',
1610             3 => 'User 1',
1611             4 => 'User 2',
1612             5 => 'User 3',
1613             6 => 'To Do',
1614             },
1615             },
1616             },
1617             0x24 => { #PH
1618             Name => 'FaceDetect1',
1619             SubDirectory => {
1620             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1621             TagTable => 'Image::ExifTool::Canon::FaceDetect1',
1622             },
1623             },
1624             0x25 => { #PH
1625             Name => 'FaceDetect2',
1626             SubDirectory => {
1627             TagTable => 'Image::ExifTool::Canon::FaceDetect2',
1628             # (can't validate because this record uses a 1-byte count instead of a 2-byte count)
1629             },
1630             },
1631             0x26 => { #PH (A570IS,1DmkIII)
1632             Name => 'CanonAFInfo2',
1633             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros in thumbnail of 60D MOV video)
1634             SubDirectory => {
1635             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1636             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1637             },
1638             },
1639             0x27 => { #PH
1640             Name => 'ContrastInfo',
1641             Condition => '$$valPt =~ /^\x0a\0/', # (seems to be various versions of this information)
1642             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ContrastInfo' },
1643             },
1644             # 0x27 - value 1 is 1 for high ISO pictures, 0 otherwise
1645             # value 4 is 9 for Flexizone and FaceDetect AF, 1 for Centre AF, 0 otherwise (SX10IS)
1646             0x28 => { #JD
1647             # bytes 0-1=sequence number (encrypted), 2-5=date/time (encrypted) (ref JD)
1648             Name => 'ImageUniqueID',
1649             Format => 'undef',
1650             Writable => 'int8u',
1651             Groups => { 2 => 'Image' },
1652             RawConv => '$val eq "\0" x 16 ? undef : $val',
1653             ValueConv => 'unpack("H*", $val)',
1654             ValueConvInv => 'pack("H*", $val)',
1655             },
1656             0x29 => { #IB (G9)
1657             Name => 'WBInfo',
1658             SubDirectory => { TagTable => 'Image::ExifTool::Canon::WBInfo' },
1659             },
1660             # 0x2d - changes with categories (ref 31)
1661             0x2f => { #PH (G12)
1662             Name => 'FaceDetect3',
1663             SubDirectory => {
1664             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1665             TagTable => 'Image::ExifTool::Canon::FaceDetect3',
1666             },
1667             },
1668             # 0x32 - if length is 768, starting at offset 4 there are 6 RGGB 1/val int16 records:
1669             # daylight,cloudy,tungsten,fluorescent,flash,kelvin (D30 2001, ref IB)
1670             0x35 => { #PH
1671             Name => 'TimeInfo',
1672             SubDirectory => {
1673             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1674             TagTable => 'Image::ExifTool::Canon::TimeInfo',
1675             },
1676             },
1677             0x38 => { #PH
1678             Name => 'BatteryType',
1679             Writable => 'undef',
1680             Condition => '$count == 76',
1681             RawConv => '$val=~/^.{4}([^\0]+)/s ? $1 : undef',
1682             RawConvInv => 'substr("\x4c\0\0\0".$val.("\0"x72), 0, 76)',
1683             },
1684             0x3c => { #PH (G1XmkII)
1685             Name => 'AFInfo3',
1686             Condition => '$$self{AFInfo3} = 1',
1687             SubDirectory => {
1688             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1689             TagTable => 'Image::ExifTool::Canon::AFInfo2',
1690             },
1691             },
1692             # 0x44 (ShootInfo)
1693             # 0x62 (UserSetting)
1694             0x81 => { #13
1695             Name => 'RawDataOffset',
1696             # (can't yet write 1D raw files)
1697             # Writable => 'int32u',
1698             # Protected => 2,
1699             },
1700             0x83 => { #PH
1701             Name => 'OriginalDecisionDataOffset',
1702             Writable => 'int32u',
1703             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1704             # this is an offset to the original decision data block
1705             # (offset relative to start of file in JPEG images, but NOT DNG images!)
1706             IsOffset => '$val and $$et{FILE_TYPE} ne "JPEG"',
1707             Protected => 2,
1708             DataTag => 'OriginalDecisionData',
1709             },
1710             0x90 => { # used by 1D and 1Ds
1711             Name => 'CustomFunctions1D',
1712             SubDirectory => {
1713             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1714             TagTable => 'Image::ExifTool::CanonCustom::Functions1D',
1715             },
1716             },
1717             0x91 => { #PH
1718             Name => 'PersonalFunctions',
1719             SubDirectory => {
1720             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1721             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncs',
1722             },
1723             },
1724             0x92 => { #PH
1725             Name => 'PersonalFunctionValues',
1726             SubDirectory => {
1727             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1728             TagTable => 'Image::ExifTool::CanonCustom::PersonalFuncValues',
1729             },
1730             },
1731             0x93 => {
1732             Name => 'CanonFileInfo', # (ShootInfoEx)
1733             SubDirectory => {
1734             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1735             TagTable => 'Image::ExifTool::Canon::FileInfo',
1736             },
1737             },
1738             0x94 => { #PH
1739             # AF points for 1D (45 points in 5 rows)
1740             Name => 'AFPointsInFocus1D',
1741             Notes => 'EOS 1D -- 5 rows: A1-7, B1-10, C1-11, D1-10, E1-7, center point is C6',
1742             PrintConv => 'Image::ExifTool::Canon::PrintAFPoints1D($val)',
1743             },
1744             0x95 => { #PH (observed in 5D sample image)
1745             Name => 'LensModel', # (LensName)
1746             Writable => 'string',
1747             },
1748             0x96 => [ #PH (CMOSNumber)
1749             {
1750             Name => 'SerialInfo',
1751             Condition => '$$self{Model} =~ /EOS 5D/',
1752             SubDirectory => { TagTable => 'Image::ExifTool::Canon::SerialInfo' },
1753             },
1754             {
1755             Name => 'InternalSerialNumber',
1756             Writable => 'string',
1757             # remove trailing 0xff's if they exist (Kiss X3)
1758             ValueConv => '$val=~s/\xff+$//; $val',
1759             ValueConvInv => '$val',
1760             },
1761             ],
1762             0x97 => { #PH (also see http://www.freepatentsonline.com/7657116.html)
1763             Name => 'DustRemovalData', # (DustDeleteData)
1764             Writable => 'undef',
1765             Flags => [ 'Binary', 'Protected' ],
1766             # 0x00: int8u - Version (0 or 1)
1767             # 0x01: int8u - LensInfo ? (1)
1768             # 0x02: int8u - AVValue ? (int8u for version 0, int16u for version 1)
1769             # 0x03: int8u - POValue ? (int8u for version 0, int16u for version 1)
1770             # 0x04: int16u - DustCount
1771             # 0x06: int16u - FocalLength ?
1772             # 0x08: int16u - LensID ?
1773             # 0x0a: int16u - Width
1774             # 0x0c: int16u - Height
1775             # 0x0e: int16u - RAW_Width
1776             # 0x10: int16u - RAW_Height
1777             # 0x12: int16u - PixelPitch [um * 1000]
1778             # 0x14: int16u - LpfDistance [mm * 1000]
1779             # 0x16: int8u - TopOffset
1780             # 0x17: int8u - BottomOffset
1781             # 0x18: int8u - LeftOffset
1782             # 0x19: int8u - RightOffset
1783             # 0x1a: int8u - Year [-1900]
1784             # 0x1b: int8u - Month
1785             # 0x1c: int8u - Day
1786             # 0x1d: int8u - Hour
1787             # 0x1e: int8u - Minutes
1788             # 0x1f: int8u - BrightDiff
1789             # Table with DustCount entries:
1790             # 0x22: int16u - DustX
1791             # 0x24: int16u - DustY
1792             # 0x26: int16u - DustSize
1793             },
1794             0x98 => { #PH
1795             Name => 'CropInfo', # (ImageSizeOffset)
1796             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CropInfo' },
1797             },
1798             0x99 => { #PH (EOS 1D Mark III, 40D, etc)
1799             Name => 'CustomFunctions2', # (CustomFunEx)
1800             SubDirectory => {
1801             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1802             TagTable => 'Image::ExifTool::CanonCustom::Functions2',
1803             },
1804             },
1805             0x9a => { #PH
1806             Name => 'AspectInfo', # (AspectRatioInfo)
1807             SubDirectory => { TagTable => 'Image::ExifTool::Canon::AspectInfo' },
1808             },
1809             0xa0 => {
1810             Name => 'ProcessingInfo', # (DevelopParam)
1811             SubDirectory => {
1812             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1813             TagTable => 'Image::ExifTool::Canon::Processing',
1814             },
1815             },
1816             0xa1 => { Name => 'ToneCurveTable', %longBin }, #PH
1817             0xa2 => { Name => 'SharpnessTable', %longBin }, #PH
1818             0xa3 => { Name => 'SharpnessFreqTable', %longBin }, #PH
1819             0xa4 => { Name => 'WhiteBalanceTable', %longBin }, #PH
1820             0xa9 => {
1821             Name => 'ColorBalance',
1822             SubDirectory => {
1823             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1824             TagTable => 'Image::ExifTool::Canon::ColorBalance',
1825             },
1826             },
1827             0xaa => {
1828             Name => 'MeasuredColor', # (PresetWBDS)
1829             SubDirectory => {
1830             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1831             TagTable => 'Image::ExifTool::Canon::MeasuredColor',
1832             },
1833             },
1834             0xae => {
1835             Name => 'ColorTemperature',
1836             Writable => 'int16u',
1837             },
1838             0xb0 => { #PH
1839             Name => 'CanonFlags',
1840             SubDirectory => {
1841             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1842             TagTable => 'Image::ExifTool::Canon::Flags',
1843             },
1844             },
1845             0xb1 => { #PH
1846             Name => 'ModifiedInfo',
1847             SubDirectory => {
1848             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1849             TagTable => 'Image::ExifTool::Canon::ModifiedInfo',
1850             },
1851             },
1852             0xb2 => { Name => 'ToneCurveMatching', %longBin }, #PH
1853             0xb3 => { Name => 'WhiteBalanceMatching', %longBin }, #PH
1854             0xb4 => { #PH
1855             Name => 'ColorSpace',
1856             Writable => 'int16u',
1857             PrintConv => {
1858             1 => 'sRGB',
1859             2 => 'Adobe RGB',
1860             65535 => 'n/a',
1861             },
1862             },
1863             0xb6 => {
1864             Name => 'PreviewImageInfo',
1865             SubDirectory => {
1866             # Note: the first word of this block gives the correct block size in bytes, but
1867             # the size is wrong by a factor of 2 in the IFD, so we must account for this
1868             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size/2)',
1869             TagTable => 'Image::ExifTool::Canon::PreviewImageInfo',
1870             },
1871             },
1872             0xd0 => { #PH
1873             Name => 'VRDOffset',
1874             Writable => 'int32u',
1875             OffsetPair => 1, # (just used as a flag, since this tag has no pair)
1876             Protected => 2,
1877             DataTag => 'CanonVRD',
1878             Notes => 'offset of VRD "recipe data" if it exists',
1879             },
1880             0xe0 => { #12
1881             Name => 'SensorInfo', # (ImageAreaDesc)
1882             SubDirectory => {
1883             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
1884             TagTable => 'Image::ExifTool::Canon::SensorInfo',
1885             },
1886             },
1887             0x4001 => [ #13 (WBPacket)
1888             { # (int16u[582]) - 20D and 350D
1889             Condition => '$count == 582',
1890             Name => 'ColorData1',
1891             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData1' },
1892             },
1893             { # (int16u[653]) - 1DmkII and 1DSmkII
1894             Condition => '$count == 653',
1895             Name => 'ColorData2',
1896             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData2' },
1897             },
1898             { # (int16u[796]) - 1DmkIIN, 5D, 30D, 400D
1899             Condition => '$count == 796',
1900             Name => 'ColorData3',
1901             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData3' },
1902             },
1903             { # (int16u[692|674|702|1227|1250|1251|1337])
1904             # 40D (692), 1DmkIII (674), 1DSmkIII (702), 450D/1000D (1227)
1905             # 50D/5DmkII (1250), 500D/7D_pre-prod/1DmkIV_pre-prod (1251),
1906             # 1DmkIV/7D/550D_pre-prod (1337), 550D (1338), 60D/1100D (1346)
1907             Condition => q{
1908             $count == 692 or $count == 674 or $count == 702 or
1909             $count == 1227 or $count == 1250 or $count == 1251 or
1910             $count == 1337 or $count == 1338 or $count == 1346
1911             },
1912             Name => 'ColorData4',
1913             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData4' },
1914             },
1915             { # (int16u[5120]) - G10, G7X
1916             Condition => '$count == 5120',
1917             Name => 'ColorData5',
1918             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData5' },
1919             },
1920             { # (int16u[1273|1275]) - 600D (1273), 1200D (1275)
1921             Condition => '$count == 1273 or $count == 1275',
1922             Name => 'ColorData6',
1923             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData6' },
1924             },
1925             { # (int16u[1312|1313|1316])
1926             # 1DX/5DmkIII/650D/700D/M (1312), 6D/70D/100D (1313),
1927             # 1DX firmware 1.x (1316), 7DmkII (1506)
1928             Condition => '$count == 1312 or $count == 1313 or $count == 1316 or
1929             $count == 1506',
1930             Name => 'ColorData7',
1931             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData7' },
1932             },
1933             { # (int16u[1560|1592]) - 5DS/5DSR (1560), 80D (1592), 1300D (1353) ref IB
1934             Condition => '$count == 1560 or $count == 1592 or $count == 1353 or $count == 1602',
1935             Name => 'ColorData8',
1936             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData8' },
1937             },
1938             { # (int16u[1816|1820|1824]) - M50 (1820) ref PH, EOS R (1824), EOS RP, SX70 (1816) ref IB
1939             Condition => '$count == 1816 or $count == 1820 or $count == 1824',
1940             Name => 'ColorData9',
1941             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData9' },
1942             },
1943             { # (int16u[2024|3656]) - 1DXmkIII (2024) ref IB, R5/R6 (3656) ref PH
1944             Condition => '$count == 2024 or $count == 3656',
1945             Name => 'ColorData10',
1946             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData10' },
1947             },
1948             { # (int16u[3973]) - R3 ref IB
1949             Condition => '$count == 3973 or $count == 3778',
1950             Name => 'ColorData11',
1951             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorData11' },
1952             },
1953             {
1954             Name => 'ColorDataUnknown',
1955             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorDataUnknown' },
1956             },
1957             ],
1958             0x4002 => { #PH
1959             # unknown data block in some JPEG and CR2 images
1960             # (5kB for most models, but 22kb for 5D and 30D, and 43kB for 5DmkII so Drop it)
1961             Name => 'CRWParam',
1962             Format => 'undef',
1963             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1964             },
1965             0x4003 => { #PH
1966             Name => 'ColorInfo',
1967             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorInfo' },
1968             },
1969             0x4005 => { #PH
1970             Name => 'Flavor',
1971             Notes => 'unknown 49kB block, not copied to JPEG images',
1972             # 'Drop' because not found in JPEG images (too large for APP1 anyway)
1973             Flags => [ 'Unknown', 'Binary', 'Drop' ],
1974             },
1975             0x4008 => { #53
1976             Name => 'PictureStyleUserDef', # (BasePictStyleOfUser)
1977             Writable => 'int16u',
1978             Count => 3, # UserDef1, UserDef2, UserDef3
1979             PrintHex => 1,
1980             SeparateTable => 'PictureStyle',
1981             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1982             },
1983             0x4009 => { #53
1984             Name => 'PictureStylePC', # (BasePictStyleOfUser)
1985             Writable => 'int16u',
1986             Count => 3, # PC1, PC2, PC3
1987             PrintHex => 1,
1988             SeparateTable => 'PictureStyle',
1989             PrintConv => [\%pictureStyles,\%pictureStyles,\%pictureStyles],
1990             },
1991             0x4010 => { #forum2933
1992             Name => 'CustomPictureStyleFileName', # (PictStyleCaption)
1993             Writable => 'string',
1994             },
1995             # 0x4011 (PictStyleAppendInfo)
1996             # 0x4012 (CustomWBCaption)
1997             0x4013 => { #PH
1998             Name => 'AFMicroAdj', # (AFMicroAdjust)
1999             SubDirectory => {
2000             # Canon DPP 3.13 is known to truncate this data to 0x14 bytes (from 0x2c),
2001             # so specifically check for 0x2c to avoid giving a warning in this case
2002             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size,0x2c)',
2003             TagTable => 'Image::ExifTool::Canon::AFMicroAdj',
2004             },
2005             },
2006             # 0x4014 (similar to 0x83?)
2007             0x4015 => [{
2008             Name => 'VignettingCorr', # (LensPacket)
2009             Condition => '$$valPt =~ /^\0/ and $$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2010             SubDirectory => {
2011             # (the size word is at byte 2 in this structure)
2012             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2013             TagTable => 'Image::ExifTool::Canon::VignettingCorr',
2014             },
2015             },{
2016             Name => 'VignettingCorrUnknown1',
2017             Condition => '$$valPt =~ /^[\x01\x02\x10\x20]/ and $$valPt !~ /^\0\0\0\0/',
2018             SubDirectory => {
2019             # (the size word is at byte 2 in this structure)
2020             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+2,$size)',
2021             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2022             },
2023             },{
2024             Name => 'VignettingCorrUnknown2',
2025             Condition => '$$valPt !~ /^\0\0\0\0/',
2026             SubDirectory => {
2027             # (the size word is at byte 4 for version 3 of this structure, but not always!)
2028             # Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart+4,$size)',
2029             TagTable => 'Image::ExifTool::Canon::VignettingCorrUnknown',
2030             },
2031             }],
2032             0x4016 => {
2033             Name => 'VignettingCorr2', # (ImageCorrectActual)
2034             SubDirectory => {
2035             # (the size word is actually 4 bytes, but it doesn't matter if little-endian)
2036             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2037             TagTable => 'Image::ExifTool::Canon::VignettingCorr2',
2038             },
2039             },
2040             0x4018 => { #PH
2041             Name => 'LightingOpt', # (ImageCorrect)
2042             SubDirectory => {
2043             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2044             TagTable => 'Image::ExifTool::Canon::LightingOpt',
2045             }
2046             },
2047             0x4019 => { #20
2048             Name => 'LensInfo', # (LensInfoForService)
2049             SubDirectory => {
2050             TagTable => 'Image::ExifTool::Canon::LensInfo',
2051             }
2052             },
2053             0x4020 => { #PH
2054             Name => 'AmbienceInfo',
2055             Condition => '$$valPt !~ /^\0\0\0\0/', # (data may be all zeros for 60D)
2056             SubDirectory => {
2057             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2058             TagTable => 'Image::ExifTool::Canon::Ambience',
2059             }
2060             },
2061             0x4021 => { #PH
2062             Name => 'MultiExp', # (ExifDSTagMultipleExposure)
2063             SubDirectory => {
2064             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2065             TagTable => 'Image::ExifTool::Canon::MultiExp',
2066             }
2067             },
2068             0x4024 => { #PH
2069             Name => 'FilterInfo',
2070             SubDirectory => {
2071             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2072             TagTable => 'Image::ExifTool::Canon::FilterInfo',
2073             }
2074             },
2075             0x4025 => { #PH
2076             Name => 'HDRInfo', # (HighDynamicRange)
2077             SubDirectory => {
2078             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2079             TagTable => 'Image::ExifTool::Canon::HDRInfo',
2080             }
2081             },
2082             0x4026 => { #github#119
2083             Name => 'LogInfo',
2084             SubDirectory => {
2085             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2086             TagTable => 'Image::ExifTool::Canon::LogInfo',
2087             }
2088             },
2089             0x4028 => { #PH
2090             Name => 'AFConfig', # (AFTabInfo)
2091             SubDirectory => {
2092             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2093             TagTable => 'Image::ExifTool::Canon::AFConfig',
2094             }
2095             },
2096             0x403f => { #25
2097             Name => 'RawBurstModeRoll',
2098             SubDirectory => {
2099             Validate => 'Image::ExifTool::Canon::Validate($dirData,$subdirStart,$size)',
2100             TagTable => 'Image::ExifTool::Canon::RawBurstInfo',
2101             }
2102             },
2103             );
2104              
2105             #..............................................................................
2106             # Canon camera settings (MakerNotes tag 0x01)
2107             # BinaryData (keys are indices into the int16s array)
2108             %Image::ExifTool::Canon::CameraSettings = (
2109             %binaryDataAttrs,
2110             FORMAT => 'int16s',
2111             FIRST_ENTRY => 1,
2112             DATAMEMBER => [ 22, 25 ], # necessary for writing
2113             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2114             1 => {
2115             Name => 'MacroMode',
2116             PrintConv => {
2117             1 => 'Macro',
2118             2 => 'Normal',
2119             },
2120             },
2121             2 => {
2122             Name => 'SelfTimer',
2123             # Custom timer mode if bit 0x4000 is set - PH (A570IS)
2124             PrintConv => q{
2125             return 'Off' unless $val;
2126             return (($val&0xfff) / 10) . ' s' . ($val & 0x4000 ? ', Custom' : '');
2127             },
2128             PrintConvInv => q{
2129             return 0 if $val =~ /^Off/i;
2130             $val =~ s/\s*s(ec)?\b//i;
2131             $val =~ s/,?\s*Custom$//i ? ($val*10) | 0x4000 : $val*10;
2132             },
2133             },
2134             3 => {
2135             Name => 'Quality',
2136             PrintConv => \%canonQuality,
2137             },
2138             4 => {
2139             Name => 'CanonFlashMode',
2140             PrintConv => {
2141             -1 => 'n/a', # (PH, EOS M MOV video)
2142             0 => 'Off',
2143             1 => 'Auto',
2144             2 => 'On',
2145             3 => 'Red-eye reduction',
2146             4 => 'Slow-sync',
2147             5 => 'Red-eye reduction (Auto)',
2148             6 => 'Red-eye reduction (On)',
2149             16 => 'External flash', # not set in D30 or 300D
2150             },
2151             },
2152             5 => {
2153             Name => 'ContinuousDrive',
2154             PrintConv => {
2155             0 => 'Single',
2156             1 => 'Continuous',
2157             2 => 'Movie', #PH
2158             3 => 'Continuous, Speed Priority', #PH
2159             4 => 'Continuous, Low', #PH
2160             5 => 'Continuous, High', #PH
2161             6 => 'Silent Single', #PH
2162             8 => 'Continuous, High+', #WolfgangGulcker
2163             # ref A: https://exiftool.org/forum/index.php/topic,5701.msg27843.html#msg27843
2164             9 => 'Single, Silent', #A
2165             10 => 'Continuous, Silent', #A
2166             # 11 - seen for SX260
2167             # 32-34 - Self-timer?
2168             },
2169             },
2170             7 => {
2171             Name => 'FocusMode',
2172             PrintConv => {
2173             0 => 'One-shot AF',
2174             1 => 'AI Servo AF',
2175             2 => 'AI Focus AF',
2176             3 => 'Manual Focus (3)',
2177             4 => 'Single',
2178             5 => 'Continuous',
2179             6 => 'Manual Focus (6)',
2180             16 => 'Pan Focus', #PH
2181             # 137 - Single?
2182             256 => 'AF + MF', #PH (NC, EOS M)
2183             257 => 'Live View', #forum12082
2184             512 => 'Movie Snap Focus', #48
2185             519 => 'Movie Servo AF', #PH (NC, EOS M)
2186             },
2187             },
2188             9 => { #PH
2189             Name => 'RecordMode',
2190             RawConv => '$val==-1 ? undef : $val', #22
2191             PrintConv => {
2192             1 => 'JPEG',
2193             2 => 'CRW+THM', # (300D,etc)
2194             3 => 'AVI+THM', # (30D)
2195             4 => 'TIF', # +THM? (1Ds) (unconfirmed)
2196             5 => 'TIF+JPEG', # (1D) (unconfirmed)
2197             6 => 'CR2', # +THM? (1D,30D,350D)
2198             7 => 'CR2+JPEG', # (S30)
2199             9 => 'MOV', # (S95 MOV)
2200             10 => 'MP4', # (SX280 MP4)
2201             11 => 'CRM', #PH (C200 CRM)
2202             12 => 'CR3', #PH (EOS R)
2203             13 => 'CR3+JPEG', #PH (EOS R)
2204             14 => 'HIF', #PH (NC)
2205             15 => 'CR3+HIF', #PH (1DXmkIII)
2206             },
2207             },
2208             10 => {
2209             Name => 'CanonImageSize',
2210             PrintConvColumns => 2,
2211             PrintConv => \%canonImageSize,
2212             },
2213             11 => {
2214             Name => 'EasyMode',
2215             PrintConvColumns => 3,
2216             PrintConv => {
2217             # references:
2218             # A = http://homepage3.nifty.com/kamisaka/makernote/makernote_canon.htm
2219             # B = http://www.burren.cx/david/canon.html
2220             # C = DPP 3.11.26
2221             0 => 'Full auto',
2222             1 => 'Manual',
2223             2 => 'Landscape',
2224             3 => 'Fast shutter',
2225             4 => 'Slow shutter',
2226             5 => 'Night', # (C='Night Scene')
2227             6 => 'Gray Scale', #PH (A/B/C='Black & White')
2228             7 => 'Sepia',
2229             8 => 'Portrait',
2230             9 => 'Sports',
2231             10 => 'Macro',
2232             11 => 'Black & White', #PH (A='Black & White', B/C='Pan focus')
2233             12 => 'Pan focus', # (A='Pan focus', C='Vivid')
2234             13 => 'Vivid', #PH (A='Vivid', C='Neutral')
2235             14 => 'Neutral', #PH (A='Natural', C='Black & White')
2236             15 => 'Flash Off', #8 (C=)
2237             16 => 'Long Shutter', #PH
2238             17 => 'Super Macro', #PH (C='Macro')
2239             18 => 'Foliage', #PH
2240             19 => 'Indoor', #PH
2241             20 => 'Fireworks', #PH
2242             21 => 'Beach', #PH
2243             22 => 'Underwater', #PH
2244             23 => 'Snow', #PH
2245             24 => 'Kids & Pets', #PH
2246             25 => 'Night Snapshot', #PH
2247             26 => 'Digital Macro', #PH
2248             27 => 'My Colors', #PH
2249             28 => 'Movie Snap', #PH
2250             29 => 'Super Macro 2', #PH
2251             30 => 'Color Accent', #18
2252             31 => 'Color Swap', #18
2253             32 => 'Aquarium', #18
2254             33 => 'ISO 3200', #18
2255             34 => 'ISO 6400', #PH
2256             35 => 'Creative Light Effect', #PH
2257             36 => 'Easy', #PH
2258             37 => 'Quick Shot', #PH
2259             38 => 'Creative Auto', #39
2260             39 => 'Zoom Blur', #PH
2261             40 => 'Low Light', #PH
2262             41 => 'Nostalgic', #PH
2263             42 => 'Super Vivid', #PH (SD4500)
2264             43 => 'Poster Effect', #PH (SD4500)
2265             44 => 'Face Self-timer', #PH
2266             45 => 'Smile', #PH
2267             46 => 'Wink Self-timer', #PH
2268             47 => 'Fisheye Effect', #PH (SX30IS,IXUS240)
2269             48 => 'Miniature Effect', #PH (SD4500)
2270             49 => 'High-speed Burst', #PH
2271             50 => 'Best Image Selection', #PH
2272             51 => 'High Dynamic Range', #PH (S95)
2273             52 => 'Handheld Night Scene', #PH
2274             53 => 'Movie Digest', #PH
2275             54 => 'Live View Control', #PH
2276             55 => 'Discreet', #PH
2277             56 => 'Blur Reduction', #PH
2278             57 => 'Monochrome', #PH (SX260 B&W,Sepia,Blue tone)
2279             58 => 'Toy Camera Effect', #51
2280             59 => 'Scene Intelligent Auto', #PH (T3i) (C='High-speed Burst HQ' !!)
2281             60 => 'High-speed Burst HQ', #PH (C='High-speed Burst HQ', same as 59)
2282             61 => 'Smooth Skin', #51
2283             62 => 'Soft Focus', #PH (SX260,IXUS240)
2284             68 => 'Food', #PH (250D)
2285             # 83 - seen for EOS M200 (ref PH)
2286             84 => 'HDR Art Standard', #PH (80D)
2287             85 => 'HDR Art Vivid', #PH (80D)
2288             93 => 'HDR Art Bold', #PH (80D)
2289             # 83 - seen for EOS M3 night shot (PH)
2290             257 => 'Spotlight', #PH
2291             258 => 'Night 2', #PH
2292             259 => 'Night+',
2293             260 => 'Super Night', #PH
2294             261 => 'Sunset', #PH (SX10IS)
2295             263 => 'Night Scene', #PH
2296             264 => 'Surface', #PH
2297             265 => 'Low Light 2', #PH
2298             },
2299             },
2300             12 => {
2301             Name => 'DigitalZoom',
2302             PrintConv => {
2303             0 => 'None',
2304             1 => '2x',
2305             2 => '4x',
2306             3 => 'Other', # value obtained from 2*$val[37]/$val[36]
2307             },
2308             },
2309             13 => {
2310             Name => 'Contrast',
2311             RawConv => '$val == 0x7fff ? undef : $val',
2312             %Image::ExifTool::Exif::printParameter,
2313             },
2314             14 => {
2315             Name => 'Saturation',
2316             RawConv => '$val == 0x7fff ? undef : $val',
2317             %Image::ExifTool::Exif::printParameter,
2318             },
2319             15 => {
2320             Name => 'Sharpness',
2321             RawConv => '$val == 0x7fff ? undef : $val',
2322             Notes => q{
2323             some models use a range of -2 to +2 where 0 is normal sharpening, and
2324             others use a range of 0 to 7 where 0 is no sharpening
2325             },
2326             PrintConv => '$val > 0 ? "+$val" : $val',
2327             PrintConvInv => '$val',
2328             },
2329             16 => {
2330             Name => 'CameraISO',
2331             RawConv => '$val == 0x7fff ? undef : $val',
2332             ValueConv => 'Image::ExifTool::Canon::CameraISO($val)',
2333             ValueConvInv => 'Image::ExifTool::Canon::CameraISO($val,1)',
2334             },
2335             17 => {
2336             Name => 'MeteringMode',
2337             PrintConv => {
2338             0 => 'Default', # older Ixus
2339             1 => 'Spot',
2340             2 => 'Average', #PH
2341             3 => 'Evaluative',
2342             4 => 'Partial',
2343             5 => 'Center-weighted average',
2344             },
2345             },
2346             18 => {
2347             # this is always 2 for the 300D - PH
2348             Name => 'FocusRange',
2349             PrintConv => {
2350             0 => 'Manual',
2351             1 => 'Auto',
2352             2 => 'Not Known',
2353             3 => 'Macro',
2354             4 => 'Very Close', #PH
2355             5 => 'Close', #PH
2356             6 => 'Middle Range', #PH
2357             7 => 'Far Range',
2358             8 => 'Pan Focus',
2359             9 => 'Super Macro', #PH
2360             10=> 'Infinity', #PH
2361             },
2362             },
2363             19 => {
2364             Name => 'AFPoint',
2365             Flags => 'PrintHex',
2366             RawConv => '$val==0 ? undef : $val',
2367             PrintConv => {
2368             0x2005 => 'Manual AF point selection',
2369             0x3000 => 'None (MF)',
2370             0x3001 => 'Auto AF point selection',
2371             0x3002 => 'Right',
2372             0x3003 => 'Center',
2373             0x3004 => 'Left',
2374             0x4001 => 'Auto AF point selection',
2375             0x4006 => 'Face Detect', #PH (A570IS)
2376             },
2377             },
2378             20 => {
2379             Name => 'CanonExposureMode',
2380             PrintConv => {
2381             0 => 'Easy',
2382             1 => 'Program AE',
2383             2 => 'Shutter speed priority AE',
2384             3 => 'Aperture-priority AE',
2385             4 => 'Manual',
2386             5 => 'Depth-of-field AE',
2387             6 => 'M-Dep', #PH
2388             7 => 'Bulb', #30
2389             8 => 'Flexible-priority AE', #ArnoldVanOostrum
2390             },
2391             },
2392             22 => { #4
2393             Name => 'LensType',
2394             Format => 'int16u',
2395             RawConv => '$val ? $$self{LensType}=$val : undef', # don't use if value is zero
2396             Notes => 'this value is incorrect for EOS 7D images with lenses of type 256 or greater',
2397             SeparateTable => 1,
2398             DataMember => 'LensType',
2399             ValueConvInv => 'int($val)', # (must truncate decimal part)
2400             PrintConv => \%canonLensTypes,
2401             },
2402             23 => {
2403             Name => 'MaxFocalLength',
2404             Format => 'int16u',
2405             # this is a bit tricky, but we need the FocalUnits to convert this to mm
2406             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2407             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2408             ValueConvInv => '$val',
2409             PrintConv => '"$val mm"',
2410             PrintConvInv => '$val=~s/\s*mm//;$val',
2411             },
2412             24 => {
2413             Name => 'MinFocalLength',
2414             Format => 'int16u',
2415             RawConvInv => '$val * ($$self{FocalUnits} || 1)',
2416             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2417             ValueConvInv => '$val',
2418             PrintConv => '"$val mm"',
2419             PrintConvInv => '$val=~s/\s*mm//;$val',
2420             },
2421             25 => {
2422             Name => 'FocalUnits',
2423             # conversion from raw focal length values to mm
2424             DataMember => 'FocalUnits',
2425             RawConv => '$$self{FocalUnits} = $val',
2426             PrintConv => '"$val/mm"',
2427             PrintConvInv => '$val=~s/\s*\/?\s*mm//;$val',
2428             },
2429             26 => { #9
2430             Name => 'MaxAperture',
2431             RawConv => '$val > 0 ? $val : undef',
2432             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2433             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2434             PrintConv => 'sprintf("%.2g",$val)',
2435             PrintConvInv => '$val',
2436             },
2437             27 => { #PH
2438             Name => 'MinAperture',
2439             RawConv => '$val > 0 ? $val : undef',
2440             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2441             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2442             PrintConv => 'sprintf("%.2g",$val)',
2443             PrintConvInv => '$val',
2444             },
2445             28 => {
2446             Name => 'FlashActivity',
2447             RawConv => '$val==-1 ? undef : $val',
2448             },
2449             29 => {
2450             Name => 'FlashBits',
2451             PrintConvColumns => 2,
2452             PrintConv => {
2453             0 => '(none)',
2454             BITMASK => {
2455             0 => 'Manual', #PH
2456             1 => 'TTL', #PH
2457             2 => 'A-TTL', #PH
2458             3 => 'E-TTL', #PH
2459             4 => 'FP sync enabled',
2460             7 => '2nd-curtain sync used',
2461             11 => 'FP sync used',
2462             13 => 'Built-in',
2463             14 => 'External', #(may not be set in manual mode - ref 37)
2464             },
2465             },
2466             },
2467             32 => {
2468             Name => 'FocusContinuous',
2469             RawConv => '$val==-1 ? undef : $val',
2470             PrintConv => {
2471             0 => 'Single',
2472             1 => 'Continuous',
2473             8 => 'Manual', #22
2474             },
2475             },
2476             33 => { #PH
2477             Name => 'AESetting',
2478             RawConv => '$val==-1 ? undef : $val',
2479             PrintConv => {
2480             0 => 'Normal AE',
2481             1 => 'Exposure Compensation',
2482             2 => 'AE Lock',
2483             3 => 'AE Lock + Exposure Comp.',
2484             4 => 'No AE',
2485             },
2486             },
2487             34 => { #PH
2488             Name => 'ImageStabilization',
2489             RawConv => '$val==-1 ? undef : $val',
2490             PrintConv => {
2491             0 => 'Off',
2492             1 => 'On',
2493             2 => 'Shoot Only', #15
2494             3 => 'Panning', # (A570IS)
2495             4 => 'Dynamic', # (SX30IS) (was 'On, Video')
2496             # (don't know what bit 0x100 indicates)
2497             256 => 'Off (2)',
2498             257 => 'On (2)',
2499             258 => 'Shoot Only (2)',
2500             259 => 'Panning (2)',
2501             260 => 'Dynamic (2)',
2502             },
2503             },
2504             35 => { #PH
2505             Name => 'DisplayAperture',
2506             RawConv => '$val ? $val : undef',
2507             ValueConv => '$val / 10',
2508             ValueConvInv => '$val * 10',
2509             },
2510             36 => 'ZoomSourceWidth', #PH
2511             37 => 'ZoomTargetWidth', #PH
2512             39 => { #22
2513             Name => 'SpotMeteringMode',
2514             RawConv => '$val==-1 ? undef : $val',
2515             PrintConv => {
2516             0 => 'Center',
2517             1 => 'AF Point',
2518             },
2519             },
2520             40 => { #PH
2521             Name => 'PhotoEffect',
2522             RawConv => '$val==-1 ? undef : $val',
2523             PrintConvColumns => 2,
2524             PrintConv => {
2525             0 => 'Off',
2526             1 => 'Vivid',
2527             2 => 'Neutral',
2528             3 => 'Smooth',
2529             4 => 'Sepia',
2530             5 => 'B&W',
2531             6 => 'Custom',
2532             100 => 'My Color Data',
2533             },
2534             },
2535             41 => { #PH (A570IS)
2536             Name => 'ManualFlashOutput',
2537             PrintHex => 1,
2538             PrintConv => {
2539             0 => 'n/a',
2540             0x500 => 'Full',
2541             0x502 => 'Medium',
2542             0x504 => 'Low',
2543             0x7fff => 'n/a', # (EOS models)
2544             },
2545             },
2546             # 41 => non-zero for manual flash intensity - PH (A570IS)
2547             42 => {
2548             Name => 'ColorTone',
2549             RawConv => '$val == 0x7fff ? undef : $val',
2550             %Image::ExifTool::Exif::printParameter,
2551             },
2552             46 => { #PH
2553             Name => 'SRAWQuality',
2554             RawConv => '$val==-1 ? undef : $val',
2555             PrintConv => {
2556             0 => 'n/a',
2557             1 => 'sRAW1 (mRAW)',
2558             2 => 'sRAW2 (sRAW)',
2559             },
2560             },
2561             # 47 - related to aspect ratio: 100=4:3,70=1:1/16:9,90=3:2,60=4:5 (PH G12)
2562             # (roughly image area in percent - 4:3=100%,1:1/16:9=75%,3:2=89%,4:5=60%)
2563             );
2564              
2565             # focal length information (MakerNotes tag 0x02)
2566             %Image::ExifTool::Canon::FocalLength = (
2567             %binaryDataAttrs,
2568             FORMAT => 'int16u',
2569             FIRST_ENTRY => 0,
2570             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2571             0 => { #9
2572             Name => 'FocalType',
2573             RawConv => '$val ? $val : undef', # don't use if value is zero
2574             PrintConv => {
2575             1 => 'Fixed',
2576             2 => 'Zoom',
2577             },
2578             },
2579             1 => {
2580             Name => 'FocalLength',
2581             # the EXIF FocalLength is more reliable, so set this priority to zero
2582             Priority => 0,
2583             RawConv => '$val ? $val : undef', # don't use if value is zero
2584             RawConvInv => q{
2585             my $focalUnits = $$self{FocalUnits};
2586             unless ($focalUnits) {
2587             $focalUnits = 1;
2588             # (this happens when writing FocalLength to CRW images)
2589             $self->Warn("FocalUnits not available for FocalLength conversion (1 assumed)");
2590             }
2591             return $val * $focalUnits;
2592             },
2593             ValueConv => '$val / ($$self{FocalUnits} || 1)',
2594             ValueConvInv => '$val',
2595             PrintConv => '"$val mm"',
2596             PrintConvInv => '$val=~s/\s*mm//;$val',
2597             },
2598             2 => [ #4
2599             {
2600             Name => 'FocalPlaneXSize',
2601             Notes => q{
2602             these focal plane sizes are only valid for some models, and are affected by
2603             digital zoom if applied
2604             },
2605             # this conversion is valid only for PowerShot models and these EOS models:
2606             # D30, D60, 1D, 1DS, 5D, 10D, 20D, 30D, 300D, 350D, and 400D
2607             Condition => q{
2608             $$self{Model} !~ /EOS/ or
2609             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2610             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2611             },
2612             # focal plane image dimensions in 1/1000 inch -- convert to mm
2613             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2614             ValueConv => '$val * 25.4 / 1000',
2615             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2616             PrintConv => 'sprintf("%.2f mm",$val)',
2617             PrintConvInv => '$val=~s/\s*mm$//;$val',
2618             },{
2619             Name => 'FocalPlaneXUnknown',
2620             Unknown => 1,
2621             },
2622             ],
2623             3 => [ #4
2624             {
2625             Name => 'FocalPlaneYSize',
2626             Condition => q{
2627             $$self{Model} !~ /EOS/ or
2628             $$self{Model} =~ /\b(1DS?|5D|D30|D60|10D|20D|30D|K236)$/ or
2629             $$self{Model} =~ /\b((300D|350D|400D) DIGITAL|REBEL( XTi?)?|Kiss Digital( [NX])?)$/
2630             },
2631             RawConv => '$val < 40 ? undef : $val', # must be reasonable
2632             ValueConv => '$val * 25.4 / 1000',
2633             ValueConvInv => 'int($val * 1000 / 25.4 + 0.5)',
2634             PrintConv => 'sprintf("%.2f mm",$val)',
2635             PrintConvInv => '$val=~s/\s*mm$//;$val',
2636             },{
2637             Name => 'FocalPlaneYUnknown',
2638             Unknown => 1,
2639             },
2640             ],
2641             );
2642              
2643             # Canon shot information (MakerNotes tag 0x04)
2644             # BinaryData (keys are indices into the int16s array)
2645             %Image::ExifTool::Canon::ShotInfo = (
2646             %binaryDataAttrs,
2647             FORMAT => 'int16s',
2648             FIRST_ENTRY => 1,
2649             DATAMEMBER => [ 19 ],
2650             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2651             1 => { #PH
2652             Name => 'AutoISO',
2653             Notes => 'actual ISO used = BaseISO * AutoISO / 100',
2654             ValueConv => 'exp($val/32*log(2))*100',
2655             ValueConvInv => '32*log($val/100)/log(2)',
2656             PrintConv => 'sprintf("%.0f",$val)',
2657             PrintConvInv => '$val',
2658             },
2659             2 => {
2660             Name => 'BaseISO',
2661             Priority => 0,
2662             RawConv => '$val ? $val : undef',
2663             ValueConv => 'exp($val/32*log(2))*100/32',
2664             ValueConvInv => '32*log($val*32/100)/log(2)',
2665             PrintConv => 'sprintf("%.0f",$val)',
2666             PrintConvInv => '$val',
2667             },
2668             3 => { #9/PH
2669             Name => 'MeasuredEV',
2670             Notes => q{
2671             this is the Canon name for what could better be called MeasuredLV, and
2672             should be close to the calculated LightValue for a proper exposure with most
2673             models
2674             },
2675             # empirical offset of +5 seems to be good for EOS models, but maybe
2676             # the offset should be less by up to 1 EV for some PowerShot models
2677             ValueConv => '$val / 32 + 5',
2678             ValueConvInv => '($val - 5) * 32',
2679             PrintConv => 'sprintf("%.2f",$val)',
2680             PrintConvInv => '$val',
2681             },
2682             4 => { #2, 9
2683             Name => 'TargetAperture',
2684             RawConv => '$val > 0 ? $val : undef',
2685             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2686             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2687             PrintConv => 'sprintf("%.2g",$val)',
2688             PrintConvInv => '$val',
2689             },
2690             5 => { #2
2691             Name => 'TargetExposureTime',
2692             # ignore obviously bad values (also, -32768 may be used for n/a)
2693             # (note that a few models always write 0: DC211, and video models)
2694             RawConv => '($val > -1000 and ($val or $$self{Model}=~/(EOS|PowerShot|IXUS|IXY)/))? $val : undef',
2695             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2696             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2697             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2698             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2699             },
2700             6 => {
2701             Name => 'ExposureCompensation',
2702             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2703             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2704             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2705             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2706             },
2707             7 => {
2708             Name => 'WhiteBalance',
2709             PrintConv => \%canonWhiteBalance,
2710             SeparateTable => 1,
2711             },
2712             8 => { #PH
2713             Name => 'SlowShutter',
2714             PrintConv => {
2715             -1 => 'n/a',
2716             0 => 'Off',
2717             1 => 'Night Scene',
2718             2 => 'On',
2719             3 => 'None',
2720             },
2721             },
2722             9 => {
2723             Name => 'SequenceNumber',
2724             Description => 'Shot Number In Continuous Burst',
2725             Notes => 'valid only for some models', #PH (eg. not the 5DmkIII)
2726             },
2727             10 => { #PH/17
2728             Name => 'OpticalZoomCode',
2729             Groups => { 2 => 'Camera' },
2730             Notes => 'for many PowerShot models, a this is 0-6 for wide-tele zoom',
2731             # (for many models, 0-6 represent 0-100% zoom, but it is always 8 for
2732             # EOS models, and I have seen values of 16,20,28,32 and 39 too...)
2733             # - set to 8 for "n/a" by Canon software (ref 22)
2734             PrintConv => '$val == 8 ? "n/a" : $val',
2735             PrintConvInv => '$val =~ /[a-z]/i ? 8 : $val',
2736             },
2737             # 11 - (8 for all EOS samples, [0,8] for other models - PH)
2738             12 => { #37
2739             Name => 'CameraTemperature',
2740             Condition => '$$self{Model} =~ /EOS/ and $$self{Model} !~ /EOS-1DS?$/',
2741             Groups => { 2 => 'Camera' },
2742             Notes => 'newer EOS models only',
2743             # usually zero if not valid for an EOS model (exceptions: 1D, 1DS)
2744             RawConv => '$val ? $val : undef',
2745             ValueConv => '$val - 128',
2746             ValueConvInv => '$val + 128',
2747             PrintConv => '"$val C"',
2748             PrintConvInv => '$val=~s/ ?C//; $val',
2749             },
2750             13 => { #PH
2751             Name => 'FlashGuideNumber',
2752             RawConv => '$val==-1 ? undef : $val',
2753             ValueConv => '$val / 32',
2754             ValueConvInv => '$val * 32',
2755             },
2756             # AF points for Ixus and IxusV cameras - 02/17/04 M. Rommel (also D30/D60 - PH)
2757             14 => { #2
2758             Name => 'AFPointsInFocus',
2759             Notes => 'used by D30, D60 and some PowerShot/Ixus models',
2760             Groups => { 2 => 'Camera' },
2761             Flags => 'PrintHex',
2762             RawConv => '$val==0 ? undef : $val',
2763             PrintConvColumns => 2,
2764             PrintConv => {
2765             0x3000 => 'None (MF)',
2766             0x3001 => 'Right',
2767             0x3002 => 'Center',
2768             0x3003 => 'Center+Right',
2769             0x3004 => 'Left',
2770             0x3005 => 'Left+Right',
2771             0x3006 => 'Left+Center',
2772             0x3007 => 'All',
2773             },
2774             },
2775             15 => {
2776             Name => 'FlashExposureComp',
2777             Description => 'Flash Exposure Compensation',
2778             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2779             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2780             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2781             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2782             },
2783             16 => {
2784             Name => 'AutoExposureBracketing',
2785             PrintConv => {
2786             -1 => 'On',
2787             0 => 'Off',
2788             1 => 'On (shot 1)',
2789             2 => 'On (shot 2)',
2790             3 => 'On (shot 3)',
2791             },
2792             },
2793             17 => {
2794             Name => 'AEBBracketValue',
2795             ValueConv => 'Image::ExifTool::Canon::CanonEv($val)',
2796             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv($val)',
2797             PrintConv => 'Image::ExifTool::Exif::PrintFraction($val)',
2798             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2799             },
2800             18 => { #22
2801             Name => 'ControlMode',
2802             PrintConv => {
2803             0 => 'n/a',
2804             1 => 'Camera Local Control',
2805             # 2 - have seen this for EOS M studio picture
2806             3 => 'Computer Remote Control',
2807             },
2808             },
2809             19 => {
2810             Name => 'FocusDistanceUpper',
2811             DataMember => 'FocusDistanceUpper',
2812             Format => 'int16u',
2813             Notes => 'FocusDistance tags are only extracted if FocusDistanceUpper is non-zero',
2814             RawConv => '($$self{FocusDistanceUpper} = $val) || undef',
2815             ValueConv => '$val / 100',
2816             ValueConvInv => '$val * 100',
2817             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2818             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2819             },
2820             20 => {
2821             Name => 'FocusDistanceLower', # (seems to be the upper distance for the 400D)
2822             Condition => '$$self{FocusDistanceUpper}',
2823             Format => 'int16u',
2824             ValueConv => '$val / 100',
2825             ValueConvInv => '$val * 100',
2826             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
2827             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
2828             },
2829             21 => {
2830             Name => 'FNumber',
2831             Priority => 0,
2832             RawConv => '$val ? $val : undef',
2833             # approximate big translation table by simple calculation - PH
2834             ValueConv => 'exp(Image::ExifTool::Canon::CanonEv($val)*log(2)/2)',
2835             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(log($val)*2/log(2))',
2836             PrintConv => 'sprintf("%.2g",$val)',
2837             PrintConvInv => '$val',
2838             },
2839             22 => [
2840             {
2841             Name => 'ExposureTime',
2842             # encoding is different for 20D and 350D (darn!)
2843             # (but note that encoding is the same for TargetExposureTime - PH)
2844             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
2845             Priority => 0,
2846             # many models write 0 here in JPEG images (even though 0 is the
2847             # value for an exposure time of 1 sec), but apparently a value of 0
2848             # is valid in a CRW image (=1s, D60 sample)
2849             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2850             # approximate big translation table by simple calculation - PH
2851             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))*1000/32',
2852             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val*32/1000)/log(2))',
2853             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2854             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2855             },
2856             {
2857             Name => 'ExposureTime',
2858             Priority => 0,
2859             # many models write 0 here in JPEG images (even though 0 is the
2860             # value for an exposure time of 1 sec), but apparently a value of 0
2861             # is valid in a CRW image (=1s, D60 sample)
2862             RawConv => '($val or $$self{FILE_TYPE} eq "CRW") ? $val : undef',
2863             # approximate big translation table by simple calculation - PH
2864             ValueConv => 'exp(-Image::ExifTool::Canon::CanonEv($val)*log(2))',
2865             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(-log($val)/log(2))',
2866             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2867             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2868             },
2869             ],
2870             23 => { #37
2871             Name => 'MeasuredEV2',
2872             Description => 'Measured EV 2',
2873             RawConv => '$val ? $val : undef',
2874             ValueConv => '$val / 8 - 6',
2875             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
2876             },
2877             24 => {
2878             Name => 'BulbDuration',
2879             ValueConv => '$val / 10',
2880             ValueConvInv => '$val * 10',
2881             },
2882             # 25 - (usually 0, but 1 for 2s timer?, 19 for small AVI, 14 for large
2883             # AVI, and -6 and -10 for shots 1 and 2 with stitch assist - PH)
2884             26 => { #15
2885             Name => 'CameraType',
2886             Groups => { 2 => 'Camera' },
2887             PrintConv => {
2888             0 => 'n/a',
2889             248 => 'EOS High-end',
2890             250 => 'Compact',
2891             252 => 'EOS Mid-range',
2892             255 => 'DV Camera', #PH
2893             },
2894             },
2895             27 => {
2896             Name => 'AutoRotate',
2897             RawConv => '$val >= 0 ? $val : undef',
2898             PrintConv => {
2899             -1 => 'n/a', # (set to -1 when rotated by Canon software)
2900             0 => 'None',
2901             1 => 'Rotate 90 CW',
2902             2 => 'Rotate 180',
2903             3 => 'Rotate 270 CW',
2904             },
2905             },
2906             28 => { #15
2907             Name => 'NDFilter',
2908             PrintConv => { -1 => 'n/a', 0 => 'Off', 1 => 'On' },
2909             },
2910             29 => {
2911             Name => 'SelfTimer2',
2912             RawConv => '$val >= 0 ? $val : undef',
2913             ValueConv => '$val / 10',
2914             ValueConvInv => '$val * 10',
2915             },
2916             33 => { #PH (A570IS)
2917             Name => 'FlashOutput',
2918             RawConv => '($$self{Model}=~/(PowerShot|IXUS|IXY)/ or $val) ? $val : undef',
2919             Notes => q{
2920             used only for PowerShot models, this has a maximum value of 500 for models
2921             like the A570IS
2922             },
2923             },
2924             );
2925              
2926             # Canon panorama information (MakerNotes tag 0x05)
2927             %Image::ExifTool::Canon::Panorama = (
2928             %binaryDataAttrs,
2929             FORMAT => 'int16s',
2930             FIRST_ENTRY => 0,
2931             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
2932             # 0 - values: always 1
2933             # 1 - values: 0,256,512(3 sequential L->R images); 0,-256(2 R->L images)
2934             2 => 'PanoramaFrameNumber', #(some models this is always 0)
2935             # 3 - values: 160(SX10IS,A570IS); 871(S30)
2936             # 4 - values: always 0
2937             5 => {
2938             Name => 'PanoramaDirection',
2939             PrintConv => {
2940             0 => 'Left to Right',
2941             1 => 'Right to Left',
2942             2 => 'Bottom to Top',
2943             3 => 'Top to Bottom',
2944             4 => '2x2 Matrix (Clockwise)',
2945             },
2946             },
2947             );
2948              
2949             # D30 color information (MakerNotes tag 0x0a)
2950             %Image::ExifTool::Canon::UnknownD30 = (
2951             %binaryDataAttrs,
2952             FORMAT => 'int16s',
2953             FIRST_ENTRY => 1,
2954             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
2955             );
2956              
2957             #..............................................................................
2958             # common CameraInfo tag definitions
2959             my %ciFNumber = (
2960             Name => 'FNumber',
2961             Format => 'int8u',
2962             Groups => { 2 => 'Image' },
2963             RawConv => '$val ? $val : undef',
2964             ValueConv => 'exp(($val-8)/16*log(2))',
2965             ValueConvInv => 'log($val)*16/log(2)+8',
2966             PrintConv => 'sprintf("%.2g",$val)',
2967             PrintConvInv => '$val',
2968             );
2969             my %ciExposureTime = (
2970             Name => 'ExposureTime',
2971             Format => 'int8u',
2972             Groups => { 2 => 'Image' },
2973             RawConv => '$val ? $val : undef',
2974             ValueConv => 'exp(4*log(2)*(1-Image::ExifTool::Canon::CanonEv($val-24)))',
2975             ValueConvInv => 'Image::ExifTool::Canon::CanonEvInv(1-log($val)/(4*log(2)))+24',
2976             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
2977             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
2978             );
2979             my %ciISO = (
2980             Name => 'ISO',
2981             Format => 'int8u',
2982             Groups => { 2 => 'Image' },
2983             ValueConv => '100*exp(($val/8-9)*log(2))',
2984             ValueConvInv => '(log($val/100)/log(2)+9)*8',
2985             PrintConv => 'sprintf("%.0f",$val)',
2986             PrintConvInv => '$val',
2987             );
2988             my %ciCameraTemperature = (
2989             Name => 'CameraTemperature',
2990             Format => 'int8u',
2991             ValueConv => '$val - 128',
2992             ValueConvInv => '$val + 128',
2993             PrintConv => '"$val C"',
2994             PrintConvInv => '$val=~s/ ?C//; $val',
2995             );
2996             my %ciMacroMagnification = (
2997             Name => 'MacroMagnification',
2998             Notes => 'currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo',
2999             Condition => '$$self{LensType} and $$self{LensType} == 124',
3000             # 75=1x, 44=5x, log relationship
3001             ValueConv => 'exp((75-$val) * log(2) * 3 / 40)',
3002             ValueConvInv => '$val > 0 ? 75 - log($val) / log(2) * 40 / 3 : undef',
3003             PrintConv => 'sprintf("%.1fx",$val)',
3004             PrintConvInv => '$val=~s/\s*x//; $val',
3005             );
3006             my %ciFocalLength = (
3007             Name => 'FocalLength',
3008             Format => 'int16uRev', # (just to make things confusing, the focal lengths are big-endian)
3009             # ignore if zero
3010             RawConv => '$val ? $val : undef',
3011             PrintConv => '"$val mm"',
3012             PrintConvInv => '$val=~s/\s*mm//;$val',
3013             );
3014             my %ciMinFocal = (
3015             Name => 'MinFocalLength',
3016             Format => 'int16uRev', # byte order is big-endian
3017             PrintConv => '"$val mm"',
3018             PrintConvInv => '$val=~s/\s*mm//;$val',
3019             );
3020             my %ciMaxFocal = (
3021             Name => 'MaxFocalLength',
3022             Format => 'int16uRev', # byte order is big-endian
3023             PrintConv => '"$val mm"',
3024             PrintConvInv => '$val=~s/\s*mm//;$val',
3025             );
3026              
3027             #..............................................................................
3028             # Camera information for 1D and 1DS (MakerNotes tag 0x0d)
3029             # (ref 15 unless otherwise noted)
3030             %Image::ExifTool::Canon::CameraInfo1D = (
3031             %binaryDataAttrs,
3032             FORMAT => 'int8u',
3033             FIRST_ENTRY => 0,
3034             PRIORITY => 0, # these tags are not reliable since they change with firmware version
3035             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3036             NOTES => q{
3037             Information in the "CameraInfo" records is tricky to decode because the
3038             encodings are very different than in other Canon records (even sometimes
3039             switching endianness between values within a single camera), plus there is
3040             considerable variation in format from model to model. The first table below
3041             lists CameraInfo tags for the 1D and 1DS.
3042             },
3043             0x04 => { %ciExposureTime }, #9
3044             0x0a => {
3045             Name => 'FocalLength',
3046             Format => 'int16u',
3047             # ignore if zero
3048             RawConv => '$val ? $val : undef',
3049             PrintConv => '"$val mm"',
3050             PrintConvInv => '$val=~s/\s*mm//;$val',
3051             },
3052             0x0d => { #9
3053             Name => 'LensType',
3054             Format => 'int16uRev', # value is little-endian
3055             SeparateTable => 1,
3056             RawConv => '$val ? $val : undef', # don't use if value is zero
3057             ValueConvInv => 'int($val)', # (must truncate decimal part)
3058             PrintConv => \%canonLensTypes,
3059             },
3060             0x0e => {
3061             Name => 'MinFocalLength',
3062             Format => 'int16u',
3063             PrintConv => '"$val mm"',
3064             PrintConvInv => '$val=~s/\s*mm//;$val',
3065             },
3066             0x10 => {
3067             Name => 'MaxFocalLength',
3068             Format => 'int16u',
3069             PrintConv => '"$val mm"',
3070             PrintConvInv => '$val=~s/\s*mm//;$val',
3071             },
3072             0x41 => {
3073             Name => 'SharpnessFrequency', # PatternSharpness?
3074             Condition => '$$self{Model} =~ /\b1D$/',
3075             Notes => '1D only',
3076             PrintConvColumns => 2,
3077             PrintConv => {
3078             0 => 'n/a',
3079             1 => 'Lowest',
3080             2 => 'Low',
3081             3 => 'Standard',
3082             4 => 'High',
3083             5 => 'Highest',
3084             },
3085             },
3086             0x42 => {
3087             Name => 'Sharpness',
3088             Format => 'int8s',
3089             Condition => '$$self{Model} =~ /\b1D$/',
3090             Notes => '1D only',
3091             },
3092             0x44 => {
3093             Name => 'WhiteBalance',
3094             Condition => '$$self{Model} =~ /\b1D$/',
3095             Notes => '1D only',
3096             SeparateTable => 1,
3097             PrintConv => \%canonWhiteBalance,
3098             },
3099             0x47 => {
3100             Name => 'SharpnessFrequency', # PatternSharpness?
3101             Condition => '$$self{Model} =~ /\b1DS$/',
3102             Notes => '1DS only',
3103             PrintConvColumns => 2,
3104             PrintConv => {
3105             0 => 'n/a',
3106             1 => 'Lowest',
3107             2 => 'Low',
3108             3 => 'Standard',
3109             4 => 'High',
3110             5 => 'Highest',
3111             },
3112             },
3113             0x48 => [
3114             {
3115             Name => 'ColorTemperature',
3116             Format => 'int16u',
3117             Condition => '$$self{Model} =~ /\b1D$/',
3118             Notes => '1D only',
3119             },
3120             {
3121             Name => 'Sharpness',
3122             Format => 'int8s',
3123             Condition => '$$self{Model} =~ /\b1DS$/',
3124             Notes => '1DS only',
3125             },
3126             ],
3127             0x4a => {
3128             Name => 'WhiteBalance',
3129             Condition => '$$self{Model} =~ /\b1DS$/',
3130             Notes => '1DS only',
3131             SeparateTable => 1,
3132             PrintConv => \%canonWhiteBalance,
3133             },
3134             0x4b => {
3135             Name => 'PictureStyle',
3136             Condition => '$$self{Model} =~ /\b1D$/',
3137             Notes => "1D only, called 'Color Matrix' in owner's manual",
3138             Flags => ['PrintHex','SeparateTable'],
3139             PrintConv => \%pictureStyles,
3140             },
3141             0x4e => {
3142             Name => 'ColorTemperature',
3143             Format => 'int16u',
3144             Condition => '$$self{Model} =~ /\b1DS$/',
3145             Notes => '1DS only',
3146             },
3147             0x51 => {
3148             Name => 'PictureStyle',
3149             Condition => '$$self{Model} =~ /\b1DS$/',
3150             Notes => '1DS only',
3151             Flags => ['PrintHex','SeparateTable'],
3152             PrintConv => \%pictureStyles,
3153             },
3154             );
3155              
3156             # Camera information for 1DmkII and 1DSmkII (MakerNotes tag 0x0d)
3157             # (ref 15 unless otherwise noted)
3158             %Image::ExifTool::Canon::CameraInfo1DmkII = (
3159             %binaryDataAttrs,
3160             FORMAT => 'int8u',
3161             FIRST_ENTRY => 0,
3162             PRIORITY => 0,
3163             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3164             NOTES => 'CameraInfo tags for the 1DmkII and 1DSmkII.',
3165             0x04 => { %ciExposureTime }, #9
3166             0x09 => { %ciFocalLength }, #9
3167             0x0c => { #9
3168             Name => 'LensType',
3169             Format => 'int16uRev', # value is big-endian
3170             SeparateTable => 1,
3171             RawConv => '$val ? $val : undef', # don't use if value is zero
3172             ValueConvInv => 'int($val)', # (must truncate decimal part)
3173             PrintConv => \%canonLensTypes,
3174             },
3175             0x11 => { %ciMinFocal }, #9
3176             0x13 => { %ciMaxFocal }, #9
3177             0x2d => { #9
3178             Name => 'FocalType',
3179             PrintConv => {
3180             0 => 'Fixed',
3181             2 => 'Zoom',
3182             },
3183             },
3184             0x36 => {
3185             Name => 'WhiteBalance',
3186             SeparateTable => 1,
3187             PrintConv => \%canonWhiteBalance,
3188             },
3189             0x37 => {
3190             Name => 'ColorTemperature',
3191             Format => 'int16uRev',
3192             },
3193             0x39 => {
3194             Name => 'CanonImageSize',
3195             Format => 'int16u',
3196             PrintConvColumns => 2,
3197             PrintConv => \%canonImageSize,
3198             },
3199             0x66 => {
3200             Name => 'JPEGQuality',
3201             Notes => 'a number from 1 to 10',
3202             },
3203             0x6c => { #12
3204             Name => 'PictureStyle',
3205             Flags => ['PrintHex','SeparateTable'],
3206             PrintConv => \%pictureStyles,
3207             },
3208             0x6e => {
3209             Name => 'Saturation',
3210             Format => 'int8s',
3211             %Image::ExifTool::Exif::printParameter,
3212             },
3213             0x6f => {
3214             Name => 'ColorTone',
3215             Format => 'int8s',
3216             %Image::ExifTool::Exif::printParameter,
3217             },
3218             0x72 => {
3219             Name => 'Sharpness',
3220             Format => 'int8s',
3221             },
3222             0x73 => {
3223             Name => 'Contrast',
3224             Format => 'int8s',
3225             %Image::ExifTool::Exif::printParameter,
3226             },
3227             0x75 => {
3228             Name => 'ISO',
3229             Format => 'string[5]',
3230             },
3231             );
3232              
3233             # Camera information for the 1DmkIIN (MakerNotes tag 0x0d)
3234             # (ref 9 unless otherwise noted)
3235             %Image::ExifTool::Canon::CameraInfo1DmkIIN = (
3236             %binaryDataAttrs,
3237             FORMAT => 'int8u',
3238             FIRST_ENTRY => 0,
3239             PRIORITY => 0,
3240             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3241             NOTES => 'CameraInfo tags for the 1DmkIIN.',
3242             0x04 => { %ciExposureTime },
3243             0x09 => { %ciFocalLength },
3244             0x0c => {
3245             Name => 'LensType',
3246             Format => 'int16uRev', # value is big-endian
3247             SeparateTable => 1,
3248             RawConv => '$val ? $val : undef', # don't use if value is zero
3249             ValueConvInv => 'int($val)', # (must truncate decimal part)
3250             PrintConv => \%canonLensTypes,
3251             },
3252             0x11 => { %ciMinFocal },
3253             0x13 => { %ciMaxFocal },
3254             0x36 => { #15
3255             Name => 'WhiteBalance',
3256             SeparateTable => 1,
3257             PrintConv => \%canonWhiteBalance,
3258             },
3259             0x37 => { #15
3260             Name => 'ColorTemperature',
3261             Format => 'int16uRev',
3262             },
3263             0x73 => { #15
3264             Name => 'PictureStyle',
3265             Flags => ['PrintHex','SeparateTable'],
3266             PrintConv => \%pictureStyles,
3267             },
3268             0x74 => { #15
3269             Name => 'Sharpness',
3270             Format => 'int8s',
3271             },
3272             0x75 => { #15
3273             Name => 'Contrast',
3274             Format => 'int8s',
3275             %Image::ExifTool::Exif::printParameter,
3276             },
3277             0x76 => { #15
3278             Name => 'Saturation',
3279             Format => 'int8s',
3280             %Image::ExifTool::Exif::printParameter,
3281             },
3282             0x77 => { #15
3283             Name => 'ColorTone',
3284             Format => 'int8s',
3285             %Image::ExifTool::Exif::printParameter,
3286             },
3287             0x79 => { #15
3288             Name => 'ISO',
3289             Format => 'string[5]',
3290             },
3291             );
3292              
3293             # Canon camera information for 1DmkIII and 1DSmkIII (MakerNotes tag 0x0d) (ref PH)
3294             %Image::ExifTool::Canon::CameraInfo1DmkIII = (
3295             %binaryDataAttrs,
3296             FORMAT => 'int8u',
3297             FIRST_ENTRY => 0,
3298             PRIORITY => 0,
3299             IS_SUBDIR => [ 0x2aa ],
3300             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3301             NOTES => 'CameraInfo tags for the 1DmkIII and 1DSmkIII.',
3302             0x03 => { %ciFNumber },
3303             0x04 => { %ciExposureTime }, #9
3304             0x06 => { %ciISO },
3305             0x18 => { %ciCameraTemperature }, #36
3306             0x1b => { %ciMacroMagnification }, #(NC)
3307             0x1d => { %ciFocalLength },
3308             0x30 => { # <-- (follows pattern /\xbb\xbb(.{64})?\x01\x01\0\0.{4}/s for all models - Dave Coffin)
3309             Name => 'CameraOrientation',
3310             PrintConv => {
3311             0 => 'Horizontal (normal)',
3312             1 => 'Rotate 90 CW',
3313             2 => 'Rotate 270 CW',
3314             },
3315             },
3316             0x43 => { #21/24
3317             Name => 'FocusDistanceUpper',
3318             # (it looks like the focus distances are also odd-byte big-endian)
3319             %focusDistanceByteSwap,
3320             },
3321             0x45 => { #21/24
3322             Name => 'FocusDistanceLower',
3323             %focusDistanceByteSwap,
3324             },
3325             0x5e => { #15
3326             Name => 'WhiteBalance',
3327             Format => 'int16u',
3328             PrintConv => \%canonWhiteBalance,
3329             SeparateTable => 1,
3330             },
3331             0x62 => { #15
3332             Name => 'ColorTemperature',
3333             Format => 'int16u',
3334             },
3335             0x86 => {
3336             Name => 'PictureStyle',
3337             Flags => ['PrintHex','SeparateTable'],
3338             PrintConv => \%pictureStyles,
3339             },
3340             0x111 => { #15
3341             Name => 'LensType',
3342             Format => 'int16uRev', # value is big-endian
3343             SeparateTable => 1,
3344             ValueConvInv => 'int($val)', # (must truncate decimal part)
3345             PrintConv => \%canonLensTypes,
3346             },
3347             0x113 => { %ciMinFocal },
3348             0x115 => { %ciMaxFocal },
3349             0x136 => { #15
3350             Name => 'FirmwareVersion',
3351             Format => 'string[6]',
3352             },
3353             0x172 => {
3354             Name => 'FileIndex',
3355             Groups => { 2 => 'Image' },
3356             Format => 'int32u',
3357             ValueConv => '$val + 1',
3358             ValueConvInv => '$val - 1',
3359             },
3360             0x176 => {
3361             Name => 'ShutterCount',
3362             Notes => 'may be valid only for some 1DmkIII copies, even running the same firmware',
3363             Format => 'int32u',
3364             ValueConv => '$val + 1',
3365             ValueConvInv => '$val - 1',
3366             },
3367             0x17e => { #(NC)
3368             Name => 'DirectoryIndex',
3369             Groups => { 2 => 'Image' },
3370             Format => 'int32u',
3371             ValueConv => '$val - 1',
3372             ValueConvInv => '$val + 1',
3373             },
3374             0x2aa => { #48
3375             Name => 'PictureStyleInfo',
3376             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3377             },
3378             0x45a => { #29
3379             Name => 'TimeStamp1',
3380             Condition => '$$self{Model} =~ /\b1D Mark III$/',
3381             Format => 'int32u',
3382             Groups => { 2 => 'Time' },
3383             # observed in 1DmkIII firmware 5.3.1 (pre-production), 1.0.3, 1.0.8
3384             Notes => 'only valid for 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             0x45e => {
3393             Name => 'TimeStamp',
3394             Format => 'int32u',
3395             Groups => { 2 => 'Time' },
3396             # observed in 1DmkIII firmware 1.1.0, 1.1.3 and
3397             # 1DSmkIII firmware 1.0.0, 1.0.4, 2.1.2, 2.7.1
3398             Notes => 'valid for the 1DSmkIII and some versions of the 1DmkIII firmware',
3399             Shift => 'Time',
3400             RawConv => '$val ? $val : undef',
3401             ValueConv => 'ConvertUnixTime($val)',
3402             ValueConvInv => 'GetUnixTime($val)',
3403             PrintConv => '$self->ConvertDateTime($val)',
3404             PrintConvInv => '$self->InverseDateTime($val)',
3405             },
3406             );
3407              
3408             # Canon camera information for 1DmkIV (MakerNotes tag 0x0d) (ref PH)
3409             %Image::ExifTool::Canon::CameraInfo1DmkIV = (
3410             %binaryDataAttrs,
3411             FIRST_ENTRY => 0,
3412             PRIORITY => 0,
3413             DATAMEMBER => [ 0x00, 0x56, 0x153 ],
3414             IS_SUBDIR => [ 0x368 ],
3415             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3416             NOTES => q{
3417             CameraInfo tags for the EOS 1D Mark IV. Indices shown are for firmware
3418             versions 1.0.x, but they may be different for other firmware versions.
3419             },
3420             0x00 => {
3421             Name => 'FirmwareVersionLookAhead',
3422             Hidden => 1,
3423             # look ahead to check location of FirmwareVersion string
3424             Format => 'undef[0x1fd]',
3425             RawConv => q{
3426             my $t = substr($val, 0x1e8, 6); # 1 = firmware 4.2.1
3427             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3428             $t = substr($val, 0x1ed, 6); # 2 = firmware 1.0.4
3429             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3430             $self->Warn('Unrecognized CameraInfo1DmkIV firmware version');
3431             $$self{CanonFirm} = 0;
3432             return undef; # not a real tag
3433             },
3434             },
3435             0x03 => { %ciFNumber },
3436             0x04 => { %ciExposureTime },
3437             0x06 => { %ciISO },
3438             0x07 => {
3439             Name => 'HighlightTonePriority',
3440             PrintConv => \%offOn,
3441             },
3442             0x08 => {
3443             Name => 'MeasuredEV2',
3444             Description => 'Measured EV 2',
3445             RawConv => '$val ? $val : undef',
3446             ValueConv => '$val / 8 - 6',
3447             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3448             },
3449             0x09 => {
3450             Name => 'MeasuredEV3',
3451             Description => 'Measured EV 3',
3452             RawConv => '$val ? $val : undef',
3453             ValueConv => '$val / 8 - 6',
3454             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
3455             },
3456             0x15 => {
3457             Name => 'FlashMeteringMode',
3458             PrintConv => {
3459             0 => 'E-TTL',
3460             3 => 'TTL',
3461             4 => 'External Auto',
3462             5 => 'External Manual',
3463             6 => 'Off',
3464             },
3465             },
3466             0x19 => { %ciCameraTemperature },
3467             0x1e => { %ciFocalLength },
3468             0x35 => {
3469             Name => 'CameraOrientation',
3470             PrintConv => {
3471             0 => 'Horizontal (normal)',
3472             1 => 'Rotate 90 CW',
3473             2 => 'Rotate 270 CW',
3474             },
3475             },
3476             0x54 => {
3477             Name => 'FocusDistanceUpper',
3478             %focusDistanceByteSwap,
3479             },
3480             0x56 => {
3481             Name => 'FocusDistanceLower',
3482             %focusDistanceByteSwap,
3483             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 2',
3484             },
3485             0x78 => {
3486             Name => 'WhiteBalance',
3487             Format => 'int16u',
3488             SeparateTable => 1,
3489             PrintConv => \%canonWhiteBalance,
3490             },
3491             0x7c => {
3492             Name => 'ColorTemperature',
3493             Format => 'int16u',
3494             },
3495             0x14f => {
3496             Name => 'LensType',
3497             Format => 'int16uRev', # value is big-endian
3498             SeparateTable => 1,
3499             ValueConvInv => 'int($val)', # (must truncate decimal part)
3500             PrintConv => \%canonLensTypes,
3501             },
3502             0x151 => { %ciMinFocal },
3503             0x153 => { %ciMaxFocal,
3504             Hook => '$varSize -= 4 if $$self{CanonFirm} < 2',
3505             },
3506             0x1ed => {
3507             Name => 'FirmwareVersion',
3508             Format => 'string[6]',
3509             Writable => 0,
3510             },
3511             0x22c => { #(NC)
3512             Name => 'FileIndex',
3513             Groups => { 2 => 'Image' },
3514             Format => 'int32u',
3515             ValueConv => '$val + 1',
3516             ValueConvInv => '$val - 1',
3517             },
3518             0x238 => { #(NC)
3519             Name => 'DirectoryIndex',
3520             Groups => { 2 => 'Image' },
3521             Format => 'int32u',
3522             ValueConv => '$val - 1',
3523             ValueConvInv => '$val + 1',
3524             },
3525             0x368 => {
3526             Name => 'PictureStyleInfo',
3527             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3528             },
3529             );
3530              
3531             # Camera information for 1D X (MakerNotes tag 0x0d) (ref PH)
3532             %Image::ExifTool::Canon::CameraInfo1DX = (
3533             %binaryDataAttrs,
3534             FORMAT => 'int8u',
3535             FIRST_ENTRY => 0,
3536             PRIORITY => 0,
3537             DATAMEMBER => [ 0x00, 0x1b, 0x8e, 0x1ab ],
3538             IS_SUBDIR => [ 0x3f4 ],
3539             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3540             NOTES => q{
3541             CameraInfo tags for the EOS 1D X. Indices shown are for firmware version
3542             1.0.2, but they may be different for other firmware versions.
3543             },
3544             0x00 => {
3545             Name => 'FirmwareVersionLookAhead',
3546             Hidden => 1,
3547             # look ahead to check location of FirmwareVersion string
3548             Format => 'undef[0x28b]',
3549             RawConv => q{
3550             my $t = substr($val, 0x271, 6); # 1 = firmware 5.7.1
3551             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3552             $t = substr($val, 0x279, 6); # 2 = firmware 6.5.1
3553             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3554             $t = substr($val, 0x280, 6); # 3 = firmware 0.0.8/1.0.2/1.1.1
3555             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3556             $t = substr($val, 0x285, 6); # 4 = firmware 2.1.0
3557             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3558             $self->Warn('Unrecognized CameraInfo1DX firmware version');
3559             $$self{CanonFirm} = 0;
3560             return undef; # not a real tag
3561             },
3562             },
3563             0x03 => { %ciFNumber },
3564             0x04 => { %ciExposureTime },
3565             0x06 => { %ciISO },
3566             0x1b => { %ciCameraTemperature,
3567             Hook => '$varSize -= 3 if $$self{CanonFirm} < 3',
3568             },
3569             0x23 => { %ciFocalLength },
3570             0x7d => {
3571             Name => 'CameraOrientation',
3572             PrintConv => {
3573             0 => 'Horizontal (normal)',
3574             1 => 'Rotate 90 CW',
3575             2 => 'Rotate 270 CW',
3576             },
3577             },
3578             0x8c => {
3579             Name => 'FocusDistanceUpper',
3580             %focusDistanceByteSwap,
3581             },
3582             0x8e => {
3583             Name => 'FocusDistanceLower',
3584             %focusDistanceByteSwap,
3585             Hook => '$varSize -= 4 if $$self{CanonFirm} < 3; $varSize += 5 if $$self{CanonFirm} == 4',
3586             },
3587             0xbc => {
3588             Name => 'WhiteBalance',
3589             Format => 'int16u',
3590             SeparateTable => 1,
3591             PrintConv => \%canonWhiteBalance,
3592             },
3593             0xc0 => {
3594             Name => 'ColorTemperature',
3595             Format => 'int16u',
3596             },
3597             0xf4 => {
3598             Name => 'PictureStyle',
3599             Format => 'int8u',
3600             Flags => ['PrintHex','SeparateTable'],
3601             PrintConv => \%pictureStyles,
3602             },
3603             0x1a7 => {
3604             Name => 'LensType',
3605             Format => 'int16uRev', # value is big-endian
3606             SeparateTable => 1,
3607             ValueConvInv => 'int($val)', # (must truncate decimal part)
3608             PrintConv => \%canonLensTypes,
3609             },
3610             0x1a9 => { %ciMinFocal },
3611             0x1ab => { %ciMaxFocal,
3612             # add another offset of -8 for firmware 5.7.1, and a large offset
3613             # to effectively abort processing for unknown firmware
3614             Hook => '$varSize += ($$self{CanonFirm} ? -8 : 0x10000) if $$self{CanonFirm} < 2',
3615             },
3616             0x280 => {
3617             Name => 'FirmwareVersion',
3618             Format => 'string[6]',
3619             Writable => 0,
3620             },
3621             0x2d0 => { # (doesn't seem to work for firmware 2.0.3 - PH)
3622             Name => 'FileIndex',
3623             Groups => { 2 => 'Image' },
3624             Format => 'int32u',
3625             ValueConv => '$val + 1',
3626             ValueConvInv => '$val - 1',
3627             },
3628             0x2dc => { #(NC)
3629             Name => 'DirectoryIndex',
3630             Groups => { 2 => 'Image' },
3631             Format => 'int32u',
3632             ValueConv => '$val - 1',
3633             ValueConvInv => '$val + 1',
3634             },
3635             0x3f4 => {
3636             Name => 'PictureStyleInfo',
3637             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
3638             },
3639             );
3640              
3641             # Camera information for 5D (MakerNotes tag 0x0d)
3642             # (ref 12 unless otherwise noted)
3643             %Image::ExifTool::Canon::CameraInfo5D = (
3644             %binaryDataAttrs,
3645             FORMAT => 'int8s',
3646             FIRST_ENTRY => 0,
3647             PRIORITY => 0,
3648             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3649             NOTES => 'CameraInfo tags for the EOS 5D.',
3650             0x03 => { %ciFNumber }, #PH
3651             0x04 => { %ciExposureTime }, #9
3652             0x06 => { %ciISO }, #PH
3653             0x0c => { #9
3654             Name => 'LensType',
3655             Format => 'int16uRev', # value is big-endian
3656             SeparateTable => 1,
3657             RawConv => '$val ? $val : undef', # don't use if value is zero
3658             ValueConvInv => 'int($val)', # (must truncate decimal part)
3659             PrintConv => \%canonLensTypes,
3660             },
3661             0x17 => { %ciCameraTemperature }, #PH
3662             0x1b => { %ciMacroMagnification }, #PH
3663             0x27 => { #PH
3664             Name => 'CameraOrientation',
3665             PrintConv => {
3666             0 => 'Horizontal (normal)',
3667             1 => 'Rotate 90 CW',
3668             2 => 'Rotate 270 CW',
3669             },
3670             },
3671             0x28 => { %ciFocalLength }, #15
3672             0x38 => {
3673             Name => 'AFPointsInFocus5D',
3674             Format => 'int16uRev',
3675             PrintConvColumns => 2,
3676             PrintConv => { 0 => '(none)',
3677             BITMASK => {
3678             0 => 'Center',
3679             1 => 'Top',
3680             2 => 'Bottom',
3681             3 => 'Upper-left',
3682             4 => 'Upper-right',
3683             5 => 'Lower-left',
3684             6 => 'Lower-right',
3685             7 => 'Left',
3686             8 => 'Right',
3687             9 => 'AI Servo1',
3688             10 => 'AI Servo2',
3689             11 => 'AI Servo3',
3690             12 => 'AI Servo4',
3691             13 => 'AI Servo5',
3692             14 => 'AI Servo6',
3693             },
3694             },
3695             },
3696             0x54 => { #15
3697             Name => 'WhiteBalance',
3698             Format => 'int16u',
3699             SeparateTable => 1,
3700             PrintConv => \%canonWhiteBalance,
3701             },
3702             0x58 => { #15
3703             Name => 'ColorTemperature',
3704             Format => 'int16u',
3705             },
3706             0x6c => {
3707             Name => 'PictureStyle',
3708             Format => 'int8u',
3709             Flags => ['PrintHex','SeparateTable'],
3710             PrintConv => \%pictureStyles,
3711             },
3712             0x93 => { %ciMinFocal }, #15
3713             0x95 => { %ciMaxFocal }, #15
3714             0x97 => { #15
3715             Name => 'LensType',
3716             Format => 'int16uRev', # value is big-endian
3717             SeparateTable => 1,
3718             ValueConvInv => 'int($val)', # (must truncate decimal part)
3719             PrintConv => \%canonLensTypes,
3720             },
3721             0xa4 => { #PH
3722             Name => 'FirmwareRevision',
3723             Format => 'string[8]',
3724             },
3725             0xac => { #PH
3726             Name => 'ShortOwnerName',
3727             Format => 'string[16]',
3728             },
3729             0xcc => { #PH (NC)
3730             Name => 'DirectoryIndex',
3731             Groups => { 2 => 'Image' },
3732             Format => 'int32u',
3733             },
3734             0xd0 => {
3735             Name => 'FileIndex',
3736             Format => 'int16u',
3737             Groups => { 2 => 'Image' },
3738             ValueConv => '$val + 1',
3739             ValueConvInv => '$val - 1',
3740             },
3741             0xe8 => 'ContrastStandard',
3742             0xe9 => 'ContrastPortrait',
3743             0xea => 'ContrastLandscape',
3744             0xeb => 'ContrastNeutral',
3745             0xec => 'ContrastFaithful',
3746             0xed => 'ContrastMonochrome',
3747             0xee => 'ContrastUserDef1',
3748             0xef => 'ContrastUserDef2',
3749             0xf0 => 'ContrastUserDef3',
3750             # sharpness values are 0-7
3751             0xf1 => 'SharpnessStandard',
3752             0xf2 => 'SharpnessPortrait',
3753             0xf3 => 'SharpnessLandscape',
3754             0xf4 => 'SharpnessNeutral',
3755             0xf5 => 'SharpnessFaithful',
3756             0xf6 => 'SharpnessMonochrome',
3757             0xf7 => 'SharpnessUserDef1',
3758             0xf8 => 'SharpnessUserDef2',
3759             0xf9 => 'SharpnessUserDef3',
3760             0xfa => 'SaturationStandard',
3761             0xfb => 'SaturationPortrait',
3762             0xfc => 'SaturationLandscape',
3763             0xfd => 'SaturationNeutral',
3764             0xfe => 'SaturationFaithful',
3765             0xff => {
3766             Name => 'FilterEffectMonochrome',
3767             PrintConv => {
3768             0 => 'None',
3769             1 => 'Yellow',
3770             2 => 'Orange',
3771             3 => 'Red',
3772             4 => 'Green',
3773             -559038737 => 'n/a', # (0xdeadbeef)
3774             },
3775             },
3776             0x100 => 'SaturationUserDef1',
3777             0x101 => 'SaturationUserDef2',
3778             0x102 => 'SaturationUserDef3',
3779             0x103 => 'ColorToneStandard',
3780             0x104 => 'ColorTonePortrait',
3781             0x105 => 'ColorToneLandscape',
3782             0x106 => 'ColorToneNeutral',
3783             0x107 => 'ColorToneFaithful',
3784             0x108 => {
3785             Name => 'ToningEffectMonochrome',
3786             PrintConv => {
3787             0 => 'None',
3788             1 => 'Sepia',
3789             2 => 'Blue',
3790             3 => 'Purple',
3791             4 => 'Green',
3792             -559038737 => 'n/a', # (0xdeadbeef)
3793             },
3794             },
3795             0x109 => 'ColorToneUserDef1',
3796             0x10a => 'ColorToneUserDef2',
3797             0x10b => 'ColorToneUserDef3',
3798             0x10c => {
3799             Name => 'UserDef1PictureStyle',
3800             Format => 'int16u',
3801             PrintHex => 1, # (only needed for one tag)
3802             SeparateTable => 'UserDefStyle',
3803             PrintConv => \%userDefStyles,
3804             },
3805             0x10e => {
3806             Name => 'UserDef2PictureStyle',
3807             Format => 'int16u',
3808             SeparateTable => 'UserDefStyle',
3809             PrintConv => \%userDefStyles,
3810             },
3811             0x110 => {
3812             Name => 'UserDef3PictureStyle',
3813             Format => 'int16u',
3814             SeparateTable => 'UserDefStyle',
3815             PrintConv => \%userDefStyles,
3816             },
3817             0x11c => {
3818             Name => 'TimeStamp',
3819             Format => 'int32u',
3820             Groups => { 2 => 'Time' },
3821             Shift => 'Time',
3822             RawConv => '$val ? $val : undef',
3823             ValueConv => 'ConvertUnixTime($val)',
3824             ValueConvInv => 'GetUnixTime($val)',
3825             PrintConv => '$self->ConvertDateTime($val)',
3826             PrintConvInv => '$self->InverseDateTime($val)',
3827             },
3828             );
3829              
3830             # Camera information for 5D Mark II (MakerNotes tag 0x0d) (ref PH)
3831             %Image::ExifTool::Canon::CameraInfo5DmkII = (
3832             %binaryDataAttrs,
3833             FORMAT => 'int8u',
3834             FIRST_ENTRY => 0,
3835             PRIORITY => 0,
3836             DATAMEMBER => [ 0x00, 0xea ],
3837             IS_SUBDIR => [ 0x2f7 ],
3838             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3839             NOTES => q{
3840             CameraInfo tags for the EOS 5D Mark II. Indices shown are for firmware
3841             version 1.0.6, but they may be different for other firmware versions.
3842             },
3843             0x00 => {
3844             Name => 'FirmwareVersionLookAhead',
3845             Hidden => 1,
3846             # look ahead to check location of FirmwareVersion string
3847             Format => 'undef[0x184]',
3848             RawConv => q{
3849             my $t = substr($val, 0x15a, 6); # 1 = firmware 3.4.6/3.6.1
3850             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3851             $t = substr($val, 0x17e, 6); # 2 = firmware 4.1.1/1.0.6
3852             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3853             $self->Warn('Unrecognized CameraInfo5DmkII firmware version');
3854             $$self{CanonFirm} = 0;
3855             return undef; # not a real tag
3856             },
3857             },
3858             0x03 => { %ciFNumber },
3859             0x04 => { %ciExposureTime },
3860             0x06 => { %ciISO },
3861             0x07 => {
3862             Name => 'HighlightTonePriority',
3863             PrintConv => \%offOn,
3864             },
3865             0x1b => { %ciMacroMagnification }, #PH
3866             0x15 => { #PH (580 EX II)
3867             Name => 'FlashMeteringMode',
3868             PrintConv => {
3869             0 => 'E-TTL',
3870             3 => 'TTL',
3871             4 => 'External Auto',
3872             5 => 'External Manual',
3873             6 => 'Off',
3874             },
3875             },
3876             0x19 => { %ciCameraTemperature }, #36
3877             # 0x1b, 0x1c, 0x1d - same as FileInfo 0x10 - PH
3878             0x1e => { %ciFocalLength },
3879             0x31 => {
3880             Name => 'CameraOrientation',
3881             PrintConv => {
3882             0 => 'Horizontal (normal)',
3883             1 => 'Rotate 90 CW',
3884             2 => 'Rotate 270 CW',
3885             },
3886             },
3887             0x50 => {
3888             Name => 'FocusDistanceUpper',
3889             %focusDistanceByteSwap,
3890             },
3891             0x52 => {
3892             Name => 'FocusDistanceLower',
3893             %focusDistanceByteSwap,
3894             },
3895             0x6f => {
3896             Name => 'WhiteBalance',
3897             Format => 'int16u',
3898             SeparateTable => 1,
3899             PrintConv => \%canonWhiteBalance,
3900             },
3901             0x73 => {
3902             Name => 'ColorTemperature',
3903             Format => 'int16u',
3904             },
3905             0xa7 => {
3906             Name => 'PictureStyle',
3907             Format => 'int8u',
3908             Flags => ['PrintHex','SeparateTable'],
3909             PrintConv => \%pictureStyles,
3910             },
3911             0xbd => {
3912             Name => 'HighISONoiseReduction',
3913             PrintConv => {
3914             0 => 'Standard',
3915             1 => 'Low',
3916             2 => 'Strong',
3917             3 => 'Off',
3918             },
3919             },
3920             0xbf => {
3921             Name => 'AutoLightingOptimizer',
3922             PrintConv => {
3923             0 => 'Standard',
3924             1 => 'Low',
3925             2 => 'Strong',
3926             3 => 'Off',
3927             },
3928             },
3929             0xe6 => {
3930             Name => 'LensType',
3931             Format => 'int16uRev', # value is big-endian
3932             SeparateTable => 1,
3933             ValueConvInv => 'int($val)', # (must truncate decimal part)
3934             PrintConv => \%canonLensTypes,
3935             },
3936             0xe8 => { %ciMinFocal },
3937             0xea => { %ciMaxFocal,
3938             # offset changes after this for different firmware versions
3939             Hook => '$varSize += ($$self{CanonFirm} ? -36 : 0x10000) if $$self{CanonFirm} < 2',
3940             },
3941             0x17e => {
3942             Name => 'FirmwareVersion',
3943             Format => 'string[6]',
3944             Writable => 0, # not writable for logic reasons
3945             # some firmwares have a null instead of a space after the version number
3946             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
3947             },
3948             0x1bb => {
3949             Name => 'FileIndex',
3950             Groups => { 2 => 'Image' },
3951             Format => 'int32u',
3952             ValueConv => '$val + 1',
3953             ValueConvInv => '$val - 1',
3954             },
3955             0x1c7 => { #(NC)
3956             Name => 'DirectoryIndex',
3957             Groups => { 2 => 'Image' },
3958             Format => 'int32u',
3959             ValueConv => '$val - 1',
3960             ValueConvInv => '$val + 1',
3961             },
3962             0x2f7 => { #48
3963             Name => 'PictureStyleInfo',
3964             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
3965             },
3966             );
3967              
3968             # Camera information for 5D Mark III (MakerNotes tag 0x0d) (ref PH)
3969             %Image::ExifTool::Canon::CameraInfo5DmkIII = (
3970             %binaryDataAttrs,
3971             FORMAT => 'int8u',
3972             FIRST_ENTRY => 0,
3973             PRIORITY => 0,
3974             DATAMEMBER => [ 0x00, 0x1b, 0x23, 0x8e, 0x157 ],
3975             IS_SUBDIR => [ 0x3b0 ],
3976             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
3977             NOTES => q{
3978             CameraInfo tags for the EOS 5D Mark III. Indices shown are for firmware
3979             versions 1.0.x, but they may be different for other firmware versions.
3980             },
3981             0x00 => {
3982             Name => 'FirmwareVersionLookAhead',
3983             Hidden => 1,
3984             # look ahead to check location of FirmwareVersion string
3985             Format => 'undef[0x24d]',
3986             RawConv => q{
3987             my $t = substr($val, 0x22c, 6); # 1 = firmware 4.5.4/4.5.6
3988             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
3989             $t = substr($val, 0x22d, 6); # 2 = firmware 5.2.2/5.3.1/5.4.2
3990             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
3991             $t = substr($val, 0x23c, 6); # 3 = firmware 1.0.3/1.0.7
3992             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 3, return undef;
3993             $t = substr($val, 0x242, 6); # 4 = firmware 1.2.1
3994             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 4, return undef;
3995             $t = substr($val, 0x247, 6); # 5 = firmware 1.3.5
3996             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 5, return undef;
3997             $self->Warn('Unrecognized CameraInfo5DmkIII firmware version');
3998             $$self{CanonFirm} = 0;
3999             return undef; # not a real tag
4000             },
4001             },
4002             0x03 => { %ciFNumber },
4003             0x04 => { %ciExposureTime },
4004             0x06 => { %ciISO },
4005             0x1b => { %ciCameraTemperature,
4006             # decrement $varSize for missing byte after this tag with firmware 5.x and earlier
4007             # (and add large offset to effectively abort processing if unknown firmware)
4008             Hook => '$varSize += ($$self{CanonFirm} ? -1 : 0x10000) if $$self{CanonFirm} < 3',
4009             },
4010             0x23 => { %ciFocalLength,
4011             Hook => q{
4012             $varSize -= 3 if $$self{CanonFirm} == 1;
4013             $varSize -= 2 if $$self{CanonFirm} == 2;
4014             $varSize += 6 if $$self{CanonFirm} >= 4;
4015             },
4016             },
4017             0x7d => {
4018             Name => 'CameraOrientation',
4019             PrintConv => {
4020             0 => 'Horizontal (normal)',
4021             1 => 'Rotate 90 CW',
4022             2 => 'Rotate 270 CW',
4023             },
4024             },
4025             0x8c => {
4026             Name => 'FocusDistanceUpper',
4027             %focusDistanceByteSwap,
4028             },
4029             0x8e => {
4030             Name => 'FocusDistanceLower',
4031             %focusDistanceByteSwap,
4032             Hook => q{
4033             $varSize -= 4 if $$self{CanonFirm} < 3;
4034             $varSize += 5 if $$self{CanonFirm} > 4;
4035             },
4036             },
4037             0xbc => {
4038             Name => 'WhiteBalance',
4039             Format => 'int16u',
4040             SeparateTable => 1,
4041             PrintConv => \%canonWhiteBalance,
4042             },
4043             0xc0 => {
4044             Name => 'ColorTemperature',
4045             Format => 'int16u',
4046             },
4047             0xf4 => {
4048             Name => 'PictureStyle',
4049             Format => 'int8u',
4050             Flags => ['PrintHex','SeparateTable'],
4051             PrintConv => \%pictureStyles,
4052             },
4053             0x153 => {
4054             Name => 'LensType',
4055             Format => 'int16uRev', # value is big-endian
4056             SeparateTable => 1,
4057             ValueConvInv => 'int($val)', # (must truncate decimal part)
4058             PrintConv => \%canonLensTypes,
4059             },
4060             0x155 => { %ciMinFocal },
4061             0x157 => { %ciMaxFocal,
4062             Hook => '$varSize -= 8 if $$self{CanonFirm} < 3',
4063             },
4064             0x164 => {
4065             Name => 'LensSerialNumber',
4066             Format => 'undef[5]',
4067             Priority => 0,
4068             ValueConv => 'unpack("H*",$val)',
4069             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
4070             },
4071             0x23c => {
4072             Name => 'FirmwareVersion',
4073             Format => 'string[6]',
4074             Writable => 0,
4075             },
4076             # the 5DmkIII has "User setting1" and "User setting2" file naming options:
4077             # - with "User setting1" 4 characters are selectable
4078             # - with "User setting2", 3 characters are selectable, and the 4th character
4079             # - in the file name corresponds to the image size:
4080             # L=large, M=medium, S=small1, T=small2, U=small3, _=movie
4081             # - as shipped, the first 4 characters of the file name are unique to the camera
4082             0x28c => { # used for file names like IMG_xxxx.JPG
4083             Name => 'FileIndex',
4084             Groups => { 2 => 'Image' },
4085             Format => 'int32u',
4086             ValueConv => '$val + 1',
4087             ValueConvInv => '$val - 1',
4088             },
4089             0x290 => { # used for file names like 2F0Axxxx.JPG and 6T3Cxxxx.JPG
4090             Name => 'FileIndex2',
4091             Groups => { 2 => 'Image' },
4092             Format => 'int32u',
4093             ValueConv => '$val + 1',
4094             ValueConvInv => '$val - 1',
4095             },
4096             0x298 => { #(NC)
4097             Name => 'DirectoryIndex',
4098             Groups => { 2 => 'Image' },
4099             Format => 'int32u',
4100             ValueConv => '$val - 1',
4101             ValueConvInv => '$val + 1',
4102             },
4103             0x29c => { #(NC)
4104             Name => 'DirectoryIndex2',
4105             Groups => { 2 => 'Image' },
4106             Format => 'int32u',
4107             ValueConv => '$val - 1',
4108             ValueConvInv => '$val + 1',
4109             },
4110             0x3b0 => {
4111             Name => 'PictureStyleInfo',
4112             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4113             },
4114             );
4115              
4116             # Camera information for 6D (MakerNotes tag 0x0d) (ref PH)
4117             %Image::ExifTool::Canon::CameraInfo6D = (
4118             %binaryDataAttrs,
4119             FORMAT => 'int8u',
4120             FIRST_ENTRY => 0,
4121             PRIORITY => 0,
4122             IS_SUBDIR => [ 0x3c6 ],
4123             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4124             NOTES => 'CameraInfo tags for the EOS 6D.',
4125             0x03 => { %ciFNumber },
4126             0x04 => { %ciExposureTime },
4127             0x06 => { %ciISO },
4128             0x1b => { %ciCameraTemperature },
4129             0x23 => { %ciFocalLength },
4130             0x83 => { # (5DmkIII + 6)
4131             Name => 'CameraOrientation',
4132             PrintConv => {
4133             0 => 'Horizontal (normal)',
4134             1 => 'Rotate 90 CW',
4135             2 => 'Rotate 270 CW',
4136             },
4137             },
4138             0x92 => { # (5DmkIII + 6)
4139             Name => 'FocusDistanceUpper',
4140             %focusDistanceByteSwap,
4141             },
4142             0x94 => { # (5DmkIII + 6)
4143             Name => 'FocusDistanceLower',
4144             %focusDistanceByteSwap,
4145             },
4146             0xc2 => { # (5DmkIII + 6)
4147             Name => 'WhiteBalance',
4148             Format => 'int16u',
4149             SeparateTable => 1,
4150             PrintConv => \%canonWhiteBalance,
4151             },
4152             0xc6 => { # (5DmkIII + 6)
4153             Name => 'ColorTemperature',
4154             Format => 'int16u',
4155             },
4156             0xfa => { # (5DmkIII + 6)
4157             Name => 'PictureStyle',
4158             Format => 'int8u',
4159             Flags => ['PrintHex','SeparateTable'],
4160             PrintConv => \%pictureStyles,
4161             },
4162             0x161 => { # (5DmkIII + 0x0e)
4163             Name => 'LensType',
4164             Format => 'int16uRev', # value is big-endian
4165             SeparateTable => 1,
4166             ValueConvInv => 'int($val)', # (must truncate decimal part)
4167             PrintConv => \%canonLensTypes,
4168             },
4169             0x163 => { %ciMinFocal }, # (5DmkIII + 0x0e)
4170             0x165 => { %ciMaxFocal }, # (5DmkIII + 0x0e)
4171             0x256 => { # (5DmkIII + 0x1a)
4172             Name => 'FirmwareVersion',
4173             Format => 'string[6]',
4174             Writable => 0,
4175             },
4176             0x2aa => { # (5DmkIII + 0x16 or 0x1e)
4177             Name => 'FileIndex',
4178             Groups => { 2 => 'Image' },
4179             Format => 'int32u',
4180             ValueConv => '$val + 1',
4181             ValueConvInv => '$val - 1',
4182             },
4183             0x2b6 => { #(NC) (5DmkIII + 0x16 or 0x1e)
4184             Name => 'DirectoryIndex',
4185             Groups => { 2 => 'Image' },
4186             Format => 'int32u',
4187             ValueConv => '$val - 1',
4188             ValueConvInv => '$val + 1',
4189             },
4190             0x3c6 => { # (5DmkIII + 0x16)
4191             Name => 'PictureStyleInfo',
4192             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4193             },
4194             );
4195              
4196             # Camera information for 7D (MakerNotes tag 0x0d) (ref PH)
4197             %Image::ExifTool::Canon::CameraInfo7D = (
4198             %binaryDataAttrs,
4199             FORMAT => 'int8u',
4200             FIRST_ENTRY => 0,
4201             PRIORITY => 0,
4202             DATAMEMBER => [ 0x00, 0x1e ],
4203             IS_SUBDIR => [ 0x327 ],
4204             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4205             NOTES => q{
4206             CameraInfo tags for the EOS 7D. Indices shown are for firmware versions
4207             1.0.x, but they may be different for other firmware versions.
4208             },
4209             0x00 => {
4210             Name => 'FirmwareVersionLookAhead',
4211             Hidden => 1,
4212             # look ahead to check location of FirmwareVersion string
4213             Format => 'undef[0x1b2]',
4214             RawConv => q{
4215             my $t = substr($val, 0x1a8, 6); # 1 = firmware 3.7.5
4216             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4217             $t = substr($val, 0x1ac, 6); # 2 = firmware 1.0.7/1.0.8/1.1.0/1.2.1/1.2.2
4218             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4219             $self->Warn('Unrecognized CameraInfo7D firmware version');
4220             $$self{CanonFirm} = 0;
4221             return undef; # not a real tag
4222             },
4223             },
4224             0x03 => { %ciFNumber },
4225             0x04 => { %ciExposureTime },
4226             0x06 => { %ciISO },
4227             0x07 => {
4228             Name => 'HighlightTonePriority',
4229             PrintConv => \%offOn,
4230             },
4231             0x08 => { #37
4232             Name => 'MeasuredEV2',
4233             Description => 'Measured EV 2',
4234             RawConv => '$val ? $val : undef',
4235             ValueConv => '$val / 8 - 6',
4236             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4237             },
4238             0x09 => { #37
4239             Name => 'MeasuredEV',
4240             Description => 'Measured EV',
4241             RawConv => '$val ? $val : undef',
4242             ValueConv => '$val / 8 - 6',
4243             ValueConvInv => 'int(($val + 6) * 8 + 0.5)',
4244             },
4245             0x15 => { #PH (580 EX II)
4246             Name => 'FlashMeteringMode',
4247             PrintConv => {
4248             0 => 'E-TTL',
4249             3 => 'TTL',
4250             4 => 'External Auto',
4251             5 => 'External Manual',
4252             6 => 'Off',
4253             },
4254             },
4255             0x19 => { %ciCameraTemperature },
4256             0x1e => { %ciFocalLength,
4257             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4258             },
4259             0x35 => {
4260             Name => 'CameraOrientation',
4261             PrintConv => {
4262             0 => 'Horizontal (normal)',
4263             1 => 'Rotate 90 CW',
4264             2 => 'Rotate 270 CW',
4265             },
4266             },
4267             0x54 => {
4268             Name => 'FocusDistanceUpper',
4269             %focusDistanceByteSwap,
4270             },
4271             0x56 => {
4272             Name => 'FocusDistanceLower',
4273             %focusDistanceByteSwap,
4274             },
4275             0x77 => {
4276             Name => 'WhiteBalance',
4277             Format => 'int16u',
4278             SeparateTable => 1,
4279             PrintConv => \%canonWhiteBalance,
4280             },
4281             0x7b => {
4282             Name => 'ColorTemperature',
4283             Format => 'int16u',
4284             },
4285             0xaf => {
4286             Name => 'CameraPictureStyle',
4287             PrintHex => 1,
4288             PrintConv => {
4289             0x81 => 'Standard',
4290             0x82 => 'Portrait',
4291             0x83 => 'Landscape',
4292             0x84 => 'Neutral',
4293             0x85 => 'Faithful',
4294             0x86 => 'Monochrome',
4295             0x21 => 'User Defined 1',
4296             0x22 => 'User Defined 2',
4297             0x23 => 'User Defined 3',
4298             },
4299             },
4300             0xc9 => {
4301             Name => 'HighISONoiseReduction',
4302             PrintConv => {
4303             0 => 'Standard',
4304             1 => 'Low',
4305             2 => 'Strong',
4306             3 => 'Off',
4307             },
4308             },
4309             0x112 => {
4310             Name => 'LensType',
4311             Format => 'int16uRev', # value is big-endian
4312             SeparateTable => 1,
4313             ValueConvInv => 'int($val)', # (must truncate decimal part)
4314             PrintConv => \%canonLensTypes,
4315             },
4316             0x114 => { %ciMinFocal },
4317             0x116 => { %ciMaxFocal },
4318             0x1ac => {
4319             Name => 'FirmwareVersion',
4320             Format => 'string[6]',
4321             Writable => 0, # not writable for logic reasons
4322             # some firmwares have a null instead of a space after the version number
4323             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4324             },
4325             0x1eb => {
4326             Name => 'FileIndex',
4327             Groups => { 2 => 'Image' },
4328             Format => 'int32u',
4329             ValueConv => '$val + 1',
4330             ValueConvInv => '$val - 1',
4331             },
4332             0x1f7 => { #(NC)
4333             Name => 'DirectoryIndex',
4334             Groups => { 2 => 'Image' },
4335             Format => 'int32u',
4336             ValueConv => '$val - 1',
4337             ValueConvInv => '$val + 1',
4338             },
4339             0x327 => { #48
4340             Name => 'PictureStyleInfo',
4341             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4342             },
4343             );
4344              
4345             # Canon camera information for 40D (MakerNotes tag 0x0d) (ref PH)
4346             %Image::ExifTool::Canon::CameraInfo40D = (
4347             %binaryDataAttrs,
4348             FORMAT => 'int8u',
4349             FIRST_ENTRY => 0,
4350             PRIORITY => 0,
4351             IS_SUBDIR => [ 0x25b ],
4352             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4353             NOTES => 'CameraInfo tags for the EOS 40D.',
4354             0x03 => { %ciFNumber }, #PH
4355             0x04 => { %ciExposureTime }, #PH
4356             0x06 => { %ciISO }, #PH
4357             0x15 => { #PH (580 EX II)
4358             Name => 'FlashMeteringMode',
4359             PrintConv => {
4360             0 => 'E-TTL',
4361             3 => 'TTL',
4362             4 => 'External Auto',
4363             5 => 'External Manual',
4364             6 => 'Off',
4365             },
4366             },
4367             0x18 => { %ciCameraTemperature }, #36
4368             0x1b => { %ciMacroMagnification }, #PH
4369             0x1d => { %ciFocalLength }, #PH
4370             0x30 => { #20
4371             Name => 'CameraOrientation',
4372             PrintConv => {
4373             0 => 'Horizontal (normal)',
4374             1 => 'Rotate 90 CW',
4375             2 => 'Rotate 270 CW',
4376             },
4377             },
4378             0x43 => { #21/24
4379             Name => 'FocusDistanceUpper',
4380             # this is very odd (little-endian number on odd boundary),
4381             # but it does seem to work better with my sample images - PH
4382             %focusDistanceByteSwap,
4383             },
4384             0x45 => { #21/24
4385             Name => 'FocusDistanceLower',
4386             %focusDistanceByteSwap,
4387             },
4388             0x6f => { #15
4389             Name => 'WhiteBalance',
4390             Format => 'int16u',
4391             PrintConv => \%canonWhiteBalance,
4392             SeparateTable => 1,
4393             },
4394             0x73 => { #15
4395             Name => 'ColorTemperature',
4396             Format => 'int16u',
4397             },
4398             0xd6 => { #15
4399             Name => 'LensType',
4400             Format => 'int16uRev', # value is big-endian
4401             SeparateTable => 1,
4402             ValueConvInv => 'int($val)', # (must truncate decimal part)
4403             PrintConv => \%canonLensTypes,
4404             },
4405             0xd8 => { %ciMinFocal }, #15
4406             0xda => { %ciMaxFocal }, #15
4407             0xff => { #15
4408             Name => 'FirmwareVersion',
4409             Format => 'string[6]',
4410             },
4411             0x133 => { #27
4412             Name => 'FileIndex',
4413             Groups => { 2 => 'Image' },
4414             Format => 'int32u',
4415             Notes => 'combined with DirectoryIndex to give the Composite FileNumber tag',
4416             ValueConv => '$val + 1',
4417             ValueConvInv => '$val - 1',
4418             },
4419             0x13f => { #27
4420             Name => 'DirectoryIndex',
4421             Groups => { 2 => 'Image' },
4422             Format => 'int32u',
4423             ValueConv => '$val - 1', # yes, minus (opposite to FileIndex)
4424             ValueConvInv => '$val + 1',
4425             },
4426             0x25b => {
4427             Name => 'PictureStyleInfo',
4428             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4429             },
4430             0x92b => { #33
4431             Name => 'LensModel',
4432             Format => 'string[64]',
4433             },
4434             );
4435              
4436             # Canon camera information for 50D (MakerNotes tag 0x0d) (ref PH)
4437             %Image::ExifTool::Canon::CameraInfo50D = (
4438             %binaryDataAttrs,
4439             FORMAT => 'int8u',
4440             FIRST_ENTRY => 0,
4441             PRIORITY => 0,
4442             DATAMEMBER => [ 0x00, 0xee ],
4443             IS_SUBDIR => [ 0x2d7 ],
4444             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4445             NOTES => q{
4446             CameraInfo tags for the EOS 50D. Indices shown are for firmware versions
4447             1.0.x, but they may be different for other firmware versions.
4448             },
4449             0x00 => {
4450             Name => 'FirmwareVersionLookAhead',
4451             Hidden => 1,
4452             # look ahead to check location of FirmwareVersion string
4453             Format => 'undef[0x164]',
4454             RawConv => q{
4455             my $t = substr($val, 0x15a, 6); # 1 = firmware 2.6.1
4456             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 1, return undef;
4457             $t = substr($val, 0x15e, 6); # 2 = firmware 2.9.1/3.1.1/1.0.2/1.0.3
4458             $t =~ /^\d+\.\d+\.\d+/ and $$self{CanonFirm} = 2, return undef;
4459             $self->Warn('Unrecognized CameraInfo50D firmware version');
4460             $$self{CanonFirm} = 0;
4461             return undef; # not a real tag
4462             },
4463             },
4464             0x03 => { %ciFNumber },
4465             0x04 => { %ciExposureTime },
4466             0x06 => { %ciISO },
4467             0x07 => {
4468             Name => 'HighlightTonePriority',
4469             PrintConv => \%offOn,
4470             },
4471             0x15 => { #PH (580 EX II)
4472             Name => 'FlashMeteringMode',
4473             PrintConv => {
4474             0 => 'E-TTL',
4475             3 => 'TTL',
4476             4 => 'External Auto',
4477             5 => 'External Manual',
4478             6 => 'Off',
4479             },
4480             },
4481             0x19 => { %ciCameraTemperature }, #36
4482             0x1e => { %ciFocalLength },
4483             0x31 => {
4484             Name => 'CameraOrientation',
4485             PrintConv => {
4486             0 => 'Horizontal (normal)',
4487             1 => 'Rotate 90 CW',
4488             2 => 'Rotate 270 CW',
4489             },
4490             },
4491             0x50 => { #33
4492             Name => 'FocusDistanceUpper',
4493             %focusDistanceByteSwap,
4494             },
4495             0x52 => { #33
4496             Name => 'FocusDistanceLower',
4497             %focusDistanceByteSwap,
4498             },
4499             0x6f => {
4500             Name => 'WhiteBalance',
4501             Format => 'int16u',
4502             SeparateTable => 1,
4503             PrintConv => \%canonWhiteBalance,
4504             },
4505             0x73 => { #33
4506             Name => 'ColorTemperature',
4507             Format => 'int16u',
4508             },
4509             0xa7 => {
4510             Name => 'PictureStyle',
4511             Format => 'int8u',
4512             Flags => ['PrintHex','SeparateTable'],
4513             PrintConv => \%pictureStyles,
4514             },
4515             0xbd => {
4516             Name => 'HighISONoiseReduction',
4517             PrintConv => {
4518             0 => 'Standard',
4519             1 => 'Low',
4520             2 => 'Strong',
4521             3 => 'Off',
4522             },
4523             },
4524             0xbf => {
4525             Name => 'AutoLightingOptimizer',
4526             PrintConv => {
4527             0 => 'Standard',
4528             1 => 'Low',
4529             2 => 'Strong',
4530             3 => 'Off',
4531             },
4532             },
4533             0xea => { #33
4534             Name => 'LensType',
4535             Format => 'int16uRev', # value is big-endian
4536             SeparateTable => 1,
4537             ValueConvInv => 'int($val)', # (must truncate decimal part)
4538             PrintConv => \%canonLensTypes,
4539             },
4540             0xec => { %ciMinFocal },
4541             0xee => { %ciMaxFocal,
4542             Hook => '$varSize += ($$self{CanonFirm} ? -4 : 0x10000) if $$self{CanonFirm} < 2',
4543             },
4544             0x15e => { #33
4545             Name => 'FirmwareVersion',
4546             Format => 'string[6]',
4547             Writable => 0,
4548             },
4549             0x19b => {
4550             Name => 'FileIndex',
4551             Groups => { 2 => 'Image' },
4552             Format => 'int32u',
4553             ValueConv => '$val + 1',
4554             ValueConvInv => '$val - 1',
4555             },
4556             0x1a7 => { #(NC)
4557             Name => 'DirectoryIndex',
4558             Groups => { 2 => 'Image' },
4559             Format => 'int32u',
4560             ValueConv => '$val - 1',
4561             ValueConvInv => '$val + 1',
4562             },
4563             0x2d7 => {
4564             Name => 'PictureStyleInfo',
4565             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4566             },
4567             );
4568              
4569             # Canon camera information for 60D/1200D (MakerNotes tag 0x0d) (ref PH)
4570             # NOTE: Can probably borrow more 50D tags here, possibly with an offset
4571             %Image::ExifTool::Canon::CameraInfo60D = (
4572             %binaryDataAttrs,
4573             FORMAT => 'int8u',
4574             FIRST_ENTRY => 0,
4575             PRIORITY => 0,
4576             IS_SUBDIR => [ 0x2f9, 0x321 ],
4577             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4578             NOTES => 'CameraInfo tags for the EOS 60D and 1200D.',
4579             0x03 => { %ciFNumber },
4580             0x04 => { %ciExposureTime },
4581             0x06 => { %ciISO },
4582             0x19 => { %ciCameraTemperature },
4583             0x1e => { %ciFocalLength },
4584             0x36 => {
4585             Name => 'CameraOrientation',
4586             Condition => '$$self{Model} =~ /EOS 60D$/', #(NC)
4587             Notes => '60D only',
4588             PrintConv => {
4589             0 => 'Horizontal (normal)',
4590             1 => 'Rotate 90 CW',
4591             2 => 'Rotate 270 CW',
4592             },
4593             },
4594             0x3a => { #IB
4595             Name => 'CameraOrientation',
4596             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4597             Notes => '1200D only',
4598             PrintConv => {
4599             0 => 'Horizontal (normal)',
4600             1 => 'Rotate 90 CW',
4601             2 => 'Rotate 270 CW',
4602             },
4603             },
4604             0x55 => {
4605             Name => 'FocusDistanceUpper',
4606             Condition => '$$self{Model} =~ /EOS 60D$/',
4607             Notes => '60D only',
4608             %focusDistanceByteSwap,
4609             },
4610             0x57 => {
4611             Name => 'FocusDistanceLower',
4612             Condition => '$$self{Model} =~ /EOS 60D$/',
4613             Notes => '60D only',
4614             %focusDistanceByteSwap,
4615             },
4616             0x7d => {
4617             Name => 'ColorTemperature',
4618             Condition => '$$self{Model} =~ /EOS 60D$/',
4619             Notes => '60D only',
4620             Format => 'int16u',
4621             },
4622             0xe8 => {
4623             Name => 'LensType',
4624             Format => 'int16uRev', # value is big-endian
4625             SeparateTable => 1,
4626             ValueConvInv => 'int($val)', # (must truncate decimal part)
4627             PrintConv => \%canonLensTypes,
4628             },
4629             0xea => { %ciMinFocal },
4630             0xec => { %ciMaxFocal },
4631             0x199 => { # (at this location for 60D firmware 2.8.1/1.0.5, and 1200D 3.3.1/1.0.0)
4632             Name => 'FirmwareVersion',
4633             Format => 'string[6]',
4634             Writable => 0,
4635             },
4636             0x1d9 => {
4637             Name => 'FileIndex',
4638             Condition => '$$self{Model} =~ /EOS 60D$/',
4639             Notes => '60D only',
4640             Groups => { 2 => 'Image' },
4641             Format => 'int32u',
4642             ValueConv => '$val + 1',
4643             ValueConvInv => '$val - 1',
4644             },
4645             0x1e5 => { #(NC)
4646             Name => 'DirectoryIndex',
4647             Condition => '$$self{Model} =~ /EOS 60D$/',
4648             Notes => '60D only',
4649             Groups => { 2 => 'Image' },
4650             Format => 'int32u',
4651             ValueConv => '$val - 1',
4652             ValueConvInv => '$val + 1',
4653             },
4654             0x2f9 => {
4655             Name => 'PictureStyleInfo',
4656             Condition => '$$self{Model} =~ /\b(1200D|REBEL T5|Kiss X70)\b/',
4657             Notes => '1200D',
4658             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4659             },
4660             0x321 => {
4661             Name => 'PictureStyleInfo',
4662             Condition => '$$self{Model} =~ /EOS 60D$/',
4663             Notes => '60D',
4664             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4665             },
4666             );
4667              
4668             # Canon camera information for 70D (MakerNotes tag 0x0d) (ref PH)
4669             %Image::ExifTool::Canon::CameraInfo70D = (
4670             %binaryDataAttrs,
4671             FORMAT => 'int8u',
4672             FIRST_ENTRY => 0,
4673             PRIORITY => 0,
4674             IS_SUBDIR => [ 0x3cf ],
4675             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4676             NOTES => 'CameraInfo tags for the EOS 70D.',
4677             0x03 => { %ciFNumber },
4678             0x04 => { %ciExposureTime },
4679             0x06 => { %ciISO },
4680             0x1b => { %ciCameraTemperature },
4681             0x23 => { %ciFocalLength },
4682             # 0x36 - focal length again?
4683             0x84 => {
4684             Name => 'CameraOrientation',
4685             PrintConv => {
4686             0 => 'Horizontal (normal)',
4687             1 => 'Rotate 90 CW',
4688             2 => 'Rotate 270 CW',
4689             },
4690             },
4691             0x93 => {
4692             Name => 'FocusDistanceUpper',
4693             %focusDistanceByteSwap,
4694             },
4695             0x95 => {
4696             Name => 'FocusDistanceLower',
4697             %focusDistanceByteSwap,
4698             },
4699             0xc7 => {
4700             Name => 'ColorTemperature',
4701             Format => 'int16u',
4702             },
4703             0x166 => {
4704             Name => 'LensType',
4705             Format => 'int16uRev', # value is big-endian
4706             SeparateTable => 1,
4707             ValueConvInv => 'int($val)', # (must truncate decimal part)
4708             PrintConv => \%canonLensTypes,
4709             },
4710             0x168 => { %ciMinFocal },
4711             0x16a => { %ciMaxFocal },
4712             0x25e => { # (at this location for firmware 6.1.2, 1.0.4 and 1.1.1)
4713             Name => 'FirmwareVersion',
4714             Format => 'string[6]',
4715             Writable => 0,
4716             },
4717             0x2b3 => {
4718             Name => 'FileIndex',
4719             Groups => { 2 => 'Image' },
4720             Format => 'int32u',
4721             ValueConv => '$val + 1',
4722             ValueConvInv => '$val - 1',
4723             },
4724             0x2bf => { #(NC)
4725             Name => 'DirectoryIndex',
4726             Groups => { 2 => 'Image' },
4727             Format => 'int32u',
4728             ValueConv => '$val - 1',
4729             ValueConvInv => '$val + 1',
4730             },
4731             0x3cf => { #48
4732             Name => 'PictureStyleInfo',
4733             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
4734             },
4735             );
4736              
4737             # Canon camera information for 80D (MakerNotes tag 0x0d) (ref PH)
4738             %Image::ExifTool::Canon::CameraInfo80D = (
4739             %binaryDataAttrs,
4740             FORMAT => 'int8u',
4741             FIRST_ENTRY => 0,
4742             PRIORITY => 0,
4743             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4744             NOTES => 'CameraInfo tags for the EOS 80D.',
4745             0x03 => { %ciFNumber },
4746             0x04 => { %ciExposureTime },
4747             0x06 => { %ciISO },
4748             0x1b => { %ciCameraTemperature },
4749             0x23 => { %ciFocalLength },
4750             0x96 => {
4751             Name => 'CameraOrientation',
4752             PrintConv => {
4753             0 => 'Horizontal (normal)',
4754             1 => 'Rotate 90 CW',
4755             2 => 'Rotate 270 CW',
4756             },
4757             },
4758             0xa5 => {
4759             Name => 'FocusDistanceUpper',
4760             %focusDistanceByteSwap,
4761             },
4762             0xa7 => {
4763             Name => 'FocusDistanceLower',
4764             %focusDistanceByteSwap,
4765             },
4766             0x13a => {
4767             Name => 'ColorTemperature',
4768             Format => 'int16u',
4769             },
4770             0x189 => {
4771             Name => 'LensType',
4772             Format => 'int16uRev', # value is big-endian
4773             SeparateTable => 1,
4774             ValueConvInv => 'int($val)', # (must truncate decimal part)
4775             PrintConv => \%canonLensTypes,
4776             },
4777             0x18b => { %ciMinFocal },
4778             0x18d => { %ciMaxFocal },
4779             0x45a => { # (at this location for firmware 1.0.1)
4780             Name => 'FirmwareVersion',
4781             Format => 'string[6]',
4782             Writable => 0,
4783             },
4784             0x4ae => {
4785             Name => 'FileIndex',
4786             Groups => { 2 => 'Image' },
4787             Format => 'int32u',
4788             ValueConv => '$val + 1',
4789             ValueConvInv => '$val - 1',
4790             },
4791             0x4ba => { #(NC)
4792             Name => 'DirectoryIndex',
4793             Groups => { 2 => 'Image' },
4794             Format => 'int32u',
4795             ValueConv => '$val - 1',
4796             ValueConvInv => '$val + 1',
4797             },
4798             );
4799              
4800             # Canon camera information for 450D (MakerNotes tag 0x0d) (ref PH)
4801             %Image::ExifTool::Canon::CameraInfo450D = (
4802             %binaryDataAttrs,
4803             FORMAT => 'int8u',
4804             FIRST_ENTRY => 0,
4805             PRIORITY => 0,
4806             IS_SUBDIR => [ 0x263 ],
4807             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4808             NOTES => 'CameraInfo tags for the EOS 450D.',
4809             0x03 => { %ciFNumber }, #PH
4810             0x04 => { %ciExposureTime }, #PH
4811             0x06 => { %ciISO }, #PH
4812             0x15 => { #PH (580 EX II)
4813             Name => 'FlashMeteringMode',
4814             PrintConv => {
4815             0 => 'E-TTL',
4816             3 => 'TTL',
4817             4 => 'External Auto',
4818             5 => 'External Manual',
4819             6 => 'Off',
4820             },
4821             },
4822             0x18 => { %ciCameraTemperature }, #36
4823             0x1b => { %ciMacroMagnification }, #PH
4824             0x1d => { %ciFocalLength }, #PH
4825             0x30 => { #20
4826             Name => 'CameraOrientation',
4827             PrintConv => {
4828             0 => 'Horizontal (normal)',
4829             1 => 'Rotate 90 CW',
4830             2 => 'Rotate 270 CW',
4831             },
4832             },
4833             0x43 => { #20
4834             Name => 'FocusDistanceUpper',
4835             # this is very odd (little-endian number on odd boundary),
4836             # but it does seem to work better with my sample images - PH
4837             %focusDistanceByteSwap,
4838             },
4839             0x45 => { #20
4840             Name => 'FocusDistanceLower',
4841             %focusDistanceByteSwap,
4842             },
4843             0x6f => { #PH
4844             Name => 'WhiteBalance',
4845             Format => 'int16u',
4846             PrintConv => \%canonWhiteBalance,
4847             SeparateTable => 1,
4848             },
4849             0x73 => { #PH
4850             Name => 'ColorTemperature',
4851             Format => 'int16u',
4852             },
4853             0xde => { #33
4854             Name => 'LensType',
4855             Format => 'int16uRev', # value is big-endian
4856             SeparateTable => 1,
4857             ValueConvInv => 'int($val)', # (must truncate decimal part)
4858             PrintConv => \%canonLensTypes,
4859             },
4860             0x107 => { #PH
4861             Name => 'FirmwareVersion',
4862             Format => 'string[6]',
4863             },
4864             0x10f => { #20
4865             Name => 'OwnerName',
4866             Format => 'string[32]',
4867             },
4868             0x133 => { #20
4869             Name => 'DirectoryIndex',
4870             Groups => { 2 => 'Image' },
4871             Format => 'int32u',
4872             },
4873             0x13f => { #20
4874             Name => 'FileIndex',
4875             Groups => { 2 => 'Image' },
4876             Format => 'int32u',
4877             ValueConv => '$val + 1',
4878             ValueConvInv => '$val - 1',
4879             },
4880             0x263 => { #PH
4881             Name => 'PictureStyleInfo',
4882             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
4883             },
4884             0x933 => { #33
4885             Name => 'LensModel',
4886             Format => 'string[64]',
4887             },
4888             );
4889              
4890             # Canon camera information for 500D (MakerNotes tag 0x0d) (ref PH)
4891             %Image::ExifTool::Canon::CameraInfo500D = (
4892             %binaryDataAttrs,
4893             FORMAT => 'int8u',
4894             FIRST_ENTRY => 0,
4895             PRIORITY => 0,
4896             IS_SUBDIR => [ 0x30b ],
4897             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
4898             NOTES => 'CameraInfo tags for the EOS 500D.',
4899             0x03 => { %ciFNumber },
4900             0x04 => { %ciExposureTime },
4901             0x06 => { %ciISO },
4902             0x07 => {
4903             Name => 'HighlightTonePriority',
4904             PrintConv => \%offOn,
4905             },
4906             0x15 => { #PH (580 EX II)
4907             Name => 'FlashMeteringMode',
4908             PrintConv => {
4909             0 => 'E-TTL',
4910             3 => 'TTL',
4911             4 => 'External Auto',
4912             5 => 'External Manual',
4913             6 => 'Off',
4914             },
4915             },
4916             0x19 => { %ciCameraTemperature },
4917             0x1e => { %ciFocalLength },
4918             0x31 => {
4919             Name => 'CameraOrientation',
4920             PrintConv => {
4921             0 => 'Horizontal (normal)',
4922             1 => 'Rotate 90 CW',
4923             2 => 'Rotate 270 CW',
4924             },
4925             },
4926             0x50 => {
4927             Name => 'FocusDistanceUpper',
4928             %focusDistanceByteSwap,
4929             },
4930             0x52 => {
4931             Name => 'FocusDistanceLower',
4932             %focusDistanceByteSwap,
4933             },
4934             0x73 => { # (50D + 4)
4935             Name => 'WhiteBalance',
4936             Format => 'int16u',
4937             SeparateTable => 1,
4938             PrintConv => \%canonWhiteBalance,
4939             },
4940             0x77 => { # (50D + 4)
4941             Name => 'ColorTemperature',
4942             Format => 'int16u',
4943             },
4944             0xab => { # (50D + 4)
4945             Name => 'PictureStyle',
4946             Format => 'int8u',
4947             Flags => ['PrintHex','SeparateTable'],
4948             PrintConv => \%pictureStyles,
4949             },
4950             0xbc => {
4951             Name => 'HighISONoiseReduction',
4952             PrintConv => {
4953             0 => 'Standard',
4954             1 => 'Low',
4955             2 => 'Strong',
4956             3 => 'Off',
4957             },
4958             },
4959             0xbe => {
4960             Name => 'AutoLightingOptimizer',
4961             PrintConv => {
4962             0 => 'Standard',
4963             1 => 'Low',
4964             2 => 'Strong',
4965             3 => 'Off',
4966             },
4967             },
4968             0xf6 => {
4969             Name => 'LensType',
4970             Format => 'int16uRev', # value is big-endian
4971             SeparateTable => 1,
4972             ValueConvInv => 'int($val)', # (must truncate decimal part)
4973             PrintConv => \%canonLensTypes,
4974             },
4975             0xf8 => { %ciMinFocal },
4976             0xfa => { %ciMaxFocal },
4977             0x190 => {
4978             Name => 'FirmwareVersion',
4979             Format => 'string[6]',
4980             Writable => 0,
4981             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
4982             },
4983             0x1d3 => {
4984             Name => 'FileIndex',
4985             Groups => { 2 => 'Image' },
4986             Format => 'int32u',
4987             ValueConv => '$val + 1',
4988             ValueConvInv => '$val - 1',
4989             },
4990             0x1df => { #(NC)
4991             Name => 'DirectoryIndex',
4992             Groups => { 2 => 'Image' },
4993             Format => 'int32u',
4994             ValueConv => '$val - 1',
4995             ValueConvInv => '$val + 1',
4996             },
4997             0x30b => {
4998             Name => 'PictureStyleInfo',
4999             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5000             },
5001             );
5002              
5003             # Canon camera information for 550D (MakerNotes tag 0x0d) (ref PH)
5004             %Image::ExifTool::Canon::CameraInfo550D = (
5005             %binaryDataAttrs,
5006             FORMAT => 'int8u',
5007             FIRST_ENTRY => 0,
5008             PRIORITY => 0,
5009             IS_SUBDIR => [ 0x31c ],
5010             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5011             NOTES => 'CameraInfo tags for the EOS 550D.',
5012             0x03 => { %ciFNumber },
5013             0x04 => { %ciExposureTime },
5014             0x06 => { %ciISO },
5015             0x07 => { #(NC)
5016             Name => 'HighlightTonePriority',
5017             PrintConv => \%offOn,
5018             },
5019             0x15 => { #(NC)
5020             Name => 'FlashMeteringMode',
5021             PrintConv => {
5022             0 => 'E-TTL',
5023             3 => 'TTL',
5024             4 => 'External Auto',
5025             5 => 'External Manual',
5026             6 => 'Off',
5027             },
5028             },
5029             0x19 => { %ciCameraTemperature }, # (500D + 0)
5030             0x1e => { %ciFocalLength }, # (500D + 0)
5031             0x35 => { # (500D + 4)
5032             Name => 'CameraOrientation',
5033             PrintConv => {
5034             0 => 'Horizontal (normal)',
5035             1 => 'Rotate 90 CW',
5036             2 => 'Rotate 270 CW',
5037             },
5038             },
5039             0x54 => { # (500D + 4)
5040             Name => 'FocusDistanceUpper',
5041             %focusDistanceByteSwap,
5042             },
5043             0x56 => { # (500D + 4)
5044             Name => 'FocusDistanceLower',
5045             %focusDistanceByteSwap,
5046             },
5047             0x78 => { # (500D + 5) (NC)
5048             Name => 'WhiteBalance',
5049             Format => 'int16u',
5050             SeparateTable => 1,
5051             PrintConv => \%canonWhiteBalance,
5052             },
5053             0x7c => { # (500D + 5)
5054             Name => 'ColorTemperature',
5055             Format => 'int16u',
5056             },
5057             0xb0 => { # (500D + 5)
5058             Name => 'PictureStyle',
5059             Format => 'int8u',
5060             Flags => ['PrintHex','SeparateTable'],
5061             PrintConv => \%pictureStyles,
5062             },
5063             0xff => { # (500D + 9)
5064             Name => 'LensType',
5065             Format => 'int16uRev', # value is big-endian
5066             SeparateTable => 1,
5067             ValueConvInv => 'int($val)', # (must truncate decimal part)
5068             PrintConv => \%canonLensTypes,
5069             },
5070             0x101 => { %ciMinFocal }, # (500D + 9)
5071             0x103 => { %ciMaxFocal }, # (500D + 9)
5072             0x1a4 => { # (500D + 0x11)
5073             Name => 'FirmwareVersion',
5074             Format => 'string[6]',
5075             Writable => 0,
5076             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5077             },
5078             0x1e4 => { # (500D + 0x11)
5079             Name => 'FileIndex',
5080             Groups => { 2 => 'Image' },
5081             Format => 'int32u',
5082             ValueConv => '$val + 1',
5083             ValueConvInv => '$val - 1',
5084             },
5085             0x1f0 => { # (500D + 0x11) (NC)
5086             Name => 'DirectoryIndex',
5087             Groups => { 2 => 'Image' },
5088             Format => 'int32u',
5089             ValueConv => '$val - 1',
5090             ValueConvInv => '$val + 1',
5091             },
5092             0x31c => { #48
5093             Name => 'PictureStyleInfo',
5094             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5095             },
5096             );
5097              
5098             # Canon camera information for 600D and 1100D (MakerNotes tag 0x0d) (ref PH)
5099             %Image::ExifTool::Canon::CameraInfo600D = (
5100             %binaryDataAttrs,
5101             FORMAT => 'int8u',
5102             FIRST_ENTRY => 0,
5103             PRIORITY => 0,
5104             IS_SUBDIR => [ 0x2fb ],
5105             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5106             NOTES => 'CameraInfo tags for the EOS 600D and 1100D.',
5107             0x03 => { %ciFNumber },
5108             0x04 => { %ciExposureTime },
5109             0x06 => { %ciISO },
5110             0x07 => { #(NC)
5111             Name => 'HighlightTonePriority',
5112             PrintConv => \%offOn,
5113             },
5114             0x15 => { #(NC)
5115             Name => 'FlashMeteringMode',
5116             PrintConv => {
5117             0 => 'E-TTL',
5118             3 => 'TTL',
5119             4 => 'External Auto',
5120             5 => 'External Manual',
5121             6 => 'Off',
5122             },
5123             },
5124             0x19 => { %ciCameraTemperature }, # (60D + 0)
5125             0x1e => { %ciFocalLength }, # (60D + 0)
5126             0x38 => { # (60D + 2)
5127             Name => 'CameraOrientation',
5128             PrintConv => {
5129             0 => 'Horizontal (normal)',
5130             1 => 'Rotate 90 CW',
5131             2 => 'Rotate 270 CW',
5132             },
5133             },
5134             0x57 => { # (60D + 2, 550D + 3)
5135             Name => 'FocusDistanceUpper',
5136             %focusDistanceByteSwap,
5137             },
5138             0x59 => { # (60D + 2, 550D + 3)
5139             Name => 'FocusDistanceLower',
5140             %focusDistanceByteSwap,
5141             },
5142             0x7b => { # (550D + 3)
5143             Name => 'WhiteBalance',
5144             Format => 'int16u',
5145             SeparateTable => 1,
5146             PrintConv => \%canonWhiteBalance,
5147             },
5148             0x7f => { # (60D + 2, 550D + 3)
5149             Name => 'ColorTemperature',
5150             Format => 'int16u',
5151             },
5152             0xb3 => { # (550D + 3)
5153             Name => 'PictureStyle',
5154             Format => 'int8u',
5155             Flags => ['PrintHex','SeparateTable'],
5156             PrintConv => \%pictureStyles,
5157             },
5158             0xea => { # (60D + 2, 550D + 3)
5159             Name => 'LensType',
5160             Format => 'int16uRev', # value is big-endian
5161             SeparateTable => 1,
5162             ValueConvInv => 'int($val)', # (must truncate decimal part)
5163             PrintConv => \%canonLensTypes,
5164             },
5165             0xec => { %ciMinFocal }, # (60D + 2)
5166             0xee => { %ciMaxFocal }, # (60D + 2)
5167             0x19b => { # (60D + 2)
5168             Name => 'FirmwareVersion',
5169             Format => 'string[6]',
5170             Writable => 0,
5171             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5172             },
5173             0x1db => { # (60D + 2) (NC)
5174             Name => 'FileIndex',
5175             Groups => { 2 => 'Image' },
5176             Format => 'int32u',
5177             ValueConv => '$val + 1',
5178             ValueConvInv => '$val - 1',
5179             },
5180             0x1e7 => { # (60D + 2) (NC)
5181             Name => 'DirectoryIndex',
5182             Groups => { 2 => 'Image' },
5183             Format => 'int32u',
5184             ValueConv => '$val - 1',
5185             ValueConvInv => '$val + 1',
5186             },
5187             0x2fb => {
5188             Name => 'PictureStyleInfo',
5189             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5190             },
5191             );
5192              
5193             # Canon camera information for 650D/700D (MakerNotes tag 0x0d) (ref PH)
5194             %Image::ExifTool::Canon::CameraInfo650D = (
5195             %binaryDataAttrs,
5196             FORMAT => 'int8u',
5197             FIRST_ENTRY => 0,
5198             PRIORITY => 0,
5199             IS_SUBDIR => [ 0x390 ],
5200             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5201             NOTES => 'CameraInfo tags for the EOS 650D and 700D.',
5202             0x03 => { %ciFNumber },
5203             0x04 => { %ciExposureTime },
5204             0x06 => { %ciISO },
5205             0x1b => { %ciCameraTemperature }, # (1DX/5DmkIII + 0)
5206             0x23 => { %ciFocalLength }, # (1DX/5DmkIII + 3)
5207             # 0x35 - seems to be the same as 0x54
5208             0x7d => { # (1DX/5DmkIII + 3)
5209             Name => 'CameraOrientation',
5210             PrintConv => {
5211             0 => 'Horizontal (normal)',
5212             1 => 'Rotate 90 CW',
5213             2 => 'Rotate 270 CW',
5214             },
5215             },
5216             0x8c => { # (1DX + 3)
5217             Name => 'FocusDistanceUpper',
5218             %focusDistanceByteSwap,
5219             },
5220             0x8e => { # (1DX + 3)
5221             Name => 'FocusDistanceLower',
5222             %focusDistanceByteSwap,
5223             },
5224             0xbc => { # (1DX + 7)
5225             Name => 'WhiteBalance',
5226             Format => 'int16u',
5227             SeparateTable => 1,
5228             PrintConv => \%canonWhiteBalance,
5229             },
5230             0xc0 => { # (1DX + 7)
5231             Name => 'ColorTemperature',
5232             Format => 'int16u',
5233             },
5234             0xf4 => { # (1DX + 7)
5235             Name => 'PictureStyle',
5236             Format => 'int8u',
5237             Flags => ['PrintHex','SeparateTable'],
5238             PrintConv => \%pictureStyles,
5239             },
5240             0x127 => {
5241             Name => 'LensType',
5242             Format => 'int16uRev', # value is big-endian
5243             SeparateTable => 1,
5244             ValueConvInv => 'int($val)', # (must truncate decimal part)
5245             PrintConv => \%canonLensTypes,
5246             },
5247             0x129 => { %ciMinFocal },
5248             0x12b => { %ciMaxFocal },
5249             0x21b => { # (650D version 1.0.1)
5250             Name => 'FirmwareVersion',
5251             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5252             Notes => '650D',
5253             Format => 'string[6]',
5254             Writable => 0,
5255             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5256             },
5257             0x220 => { # (700D version 1.1.1/2.1.1)
5258             Name => 'FirmwareVersion',
5259             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5260             Notes => '700D',
5261             Format => 'string[6]',
5262             Writable => 0,
5263             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5264             },
5265             0x270 => { #(NC)
5266             Name => 'FileIndex',
5267             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5268             Notes => '650D',
5269             Groups => { 2 => 'Image' },
5270             Format => 'int32u',
5271             ValueConv => '$val + 1',
5272             ValueConvInv => '$val - 1',
5273             },
5274             0x274 => { #(NC)
5275             Name => 'FileIndex',
5276             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5277             Notes => '700D',
5278             Groups => { 2 => 'Image' },
5279             Format => 'int32u',
5280             ValueConv => '$val + 1',
5281             ValueConvInv => '$val - 1',
5282             },
5283             0x27c => { #(NC)
5284             Name => 'DirectoryIndex',
5285             Condition => '$$self{Model} =~ /(650D|REBEL T4i|Kiss X6i)\b/',
5286             Notes => '650D',
5287             Groups => { 2 => 'Image' },
5288             Format => 'int32u',
5289             ValueConv => '$val - 1',
5290             ValueConvInv => '$val + 1',
5291             },
5292             0x280 => { #(NC)
5293             Name => 'DirectoryIndex',
5294             Condition => '$$self{Model} =~ /(700D|REBEL T5i|Kiss X7i)\b/',
5295             Notes => '700D',
5296             Groups => { 2 => 'Image' },
5297             Format => 'int32u',
5298             ValueConv => '$val - 1',
5299             ValueConvInv => '$val + 1',
5300             },
5301             0x390 => {
5302             Name => 'PictureStyleInfo',
5303             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo2' },
5304             },
5305             );
5306              
5307             # Canon camera information for 750D/760D (MakerNotes tag 0x0d) (ref PH)
5308             %Image::ExifTool::Canon::CameraInfo750D = (
5309             %binaryDataAttrs,
5310             FORMAT => 'int8u',
5311             FIRST_ENTRY => 0,
5312             PRIORITY => 0,
5313             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5314             NOTES => 'CameraInfo tags for the EOS 750D and 760D.',
5315             0x03 => { %ciFNumber },
5316             0x04 => { %ciExposureTime },
5317             0x06 => { %ciISO },
5318             0x1b => { %ciCameraTemperature }, # (700D + 0)
5319             0x23 => { %ciFocalLength }, # (700D + 0)
5320             0x96 => { #IB (700D + 0x19)
5321             Name => 'CameraOrientation',
5322             PrintConv => {
5323             0 => 'Horizontal (normal)',
5324             1 => 'Rotate 90 CW',
5325             2 => 'Rotate 270 CW',
5326             },
5327             },
5328             0xa5 => { # (700D + 0x19)
5329             Name => 'FocusDistanceUpper',
5330             %focusDistanceByteSwap,
5331             },
5332             0xa7 => { # (700D + 0x19)
5333             Name => 'FocusDistanceLower',
5334             %focusDistanceByteSwap,
5335             },
5336             0x131 => { # (700D + 0x19)
5337             Name => 'WhiteBalance',
5338             Format => 'int16u',
5339             SeparateTable => 1,
5340             PrintConv => \%canonWhiteBalance,
5341             },
5342             0x135 => {
5343             Name => 'ColorTemperature',
5344             Format => 'int16u',
5345             },
5346             0x169 => {
5347             Name => 'PictureStyle',
5348             Format => 'int8u',
5349             Flags => ['PrintHex','SeparateTable'],
5350             PrintConv => \%pictureStyles,
5351             },
5352             0x184 => {
5353             Name => 'LensType',
5354             Format => 'int16uRev', # value is big-endian
5355             SeparateTable => 1,
5356             ValueConvInv => 'int($val)', # (must truncate decimal part)
5357             PrintConv => \%canonLensTypes,
5358             },
5359             0x186 => { %ciMinFocal },
5360             0x188 => { %ciMaxFocal },
5361             0x43d => { # (750D/760D firmware 6.7.2)
5362             Name => 'FirmwareVersion',
5363             Format => 'string[6]',
5364             Writable => 0,
5365             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5366             },
5367             0x449 => { # (750D/760D firmware 1.0.0)
5368             Name => 'FirmwareVersion',
5369             Format => 'string[6]',
5370             Writable => 0,
5371             RawConv => '$val=~/^\d+\.\d+\.\d+\s*$/ ? $val : undef',
5372             },
5373             );
5374              
5375             # Canon camera information for 1000D (MakerNotes tag 0x0d) (ref PH)
5376             %Image::ExifTool::Canon::CameraInfo1000D = (
5377             %binaryDataAttrs,
5378             FORMAT => 'int8u',
5379             FIRST_ENTRY => 0,
5380             PRIORITY => 0,
5381             IS_SUBDIR => [ 0x267 ],
5382             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5383             NOTES => 'CameraInfo tags for the EOS 1000D.',
5384             0x03 => { %ciFNumber }, #PH
5385             0x04 => { %ciExposureTime }, #PH
5386             0x06 => { %ciISO }, #PH
5387             0x15 => { #PH (580 EX II)
5388             Name => 'FlashMeteringMode',
5389             PrintConv => {
5390             0 => 'E-TTL',
5391             3 => 'TTL',
5392             4 => 'External Auto',
5393             5 => 'External Manual',
5394             6 => 'Off',
5395             },
5396             },
5397             0x18 => { %ciCameraTemperature }, #36
5398             0x1b => { %ciMacroMagnification }, #PH (NC)
5399             0x1d => { %ciFocalLength }, #PH
5400             0x30 => { #20
5401             Name => 'CameraOrientation',
5402             PrintConv => {
5403             0 => 'Horizontal (normal)',
5404             1 => 'Rotate 90 CW',
5405             2 => 'Rotate 270 CW',
5406             },
5407             },
5408             0x43 => { #20
5409             Name => 'FocusDistanceUpper',
5410             %focusDistanceByteSwap,
5411             },
5412             0x45 => { #20
5413             Name => 'FocusDistanceLower',
5414             %focusDistanceByteSwap,
5415             },
5416             0x6f => { #PH
5417             Name => 'WhiteBalance',
5418             Format => 'int16u',
5419             PrintConv => \%canonWhiteBalance,
5420             SeparateTable => 1,
5421             },
5422             0x73 => { #PH
5423             Name => 'ColorTemperature',
5424             Format => 'int16u',
5425             },
5426             0xe2 => { #PH
5427             Name => 'LensType',
5428             Format => 'int16uRev', # value is big-endian
5429             SeparateTable => 1,
5430             ValueConvInv => 'int($val)', # (must truncate decimal part)
5431             PrintConv => \%canonLensTypes,
5432             },
5433             0xe4 => { %ciMinFocal }, #PH
5434             0xe6 => { %ciMaxFocal }, #PH
5435             0x10b => { #PH
5436             Name => 'FirmwareVersion',
5437             Format => 'string[6]',
5438             },
5439             0x137 => { #PH (NC)
5440             Name => 'DirectoryIndex',
5441             Groups => { 2 => 'Image' },
5442             Format => 'int32u',
5443             },
5444             0x143 => { #PH
5445             Name => 'FileIndex',
5446             Groups => { 2 => 'Image' },
5447             Format => 'int32u',
5448             ValueConv => '$val + 1',
5449             ValueConvInv => '$val - 1',
5450             },
5451             0x267 => { #PH
5452             Name => 'PictureStyleInfo',
5453             SubDirectory => { TagTable => 'Image::ExifTool::Canon::PSInfo' },
5454             },
5455             0x937 => { #PH
5456             Name => 'LensModel',
5457             Format => 'string[64]',
5458             },
5459             );
5460              
5461             # Canon camera information for PowerShot models (MakerNotes tag 0x0d) - PH
5462             %Image::ExifTool::Canon::CameraInfoPowerShot = (
5463             %binaryDataAttrs,
5464             FORMAT => 'int32s',
5465             FIRST_ENTRY => 0,
5466             PRIORITY => 0,
5467             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5468             NOTES => q{
5469             CameraInfo tags for PowerShot models such as the A450, A460, A550, A560,
5470             A570, A630, A640, A650, A710, A720, G7, G9, S5, SD40, SD750, SD800, SD850,
5471             SD870, SD900, SD950, SD1000, SX100 and TX1.
5472             },
5473             0x00 => {
5474             Name => 'ISO',
5475             Groups => { 2 => 'Image' },
5476             ValueConv => '100*exp((($val-411)/96)*log(2))',
5477             ValueConvInv => 'log($val/100)/log(2)*96+411',
5478             PrintConv => 'sprintf("%.0f",$val)',
5479             PrintConvInv => '$val',
5480             },
5481             0x05 => {
5482             Name => 'FNumber',
5483             Groups => { 2 => 'Image' },
5484             ValueConv => 'exp($val/192*log(2))',
5485             ValueConvInv => 'log($val)*192/log(2)',
5486             PrintConv => 'sprintf("%.2g",$val)',
5487             PrintConvInv => '$val',
5488             },
5489             0x06 => {
5490             Name => 'ExposureTime',
5491             Groups => { 2 => 'Image' },
5492             ValueConv => 'exp(-$val/96*log(2))',
5493             ValueConvInv => '-log($val)*96/log(2)',
5494             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5495             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5496             },
5497             0x17 => 'Rotation', # usually the same as Orientation (but not always! why?)
5498             # 0x25 - flash fired/not fired (ref 37)
5499             # 0x26 - related to flash mode? (ref 37)
5500             # 0x37 - related to flash strength (ref 37)
5501             # 0x38 - pre-flash fired/no fired or flash data collection (ref 37)
5502             135 => { # [-3] <-- index relative to CameraInfoCount
5503             Name => 'CameraTemperature',
5504             Condition => '$$self{CameraInfoCount} == 138',
5505             Notes => 'A450, A460, A550, A630, A640 and A710',
5506             PrintConv => '"$val C"',
5507             PrintConvInv => '$val=~s/ ?C//; $val',
5508             },
5509             145 => { #37 [-3]
5510             Name => 'CameraTemperature',
5511             Condition => '$$self{CameraInfoCount} == 148',
5512             Notes => q{
5513             A560, A570, A650, A720, G7, G9, S5, SD40, SD750, SD800, SD850, SD870, SD900,
5514             SD950, SD1000, SX100 and TX1
5515             },
5516             PrintConv => '"$val C"',
5517             PrintConvInv => '$val=~s/ ?C//; $val',
5518             },
5519             );
5520              
5521             # Canon camera information for some PowerShot models (MakerNotes tag 0x0d) - PH
5522             %Image::ExifTool::Canon::CameraInfoPowerShot2 = (
5523             %binaryDataAttrs,
5524             FORMAT => 'int32s',
5525             FIRST_ENTRY => 0,
5526             PRIORITY => 0,
5527             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5528             NOTES => q{
5529             CameraInfo tags for PowerShot models such as the A470, A480, A490, A495,
5530             A580, A590, A1000, A1100, A2000, A2100, A3000, A3100, D10, E1, G10, G11,
5531             S90, S95, SD770, SD780, SD790, SD880, SD890, SD940, SD960, SD970, SD980,
5532             SD990, SD1100, SD1200, SD1300, SD1400, SD3500, SD4000, SD4500, SX1, SX10,
5533             SX20, SX110, SX120, SX130, SX200 and SX210.
5534             },
5535             0x01 => {
5536             Name => 'ISO',
5537             Groups => { 2 => 'Image' },
5538             ValueConv => '100*exp((($val-411)/96)*log(2))',
5539             ValueConvInv => 'log($val/100)/log(2)*96+411',
5540             PrintConv => 'sprintf("%.0f",$val)',
5541             PrintConvInv => '$val',
5542             },
5543             0x06 => {
5544             Name => 'FNumber',
5545             Groups => { 2 => 'Image' },
5546             ValueConv => 'exp($val/192*log(2))',
5547             ValueConvInv => 'log($val)*192/log(2)',
5548             PrintConv => 'sprintf("%.2g",$val)',
5549             PrintConvInv => '$val',
5550             },
5551             0x07 => {
5552             Name => 'ExposureTime',
5553             Groups => { 2 => 'Image' },
5554             ValueConv => 'exp(-$val/96*log(2))',
5555             ValueConvInv => '-log($val)*96/log(2)',
5556             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
5557             PrintConvInv => 'Image::ExifTool::Exif::ConvertFraction($val)',
5558             },
5559             0x18 => 'Rotation',
5560             153 => { # [-3] <-- index relative to CameraInfoCount
5561             Name => 'CameraTemperature',
5562             Condition => '$$self{CameraInfoCount} == 156',
5563             Notes => 'A470, A580, A590, SD770, SD790, SD890 and SD1100',
5564             PrintConv => '"$val C"',
5565             PrintConvInv => '$val=~s/ ?C//; $val',
5566             },
5567             159 => { # [-3]
5568             Name => 'CameraTemperature',
5569             Condition => '$$self{CameraInfoCount} == 162',
5570             Notes => 'A1000, A2000, E1, G10, SD880, SD990, SX1, SX10 and SX110',
5571             PrintConv => '"$val C"',
5572             PrintConvInv => '$val=~s/ ?C//; $val',
5573             },
5574             164 => { # [-3]
5575             Name => 'CameraTemperature',
5576             Condition => '$$self{CameraInfoCount} == 167',
5577             Notes => 'A480, A1100, A2100, D10, SD780, SD960, SD970, SD1200 and SX200',
5578             PrintConv => '"$val C"',
5579             PrintConvInv => '$val=~s/ ?C//; $val',
5580             },
5581             168 => { # [-3]
5582             Name => 'CameraTemperature',
5583             Condition => '$$self{CameraInfoCount} == 171',
5584             Notes => q{
5585             A490, A495, A3000, A3100, G11, S90, SD940, SD980, SD1300, SD1400, SD3500,
5586             SD4000, SX20, SX120 and SX210
5587             },
5588             PrintConv => '"$val C"',
5589             PrintConvInv => '$val=~s/ ?C//; $val',
5590             },
5591             261 => { # [-3]
5592             Name => 'CameraTemperature',
5593             Condition => '$$self{CameraInfoCount} == 264',
5594             Notes => 'S95, SD4500 and SX130',
5595             PrintConv => '"$val C"',
5596             PrintConvInv => '$val=~s/ ?C//; $val',
5597             },
5598             );
5599              
5600             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5601             %Image::ExifTool::Canon::CameraInfoUnknown32 = (
5602             %binaryDataAttrs,
5603             FORMAT => 'int32s',
5604             FIRST_ENTRY => 0,
5605             PRIORITY => 0,
5606             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5607             NOTES => 'Unknown CameraInfo tags are divided into 3 tables based on format size.',
5608             # This tag may be uncommented, and is useful for generating
5609             # lists of models in the "Notes" below...
5610             # 0 => {
5611             # Name => 'CameraInfoCount',
5612             # ValueConv => '$$self{CameraInfoCount}',
5613             # },
5614             71 => { # [-1] <-- index relative to CameraInfoCount
5615             Name => 'CameraTemperature',
5616             Condition => '$$self{CameraInfoCount} == 72',
5617             Notes => 'S1',
5618             PrintConv => '"$val C"',
5619             PrintConvInv => '$val=~s/ ?C//; $val',
5620             },
5621             83 => { # [-2]
5622             Name => 'CameraTemperature',
5623             Condition => '$$self{CameraInfoCount} == 85',
5624             Notes => 'S2',
5625             PrintConv => '"$val C"',
5626             PrintConvInv => '$val=~s/ ?C//; $val',
5627             },
5628             91 => { # [-2 or -3]
5629             Name => 'CameraTemperature',
5630             Condition => '$$self{CameraInfoCount} == 93 or $$self{CameraInfoCount} == 94',
5631             Notes => 'A410, A610, A620, S80, SD30, SD400, SD430, SD450, SD500 and SD550',
5632             PrintConv => '"$val C"',
5633             PrintConvInv => '$val=~s/ ?C//; $val',
5634             },
5635             92 => { # [-4]
5636             Name => 'CameraTemperature',
5637             Condition => '$$self{CameraInfoCount} == 96',
5638             Notes => 'S3',
5639             PrintConv => '"$val C"',
5640             PrintConvInv => '$val=~s/ ?C//; $val',
5641             },
5642             100 => { # [-4]
5643             Name => 'CameraTemperature',
5644             Condition => '$$self{CameraInfoCount} == 104',
5645             Notes => 'A420, A430, A530, A540, A700, SD600, SD630 and SD700',
5646             PrintConv => '"$val C"',
5647             PrintConvInv => '$val=~s/ ?C//; $val',
5648             },
5649             -3 => {
5650             Name => 'CameraTemperature',
5651             Condition => '$$self{CameraInfoCount} > 400',
5652             Notes => '3 entries from end of record for most newer camera models',
5653             PrintConv => '"$val C"',
5654             PrintConvInv => '$val=~s/ ?C//; $val',
5655             },
5656             # 466 => { # [-3]
5657             # Name => 'CameraTemperature',
5658             # Condition => '$$self{CameraInfoCount} == 469',
5659             # Notes => '100HS, 300HS, 500HS, A1200, A2200, A3200 and A3300',
5660             # PrintConv => '"$val C"',
5661             # PrintConvInv => '$val=~s/ ?C//; $val',
5662             # },
5663             # 503 => { # [-3]
5664             # Name => 'CameraTemperature',
5665             # Condition => '$$self{CameraInfoCount} == 506',
5666             # Notes => 'A800',
5667             # PrintConv => '"$val C"',
5668             # PrintConvInv => '$val=~s/ ?C//; $val',
5669             # },
5670             # 506 => { # [-3]
5671             # Name => 'CameraTemperature',
5672             # Condition => '$$self{CameraInfoCount} == 509',
5673             # Notes => 'SX230HS',
5674             # PrintConv => '"$val C"',
5675             # PrintConvInv => '$val=~s/ ?C//; $val',
5676             # },
5677             # 520 => { # [-3]
5678             # Name => 'CameraTemperature',
5679             # Condition => '$$self{CameraInfoCount} == 523',
5680             # Notes => '310HS, 510HS, G1X, S100 (new), SX40HS and SX150',
5681             # PrintConv => '"$val C"',
5682             # PrintConvInv => '$val=~s/ ?C//; $val',
5683             # },
5684             # 524 => { # [-3]
5685             # Name => 'CameraTemperature',
5686             # Condition => '$$self{CameraInfoCount} == 527',
5687             # Notes => '110HS, 520HS, A2300, A2400, A3400, A4000, D20 and SX260HS',
5688             # PrintConv => '"$val C"',
5689             # PrintConvInv => '$val=~s/ ?C//; $val',
5690             # },
5691             # 532 => { # [-3]
5692             # Name => 'CameraTemperature',
5693             # Condition => '$$self{CameraInfoCount} == 535',
5694             # Notes => 'S110 (new), G15, SX50, SX160IS and SX500IS',
5695             # PrintConv => '"$val C"',
5696             # PrintConvInv => '$val=~s/ ?C//; $val',
5697             # },
5698             # 547 => { # [-3]
5699             # Name => 'CameraTemperature',
5700             # Condition => '$$self{CameraInfoCount} == 550',
5701             # Notes => '130IS, A1400, A2500 and A2600',
5702             # PrintConv => '"$val C"',
5703             # PrintConvInv => '$val=~s/ ?C//; $val',
5704             # },
5705             # 549 => { # [-3]
5706             # Name => 'CameraTemperature',
5707             # Condition => '$$self{CameraInfoCount} == 552',
5708             # Notes => '115IS, 130IS, SX270, SX280, 330HS and A3500',
5709             # PrintConv => '"$val C"',
5710             # PrintConvInv => '$val=~s/ ?C//; $val',
5711             # },
5712             # 552 => { # [-3]
5713             # Name => 'CameraTemperature',
5714             # Condition => '$$self{CameraInfoCount} == 555',
5715             # Notes => 'S200 (new)',
5716             # PrintConv => '"$val C"',
5717             # PrintConvInv => '$val=~s/ ?C//; $val',
5718             # },
5719             # 850 => { # [-3]
5720             # Name => 'CameraTemperature',
5721             # Condition => '$$self{CameraInfoCount} == 853',
5722             # Notes => 'N',
5723             # PrintConv => '"$val C"',
5724             # PrintConvInv => '$val=~s/ ?C//; $val',
5725             # },
5726             # 895 => { # [-3]
5727             # Name => 'CameraTemperature',
5728             # Condition => '$$self{CameraInfoCount} == 898',
5729             # Notes => 'G1XmkII, N100, SX600HS and SX700HS',
5730             # PrintConv => '"$val C"',
5731             # PrintConvInv => '$val=~s/ ?C//; $val',
5732             # },
5733             );
5734              
5735             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5736             %Image::ExifTool::Canon::CameraInfoUnknown16 = (
5737             %binaryDataAttrs,
5738             FORMAT => 'int16s',
5739             FIRST_ENTRY => 0,
5740             PRIORITY => 0,
5741             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5742             );
5743              
5744             # unknown Canon camera information (MakerNotes tag 0x0d) - PH
5745             %Image::ExifTool::Canon::CameraInfoUnknown = (
5746             %binaryDataAttrs,
5747             FORMAT => 'int8s',
5748             FIRST_ENTRY => 0,
5749             PRIORITY => 0,
5750             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5751             0x16b => {
5752             Name => 'LensSerialNumber',
5753             Condition => '$$self{Model} =~ /^Canon EOS 5DS/', # (good for 5DS and 5DSR)
5754             Format => 'undef[5]',
5755             Priority => 0,
5756             ValueConv => 'unpack("H*",$val)',
5757             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
5758             },
5759             0x5c1 => {
5760             Name => 'FirmwareVersion',
5761             Format => 'string[6]',
5762             Writable => 0,
5763             Condition => '$$valPt =~ /^\d\.\d\.\d\0/',
5764             Notes => 'M50', # (firmware 1.0.0)
5765             },
5766             );
5767              
5768             # Picture Style information for various cameras (ref 48)
5769             %Image::ExifTool::Canon::PSInfo = (
5770             %binaryDataAttrs,
5771             FIRST_ENTRY => 0,
5772             PRIORITY => 0,
5773             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5774             NOTES => 'Custom picture style information for various models.',
5775             # (values expected to be "n/a" are flagged as Unknown)
5776             0x00 => { Name => 'ContrastStandard', %psInfo },
5777             0x04 => { Name => 'SharpnessStandard', %psInfo },
5778             0x08 => { Name => 'SaturationStandard', %psInfo },
5779             0x0c => { Name => 'ColorToneStandard', %psInfo },
5780             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5781             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5782             0x18 => { Name => 'ContrastPortrait', %psInfo },
5783             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5784             0x20 => { Name => 'SaturationPortrait', %psInfo },
5785             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5786             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5787             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5788             0x30 => { Name => 'ContrastLandscape', %psInfo },
5789             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5790             0x38 => { Name => 'SaturationLandscape', %psInfo },
5791             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5792             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5793             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5794             0x48 => { Name => 'ContrastNeutral', %psInfo },
5795             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5796             0x50 => { Name => 'SaturationNeutral', %psInfo },
5797             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5798             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5799             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5800             0x60 => { Name => 'ContrastFaithful', %psInfo },
5801             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5802             0x68 => { Name => 'SaturationFaithful', %psInfo },
5803             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5804             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5805             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5806             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5807             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5808             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5809             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5810             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
5811             PrintConv => {
5812             0 => 'None',
5813             1 => 'Yellow',
5814             2 => 'Orange',
5815             3 => 'Red',
5816             4 => 'Green',
5817             -559038737 => 'n/a', # (0xdeadbeef)
5818             },
5819             },
5820             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
5821             PrintConv => {
5822             0 => 'None',
5823             1 => 'Sepia',
5824             2 => 'Blue',
5825             3 => 'Purple',
5826             4 => 'Green',
5827             -559038737 => 'n/a', # (0xdeadbeef)
5828             },
5829             },
5830             0x90 => { Name => 'ContrastUserDef1', %psInfo },
5831             0x94 => { Name => 'SharpnessUserDef1', %psInfo },
5832             0x98 => { Name => 'SaturationUserDef1', %psInfo },
5833             0x9c => { Name => 'ColorToneUserDef1', %psInfo },
5834             0xa0 => { Name => 'FilterEffectUserDef1', %psInfo,
5835             PrintConv => {
5836             0 => 'None',
5837             1 => 'Yellow',
5838             2 => 'Orange',
5839             3 => 'Red',
5840             4 => 'Green',
5841             -559038737 => 'n/a', # (0xdeadbeef)
5842             },
5843             },
5844             0xa4 => { Name => 'ToningEffectUserDef1', %psInfo,
5845             PrintConv => {
5846             0 => 'None',
5847             1 => 'Sepia',
5848             2 => 'Blue',
5849             3 => 'Purple',
5850             4 => 'Green',
5851             -559038737 => 'n/a', # (0xdeadbeef)
5852             },
5853             },
5854             0xa8 => { Name => 'ContrastUserDef2', %psInfo },
5855             0xac => { Name => 'SharpnessUserDef2', %psInfo },
5856             0xb0 => { Name => 'SaturationUserDef2', %psInfo },
5857             0xb4 => { Name => 'ColorToneUserDef2', %psInfo },
5858             0xb8 => { Name => 'FilterEffectUserDef2', %psInfo,
5859             PrintConv => {
5860             0 => 'None',
5861             1 => 'Yellow',
5862             2 => 'Orange',
5863             3 => 'Red',
5864             4 => 'Green',
5865             -559038737 => 'n/a', # (0xdeadbeef)
5866             },
5867             },
5868             0xbc => { Name => 'ToningEffectUserDef2', %psInfo,
5869             PrintConv => {
5870             0 => 'None',
5871             1 => 'Sepia',
5872             2 => 'Blue',
5873             3 => 'Purple',
5874             4 => 'Green',
5875             -559038737 => 'n/a', # (0xdeadbeef)
5876             },
5877             },
5878             0xc0 => { Name => 'ContrastUserDef3', %psInfo },
5879             0xc4 => { Name => 'SharpnessUserDef3', %psInfo },
5880             0xc8 => { Name => 'SaturationUserDef3', %psInfo },
5881             0xcc => { Name => 'ColorToneUserDef3', %psInfo },
5882             0xd0 => { Name => 'FilterEffectUserDef3', %psInfo,
5883             PrintConv => {
5884             0 => 'None',
5885             1 => 'Yellow',
5886             2 => 'Orange',
5887             3 => 'Red',
5888             4 => 'Green',
5889             -559038737 => 'n/a', # (0xdeadbeef)
5890             },
5891             },
5892             0xd4 => { Name => 'ToningEffectUserDef3', %psInfo,
5893             PrintConv => {
5894             0 => 'None',
5895             1 => 'Sepia',
5896             2 => 'Blue',
5897             3 => 'Purple',
5898             4 => 'Green',
5899             -559038737 => 'n/a', # (0xdeadbeef)
5900             },
5901             },
5902             # base picture style names:
5903             0xd8 => {
5904             Name => 'UserDef1PictureStyle',
5905             Format => 'int16u',
5906             SeparateTable => 'UserDefStyle',
5907             PrintConv => \%userDefStyles,
5908             },
5909             0xda => {
5910             Name => 'UserDef2PictureStyle',
5911             Format => 'int16u',
5912             SeparateTable => 'UserDefStyle',
5913             PrintConv => \%userDefStyles,
5914             },
5915             0xdc => {
5916             Name => 'UserDef3PictureStyle',
5917             Format => 'int16u',
5918             SeparateTable => 'UserDefStyle',
5919             PrintConv => \%userDefStyles,
5920             },
5921             );
5922              
5923             # Picture Style information for the 60D, etc (ref 48)
5924             %Image::ExifTool::Canon::PSInfo2 = (
5925             %binaryDataAttrs,
5926             FIRST_ENTRY => 0,
5927             PRIORITY => 0,
5928             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
5929             NOTES => 'Custom picture style information for the EOS 5DmkIII, 60D, 600D and 1100D.',
5930             # (values expected to be "n/a" are flagged as Unknown)
5931             0x00 => { Name => 'ContrastStandard', %psInfo },
5932             0x04 => { Name => 'SharpnessStandard', %psInfo },
5933             0x08 => { Name => 'SaturationStandard', %psInfo },
5934             0x0c => { Name => 'ColorToneStandard', %psInfo },
5935             0x10 => { Name => 'FilterEffectStandard', %psInfo, Unknown => 1 },
5936             0x14 => { Name => 'ToningEffectStandard', %psInfo, Unknown => 1 },
5937             0x18 => { Name => 'ContrastPortrait', %psInfo },
5938             0x1c => { Name => 'SharpnessPortrait', %psInfo },
5939             0x20 => { Name => 'SaturationPortrait', %psInfo },
5940             0x24 => { Name => 'ColorTonePortrait', %psInfo },
5941             0x28 => { Name => 'FilterEffectPortrait', %psInfo, Unknown => 1 },
5942             0x2c => { Name => 'ToningEffectPortrait', %psInfo, Unknown => 1 },
5943             0x30 => { Name => 'ContrastLandscape', %psInfo },
5944             0x34 => { Name => 'SharpnessLandscape', %psInfo },
5945             0x38 => { Name => 'SaturationLandscape', %psInfo },
5946             0x3c => { Name => 'ColorToneLandscape', %psInfo },
5947             0x40 => { Name => 'FilterEffectLandscape', %psInfo, Unknown => 1 },
5948             0x44 => { Name => 'ToningEffectLandscape', %psInfo, Unknown => 1 },
5949             0x48 => { Name => 'ContrastNeutral', %psInfo },
5950             0x4c => { Name => 'SharpnessNeutral', %psInfo },
5951             0x50 => { Name => 'SaturationNeutral', %psInfo },
5952             0x54 => { Name => 'ColorToneNeutral', %psInfo },
5953             0x58 => { Name => 'FilterEffectNeutral', %psInfo, Unknown => 1 },
5954             0x5c => { Name => 'ToningEffectNeutral', %psInfo, Unknown => 1 },
5955             0x60 => { Name => 'ContrastFaithful', %psInfo },
5956             0x64 => { Name => 'SharpnessFaithful', %psInfo },
5957             0x68 => { Name => 'SaturationFaithful', %psInfo },
5958             0x6c => { Name => 'ColorToneFaithful', %psInfo },
5959             0x70 => { Name => 'FilterEffectFaithful', %psInfo, Unknown => 1 },
5960             0x74 => { Name => 'ToningEffectFaithful', %psInfo, Unknown => 1 },
5961             0x78 => { Name => 'ContrastMonochrome', %psInfo },
5962             0x7c => { Name => 'SharpnessMonochrome', %psInfo },
5963             0x80 => { Name => 'SaturationMonochrome', %psInfo, Unknown => 1 },
5964             0x84 => { Name => 'ColorToneMonochrome', %psInfo, Unknown => 1 },
5965             0x88 => { Name => 'FilterEffectMonochrome',%psInfo,
5966             PrintConv => {
5967             0 => 'None',
5968             1 => 'Yellow',
5969             2 => 'Orange',
5970             3 => 'Red',
5971             4 => 'Green',
5972             -559038737 => 'n/a', # (0xdeadbeef)
5973             },
5974             },
5975             0x8c => { Name => 'ToningEffectMonochrome',%psInfo,
5976             PrintConv => {
5977             0 => 'None',
5978             1 => 'Sepia',
5979             2 => 'Blue',
5980             3 => 'Purple',
5981             4 => 'Green',
5982             -559038737 => 'n/a', # (0xdeadbeef)
5983             },
5984             },
5985             0x90 => { Name => 'ContrastAuto', %psInfo },
5986             0x94 => { Name => 'SharpnessAuto', %psInfo },
5987             0x98 => { Name => 'SaturationAuto', %psInfo },
5988             0x9c => { Name => 'ColorToneAuto', %psInfo },
5989             0xa0 => { Name => 'FilterEffectAuto', %psInfo,
5990             PrintConv => {
5991             0 => 'None',
5992             1 => 'Yellow',
5993             2 => 'Orange',
5994             3 => 'Red',
5995             4 => 'Green',
5996             -559038737 => 'n/a', # (0xdeadbeef)
5997             },
5998             },
5999             0xa4 => { Name => 'ToningEffectAuto', %psInfo,
6000             PrintConv => {
6001             0 => 'None',
6002             1 => 'Sepia',
6003             2 => 'Blue',
6004             3 => 'Purple',
6005             4 => 'Green',
6006             -559038737 => 'n/a', # (0xdeadbeef)
6007             },
6008             },
6009             0xa8 => { Name => 'ContrastUserDef1', %psInfo },
6010             0xac => { Name => 'SharpnessUserDef1', %psInfo },
6011             0xb0 => { Name => 'SaturationUserDef1', %psInfo },
6012             0xb4 => { Name => 'ColorToneUserDef1', %psInfo },
6013             0xb8 => { Name => 'FilterEffectUserDef1', %psInfo,
6014             PrintConv => {
6015             0 => 'None',
6016             1 => 'Yellow',
6017             2 => 'Orange',
6018             3 => 'Red',
6019             4 => 'Green',
6020             -559038737 => 'n/a', # (0xdeadbeef)
6021             },
6022             },
6023             0xbc => { Name => 'ToningEffectUserDef1', %psInfo,
6024             PrintConv => {
6025             0 => 'None',
6026             1 => 'Sepia',
6027             2 => 'Blue',
6028             3 => 'Purple',
6029             4 => 'Green',
6030             -559038737 => 'n/a', # (0xdeadbeef)
6031             },
6032             },
6033             0xc0 => { Name => 'ContrastUserDef2', %psInfo },
6034             0xc4 => { Name => 'SharpnessUserDef2', %psInfo },
6035             0xc8 => { Name => 'SaturationUserDef2', %psInfo },
6036             0xcc => { Name => 'ColorToneUserDef2', %psInfo },
6037             0xd0 => { Name => 'FilterEffectUserDef2', %psInfo,
6038             PrintConv => {
6039             0 => 'None',
6040             1 => 'Yellow',
6041             2 => 'Orange',
6042             3 => 'Red',
6043             4 => 'Green',
6044             -559038737 => 'n/a', # (0xdeadbeef)
6045             },
6046             },
6047             0xd4 => { Name => 'ToningEffectUserDef2', %psInfo,
6048             PrintConv => {
6049             0 => 'None',
6050             1 => 'Sepia',
6051             2 => 'Blue',
6052             3 => 'Purple',
6053             4 => 'Green',
6054             -559038737 => 'n/a', # (0xdeadbeef)
6055             },
6056             },
6057             0xd8 => { Name => 'ContrastUserDef3', %psInfo },
6058             0xdc => { Name => 'SharpnessUserDef3', %psInfo },
6059             0xe0 => { Name => 'SaturationUserDef3', %psInfo },
6060             0xe4 => { Name => 'ColorToneUserDef3', %psInfo },
6061             0xe8 => { Name => 'FilterEffectUserDef3', %psInfo,
6062             PrintConv => {
6063             0 => 'None',
6064             1 => 'Yellow',
6065             2 => 'Orange',
6066             3 => 'Red',
6067             4 => 'Green',
6068             -559038737 => 'n/a', # (0xdeadbeef)
6069             },
6070             },
6071             0xec => { Name => 'ToningEffectUserDef3', %psInfo,
6072             PrintConv => {
6073             0 => 'None',
6074             1 => 'Sepia',
6075             2 => 'Blue',
6076             3 => 'Purple',
6077             4 => 'Green',
6078             -559038737 => 'n/a', # (0xdeadbeef)
6079             },
6080             },
6081             # base picture style names:
6082             0xf0 => {
6083             Name => 'UserDef1PictureStyle',
6084             Format => 'int16u',
6085             SeparateTable => 'UserDefStyle',
6086             PrintConv => \%userDefStyles,
6087             },
6088             0xf2 => {
6089             Name => 'UserDef2PictureStyle',
6090             Format => 'int16u',
6091             SeparateTable => 'UserDefStyle',
6092             PrintConv => \%userDefStyles,
6093             },
6094             0xf4 => {
6095             Name => 'UserDef3PictureStyle',
6096             Format => 'int16u',
6097             SeparateTable => 'UserDefStyle',
6098             PrintConv => \%userDefStyles,
6099             },
6100             );
6101              
6102             # Movie information (MakerNotes tag 0x11) (ref PH)
6103             %Image::ExifTool::Canon::MovieInfo = (
6104             %binaryDataAttrs,
6105             FORMAT => 'int16u',
6106             FIRST_ENTRY => 1,
6107             GROUPS => { 0 => 'MakerNotes', 2 => 'Video' },
6108             NOTES => 'Tags written by some Canon cameras when recording video.',
6109             1 => { # (older PowerShot AVI)
6110             Name => 'FrameRate',
6111             RawConv => '$val == 65535 ? undef: $val',
6112             ValueConvInv => '$val > 65535 ? 65535 : $val',
6113             },
6114             2 => { # (older PowerShot AVI)
6115             Name => 'FrameCount',
6116             RawConv => '$val == 65535 ? undef: $val',
6117             ValueConvInv => '$val > 65535 ? 65535 : $val',
6118             },
6119             # 3 - values: 0x0001 (older PowerShot AVI), 0x4004, 0x4005
6120             4 => {
6121             Name => 'FrameCount',
6122             Format => 'int32u',
6123             },
6124             6 => {
6125             Name => 'FrameRate',
6126             Format => 'rational32u',
6127             PrintConv => 'int($val * 1000 + 0.5) / 1000',
6128             PrintConvInv => '$val',
6129             },
6130             # 9/10 - same as 6/7 (FrameRate)
6131             106 => {
6132             Name => 'Duration',
6133             Format => 'int32u',
6134             ValueConv => '$val / 1000',
6135             ValueConvInv => '$val * 1000',
6136             PrintConv => 'ConvertDuration($val)',
6137             PrintConvInv => q{
6138             my @a = ($val =~ /\d+(?:\.\d*)?/g);
6139             $val = pop(@a) || 0; # seconds
6140             $val += pop(@a) * 60 if @a; # minutes
6141             $val += pop(@a) * 3600 if @a; # hours
6142             return $val;
6143             },
6144             },
6145             108 => {
6146             Name => 'AudioBitrate',
6147             Groups => { 2 => 'Audio' },
6148             Format => 'int32u',
6149             PrintConv => 'ConvertBitrate($val)',
6150             PrintConvInv => q{
6151             $val =~ /^(\d+(?:\.\d*)?) ?([kMG]?bps)?$/ or return undef;
6152             return $1 * {bps=>1,kbps=>1000,Mbps=>1000000,Gbps=>1000000000}->{$2 || 'bps'};
6153             },
6154             },
6155             110 => {
6156             Name => 'AudioSampleRate',
6157             Groups => { 2 => 'Audio' },
6158             Format => 'int32u',
6159             },
6160             112 => { # (guess)
6161             Name => 'AudioChannels',
6162             Groups => { 2 => 'Audio' },
6163             Format => 'int32u',
6164             },
6165             # 114 - values: 0 (60D), 1 (S95)
6166             116 => {
6167             Name => 'VideoCodec',
6168             Format => 'undef[4]',
6169             # swap bytes if little endian
6170             RawConv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6171             RawConvInv => 'GetByteOrder() eq "MM" ? $val : pack("N",unpack("V",$val))',
6172             },
6173             # 125 - same as 10
6174             );
6175              
6176             # AF information (MakerNotes tag 0x12) - PH
6177             %Image::ExifTool::Canon::AFInfo = (
6178             PROCESS_PROC => \&ProcessSerialData,
6179             VARS => { ID_LABEL => 'Sequence' },
6180             FORMAT => 'int16u',
6181             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6182             NOTES => q{
6183             Auto-focus information used by many older Canon models. The values in this
6184             record are sequential, and some have variable sizes based on the value of
6185             NumAFPoints (which may be 1,5,7,9,15,45 or 53). The AFArea coordinates are
6186             given in a system where the image has dimensions given by AFImageWidth and
6187             AFImageHeight, and 0,0 is the image center. The direction of the Y axis
6188             depends on the camera model, with positive Y upwards for EOS models, but
6189             apparently downwards for PowerShot models.
6190             },
6191             0 => {
6192             Name => 'NumAFPoints',
6193             },
6194             1 => {
6195             Name => 'ValidAFPoints',
6196             Notes => 'number of AF points valid in the following information',
6197             },
6198             2 => {
6199             Name => 'CanonImageWidth',
6200             Groups => { 2 => 'Image' },
6201             },
6202             3 => {
6203             Name => 'CanonImageHeight',
6204             Groups => { 2 => 'Image' },
6205             },
6206             4 => {
6207             Name => 'AFImageWidth',
6208             Notes => 'size of image in AF coordinates',
6209             },
6210             5 => 'AFImageHeight',
6211             6 => 'AFAreaWidth',
6212             7 => 'AFAreaHeight',
6213             8 => {
6214             Name => 'AFAreaXPositions',
6215             Format => 'int16s[$val{0}]',
6216             },
6217             9 => {
6218             Name => 'AFAreaYPositions',
6219             Format => 'int16s[$val{0}]',
6220             },
6221             10 => {
6222             Name => 'AFPointsInFocus',
6223             Format => 'int16s[int(($val{0}+15)/16)]',
6224             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6225             },
6226             11 => [
6227             {
6228             Name => 'PrimaryAFPoint',
6229             Condition => q{
6230             $$self{Model} !~ /EOS/ and
6231             (not $$self{AFInfoCount} or $$self{AFInfoCount} != 36)
6232             },
6233             },
6234             {
6235             # (some PowerShot 9-point systems put PrimaryAFPoint after 8 unknown values)
6236             Name => 'Canon_AFInfo_0x000b',
6237             Condition => '$$self{Model} !~ /EOS/',
6238             Format => 'int16u[8]',
6239             Unknown => 1,
6240             },
6241             # (serial processing stops here for EOS cameras)
6242             ],
6243             12 => 'PrimaryAFPoint',
6244             );
6245              
6246             # newer AF information (MakerNotes tag 0x26 and 0x32) - PH (A570IS,1DmkIII,40D and G1XmkII)
6247             # (Note: this tag is out of sequence in A570IS maker notes)
6248             %Image::ExifTool::Canon::AFInfo2 = (
6249             PROCESS_PROC => \&ProcessSerialData,
6250             VARS => { ID_LABEL => 'Sequence' },
6251             FORMAT => 'int16u',
6252             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6253             NOTES => q{
6254             Newer version of the AFInfo record containing much of the same information
6255             (and coordinate confusion) as the older version. In this record, NumAFPoints
6256             may be 7, 9, 11, 19, 31, 45 or 61, depending on the camera model.
6257             },
6258             0 => {
6259             Name => 'AFInfoSize',
6260             Unknown => 1, # normally don't print this out
6261             },
6262             1 => {
6263             Name => 'AFAreaMode',
6264             PrintConv => {
6265             0 => 'Off (Manual Focus)',
6266             1 => 'AF Point Expansion (surround)', #PH
6267             2 => 'Single-point AF',
6268             # 3 - n/a
6269             4 => 'Auto', #forum6237 (AiAF on A570IS)
6270             5 => 'Face Detect AF',
6271             6 => 'Face + Tracking', #PH (NC, EOS M, live view)
6272             7 => 'Zone AF', #46
6273             8 => 'AF Point Expansion (4 point)', #46/PH/forum6237
6274             9 => 'Spot AF', #46
6275             10 => 'AF Point Expansion (8 point)', #forum6237
6276             11 => 'Flexizone Multi (49 point)', #PH (NC, EOS M, live view; 750D 49 points)
6277             12 => 'Flexizone Multi (9 point)', #PH (750D, 9 points)
6278             13 => 'Flexizone Single', #PH (EOS M default, live view)
6279             14 => 'Large Zone AF', #PH/forum6237 (7DmkII)
6280             },
6281             },
6282             2 => {
6283             Name => 'NumAFPoints',
6284             RawConv => '$$self{NumAFPoints} = $val', # save for later
6285             },
6286             3 => {
6287             Name => 'ValidAFPoints',
6288             Notes => 'number of AF points valid in the following information',
6289             },
6290             4 => {
6291             Name => 'CanonImageWidth',
6292             Groups => { 2 => 'Image' },
6293             },
6294             5 => {
6295             Name => 'CanonImageHeight',
6296             Groups => { 2 => 'Image' },
6297             },
6298             6 => {
6299             Name => 'AFImageWidth',
6300             Notes => 'size of image in AF coordinates',
6301             },
6302             7 => 'AFImageHeight',
6303             8 => {
6304             Name => 'AFAreaWidths',
6305             Format => 'int16s[$val{2}]',
6306             },
6307             9 => {
6308             Name => 'AFAreaHeights',
6309             Format => 'int16s[$val{2}]',
6310             },
6311             10 => {
6312             Name => 'AFAreaXPositions',
6313             Format => 'int16s[$val{2}]',
6314             },
6315             11 => {
6316             Name => 'AFAreaYPositions',
6317             Format => 'int16s[$val{2}]',
6318             },
6319             12 => {
6320             Name => 'AFPointsInFocus',
6321             Format => 'int16s[int(($val{2}+15)/16)]',
6322             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6323             },
6324             13 => [
6325             {
6326             Name => 'AFPointsSelected',
6327             Condition => '$$self{Model} =~ /EOS/',
6328             Format => 'int16s[int(($val{2}+15)/16)]',
6329             PrintConv => 'Image::ExifTool::DecodeBits($val, undef, 16)',
6330             },
6331             {
6332             Name => 'Canon_AFInfo2_0x000d',
6333             Format => 'int16s[int(($val{2}+15)/16)+1]',
6334             Unknown => 1,
6335             },
6336             ],
6337             14 => {
6338             # usually, but not always, the lowest number AF point in focus
6339             Name => 'PrimaryAFPoint',
6340             Condition => '$$self{Model} !~ /EOS/ and not $$self{AFInfo3}', # (not valid for G1XmkII)
6341             },
6342             );
6343              
6344             # contrast information (MakerNotes tag 0x27) - PH
6345             %Image::ExifTool::Canon::ContrastInfo = (
6346             %binaryDataAttrs,
6347             FORMAT => 'int16u',
6348             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6349             4 => {
6350             Name => 'IntelligentContrast',
6351             PrintHex => 1,
6352             PrintConv => {
6353             0x00 => 'Off',
6354             0x08 => 'On',
6355             0xffff => 'n/a',
6356             OTHER => sub {
6357             # DPP shows "On" for any value except 0xffff when bit 0x08 is set
6358             my ($val, $inv) = @_;
6359             if ($inv) {
6360             $val =~ /(0x[0-9a-f]+)/i or $val =~ /(\d+)/ or return undef;
6361             return $1;
6362             } else {
6363             return sprintf("On (0x%.2x)",$val) if $val & 0x08;
6364             return sprintf("Off (0x%.2x)",$val);
6365             }
6366             },
6367             },
6368             },
6369             # 6 - 0=normal, 257=i-Contrast On
6370             );
6371              
6372             # time information (MakerNotes tag 0x35) - PH (1DX, 5DmkIII)
6373             %Image::ExifTool::Canon::TimeInfo = (
6374             %binaryDataAttrs,
6375             FORMAT => 'int32s',
6376             FIRST_ENTRY => 1,
6377             GROUPS => { 0 => 'MakerNotes', 2 => 'Time' },
6378             # 0 - size (16 bytes)
6379             1 => {
6380             Name => 'TimeZone',
6381             PrintConv => 'Image::ExifTool::TimeZoneString($val)',
6382             PrintConvInv => q{
6383             $val =~ /Z$/ and return 0;
6384             $val =~ /([-+])(\d{1,2}):?(\d{2})$/ and return $1 . ($2 * 60 + $3);
6385             $val =~ /^(\d{2})(\d{2})$/ and return $1 * 60 + $2;
6386             return undef;
6387             },
6388             },
6389             2 => {
6390             Name => 'TimeZoneCity',
6391             PrintConvColumns => 3,
6392             PrintConv => {
6393             # [square brackets] = actual time zone for each city
6394             # (round brackets) = observed time zone values from sample images
6395             # --> unobserved entries have not been confirmed!
6396             0 => 'n/a', # (PowerShot models)
6397             1 => 'Chatham Islands', # [+12:45]
6398             2 => 'Wellington', # [+12] (+12:00,DST+0)
6399             3 => 'Solomon Islands', # [+11]
6400             4 => 'Sydney', # [+10] (+11:00,DST+1)
6401             5 => 'Adelaide', # [+9:30]
6402             6 => 'Tokyo', # [+9] (+09:00,DST+0)
6403             7 => 'Hong Kong', # [+8] (+08:00,DST+0)
6404             8 => 'Bangkok', # [+7] (+08:00,DST+1)
6405             9 => 'Yangon', # [+6:30]
6406             10 => 'Dhaka', # [+6] (Canon uses old "Dacca" spelling)
6407             11 => 'Kathmandu', # [+5:45]
6408             12 => 'Delhi', # [+5:30]
6409             13 => 'Karachi', # [+5]
6410             14 => 'Kabul', # [+4:30]
6411             15 => 'Dubai', # [+4]
6412             16 => 'Tehran', # [+3:30]
6413             17 => 'Moscow', # [+4] (+03:00,DST+0) (! changed to +4 permanent DST in 2011)
6414             18 => 'Cairo', # [+2]
6415             19 => 'Paris', # [+1] (+01:10,DST+0; +02:00,DST+1)
6416             20 => 'London', # [0] (+00:00,DST+0)
6417             21 => 'Azores', # [-1]
6418             22 => 'Fernando de Noronha', # [-2]
6419             23 => 'Sao Paulo', # [-3]
6420             24 => 'Newfoundland', # [-3:30]
6421             25 => 'Santiago', # [-4]
6422             26 => 'Caracas', # [-4:30]
6423             27 => 'New York', # [-5] (-05:00,DST+0; -04:00,DST+1)
6424             28 => 'Chicago', # [-6]
6425             29 => 'Denver', # [-7]
6426             30 => 'Los Angeles', # [-8] (-08:00,DST+0; -07:00,DST+1)
6427             31 => 'Anchorage', # [-9]
6428             32 => 'Honolulu', # [-10]
6429             33 => 'Samoa', # [+13]
6430             32766 => '(not set)', #(NC)
6431             },
6432             },
6433             3 => {
6434             Name => 'DaylightSavings',
6435             PrintConv => {
6436             0 => 'Off',
6437             60 => 'On',
6438             },
6439             },
6440             );
6441              
6442             # my color mode information (MakerNotes tag 0x1d) - PH (A570IS)
6443             %Image::ExifTool::Canon::MyColors = (
6444             %binaryDataAttrs,
6445             FORMAT => 'int16u',
6446             FIRST_ENTRY => 0,
6447             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6448             0x02 => {
6449             Name => 'MyColorMode',
6450             PrintConvColumns => 2,
6451             PrintConv => {
6452             0 => 'Off',
6453             1 => 'Positive Film', #15 (SD600)
6454             2 => 'Light Skin Tone', #15
6455             3 => 'Dark Skin Tone', #15
6456             4 => 'Vivid Blue', #15
6457             5 => 'Vivid Green', #15
6458             6 => 'Vivid Red', #15
6459             7 => 'Color Accent', #15 (A610) (NC)
6460             8 => 'Color Swap', #15 (A610)
6461             9 => 'Custom',
6462             12 => 'Vivid',
6463             13 => 'Neutral',
6464             14 => 'Sepia',
6465             15 => 'B&W',
6466             },
6467             },
6468             );
6469              
6470             # face detect information (MakerNotes tag 0x24) - PH (A570IS)
6471             %Image::ExifTool::Canon::FaceDetect1 = (
6472             %binaryDataAttrs,
6473             FORMAT => 'int16u',
6474             FIRST_ENTRY => 0,
6475             DATAMEMBER => [ 0x02 ],
6476             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6477             0x02 => {
6478             Name => 'FacesDetected',
6479             DataMember => 'FacesDetected',
6480             RawConv => '$$self{FacesDetected} = $val',
6481             },
6482             0x03 => {
6483             Name => 'FaceDetectFrameSize',
6484             Format => 'int16u[2]',
6485             },
6486             0x08 => {
6487             Name => 'Face1Position',
6488             Format => 'int16s[2]',
6489             RawConv => '$$self{FacesDetected} < 1 ? undef: $val',
6490             Notes => q{
6491             X-Y coordinates for the center of each face in the Face Detect frame at the
6492             time of focus lock. "0 0" is the center, and positive X and Y are to the
6493             right and downwards respectively
6494             },
6495             },
6496             0x0a => {
6497             Name => 'Face2Position',
6498             Format => 'int16s[2]',
6499             RawConv => '$$self{FacesDetected} < 2 ? undef : $val',
6500             },
6501             0x0c => {
6502             Name => 'Face3Position',
6503             Format => 'int16s[2]',
6504             RawConv => '$$self{FacesDetected} < 3 ? undef : $val',
6505             },
6506             0x0e => {
6507             Name => 'Face4Position',
6508             Format => 'int16s[2]',
6509             RawConv => '$$self{FacesDetected} < 4 ? undef : $val',
6510             },
6511             0x10 => {
6512             Name => 'Face5Position',
6513             Format => 'int16s[2]',
6514             RawConv => '$$self{FacesDetected} < 5 ? undef : $val',
6515             },
6516             0x12 => {
6517             Name => 'Face6Position',
6518             Format => 'int16s[2]',
6519             RawConv => '$$self{FacesDetected} < 6 ? undef : $val',
6520             },
6521             0x14 => {
6522             Name => 'Face7Position',
6523             Format => 'int16s[2]',
6524             RawConv => '$$self{FacesDetected} < 7 ? undef : $val',
6525             },
6526             0x16 => {
6527             Name => 'Face8Position',
6528             Format => 'int16s[2]',
6529             RawConv => '$$self{FacesDetected} < 8 ? undef : $val',
6530             },
6531             0x18 => {
6532             Name => 'Face9Position',
6533             Format => 'int16s[2]',
6534             RawConv => '$$self{FacesDetected} < 9 ? undef : $val',
6535             },
6536             );
6537              
6538             # more face detect information (MakerNotes tag 0x25) - PH (A570IS)
6539             %Image::ExifTool::Canon::FaceDetect2 = (
6540             %binaryDataAttrs,
6541             FORMAT => 'int8u',
6542             FIRST_ENTRY => 0,
6543             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6544             0x01 => 'FaceWidth',
6545             0x02 => 'FacesDetected',
6546             );
6547              
6548             # G9 white balance information (MakerNotes tag 0x29) (ref IB, changed ref forum13640)
6549             %Image::ExifTool::Canon::WBInfo = (
6550             %binaryDataAttrs,
6551             NOTES => 'WB tags for the Canon G9.',
6552             FORMAT => 'int32u',
6553             FIRST_ENTRY => 1,
6554             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6555             0x02 => { Name => 'WB_GRBGLevelsAuto', Format => 'int32s[4]' },
6556             0x0a => { Name => 'WB_GRBGLevelsDaylight', Format => 'int32s[4]' },
6557             0x12 => { Name => 'WB_GRBGLevelsCloudy', Format => 'int32s[4]' },
6558             0x1a => { Name => 'WB_GRBGLevelsTungsten', Format => 'int32s[4]' },
6559             0x22 => { Name => 'WB_GRBGLevelsFluorescent', Format => 'int32s[4]' },
6560             0x2a => { Name => 'WB_GRBGLevelsFluorHigh', Format => 'int32s[4]' },
6561             0x32 => { Name => 'WB_GRBGLevelsFlash', Format => 'int32s[4]' },
6562             0x3a => { Name => 'WB_GRBGLevelsUnderwater', Format => 'int32s[4]' },
6563             0x42 => { Name => 'WB_GRBGLevelsCustom1', Format => 'int32s[4]' },
6564             0x4a => { Name => 'WB_GRBGLevelsCustom2', Format => 'int32s[4]' },
6565             );
6566              
6567             # yet more face detect information (MakerNotes tag 0x2f) - PH (G12)
6568             %Image::ExifTool::Canon::FaceDetect3 = (
6569             %binaryDataAttrs,
6570             FORMAT => 'int16u',
6571             FIRST_ENTRY => 1,
6572             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6573             # 0 - size (34 bytes)
6574             # 1 - 1=4:3/16:9,2=1:1/3:2/4:5
6575             # 2 - normally 1 if faces detected, but sometimes 0 (maybe if face wasn't in captured image?)
6576             3 => 'FacesDetected',
6577             # 4 - 240=4:3/4:5/1:1,180=16:9,212=3:2
6578             );
6579              
6580             # File number information (MakerNotes tag 0x93)
6581             %Image::ExifTool::Canon::FileInfo = (
6582             %binaryDataAttrs,
6583             FORMAT => 'int16s',
6584             FIRST_ENTRY => 1,
6585             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6586             DATAMEMBER => [ 20 ],
6587             1 => [
6588             { #5
6589             Name => 'FileNumber',
6590             Condition => '$$self{Model} =~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6591             Format => 'int32u',
6592             # Thanks to Juha Eskelinen for figuring this out:
6593             # [this is an odd bit mapping -- it looks like the file number exists as
6594             # a 16-bit integer containing the high bits, followed by an 8-bit integer
6595             # with the low bits. But it is more convenient to have this in a single
6596             # word, so some bit manipulations are necessary... - PH]
6597             # The bit pattern of the 32-bit word is:
6598             # 31....24 23....16 15.....8 7......0
6599             # 00000000 ffffffff DDDDDDDD ddFFFFFF
6600             # 0 = zero bits (not part of the file number?)
6601             # f/F = low/high bits of file number
6602             # d/D = low/high bits of directory number
6603             # The directory and file number are then converted into decimal
6604             # and separated by a '-' to give the file number used in the 20D
6605             ValueConv => '(($val&0xffc0)>>6)*10000+(($val>>16)&0xff)+(($val&0x3f)<<8)',
6606             ValueConvInv => q{
6607             my $d = int($val/10000);
6608             my $f = $val - $d * 10000;
6609             return (($d<<6) & 0xffc0) + (($f & 0xff)<<16) + (($f>>8) & 0x3f);
6610             },
6611             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6612             PrintConvInv => '$val=~s/-//g;$val',
6613             },
6614             { #16
6615             Name => 'FileNumber',
6616             Condition => '$$self{Model} =~ /\b(30D|400D|REBEL XTi|Kiss Digital X|K236)\b/',
6617             Format => 'int32u',
6618             Notes => q{
6619             the location of the upper 4 bits of the directory number is a mystery for
6620             the EOS 30D, so the reported directory number will be incorrect for original
6621             images with a directory number of 164 or greater
6622             },
6623             # Thanks to Emil Sit for figuring this out:
6624             # [more insane bit maniplations like the 20D/350D above, but this time we
6625             # appear to have lost the upper 4 bits of the directory number (this was
6626             # verified through tests with directory numbers 100, 222, 801 and 999) - PH]
6627             # The bit pattern for the 30D is: (see 20D notes above for more information)
6628             # 31....24 23....16 15.....8 7......0
6629             # 00000000 ffff0000 ddddddFF FFFFFFFF
6630             # [NOTE: the 4 high order directory bits don't appear in this record, but
6631             # I have chosen to write them into bits 16-19 since these 4 zero bits look
6632             # very suspicious, and are a convenient place to store this information - PH]
6633             ValueConv => q{
6634             my $d = ($val & 0xffc00) >> 10;
6635             # we know there are missing bits if directory number is < 100
6636             $d += 0x40 while $d < 100; # (repair the damage as best we can)
6637             return $d*10000 + (($val&0x3ff)<<4) + (($val>>20)&0x0f);
6638             },
6639             ValueConvInv => q{
6640             my $d = int($val/10000);
6641             my $f = $val - $d * 10000;
6642             return ($d << 10) + (($f>>4)&0x3ff) + (($f&0x0f)<<20);
6643             },
6644             PrintConv => '$_=$val,s/(\d+)(\d{4})/$1-$2/,$_',
6645             PrintConvInv => '$val=~s/-//g;$val',
6646             },
6647             { #7 (1D, 1Ds)
6648             Name => 'ShutterCount',
6649             Condition => 'GetByteOrder() eq "MM"',
6650             Format => 'int32u',
6651             },
6652             { #7 (1DmkII, 1DSmkII, 1DSmkIIN)
6653             Name => 'ShutterCount',
6654             # ref http://www.luminous-landscape.com/forum/index.php?topic=36469 :
6655             Notes => q{
6656             there are reports that the ShutterCount changed when loading a settings file
6657             on the 1DSmkII
6658             },
6659             Condition => '$$self{Model} =~ /\b1Ds? Mark II\b/',
6660             Format => 'int32u',
6661             ValueConv => '($val>>16)|(($val&0xffff)<<16)',
6662             ValueConvInv => '($val>>16)|(($val&0xffff)<<16)',
6663             },
6664             # 5D gives a single byte value (unknown)
6665             # 40D stores all zeros
6666             ],
6667             3 => { #PH
6668             Name => 'BracketMode',
6669             PrintConv => {
6670             0 => 'Off',
6671             1 => 'AEB',
6672             2 => 'FEB',
6673             3 => 'ISO',
6674             4 => 'WB',
6675             },
6676             },
6677             4 => 'BracketValue', #PH
6678             5 => 'BracketShotNumber', #PH
6679             6 => { #PH
6680             Name => 'RawJpgQuality',
6681             RawConv => '$val<=0 ? undef : $val',
6682             PrintConv => \%canonQuality,
6683             },
6684             7 => { #PH
6685             Name => 'RawJpgSize',
6686             RawConv => '$val<0 ? undef : $val',
6687             PrintConv => \%canonImageSize,
6688             },
6689             8 => { #PH
6690             Name => 'LongExposureNoiseReduction2',
6691             Notes => q{
6692             for some modules this gives the long exposure noise reduction applied to the
6693             image, but for other models this just reflects the setting independent of
6694             whether or not it was applied
6695             },
6696             RawConv => '$val<0 ? undef : $val',
6697             PrintConv => {
6698             0 => 'Off',
6699             1 => 'On (1D)',
6700             3 => 'On',
6701             4 => 'Auto',
6702             },
6703             },
6704             9 => { #PH
6705             Name => 'WBBracketMode',
6706             PrintConv => {
6707             0 => 'Off',
6708             1 => 'On (shift AB)',
6709             2 => 'On (shift GM)',
6710             },
6711             },
6712             12 => 'WBBracketValueAB', #PH
6713             13 => 'WBBracketValueGM', #PH
6714             14 => { #PH
6715             Name => 'FilterEffect',
6716             RawConv => '$val==-1 ? undef : $val',
6717             PrintConv => {
6718             0 => 'None',
6719             1 => 'Yellow',
6720             2 => 'Orange',
6721             3 => 'Red',
6722             4 => 'Green',
6723             },
6724             },
6725             15 => { #PH
6726             Name => 'ToningEffect',
6727             RawConv => '$val==-1 ? undef : $val',
6728             PrintConv => {
6729             0 => 'None',
6730             1 => 'Sepia',
6731             2 => 'Blue',
6732             3 => 'Purple',
6733             4 => 'Green',
6734             },
6735             },
6736             16 => { #PH
6737             %ciMacroMagnification,
6738             # MP-E 65mm on 5DmkII: 44=5x,52~=3.9x,56~=3.3x,62~=2.6x,75=1x
6739             # ME-E 65mm on 40D/450D: 72 for all samples (not valid)
6740             Condition => q{
6741             $$self{LensType} and $$self{LensType} == 124 and
6742             $$self{Model} !~ /\b(40D|450D|REBEL XSi|Kiss X2)\b/
6743             },
6744             Notes => q{
6745             currently decoded only for the MP-E 65mm f/2.8 1-5x Macro Photo, and not
6746             valid for all camera models
6747             },
6748             },
6749             # 17 - values: 0, 3, 4
6750             # 18 - same as LiveViewShooting for all my samples (5DmkII, 50D) - PH
6751             19 => { #PH
6752             # Note: this value is not displayed by Canon ImageBrowser for the following
6753             # models with the live view feature: 1DmkIII, 1DSmkIII, 40D, 450D, 1000D
6754             # (this tag could be valid only for some firmware versions:
6755             # http://www.breezesys.com/forum/showthread.php?p=16980)
6756             Name => 'LiveViewShooting',
6757             PrintConv => \%offOn,
6758             },
6759             20 => { #47
6760             Name => 'FocusDistanceUpper',
6761             DataMember => 'FocusDistanceUpper2',
6762             Format => 'int16u',
6763             RawConv => '($$self{FocusDistanceUpper2} = $val) || undef',
6764             ValueConv => '$val / 100',
6765             ValueConvInv => '$val * 100',
6766             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6767             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6768             },
6769             21 => { #47
6770             Name => 'FocusDistanceLower',
6771             Condition => '$$self{FocusDistanceUpper2}',
6772             Format => 'int16u',
6773             ValueConv => '$val / 100',
6774             ValueConvInv => '$val * 100',
6775             PrintConv => '$val > 655.345 ? "inf" : "$val m"',
6776             PrintConvInv => '$val =~ s/ ?m$//; IsFloat($val) ? $val : 655.35',
6777             },
6778             # 22 - values: 0, 1
6779             23 => { #JohnMoyer (forum12925)
6780             Name => 'ShutterMode',
6781             PrintConv => {
6782             0 => 'Mechanical',
6783             1 => 'Electronic First Curtain',
6784             2 => 'Electronic',
6785             # 3 => ?
6786             # 21 => ?
6787             # 22 => ?
6788             },
6789             },
6790             25 => { #PH
6791             Name => 'FlashExposureLock',
6792             PrintConv => \%offOn,
6793             },
6794             0x3d => { #IB
6795             Name => 'RFLensType',
6796             Format => 'int16u',
6797             PrintConv => {
6798             0 => 'n/a',
6799             257 => 'Canon RF 50mm F1.2L USM',
6800             258 => 'Canon RF 24-105mm F4L IS USM',
6801             259 => 'Canon RF 28-70mm F2L USM',
6802             260 => 'Canon RF 35mm F1.8 MACRO IS STM',
6803             261 => 'Canon RF 85mm F1.2L USM',
6804             262 => 'Canon RF 85mm F1.2L USM DS',
6805             263 => 'Canon RF 24-70mm F2.8L IS USM',
6806             264 => 'Canon RF 15-35mm F2.8L IS USM',
6807             265 => 'Canon RF 24-240mm F4-6.3 IS USM',
6808             266 => 'Canon RF 70-200mm F2.8L IS USM',
6809             267 => 'Canon RF 85mm F2 MACRO IS STM',
6810             268 => 'Canon RF 600mm F11 IS STM',
6811             269 => 'Canon RF 600mm F11 IS STM + RF1.4x',
6812             270 => 'Canon RF 600mm F11 IS STM + RF2x',
6813             271 => 'Canon RF 800mm F11 IS STM',
6814             272 => 'Canon RF 800mm F11 IS STM + RF1.4x',
6815             273 => 'Canon RF 800mm F11 IS STM + RF2x',
6816             274 => 'Canon RF 24-105mm F4-7.1 IS STM',
6817             275 => 'Canon RF 100-500mm F4.5-7.1L IS USM',
6818             276 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF1.4x',
6819             277 => 'Canon RF 100-500mm F4.5-7.1L IS USM + RF2x',
6820             278 => 'Canon RF 70-200mm F4L IS USM', #42
6821             279 => 'Canon RF 100mm F2.8L MACRO IS USM', #42
6822             280 => 'Canon RF 50mm F1.8 STM', #42
6823             281 => 'Canon RF 14-35mm F4L IS USM', #42/IB
6824             282 => 'Canon RF-S 18-45mm F4.5-6.3 IS STM', #42
6825             283 => 'Canon RF 100-400mm F5.6-8 IS USM', #42
6826             284 => 'Canon RF 100-400mm F5.6-8 IS USM + RF1.4x', #42
6827             285 => 'Canon RF 100-400mm F5.6-8 IS USM + RF2x', #42
6828             286 => 'Canon RF-S 18-150mm F3.5-6.3 IS STM', #42
6829             287 => 'Canon RF 24mm F1.8 MACRO IS STM', #42
6830             288 => 'Canon RF 16mm F2.8 STM', #42
6831             289 => 'Canon RF 400mm F2.8L IS USM', #IB
6832             290 => 'Canon RF 400mm F2.8L IS USM + RF1.4x', #IB
6833             291 => 'Canon RF 400mm F2.8L IS USM + RF2x', #IB
6834             292 => 'Canon RF 600mm F4L IS USM', #GiaZopatti
6835             295 => 'Canon RF 800mm F5.6L IS USM', #42
6836             296 => 'Canon RF 800mm F5.6L IS USM + RF1.4x', #42
6837             297 => 'Canon RF 800mm F5.6L IS USM + RF2x', #42
6838             298 => 'Canon RF 1200mm F8L IS USM', #42
6839             299 => 'Canon RF 1200mm F8L IS USM + RF1.4x', #42
6840             300 => 'Canon RF 1200mm F8L IS USM + RF2x', #42
6841             302 => 'Canon RF 15-30mm F4.5-6.3 IS STM', #42
6842             303 => 'Canon RF 135mm F1.8 L IS USM', #42
6843             # Note: add new RF lenses to %canonLensTypes with ID 61182
6844             },
6845             },
6846             );
6847              
6848             # Internal serial number information (MakerNotes tag 0x96) (ref PH)
6849             %Image::ExifTool::Canon::SerialInfo = (
6850             %binaryDataAttrs,
6851             FIRST_ENTRY => 0,
6852             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6853             9 => {
6854             Name => 'InternalSerialNumber',
6855             Format => 'string',
6856             },
6857             );
6858              
6859             # Cropping information (MakerNotes tag 0x98) (ref PH)
6860             %Image::ExifTool::Canon::CropInfo = (
6861             %binaryDataAttrs,
6862             FORMAT => 'int16u',
6863             FIRST_ENTRY => 0,
6864             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6865             0 => 'CropLeftMargin', # (NC, may be right)
6866             1 => 'CropRightMargin',
6867             2 => 'CropTopMargin', # (NC, may be bottom)
6868             3 => 'CropBottomMargin',
6869             );
6870              
6871             # Aspect ratio information (MakerNotes tag 0x9a) (ref PH)
6872             %Image::ExifTool::Canon::AspectInfo = (
6873             %binaryDataAttrs,
6874             FORMAT => 'int32u',
6875             FIRST_ENTRY => 0,
6876             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6877             0 => {
6878             Name => 'AspectRatio',
6879             PrintConv => {
6880             0 => '3:2',
6881             1 => '1:1',
6882             2 => '4:3',
6883             7 => '16:9',
6884             8 => '4:5',
6885             12 => '3:2 (APS-H crop)', #IB
6886             13 => '3:2 (APS-C crop)', #IB
6887             258 => '4:3 crop', #PH (NC)
6888             },
6889             },
6890             # (could use better names for these, or the Crop tags above, or both)
6891             1 => 'CroppedImageWidth',
6892             2 => 'CroppedImageHeight',
6893             3 => 'CroppedImageLeft', #forum4138
6894             4 => 'CroppedImageTop', #ditto
6895             );
6896              
6897             # Color information (MakerNotes tag 0xa0)
6898             %Image::ExifTool::Canon::Processing = (
6899             %binaryDataAttrs,
6900             FORMAT => 'int16s',
6901             FIRST_ENTRY => 1,
6902             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
6903             1 => { #PH
6904             Name => 'ToneCurve',
6905             PrintConv => {
6906             0 => 'Standard',
6907             1 => 'Manual',
6908             2 => 'Custom',
6909             },
6910             },
6911             2 => { #12
6912             Name => 'Sharpness',
6913             Notes => 'all models except the 20D and 350D',
6914             Condition => '$$self{Model} !~ /\b(20D|350D|REBEL XT|Kiss Digital N)\b/',
6915             Priority => 0, # (maybe not as reliable as other sharpness values)
6916             },
6917             3 => { #PH
6918             Name => 'SharpnessFrequency', # PatternSharpness?
6919             PrintConvColumns => 2,
6920             PrintConv => {
6921             0 => 'n/a',
6922             1 => 'Lowest',
6923             2 => 'Low',
6924             3 => 'Standard',
6925             4 => 'High',
6926             5 => 'Highest',
6927             },
6928             },
6929             4 => 'SensorRedLevel', #PH
6930             5 => 'SensorBlueLevel', #PH
6931             6 => 'WhiteBalanceRed', #PH
6932             7 => 'WhiteBalanceBlue', #PH
6933             8 => { #PH
6934             Name => 'WhiteBalance',
6935             RawConv => '$val < 0 ? undef : $val',
6936             PrintConv => \%canonWhiteBalance,
6937             SeparateTable => 1,
6938             },
6939             9 => 'ColorTemperature', #6
6940             10 => { #12
6941             Name => 'PictureStyle',
6942             Flags => ['PrintHex','SeparateTable'],
6943             PrintConv => \%pictureStyles,
6944             },
6945             11 => { #PH
6946             Name => 'DigitalGain',
6947             ValueConv => '$val / 10',
6948             ValueConvInv => '$val * 10',
6949             },
6950             12 => { #PH
6951             Name => 'WBShiftAB',
6952             Notes => 'positive is a shift toward amber',
6953             },
6954             13 => { #PH
6955             Name => 'WBShiftGM',
6956             Notes => 'positive is a shift toward green',
6957             },
6958             );
6959              
6960             # Color balance information (MakerNotes tag 0xa9) (ref PH)
6961             %Image::ExifTool::Canon::ColorBalance = (
6962             %binaryDataAttrs,
6963             NOTES => 'These tags are used by the 10D and 300D.',
6964             FORMAT => 'int16s',
6965             FIRST_ENTRY => 0,
6966             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6967             # red,green1,green2,blue (ref 2)
6968             1 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
6969             5 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
6970             9 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
6971             13 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
6972             17 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
6973             21 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
6974             25 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
6975             29 => [{
6976             Name => 'WB_RGGBLevelsCustom',
6977             Notes => 'black levels for the D60',
6978             Condition => '$$self{Model} !~ /EOS D60\b/',
6979             Format => 'int16s[4]',
6980             },{ # (black levels for D60, ref IB)
6981             Name => 'BlackLevels',
6982             Format => 'int16s[4]',
6983             }],
6984             33 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
6985             37 => { Name => 'WB_RGGBBlackLevels', Format => 'int16s[4]' }, #IB
6986             );
6987              
6988             # Measured color levels (MakerNotes tag 0xaa) (ref 37)
6989             %Image::ExifTool::Canon::MeasuredColor = (
6990             %binaryDataAttrs,
6991             FORMAT => 'int16u',
6992             FIRST_ENTRY => 1,
6993             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
6994             1 => {
6995             # this is basically the inverse of WB_RGGBLevelsMeasured (ref 37)
6996             Name => 'MeasuredRGGB',
6997             Format => 'int16u[4]',
6998             },
6999             # 5 - observed values: 0, 1 - PH
7000             );
7001              
7002             # Flags information (MakerNotes tag 0xb0) (ref PH)
7003             %Image::ExifTool::Canon::Flags = (
7004             %binaryDataAttrs,
7005             FORMAT => 'int16s',
7006             FIRST_ENTRY => 1,
7007             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7008             1 => 'ModifiedParamFlag',
7009             );
7010              
7011             # Modified information (MakerNotes tag 0xb1) (ref PH)
7012             %Image::ExifTool::Canon::ModifiedInfo = (
7013             %binaryDataAttrs,
7014             FORMAT => 'int16s',
7015             FIRST_ENTRY => 1,
7016             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7017             1 => {
7018             Name => 'ModifiedToneCurve',
7019             PrintConv => {
7020             0 => 'Standard',
7021             1 => 'Manual',
7022             2 => 'Custom',
7023             },
7024             },
7025             2 => {
7026             Name => 'ModifiedSharpness',
7027             Notes => '1D and 5D only',
7028             Condition => '$$self{Model} =~ /\b(1D|5D)/',
7029             },
7030             3 => {
7031             Name => 'ModifiedSharpnessFreq', # ModifiedPatternSharpness?
7032             PrintConv => {
7033             0 => 'n/a',
7034             1 => 'Lowest',
7035             2 => 'Low',
7036             3 => 'Standard',
7037             4 => 'High',
7038             5 => 'Highest',
7039             },
7040             },
7041             4 => 'ModifiedSensorRedLevel',
7042             5 => 'ModifiedSensorBlueLevel',
7043             6 => 'ModifiedWhiteBalanceRed',
7044             7 => 'ModifiedWhiteBalanceBlue',
7045             8 => {
7046             Name => 'ModifiedWhiteBalance',
7047             PrintConv => \%canonWhiteBalance,
7048             SeparateTable => 'WhiteBalance',
7049             },
7050             9 => 'ModifiedColorTemp',
7051             10 => {
7052             Name => 'ModifiedPictureStyle',
7053             PrintHex => 1,
7054             SeparateTable => 'PictureStyle',
7055             PrintConv => \%pictureStyles,
7056             },
7057             11 => {
7058             Name => 'ModifiedDigitalGain',
7059             ValueConv => '$val / 10',
7060             ValueConvInv => '$val * 10',
7061             },
7062             );
7063              
7064             # Preview image information (MakerNotes tag 0xb6)
7065             # - The 300D writes a 1536x1024 preview image that is accessed
7066             # through this information - decoded by PH 12/14/03
7067             %Image::ExifTool::Canon::PreviewImageInfo = (
7068             %binaryDataAttrs,
7069             FORMAT => 'int32u',
7070             FIRST_ENTRY => 1,
7071             IS_OFFSET => [ 5 ], # tag 5 is 'IsOffset'
7072             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7073             # the size of the preview block in 2-byte increments
7074             # 0 => {
7075             # Name => 'PreviewImageInfoWords',
7076             # },
7077             1 => {
7078             Name => 'PreviewQuality',
7079             PrintConv => \%canonQuality,
7080             },
7081             2 => {
7082             Name => 'PreviewImageLength',
7083             OffsetPair => 5, # point to associated offset
7084             DataTag => 'PreviewImage',
7085             WriteGroup => 'MakerNotes',
7086             Protected => 2,
7087             },
7088             3 => 'PreviewImageWidth',
7089             4 => 'PreviewImageHeight',
7090             5 => {
7091             Name => 'PreviewImageStart',
7092             Flags => 'IsOffset',
7093             OffsetPair => 2, # associated byte count tagID
7094             DataTag => 'PreviewImage',
7095             WriteGroup => 'MakerNotes',
7096             Protected => 2,
7097             },
7098             # NOTE: The size of the PreviewImageInfo structure is incorrectly
7099             # written as 48 bytes (Count=12, Format=int32u), but only the first
7100             # 6 int32u values actually exist
7101             );
7102              
7103             # Sensor information (MakerNotes tag 0xe0) (ref 12)
7104             %Image::ExifTool::Canon::SensorInfo = (
7105             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
7106             FORMAT => 'int16s',
7107             FIRST_ENTRY => 1,
7108             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
7109             # Note: Don't make these writable because it confuses Canon decoding software
7110             # if these are changed
7111             1 => 'SensorWidth',
7112             2 => 'SensorHeight',
7113             5 => 'SensorLeftBorder', #2
7114             6 => 'SensorTopBorder', #2
7115             7 => 'SensorRightBorder', #2
7116             8 => 'SensorBottomBorder', #2
7117             9 => { #22
7118             Name => 'BlackMaskLeftBorder',
7119             Notes => q{
7120             coordinates for the area to the left or right of the image used to calculate
7121             the average black level
7122             },
7123             },
7124             10 => 'BlackMaskTopBorder', #22
7125             11 => 'BlackMaskRightBorder', #22
7126             12 => 'BlackMaskBottomBorder', #22
7127             );
7128              
7129             # Color data (MakerNotes tag 0x4001, count=582) (ref 12)
7130             %Image::ExifTool::Canon::ColorData1 = (
7131             %binaryDataAttrs,
7132             NOTES => 'These tags are used by the 20D and 350D.',
7133             FORMAT => 'int16s',
7134             FIRST_ENTRY => 0,
7135             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7136             IS_SUBDIR => [ 0x4b ],
7137             # 0x00: size of record in bytes - PH
7138             # (dcraw 8.81 uses index 0x19 for WB)
7139             0x19 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7140             0x1d => 'ColorTempAsShot',
7141             0x1e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7142             0x22 => 'ColorTempAuto',
7143             0x23 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7144             0x27 => 'ColorTempDaylight',
7145             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7146             0x2c => 'ColorTempShade',
7147             0x2d => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7148             0x31 => 'ColorTempCloudy',
7149             0x32 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7150             0x36 => 'ColorTempTungsten',
7151             0x37 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7152             0x3b => 'ColorTempFluorescent',
7153             0x3c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7154             0x40 => 'ColorTempFlash',
7155             0x41 => { Name => 'WB_RGGBLevelsCustom1', Format => 'int16s[4]' },
7156             0x45 => 'ColorTempCustom1',
7157             0x46 => { Name => 'WB_RGGBLevelsCustom2', Format => 'int16s[4]' },
7158             0x4a => 'ColorTempCustom2',
7159             0x4b => { #PH
7160             Name => 'ColorCalib',
7161             Format => 'undef[120]',
7162             Unknown => 1, # (all tags are unknown, so we can avoid processing entire directory)
7163             Notes => 'A, B, C, Temperature',
7164             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7165             },
7166             );
7167              
7168             # Color data (MakerNotes tag 0x4001, count=653) (ref 12)
7169             %Image::ExifTool::Canon::ColorData2 = (
7170             %binaryDataAttrs,
7171             NOTES => 'These tags are used by the 1DmkII and 1DSmkII.',
7172             FORMAT => 'int16s',
7173             FIRST_ENTRY => 0,
7174             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7175             IS_SUBDIR => [ 0xa4 ],
7176             0x18 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7177             0x1c => 'ColorTempAuto',
7178             0x1d => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7179             0x21 => { Name => 'ColorTempUnknown', Unknown => 1 },
7180             # (dcraw 8.81 uses index 0x22 for WB)
7181             0x22 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7182             0x26 => 'ColorTempAsShot',
7183             0x27 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7184             0x2b => 'ColorTempDaylight',
7185             0x2c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7186             0x30 => 'ColorTempShade',
7187             0x31 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7188             0x35 => 'ColorTempCloudy',
7189             0x36 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7190             0x3a => 'ColorTempTungsten',
7191             0x3b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7192             0x3f => 'ColorTempFluorescent',
7193             0x40 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7194             0x44 => 'ColorTempKelvin',
7195             0x45 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7196             0x49 => 'ColorTempFlash',
7197             0x4a => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7198             0x4e => { Name => 'ColorTempUnknown2', Unknown => 1 },
7199             0x4f => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7200             0x53 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7201             0x54 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7202             0x58 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7203             0x59 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7204             0x5d => { Name => 'ColorTempUnknown5', Unknown => 1 },
7205             0x5e => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7206             0x62 => { Name => 'ColorTempUnknown6', Unknown => 1 },
7207             0x63 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7208             0x67 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7209             0x68 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7210             0x6c => { Name => 'ColorTempUnknown8', Unknown => 1 },
7211             0x6d => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7212             0x71 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7213             0x72 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7214             0x76 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7215             0x77 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7216             0x7b => { Name => 'ColorTempUnknown11', Unknown => 1 },
7217             0x7c => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7218             0x80 => { Name => 'ColorTempUnknown12', Unknown => 1 },
7219             0x81 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7220             0x85 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7221             0x86 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7222             0x8a => { Name => 'ColorTempUnknown14', Unknown => 1 },
7223             0x8b => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7224             0x8f => { Name => 'ColorTempUnknown15', Unknown => 1 },
7225             0x90 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7226             0x94 => 'ColorTempPC1',
7227             0x95 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7228             0x99 => 'ColorTempPC2',
7229             0x9a => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7230             0x9e => 'ColorTempPC3',
7231             0x9f => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7232             0xa3 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7233             0xa4 => { #PH
7234             Name => 'ColorCalib',
7235             Format => 'undef[120]',
7236             Unknown => 1,
7237             Notes => 'A, B, C, Temperature',
7238             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7239             },
7240             0x26a => { #PH
7241             Name => 'RawMeasuredRGGB',
7242             Format => 'int32u[4]',
7243             Notes => 'raw MeasuredRGGB values, before normalization',
7244             # swap words because the word ordering is big-endian, opposite to the byte ordering
7245             ValueConv => \&SwapWords,
7246             ValueConvInv => \&SwapWords,
7247             },
7248             );
7249              
7250             # Color data (MakerNotes tag 0x4001, count=796) (ref 12)
7251             %Image::ExifTool::Canon::ColorData3 = (
7252             %binaryDataAttrs,
7253             NOTES => 'These tags are used by the 1DmkIIN, 5D, 30D and 400D.',
7254             FORMAT => 'int16s',
7255             FIRST_ENTRY => 0,
7256             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7257             IS_SUBDIR => [ 0x85 ],
7258             0x00 => { #PH
7259             Name => 'ColorDataVersion',
7260             PrintConv => {
7261             1 => '1 (1DmkIIN/5D/30D/400D)',
7262             },
7263             },
7264             # 0x01-0x3e: RGGB coefficients, apparently specific to the
7265             # individual camera and possibly used for color calibration (ref 37)
7266             # (dcraw 8.81 uses index 0x3f for WB)
7267             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7268             0x43 => 'ColorTempAsShot',
7269             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7270             0x48 => 'ColorTempAuto',
7271             # not sure exactly what 'Measured' values mean...
7272             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7273             0x4d => 'ColorTempMeasured',
7274             0x4e => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7275             0x52 => 'ColorTempDaylight',
7276             0x53 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7277             0x57 => 'ColorTempShade',
7278             0x58 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7279             0x5c => 'ColorTempCloudy',
7280             0x5d => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7281             0x61 => 'ColorTempTungsten',
7282             0x62 => { Name => 'WB_RGGBLevelsFluorescent', Format => 'int16s[4]' },
7283             0x66 => 'ColorTempFluorescent',
7284             0x67 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7285             0x6b => 'ColorTempKelvin',
7286             0x6c => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7287             0x70 => 'ColorTempFlash',
7288             0x71 => { Name => 'WB_RGGBLevelsPC1', Format => 'int16s[4]' },
7289             0x75 => 'ColorTempPC1',
7290             0x76 => { Name => 'WB_RGGBLevelsPC2', Format => 'int16s[4]' },
7291             0x7a => 'ColorTempPC2',
7292             0x7b => { Name => 'WB_RGGBLevelsPC3', Format => 'int16s[4]' },
7293             0x7f => 'ColorTempPC3',
7294             0x80 => { Name => 'WB_RGGBLevelsCustom', Format => 'int16s[4]' },
7295             0x84 => 'ColorTempCustom',
7296             0x85 => { #37
7297             Name => 'ColorCalib',
7298             Format => 'undef[120]',
7299             Unknown => 1,
7300             Notes => 'B, C, A, Temperature',
7301             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7302             },
7303             0xc4 => { #IB
7304             Name => 'PerChannelBlackLevel',
7305             Format => 'int16u[4]',
7306             },
7307             # 0xc8-0x1c7: some sort of color table (ref 37)
7308             0x248 => { #37
7309             Name => 'FlashOutput',
7310             ValueConv => '$val >= 255 ? 255 : exp(($val-200)/16*log(2))',
7311             ValueConvInv => '$val == 255 ? 255 : 200 + log($val)*16/log(2)',
7312             PrintConv => '$val == 255 ? "Strobe or Misfire" : sprintf("%.0f%%", $val * 100)',
7313             PrintConvInv => '$val =~ /^(\d(\.?\d*))/ ? $1 / 100 : 255',
7314             },
7315             0x249 => { #37
7316             Name => 'FlashBatteryLevel',
7317             # calibration points for external flash: 144=3.76V (almost empty), 192=5.24V (full)
7318             # - have seen a value of 201 with internal flash
7319             PrintConv => '$val ? sprintf("%.2fV", $val * 5 / 186) : "n/a"',
7320             PrintConvInv => '$val=~/^(\d+\.\d+)\s*V?$/i ? int($val*186/5+0.5) : 0',
7321             },
7322             0x24a => { #37
7323             Name => 'ColorTempFlashData',
7324             # 0 for no external flash, 35980 for 'Strobe or Misfire'
7325             # (lower than ColorTempFlash by up to 200 degrees)
7326             RawConv => '($val < 2000 or $val > 12000) ? undef : $val',
7327             },
7328             # 0x24b: inverse relationship with flash power (ref 37)
7329             # 0x286: has value 256 for correct exposure, less for under exposure (seen 96 minimum) (ref 37)
7330             0x287 => { #37
7331             Name => 'MeasuredRGGBData',
7332             Format => 'int32u[4]',
7333             Notes => 'MeasuredRGGB may be derived from these data values',
7334             # swap words because the word ordering is big-endian, opposite to the byte ordering
7335             ValueConv => \&SwapWords,
7336             ValueConvInv => \&SwapWords,
7337             },
7338             # 0x297: ranges from -10 to 30, higher for high ISO (ref 37)
7339             );
7340              
7341             # Color data (MakerNotes tag 0x4001, count=674|692|702|1227|1250|1251|1337|1338|1346) (ref PH)
7342             %Image::ExifTool::Canon::ColorData4 = (
7343             %binaryDataAttrs,
7344             NOTES => q{
7345             These tags are used by the 1DmkIII, 1DSmkIII, 1DmkIV, 5DmkII, 7D, 40D, 50D,
7346             60D, 450D, 500D, 550D, 1000D and 1100D.
7347             },
7348             FORMAT => 'int16s',
7349             FIRST_ENTRY => 0,
7350             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7351             IS_SUBDIR => [ 0x3f, 0xa8 ],
7352             DATAMEMBER => [ 0x00 ],
7353             0x00 => {
7354             Name => 'ColorDataVersion',
7355             DataMember => 'ColorDataVersion',
7356             RawConv => '$$self{ColorDataVersion} = $val',
7357             PrintConv => {
7358             2 => '2 (1DmkIII)',
7359             3 => '3 (40D)',
7360             4 => '4 (1DSmkIII)',
7361             5 => '5 (450D/1000D)',
7362             6 => '6 (50D/5DmkII)',
7363             7 => '7 (500D/550D/7D/1DmkIV)',
7364             9 => '9 (60D/1100D)',
7365             },
7366             },
7367             # 0x01-0x18: unknown RGGB coefficients (int16s[4]) (50D)
7368             # (dcraw 8.81 uses index 0x3f for WB)
7369             0x3f => {
7370             Name => 'ColorCoefs',
7371             Format => 'undef[210]', # ColorTempUnknown11 is last entry
7372             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7373             },
7374             0xa8 => {
7375             Name => 'ColorCalib',
7376             Format => 'undef[120]',
7377             Unknown => 1,
7378             Notes => 'B, C, A, Temperature',
7379             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7380             },
7381             0x0e7 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7382             0x280 => { #PH
7383             Name => 'RawMeasuredRGGB',
7384             Format => 'int32u[4]',
7385             Notes => 'raw MeasuredRGGB values, before normalization',
7386             # swap words because the word ordering is big-endian, opposite to the byte ordering
7387             ValueConv => \&SwapWords,
7388             ValueConvInv => \&SwapWords,
7389             },
7390             0x2b4 => { #IB
7391             Name => 'PerChannelBlackLevel',
7392             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7393             Format => 'int16u[4]',
7394             },
7395             0x2b8 => { #IB
7396             Name => 'NormalWhiteLevel',
7397             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7398             Format => 'int16u',
7399             RawConv => '$val || undef',
7400             },
7401             0x2b9 => { #IB
7402             Name => 'SpecularWhiteLevel',
7403             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7404             Format => 'int16u',
7405             },
7406             0x2ba => { #IB
7407             Name => 'LinearityUpperMargin',
7408             Condition => '$$self{ColorDataVersion} == 4 or $$self{ColorDataVersion} == 5',
7409             Format => 'int16u',
7410             },
7411             0x2cb => { #IB
7412             Name => 'PerChannelBlackLevel',
7413             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7414             Format => 'int16u[4]',
7415             },
7416             0x2cf => [{ #IB
7417             Name => 'NormalWhiteLevel',
7418             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7419             Format => 'int16u',
7420             RawConv => '$val || undef',
7421             },{
7422             Name => 'PerChannelBlackLevel',
7423             Condition => '$$self{ColorDataVersion} == 9',
7424             Format => 'int16u[4]',
7425             }],
7426             0x2d0 => { #IB
7427             Name => 'SpecularWhiteLevel',
7428             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7429             Format => 'int16u',
7430             },
7431             0x2d1 => { #IB
7432             Name => 'LinearityUpperMargin',
7433             Condition => '$$self{ColorDataVersion} == 6 or $$self{ColorDataVersion} == 7',
7434             Format => 'int16u',
7435             },
7436             0x2d3 => { #IB
7437             Name => 'NormalWhiteLevel',
7438             Condition => '$$self{ColorDataVersion} == 9',
7439             Format => 'int16u',
7440             RawConv => '$val || undef',
7441             },
7442             0x2d4 => { #IB
7443             Name => 'SpecularWhiteLevel',
7444             Condition => '$$self{ColorDataVersion} == 9',
7445             Format => 'int16u',
7446             },
7447             0x2d5 => { #IB
7448             Name => 'LinearityUpperMargin',
7449             Condition => '$$self{ColorDataVersion} == 9',
7450             Format => 'int16u',
7451             },
7452             );
7453              
7454             # color coefficients (ref PH)
7455             %Image::ExifTool::Canon::ColorCoefs = (
7456             %binaryDataAttrs,
7457             FORMAT => 'int16s',
7458             FIRST_ENTRY => 0,
7459             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7460             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7461             0x04 => 'ColorTempAsShot',
7462             0x05 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7463             0x09 => 'ColorTempAuto',
7464             0x0a => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7465             0x0e => 'ColorTempMeasured',
7466             # the following Unknown values are set for the 50D and 5DmkII, and the
7467             # SRAW images of the 40D, and affect thumbnail display for the 50D/5DmkII
7468             # and conversion for all modes of the 40D
7469             0x0f => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7470             0x13 => { Name => 'ColorTempUnknown', Unknown => 1 },
7471             0x14 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7472             0x18 => 'ColorTempDaylight',
7473             0x19 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7474             0x1d => 'ColorTempShade',
7475             0x1e => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7476             0x22 => 'ColorTempCloudy',
7477             0x23 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7478             0x27 => 'ColorTempTungsten',
7479             0x28 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7480             0x2c => 'ColorTempFluorescent',
7481             # (changing the Kelvin values has no effect on image in DPP... why not?)
7482             0x2d => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7483             0x31 => 'ColorTempKelvin',
7484             0x32 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7485             0x36 => 'ColorTempFlash',
7486             0x37 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7487             0x3b => { Name => 'ColorTempUnknown2', Unknown => 1 },
7488             0x3c => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7489             0x40 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7490             0x41 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7491             0x45 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7492             0x46 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7493             0x4a => { Name => 'ColorTempUnknown5', Unknown => 1 },
7494             0x4b => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7495             0x4f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7496             0x50 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7497             0x54 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7498             0x55 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7499             0x59 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7500             0x5a => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7501             0x5e => { Name => 'ColorTempUnknown9', Unknown => 1 },
7502             0x5f => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7503             0x63 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7504             0x64 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7505             0x68 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7506             0x69 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7507             0x6d => { Name => 'ColorTempUnknown12', Unknown => 1 },
7508             0x6e => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7509             0x72 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7510             );
7511              
7512             # color coefficients (ref PH/IB)
7513             %Image::ExifTool::Canon::ColorCoefs2 = (
7514             %binaryDataAttrs,
7515             FORMAT => 'int16s',
7516             FIRST_ENTRY => 0,
7517             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7518             0x00 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7519             0x07 => 'ColorTempAsShot',
7520             0x08 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7521             0x0f => 'ColorTempAuto',
7522             0x10 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7523             0x17 => 'ColorTempMeasured',
7524             0x18 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7525             0x1f => { Name => 'ColorTempUnknown', Unknown => 1 },
7526             0x20 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7527             0x27 => 'ColorTempDaylight',
7528             0x28 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7529             0x2f => 'ColorTempShade',
7530             0x30 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7531             0x37 => 'ColorTempCloudy',
7532             0x38 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7533             0x3f => 'ColorTempTungsten',
7534             0x40 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7535             0x47 => 'ColorTempFluorescent',
7536             0x48 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7537             0x4f => 'ColorTempKelvin',
7538             0x50 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7539             0x57 => 'ColorTempFlash',
7540             0x58 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7541             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
7542             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7543             0x67 => { Name => 'ColorTempUnknown3', Unknown => 1 },
7544             0x68 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7545             0x6f => { Name => 'ColorTempUnknown4', Unknown => 1 },
7546             0x70 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7547             0x77 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7548             0x78 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7549             0x7f => { Name => 'ColorTempUnknown6', Unknown => 1 },
7550             0x80 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7551             0x87 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7552             0x88 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7553             0x8f => { Name => 'ColorTempUnknown8', Unknown => 1 },
7554             0x90 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7555             0x97 => { Name => 'ColorTempUnknown9', Unknown => 1 },
7556             0x98 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7557             0x9f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7558             0xa0 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7559             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7560             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7561             0xaf => { Name => 'ColorTempUnknown12', Unknown => 1 },
7562             0xb0 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7563             0xb7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7564             );
7565              
7566             # color calibration (ref 37)
7567             %Image::ExifTool::Canon::ColorCalib = (
7568             %binaryDataAttrs,
7569             FORMAT => 'int16s',
7570             FIRST_ENTRY => 0,
7571             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7572             # these coefficients are in a different order compared to older
7573             # models (A,B,C in ColorData1/2 vs. C,A,B in ColorData3/4) - PH
7574             # Coefficient A most closely matches the blue curvature, and
7575             # coefficient B most closely matches the red curvature, but the match
7576             # is not perfect, and I don't know what coefficient C is for (certainly
7577             # not a green coefficient) - PH
7578             NOTES => q{
7579             Camera color calibration data. For the 20D, 350D, 1DmkII and 1DSmkII the
7580             order of the coefficients is A, B, C, Temperature, but for newer models it
7581             is B, C, A, Temperature. These tags are extracted only when the L
7582             option is used.
7583             },
7584             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration },
7585             0x04 => { Name => 'CameraColorCalibration02', %cameraColorCalibration },
7586             0x08 => { Name => 'CameraColorCalibration03', %cameraColorCalibration },
7587             0x0c => { Name => 'CameraColorCalibration04', %cameraColorCalibration },
7588             0x10 => { Name => 'CameraColorCalibration05', %cameraColorCalibration },
7589             0x14 => { Name => 'CameraColorCalibration06', %cameraColorCalibration },
7590             0x18 => { Name => 'CameraColorCalibration07', %cameraColorCalibration },
7591             0x1c => { Name => 'CameraColorCalibration08', %cameraColorCalibration },
7592             0x20 => { Name => 'CameraColorCalibration09', %cameraColorCalibration },
7593             0x24 => { Name => 'CameraColorCalibration10', %cameraColorCalibration },
7594             0x28 => { Name => 'CameraColorCalibration11', %cameraColorCalibration },
7595             0x2c => { Name => 'CameraColorCalibration12', %cameraColorCalibration },
7596             0x30 => { Name => 'CameraColorCalibration13', %cameraColorCalibration },
7597             0x34 => { Name => 'CameraColorCalibration14', %cameraColorCalibration },
7598             0x38 => { Name => 'CameraColorCalibration15', %cameraColorCalibration },
7599             );
7600              
7601             # color calibration2
7602             %Image::ExifTool::Canon::ColorCalib2 = (
7603             %binaryDataAttrs,
7604             FORMAT => 'int16s',
7605             FIRST_ENTRY => 0,
7606             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7607             NOTES => 'B, C, A, D, Temperature.',
7608             0x00 => { Name => 'CameraColorCalibration01', %cameraColorCalibration2 },
7609             0x05 => { Name => 'CameraColorCalibration02', %cameraColorCalibration2 },
7610             0x0a => { Name => 'CameraColorCalibration03', %cameraColorCalibration2 },
7611             0x0f => { Name => 'CameraColorCalibration04', %cameraColorCalibration2 },
7612             0x14 => { Name => 'CameraColorCalibration05', %cameraColorCalibration2 },
7613             0x19 => { Name => 'CameraColorCalibration06', %cameraColorCalibration2 },
7614             0x1e => { Name => 'CameraColorCalibration07', %cameraColorCalibration2 },
7615             0x23 => { Name => 'CameraColorCalibration08', %cameraColorCalibration2 },
7616             0x28 => { Name => 'CameraColorCalibration09', %cameraColorCalibration2 },
7617             0x2d => { Name => 'CameraColorCalibration10', %cameraColorCalibration2 },
7618             0x32 => { Name => 'CameraColorCalibration11', %cameraColorCalibration2 },
7619             0x37 => { Name => 'CameraColorCalibration12', %cameraColorCalibration2 },
7620             0x3c => { Name => 'CameraColorCalibration13', %cameraColorCalibration2 },
7621             0x41 => { Name => 'CameraColorCalibration14', %cameraColorCalibration2 },
7622             0x46 => { Name => 'CameraColorCalibration15', %cameraColorCalibration2 },
7623             );
7624              
7625             # Color data (MakerNotes tag 0x4001, count=5120) (ref PH)
7626             %Image::ExifTool::Canon::ColorData5 = (
7627             %binaryDataAttrs,
7628             NOTES => 'These tags are used by many EOS M and PowerShot models.',
7629             FORMAT => 'int16s',
7630             FIRST_ENTRY => 0,
7631             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7632             DATAMEMBER => [ 0x00 ],
7633             IS_SUBDIR => [ 0x47, 0xba, 0xff ],
7634             0x00 => {
7635             Name => 'ColorDataVersion',
7636             DataMember => 'ColorDataVersion',
7637             RawConv => '$$self{ColorDataVersion} = $val',
7638             PrintConv => {
7639             -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)
7640             -4 => '-4 (M100/M5/M6)', # (and PowerShot G1XmkIII/G7XmkII/G9XmkII)
7641             },
7642             },
7643             0x47 => [{
7644             Name => 'ColorCoefs',
7645             Condition => '$$self{ColorDataVersion} == -3',
7646             Format => 'undef[230]', # ColorTempUnknown13 is last entry
7647             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs' }
7648             },{
7649             Name => 'ColorCoefs2',
7650             Condition => '$$self{ColorDataVersion} == -4',
7651             Format => 'undef[368]',
7652             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCoefs2' }
7653             }],
7654             0xba => {
7655             Name => 'ColorCalib2',
7656             Condition => '$$self{ColorDataVersion} == -3',
7657             Format => 'undef[150]',
7658             Unknown => 1,
7659             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7660             },
7661             0xff => {
7662             Name => 'ColorCalib2',
7663             Condition => '$$self{ColorDataVersion} == -4',
7664             Format => 'undef[150]',
7665             Unknown => 1,
7666             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib2' }
7667             },
7668             0x108=> { #IB
7669             Name => 'PerChannelBlackLevel',
7670             Condition => '$$self{ColorDataVersion} == -3',
7671             Format => 'int16s[4]',
7672             },
7673             0x14d=> { #IB
7674             Name => 'PerChannelBlackLevel',
7675             Condition => '$$self{ColorDataVersion} == -4',
7676             Format => 'int16s[4]',
7677             },
7678             0x0569 => { #PH (NC)
7679             Name => 'NormalWhiteLevel',
7680             Condition => '$$self{ColorDataVersion} == -4',
7681             Format => 'int16u',
7682             },
7683             0x056a => { #PH (NC)
7684             Name => 'SpecularWhiteLevel',
7685             Condition => '$$self{ColorDataVersion} == -4',
7686             Format => 'int16u',
7687             },
7688             );
7689              
7690             # Color data (MakerNotes tag 0x4001, count=1273|1275) (ref PH)
7691             %Image::ExifTool::Canon::ColorData6 = (
7692             %binaryDataAttrs,
7693             NOTES => 'These tags are used by the EOS 600D and 1200D.',
7694             FORMAT => 'int16s',
7695             FIRST_ENTRY => 0,
7696             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7697             IS_SUBDIR => [ 0xbc ],
7698             0x00 => {
7699             Name => 'ColorDataVersion',
7700             PrintConv => {
7701             10 => '10 (600D/1200D)',
7702             },
7703             },
7704             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7705             0x43 => 'ColorTempAsShot',
7706             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7707             0x48 => 'ColorTempAuto',
7708             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7709             0x4d => 'ColorTempMeasured',
7710             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7711             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7712             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7713             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7714             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7715             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7716             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7717             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7718             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7719             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7720             0x67 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7721             0x6b => 'ColorTempDaylight',
7722             0x6c => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7723             0x70 => 'ColorTempShade',
7724             0x71 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7725             0x75 => 'ColorTempCloudy',
7726             0x76 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7727             0x7a => 'ColorTempTungsten',
7728             0x7b => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7729             0x7f => 'ColorTempFluorescent',
7730             0x80 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7731             0x84 => 'ColorTempKelvin',
7732             0x85 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7733             0x89 => 'ColorTempFlash',
7734             0x8a => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7735             0x8e => { Name => 'ColorTempUnknown6', Unknown => 1 },
7736             0x8f => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7737             0x93 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7738             0x94 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7739             0x98 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7740             0x99 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7741             0x9d => { Name => 'ColorTempUnknown9', Unknown => 1 },
7742             0x9e => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7743             0xa2 => { Name => 'ColorTempUnknown10', Unknown => 1 },
7744             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7745             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7746             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7747             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7748             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7749             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7750             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7751             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7752             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7753             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7754             0xbc => {
7755             Name => 'ColorCalib',
7756             Format => 'undef[120]',
7757             Unknown => 1,
7758             Notes => 'B, C, A, Temperature',
7759             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7760             },
7761             0x0fb => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7762             0x194 => { #PH
7763             Name => 'RawMeasuredRGGB',
7764             Format => 'int32u[4]',
7765             Notes => 'raw MeasuredRGGB values, before normalization',
7766             # swap words because the word ordering is big-endian, opposite to the byte ordering
7767             ValueConv => \&SwapWords,
7768             ValueConvInv => \&SwapWords,
7769             },
7770             0x1df => { Name => 'PerChannelBlackLevel', Format => 'int16u[4]' }, #IB
7771             0x1e3 => { Name => 'NormalWhiteLevel', Format => 'int16u', RawConv => '$val || undef' }, #IB
7772             0x1e4 => { Name => 'SpecularWhiteLevel', Format => 'int16u' }, #IB
7773             0x1e5 => { Name => 'LinearityUpperMargin', Format => 'int16u' }, #IB
7774             );
7775              
7776             # Color data (MakerNotes tag 0x4001, count=1312,1313,1316) (ref PH)
7777             %Image::ExifTool::Canon::ColorData7 = (
7778             %binaryDataAttrs,
7779             NOTES => q{
7780             These tags are used by the EOS 1DX, 5DmkIII, 6D, 7DmkII, 100D, 650D, 700D,
7781             8000D, M and M2.
7782             },
7783             FORMAT => 'int16s',
7784             FIRST_ENTRY => 0,
7785             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7786             DATAMEMBER => [ 0x00 ],
7787             IS_SUBDIR => [ 0xd5 ],
7788             0x00 => {
7789             Name => 'ColorDataVersion',
7790             DataMember => 'ColorDataVersion',
7791             RawConv => '$$self{ColorDataVersion} = $val',
7792             PrintConv => {
7793             10 => '10 (1DX/5DmkIII/6D/70D/100D/650D/700D/M/M2)',
7794             11 => '11 (7DmkII/750D/760D/8000D)',
7795             },
7796             },
7797             # not really sure about the AsShot, Auto and Measured values any more - PH
7798             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7799             0x43 => 'ColorTempAsShot',
7800             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7801             0x48 => 'ColorTempAuto',
7802             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7803             0x4d => 'ColorTempMeasured',
7804             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7805             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7806             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7807             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7808             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7809             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7810             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7811             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7812             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7813             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7814             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7815             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7816             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7817             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7818             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7819             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7820             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7821             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7822             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7823             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7824             0x80 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7825             0x84 => 'ColorTempDaylight',
7826             0x85 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7827             0x89 => 'ColorTempShade',
7828             0x8a => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7829             0x8e => 'ColorTempCloudy',
7830             0x8f => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7831             0x93 => 'ColorTempTungsten',
7832             0x94 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7833             0x98 => 'ColorTempFluorescent',
7834             0x99 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7835             0x9d => 'ColorTempKelvin',
7836             0x9e => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7837             0xa2 => 'ColorTempFlash',
7838             0xa3 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7839             0xa7 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7840             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7841             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7842             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7843             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7844             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7845             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7846             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7847             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7848             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
7849             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
7850             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
7851             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
7852             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
7853             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
7854             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
7855             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
7856             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
7857             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
7858             0xd5 => {
7859             Name => 'ColorCalib',
7860             Format => 'undef[120]',
7861             Unknown => 1,
7862             Notes => 'B, C, A, Temperature',
7863             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
7864             },
7865             0x114 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' }, #IB
7866             0x1ad => {
7867             Name => 'RawMeasuredRGGB',
7868             Condition => '$$self{ColorDataVersion} == 10',
7869             Format => 'int32u[4]',
7870             Notes => 'raw MeasuredRGGB values, before normalization',
7871             # swap words because the word ordering is big-endian, opposite to the byte ordering
7872             ValueConv => \&SwapWords,
7873             ValueConvInv => \&SwapWords,
7874             },
7875             0x1f8 => { #IB
7876             Name => 'PerChannelBlackLevel',
7877             Condition => '$$self{ColorDataVersion} == 10',
7878             Format => 'int16u[4]',
7879             },
7880             0x1fc => { #IB
7881             Name => 'NormalWhiteLevel',
7882             Condition => '$$self{ColorDataVersion} == 10',
7883             Format => 'int16u',
7884             RawConv => '$val || undef',
7885             },
7886             0x1fd => { #IB
7887             Name => 'SpecularWhiteLevel',
7888             Condition => '$$self{ColorDataVersion} == 10',
7889             Format => 'int16u',
7890             },
7891             0x1fe => { #IB
7892             Name => 'LinearityUpperMargin',
7893             Condition => '$$self{ColorDataVersion} == 10',
7894             Format => 'int16u',
7895             },
7896             0x26b => {
7897             Name => 'RawMeasuredRGGB',
7898             Condition => '$$self{ColorDataVersion} == 11',
7899             Format => 'int32u[4]',
7900             ValueConv => \&SwapWords,
7901             ValueConvInv => \&SwapWords,
7902             },
7903             0x2d8 => {
7904             Name => 'PerChannelBlackLevel',
7905             Condition => '$$self{ColorDataVersion} == 11',
7906             Format => 'int16u[4]',
7907             },
7908             0x2dc => {
7909             Name => 'NormalWhiteLevel',
7910             Condition => '$$self{ColorDataVersion} == 11',
7911             Format => 'int16u',
7912             RawConv => '$val || undef',
7913             },
7914             0x2dd => {
7915             Name => 'SpecularWhiteLevel',
7916             Condition => '$$self{ColorDataVersion} == 11',
7917             Format => 'int16u',
7918             },
7919             0x2de => {
7920             Name => 'LinearityUpperMargin',
7921             Condition => '$$self{ColorDataVersion} == 11',
7922             Format => 'int16u',
7923             },
7924             );
7925              
7926             # Color data (MakerNotes tag 0x4001, count=1560,etc) (ref IB)
7927             %Image::ExifTool::Canon::ColorData8 = (
7928             %binaryDataAttrs,
7929             NOTES => q{
7930             These tags are used by the EOS 1DXmkII, 5DS, 5DSR, 5DmkIV, 6DmkII, 77D, 80D,
7931             200D, 800D, 1300D, 2000D, 4000D and 9000D.
7932             },
7933             FORMAT => 'int16s',
7934             FIRST_ENTRY => 0,
7935             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
7936             DATAMEMBER => [ 0 ],
7937             IS_SUBDIR => [ 0x107 ],
7938             0x00 => {
7939             Name => 'ColorDataVersion',
7940             DataMember => 'ColorDataVersion',
7941             RawConv => '$$self{ColorDataVersion} = $val',
7942             PrintConv => {
7943             12 => '12 (1DXmkII/5DS/5DSR)',
7944             13 => '13 (80D/5DmkIV)', #PH
7945             14 => '14 (1300D/2000D/4000D)', #IB
7946             15 => '15 (6DmkII/77D/200D/800D,9000D)', #IB
7947             },
7948             },
7949             0x3f => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
7950             0x43 => 'ColorTempAsShot',
7951             0x44 => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
7952             0x48 => 'ColorTempAuto',
7953             0x49 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
7954             0x4d => 'ColorTempMeasured',
7955             0x4e => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
7956             0x52 => { Name => 'ColorTempUnknown', Unknown => 1 },
7957             0x53 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
7958             0x57 => { Name => 'ColorTempUnknown2', Unknown => 1 },
7959             0x58 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
7960             0x5c => { Name => 'ColorTempUnknown3', Unknown => 1 },
7961             0x5d => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
7962             0x61 => { Name => 'ColorTempUnknown4', Unknown => 1 },
7963             0x62 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
7964             0x66 => { Name => 'ColorTempUnknown5', Unknown => 1 },
7965             0x67 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
7966             0x6b => { Name => 'ColorTempUnknown6', Unknown => 1 },
7967             0x6c => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
7968             0x70 => { Name => 'ColorTempUnknown7', Unknown => 1 },
7969             0x71 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
7970             0x75 => { Name => 'ColorTempUnknown8', Unknown => 1 },
7971             0x76 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
7972             0x7a => { Name => 'ColorTempUnknown9', Unknown => 1 },
7973             0x7b => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
7974             0x7f => { Name => 'ColorTempUnknown10', Unknown => 1 },
7975             0x80 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
7976             0x84 => { Name => 'ColorTempUnknown11', Unknown => 1 },
7977             0x85 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
7978             0x89 => 'ColorTempDaylight',
7979             0x8a => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
7980             0x8e => 'ColorTempShade',
7981             0x8f => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
7982             0x93 => 'ColorTempCloudy',
7983             0x94 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
7984             0x98 => 'ColorTempTungsten',
7985             0x99 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
7986             0x9d => 'ColorTempFluorescent',
7987             0x9e => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
7988             0xa2 => 'ColorTempKelvin',
7989             0xa3 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
7990             0xa7 => 'ColorTempFlash',
7991             0xa8 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
7992             0xac => { Name => 'ColorTempUnknown12', Unknown => 1 },
7993             0xad => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
7994             0xb1 => { Name => 'ColorTempUnknown13', Unknown => 1 },
7995             0xb2 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
7996             0xb6 => { Name => 'ColorTempUnknown14', Unknown => 1 },
7997             0xb7 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
7998             0xbb => { Name => 'ColorTempUnknown15', Unknown => 1 },
7999             0xbc => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8000             0xc0 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8001             0xc1 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8002             0xc5 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8003             0xc6 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8004             0xca => { Name => 'ColorTempUnknown18', Unknown => 1 },
8005             0xcb => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8006             0xcf => { Name => 'ColorTempUnknown19', Unknown => 1 },
8007             0xd0 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8008             0xd4 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8009             0xd5 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8010             0xd9 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8011             0xda => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8012             0xde => { Name => 'ColorTempUnknown22', Unknown => 1 },
8013             0xdf => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8014             0xe3 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8015             0xe4 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8016             0xe8 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8017             0xe9 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8018             0xed => { Name => 'ColorTempUnknown25', Unknown => 1 },
8019             0xee => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8020             0xf2 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8021             0xf3 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8022             0xf7 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8023             0xf8 => { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8024             0xfc => { Name => 'ColorTempUnknown28', Unknown => 1 },
8025             0xfd => { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8026             0x101 => { Name => 'ColorTempUnknown29', Unknown => 1 },
8027             0x102 => { Name => 'WB_RGGBLevelsUnknown30', Format => 'int16s[4]', Unknown => 1 },
8028             0x106 => { Name => 'ColorTempUnknown30', Unknown => 1 },
8029              
8030             0x107 => {
8031             Name => 'ColorCalib',
8032             Format => 'undef[120]',
8033             Unknown => 1,
8034             Notes => 'B, C, A, Temperature',
8035             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8036             },
8037             0x146 => { Name => 'AverageBlackLevel', Format => 'int16u[4]' },
8038             0x22c => {
8039             Name => 'PerChannelBlackLevel',
8040             Condition => '$$self{ColorDataVersion} == 14',
8041             Format => 'int16u[4]',
8042             Notes => '1300D',
8043             },
8044             0x230 => {
8045             Name => 'NormalWhiteLevel',
8046             Condition => '$$self{ColorDataVersion} == 14',
8047             Format => 'int16u',
8048             Notes => '1300D',
8049             RawConv => '$val || undef',
8050             },
8051             0x231 => {
8052             Name => 'SpecularWhiteLevel',
8053             Condition => '$$self{ColorDataVersion} == 14',
8054             Format => 'int16u',
8055             Notes => '1300D',
8056             },
8057             0x232 => {
8058             Name => 'LinearityUpperMargin',
8059             Condition => '$$self{ColorDataVersion} == 14',
8060             Format => 'int16u',
8061             Notes => '1300D',
8062             },
8063             0x30a => {
8064             Name => 'PerChannelBlackLevel',
8065             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8066             Format => 'int16u[4]',
8067             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8068             },
8069             0x30e => {
8070             Name => 'NormalWhiteLevel',
8071             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8072             Format => 'int16u',
8073             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8074             RawConv => '$val || undef',
8075             },
8076             0x30f => {
8077             Name => 'SpecularWhiteLevel',
8078             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8079             Format => 'int16u',
8080             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8081             },
8082             0x310 => {
8083             Name => 'LinearityUpperMargin',
8084             Condition => '$$self{ColorDataVersion} < 14 or $$self{ColorDataVersion} == 15',
8085             Format => 'int16u',
8086             Notes => '5DS, 5DS R, 77D, 80D and 800D',
8087             },
8088             );
8089              
8090             # Color data (MakerNotes tag 0x4001, count=1820,etc) (ref PH)
8091             %Image::ExifTool::Canon::ColorData9 = (
8092             %binaryDataAttrs,
8093             NOTES => 'These tags are used by the M6mkII, M50, M200, EOS R, RP, 90D, 250D and 850D',
8094             FORMAT => 'int16s',
8095             FIRST_ENTRY => 0,
8096             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8097             DATAMEMBER => [ 0 ],
8098             IS_SUBDIR => [ 0x10a ],
8099             0x00 => {
8100             Name => 'ColorDataVersion',
8101             DataMember => 'ColorDataVersion',
8102             RawConv => '$$self{ColorDataVersion} = $val',
8103             PrintConv => {
8104             16 => '16 (M50)',
8105             17 => '17 (EOS R)', # (and PowerShot SX740HS)
8106             18 => '18 (EOS RP/250D)', # (and PowerShot SX70HS)
8107             19 => '19 (90D/850D/M6mkII/M200)',# (and PowerShot G7XmkIII)
8108             },
8109             },
8110             0x47 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8111             0x4b => 'ColorTempAsShot',
8112             0x4c => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8113             0x50 => 'ColorTempAuto',
8114             0x51 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8115             0x55 => 'ColorTempMeasured',
8116             0x56 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8117             0x5a => { Name => 'ColorTempUnknown', Unknown => 1 },
8118             0x5b => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8119             0x5f => { Name => 'ColorTempUnknown2', Unknown => 1 },
8120             0x60 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8121             0x64 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8122             0x65 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8123             0x69 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8124             0x6a => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8125             0x6e => { Name => 'ColorTempUnknown5', Unknown => 1 },
8126             0x6f => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8127             0x73 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8128             0x74 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8129             0x78 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8130             0x79 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8131             0x7d => { Name => 'ColorTempUnknown8', Unknown => 1 },
8132             0x7e => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8133             0x82 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8134             0x83 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8135             0x87 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8136             0x88 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8137             0x8c => 'ColorTempDaylight',
8138             0x8d => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8139             0x91 => 'ColorTempShade',
8140             0x92 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8141             0x96 => 'ColorTempCloudy',
8142             0x97 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8143             0x9b => 'ColorTempTungsten',
8144             0x9c => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8145             0xa0 => 'ColorTempFluorescent',
8146             0xa1 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8147             0xa5 => 'ColorTempKelvin',
8148             0xa6 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8149             0xaa => 'ColorTempFlash',
8150             0xab => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8151             0xaf => { Name => 'ColorTempUnknown11', Unknown => 1 },
8152             0xb0 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8153             0xb4 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8154             0xb5 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8155             0xb9 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8156             0xba => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8157             0xbe => { Name => 'ColorTempUnknown14', Unknown => 1 },
8158             0xbf => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8159             0xc3 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8160             0xc4 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8161             0xc8 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8162             0xc9 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8163             0xcd => { Name => 'ColorTempUnknown17', Unknown => 1 },
8164             0xce => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8165             0xd2 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8166             0xd3 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8167             0xd7 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8168             0xd8 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8169             0xdc => { Name => 'ColorTempUnknown20', Unknown => 1 },
8170             0xdd => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8171             0xe1 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8172             0xe2 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8173             0xe6 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8174             0xe7 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8175             0xeb => { Name => 'ColorTempUnknown23', Unknown => 1 },
8176             0xec => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8177             0xf0 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8178             0xf1 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8179             0xf5 => { Name => 'ColorTempUnknown25', Unknown => 1 },
8180             0xf6 => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8181             0xfa => { Name => 'ColorTempUnknown26', Unknown => 1 },
8182             0xfb => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8183             0xff => { Name => 'ColorTempUnknown27', Unknown => 1 },
8184             0x100=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8185             0x104=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8186             0x105=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8187             0x109=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8188             0x10a => { #IB
8189             Name => 'ColorCalib',
8190             Format => 'undef[120]',
8191             Unknown => 1,
8192             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8193             },
8194             0x149 => { #IB
8195             Name => 'PerChannelBlackLevel',
8196             Format => 'int16u[4]',
8197             },
8198             # 0x318 - PerChannelBlackLevel again (ref IB)
8199             0x31c => { #IB
8200             Name => 'NormalWhiteLevel',
8201             Format => 'int16u',
8202             RawConv => '$val || undef',
8203             },
8204             0x31d => { #IB
8205             Name => 'SpecularWhiteLevel',
8206             Format => 'int16u',
8207             },
8208             0x31e => { #IB
8209             Name => 'LinearityUpperMargin',
8210             Format => 'int16u',
8211             },
8212             );
8213              
8214             # Color data (MakerNotes tag 0x4001, count=2024,3656)
8215             # (same as ColorData9 but shifted up by 0x0e, ref PH)
8216             %Image::ExifTool::Canon::ColorData10 = (
8217             %binaryDataAttrs,
8218             NOTES => 'These tags are used by the R5, R5 and EOS 1DXmkIII.',
8219             FORMAT => 'int16s',
8220             FIRST_ENTRY => 0,
8221             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8222             DATAMEMBER => [ 0 ],
8223             IS_SUBDIR => [ 0x118 ],
8224             0x00 => {
8225             Name => 'ColorDataVersion',
8226             DataMember => 'ColorDataVersion',
8227             RawConv => '$$self{ColorDataVersion} = $val',
8228             PrintConv => {
8229             32 => '32 (1DXmkIII)', #IB
8230             33 => '33 (R5/R6)',
8231             },
8232             },
8233             0x55 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8234             0x59 => 'ColorTempAsShot',
8235             0x5a => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8236             0x5e => 'ColorTempAuto',
8237             0x5f => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8238             0x63 => 'ColorTempMeasured',
8239             0x64 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8240             0x68 => { Name => 'ColorTempUnknown', Unknown => 1 },
8241             0x69 => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8242             0x6d => { Name => 'ColorTempUnknown2', Unknown => 1 },
8243             0x6e => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8244             0x72 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8245             0x73 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8246             0x77 => { Name => 'ColorTempUnknown4', Unknown => 1 },
8247             0x78 => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8248             0x7c => { Name => 'ColorTempUnknown5', Unknown => 1 },
8249             0x7d => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8250             0x81 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8251             0x82 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8252             0x86 => { Name => 'ColorTempUnknown7', Unknown => 1 },
8253             0x87 => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8254             0x8b => { Name => 'ColorTempUnknown8', Unknown => 1 },
8255             0x8c => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8256             0x90 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8257             0x91 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8258             0x95 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8259             0x96 => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8260             0x9a => 'ColorTempDaylight',
8261             0x9b => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8262             0x9f => 'ColorTempShade',
8263             0xa0 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8264             0xa4 => 'ColorTempCloudy',
8265             0xa5 => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8266             0xa9 => 'ColorTempTungsten',
8267             0xaa => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8268             0xae => 'ColorTempFluorescent',
8269             0xaf => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8270             0xb3 => 'ColorTempKelvin',
8271             0xb4 => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8272             0xb8 => 'ColorTempFlash',
8273             0xb9 => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8274             0xbd => { Name => 'ColorTempUnknown11', Unknown => 1 },
8275             0xbe => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8276             0xc2 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8277             0xc3 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8278             0xc7 => { Name => 'ColorTempUnknown13', Unknown => 1 },
8279             0xc8 => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8280             0xcc => { Name => 'ColorTempUnknown14', Unknown => 1 },
8281             0xcd => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8282             0xd1 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8283             0xd2 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8284             0xd6 => { Name => 'ColorTempUnknown16', Unknown => 1 },
8285             0xd7 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8286             0xdb => { Name => 'ColorTempUnknown17', Unknown => 1 },
8287             0xdc => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8288             0xe0 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8289             0xe1 => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8290             0xe5 => { Name => 'ColorTempUnknown19', Unknown => 1 },
8291             0xe6 => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8292             0xea => { Name => 'ColorTempUnknown20', Unknown => 1 },
8293             0xeb => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8294             0xef => { Name => 'ColorTempUnknown21', Unknown => 1 },
8295             0xf0 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8296             0xf4 => { Name => 'ColorTempUnknown22', Unknown => 1 },
8297             0xf5 => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8298             0xf9 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8299             0xfa => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8300             0xfe => { Name => 'ColorTempUnknown24', Unknown => 1 },
8301             0xff => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8302             0x103=> { Name => 'ColorTempUnknown25', Unknown => 1 },
8303             0x104=> { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8304             0x108=> { Name => 'ColorTempUnknown26', Unknown => 1 },
8305             0x109=> { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8306             0x10d=> { Name => 'ColorTempUnknown27', Unknown => 1 },
8307             0x10e=> { Name => 'WB_RGGBLevelsUnknown28', Format => 'int16s[4]', Unknown => 1 },
8308             0x112=> { Name => 'ColorTempUnknown28', Unknown => 1 },
8309             0x113=> { Name => 'WB_RGGBLevelsUnknown29', Format => 'int16s[4]', Unknown => 1 },
8310             0x117=> { Name => 'ColorTempUnknown29', Unknown => 1 },
8311             0x118 => {
8312             Name => 'ColorCalib',
8313             Format => 'undef[120]',
8314             Unknown => 1,
8315             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8316             },
8317             0x157 => {
8318             Name => 'PerChannelBlackLevel',
8319             Format => 'int16u[4]',
8320             },
8321             # 0x326 - PerChannelBlackLevel again
8322             0x32a => {
8323             Name => 'NormalWhiteLevel',
8324             Format => 'int16u',
8325             RawConv => '$val || undef',
8326             },
8327             0x32b => {
8328             Name => 'SpecularWhiteLevel',
8329             Format => 'int16u',
8330             },
8331             0x32c => {
8332             Name => 'LinearityUpperMargin',
8333             Format => 'int16u',
8334             },
8335             );
8336              
8337             # Color data (MakerNotes tag 0x4001, count=3973, ref IB)
8338             %Image::ExifTool::Canon::ColorData11 = (
8339             %binaryDataAttrs,
8340             NOTES => 'These tags are used by the EOS R3, R7 and R6mkII',
8341             FORMAT => 'int16s',
8342             FIRST_ENTRY => 0,
8343             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8344             DATAMEMBER => [ 0 ],
8345             IS_SUBDIR => [ 0x12c ],
8346             0x00 => {
8347             Name => 'ColorDataVersion',
8348             DataMember => 'ColorDataVersion',
8349             RawConv => '$$self{ColorDataVersion} = $val',
8350             PrintConv => {
8351             34 => '34 (R3)', #IB
8352             48 => '48 (R7, R10, R6 Mark II)', #IB
8353             },
8354             },
8355             0x69 => { Name => 'WB_RGGBLevelsAsShot', Format => 'int16s[4]' },
8356             0x6d => 'ColorTempAsShot',
8357             0x6e => { Name => 'WB_RGGBLevelsAuto', Format => 'int16s[4]' },
8358             0x72 => 'ColorTempAuto',
8359             0x73 => { Name => 'WB_RGGBLevelsMeasured', Format => 'int16s[4]' },
8360             0x77 => 'ColorTempMeasured',
8361             0x78 => { Name => 'WB_RGGBLevelsUnknown', Format => 'int16s[4]', Unknown => 1 },
8362             0x7c => { Name => 'ColorTempUnknown', Unknown => 1 },
8363             0x7d => { Name => 'WB_RGGBLevelsUnknown2', Format => 'int16s[4]', Unknown => 1 },
8364             0x81 => { Name => 'ColorTempUnknown2', Unknown => 1 },
8365             0x82 => { Name => 'WB_RGGBLevelsUnknown3', Format => 'int16s[4]', Unknown => 1 },
8366             0x86 => { Name => 'ColorTempUnknown3', Unknown => 1 },
8367             0x87 => { Name => 'WB_RGGBLevelsUnknown4', Format => 'int16s[4]', Unknown => 1 },
8368             0x8b => { Name => 'ColorTempUnknown4', Unknown => 1 },
8369             0x8c => { Name => 'WB_RGGBLevelsUnknown5', Format => 'int16s[4]', Unknown => 1 },
8370             0x90 => { Name => 'ColorTempUnknown5', Unknown => 1 },
8371             0x91 => { Name => 'WB_RGGBLevelsUnknown6', Format => 'int16s[4]', Unknown => 1 },
8372             0x95 => { Name => 'ColorTempUnknown6', Unknown => 1 },
8373             0x96 => { Name => 'WB_RGGBLevelsUnknown7', Format => 'int16s[4]', Unknown => 1 },
8374             0x9a => { Name => 'ColorTempUnknown7', Unknown => 1 },
8375             0x9b => { Name => 'WB_RGGBLevelsUnknown8', Format => 'int16s[4]', Unknown => 1 },
8376             0x9f => { Name => 'ColorTempUnknown8', Unknown => 1 },
8377             0xa0 => { Name => 'WB_RGGBLevelsUnknown9', Format => 'int16s[4]', Unknown => 1 },
8378             0xa4 => { Name => 'ColorTempUnknown9', Unknown => 1 },
8379             0xa5 => { Name => 'WB_RGGBLevelsUnknown10', Format => 'int16s[4]', Unknown => 1 },
8380             0xa9 => { Name => 'ColorTempUnknown10', Unknown => 1 },
8381             0xaa => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8382             0xae => { Name => 'ColorTempUnknown11', Unknown => 1 },
8383             0xaf => { Name => 'WB_RGGBLevelsUnknown11', Format => 'int16s[4]', Unknown => 1 },
8384             0xb3 => { Name => 'ColorTempUnknown11', Unknown => 1 },
8385             0xb4 => { Name => 'WB_RGGBLevelsUnknown12', Format => 'int16s[4]', Unknown => 1 },
8386             0xb8 => { Name => 'ColorTempUnknown12', Unknown => 1 },
8387             0xb9 => { Name => 'WB_RGGBLevelsUnknown13', Format => 'int16s[4]', Unknown => 1 },
8388             0xbd => { Name => 'ColorTempUnknown13', Unknown => 1 },
8389             0xbe => { Name => 'WB_RGGBLevelsUnknown14', Format => 'int16s[4]', Unknown => 1 },
8390             0xc2 => { Name => 'ColorTempUnknown14', Unknown => 1 },
8391             0xc3 => { Name => 'WB_RGGBLevelsUnknown15', Format => 'int16s[4]', Unknown => 1 },
8392             0xc7 => { Name => 'ColorTempUnknown15', Unknown => 1 },
8393             0xc8 => { Name => 'WB_RGGBLevelsUnknown16', Format => 'int16s[4]', Unknown => 1 },
8394             0xcc => { Name => 'ColorTempUnknown16', Unknown => 1 },
8395             0xcd => { Name => 'WB_RGGBLevelsDaylight', Format => 'int16s[4]' },
8396             0xd1 => 'ColorTempDaylight',
8397             0xd2 => { Name => 'WB_RGGBLevelsShade', Format => 'int16s[4]' },
8398             0xd6 => 'ColorTempShade',
8399             0xd7 => { Name => 'WB_RGGBLevelsCloudy', Format => 'int16s[4]' },
8400             0xdb => 'ColorTempCloudy',
8401             0xdc => { Name => 'WB_RGGBLevelsTungsten', Format => 'int16s[4]' },
8402             0xe0 => 'ColorTempTungsten',
8403             0xe1 => { Name => 'WB_RGGBLevelsFluorescent',Format => 'int16s[4]' },
8404             0xe5 => 'ColorTempFluorescent',
8405             0xe6 => { Name => 'WB_RGGBLevelsKelvin', Format => 'int16s[4]' },
8406             0xea => 'ColorTempKelvin',
8407             0xeb => { Name => 'WB_RGGBLevelsFlash', Format => 'int16s[4]' },
8408             0xef => 'ColorTempFlash',
8409             0xf0 => { Name => 'WB_RGGBLevelsUnknown17', Format => 'int16s[4]', Unknown => 1 },
8410             0xf4 => { Name => 'ColorTempUnknown17', Unknown => 1 },
8411             0xf5 => { Name => 'WB_RGGBLevelsUnknown18', Format => 'int16s[4]', Unknown => 1 },
8412             0xf9 => { Name => 'ColorTempUnknown18', Unknown => 1 },
8413             0xfa => { Name => 'WB_RGGBLevelsUnknown19', Format => 'int16s[4]', Unknown => 1 },
8414             0xfe => { Name => 'ColorTempUnknown19', Unknown => 1 },
8415             0xff => { Name => 'WB_RGGBLevelsUnknown20', Format => 'int16s[4]', Unknown => 1 },
8416             0x103 => { Name => 'ColorTempUnknown20', Unknown => 1 },
8417             0x104 => { Name => 'WB_RGGBLevelsUnknown21', Format => 'int16s[4]', Unknown => 1 },
8418             0x108 => { Name => 'ColorTempUnknown21', Unknown => 1 },
8419             0x109 => { Name => 'WB_RGGBLevelsUnknown22', Format => 'int16s[4]', Unknown => 1 },
8420             0x10d => { Name => 'ColorTempUnknown22', Unknown => 1 },
8421             0x10e => { Name => 'WB_RGGBLevelsUnknown23', Format => 'int16s[4]', Unknown => 1 },
8422             0x112 => { Name => 'ColorTempUnknown23', Unknown => 1 },
8423             0x113 => { Name => 'WB_RGGBLevelsUnknown24', Format => 'int16s[4]', Unknown => 1 },
8424             0x117 => { Name => 'ColorTempUnknown24', Unknown => 1 },
8425             0x118 => { Name => 'WB_RGGBLevelsUnknown25', Format => 'int16s[4]', Unknown => 1 },
8426             0x11c => { Name => 'ColorTempUnknown25', Unknown => 1 },
8427             0x11d => { Name => 'WB_RGGBLevelsUnknown26', Format => 'int16s[4]', Unknown => 1 },
8428             0x121 => { Name => 'ColorTempUnknown26', Unknown => 1 },
8429             0x122 => { Name => 'WB_RGGBLevelsUnknown27', Format => 'int16s[4]', Unknown => 1 },
8430             0x126 => { Name => 'ColorTempUnknown27', Unknown => 1 },
8431             0x12c => {
8432             Name => 'ColorCalib',
8433             Format => 'undef[120]',
8434             Unknown => 1,
8435             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ColorCalib' }
8436             },
8437             0x16b => {
8438             Name => 'PerChannelBlackLevel',
8439             Format => 'int16u[4]',
8440             },
8441             # 0x27c - PerChannelBlackLevel again
8442             0x280 => {
8443             Name => 'NormalWhiteLevel',
8444             Format => 'int16u',
8445             RawConv => '$val || undef',
8446             },
8447             0x281 => {
8448             Name => 'SpecularWhiteLevel',
8449             Format => 'int16u',
8450             },
8451             0x282 => {
8452             Name => 'LinearityUpperMargin',
8453             Format => 'int16u',
8454             },
8455             );
8456              
8457             # Unknown color data (MakerNotes tag 0x4001)
8458             %Image::ExifTool::Canon::ColorDataUnknown = (
8459             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
8460             FORMAT => 'int16s',
8461             FIRST_ENTRY => 0,
8462             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8463             0x00 => 'ColorDataVersion',
8464             );
8465              
8466             # Color information (MakerNotes tag 0x4003) (ref PH)
8467             %Image::ExifTool::Canon::ColorInfo = (
8468             %binaryDataAttrs,
8469             FORMAT => 'int16s',
8470             FIRST_ENTRY => 1,
8471             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8472             1 => {
8473             Condition => '$$self{Model} =~ /EOS-1D/',
8474             Name => 'Saturation',
8475             %Image::ExifTool::Exif::printParameter,
8476             },
8477             2 => {
8478             Name => 'ColorTone',
8479             %Image::ExifTool::Exif::printParameter,
8480             },
8481             3 => {
8482             Name => 'ColorSpace',
8483             RawConv => '$val ? $val : undef', # ignore tag if zero
8484             PrintConv => {
8485             1 => 'sRGB',
8486             2 => 'Adobe RGB',
8487             },
8488             },
8489             );
8490              
8491             # AF micro-adjustment information (MakerNotes tag 0x4013) (ref PH)
8492             %Image::ExifTool::Canon::AFMicroAdj = (
8493             %binaryDataAttrs,
8494             FORMAT => 'int32s',
8495             FIRST_ENTRY => 1,
8496             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8497             1 => {
8498             Name => 'AFMicroAdjMode',
8499             PrintConv => {
8500             0 => 'Disable',
8501             1 => 'Adjust all by the same amount',
8502             2 => 'Adjust by lens',
8503             # 3 - seen this for EOS 77D, which doesn't have an AF Micro Adjust feature - PH
8504             },
8505             },
8506             2 => {
8507             Name => 'AFMicroAdjValue',
8508             Format => 'rational64s',
8509             },
8510             );
8511              
8512             # Vignetting correction information (MakerNotes tag 0x4015)
8513             %Image::ExifTool::Canon::VignettingCorr = (
8514             %binaryDataAttrs,
8515             FORMAT => 'int16s',
8516             FIRST_ENTRY => 1,
8517             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8518             NOTES => 'This information is found in images from newer EOS models.',
8519             0 => {
8520             Name => 'VignettingCorrVersion',
8521             Format => 'int8u',
8522             Writable => 0,
8523             },
8524             2 => {
8525             Name => 'PeripheralLighting',
8526             PrintConv => \%offOn,
8527             },
8528             3 => {
8529             Name => 'DistortionCorrection',
8530             PrintConv => \%offOn,
8531             },
8532             4 => {
8533             Name => 'ChromaticAberrationCorr',
8534             PrintConv => \%offOn,
8535             },
8536             5 => {
8537             Name => 'ChromaticAberrationCorr',
8538             PrintConv => \%offOn,
8539             },
8540             6 => 'PeripheralLightingValue',
8541             9 => 'DistortionCorrectionValue',
8542             # 10 - flags?
8543             11 => {
8544             Name => 'OriginalImageWidth',
8545             Notes => 'full size of original image before being rotated or scaled in camera',
8546             },
8547             12 => 'OriginalImageHeight',
8548             );
8549              
8550             %Image::ExifTool::Canon::VignettingCorrUnknown = (
8551             %binaryDataAttrs,
8552             FORMAT => 'int16s',
8553             FIRST_ENTRY => 1,
8554             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8555             NOTES => 'Vignetting correction from PowerShot models.',
8556             0 => {
8557             Name => 'VignettingCorrVersion',
8558             Format => 'int8u',
8559             Writable => 0,
8560             },
8561             );
8562              
8563             # More Vignetting correction information (MakerNotes tag 0x4016)
8564             %Image::ExifTool::Canon::VignettingCorr2 = (
8565             %binaryDataAttrs,
8566             FORMAT => 'int32s',
8567             FIRST_ENTRY => 1,
8568             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8569             5 => {
8570             Name => 'PeripheralLightingSetting',
8571             PrintConv => \%offOn,
8572             },
8573             6 => {
8574             Name => 'ChromaticAberrationSetting',
8575             PrintConv => \%offOn,
8576             },
8577             7 => {
8578             Name => 'DistortionCorrectionSetting',
8579             PrintConv => \%offOn,
8580             },
8581             );
8582              
8583             # Auto Lighting Optimizater information (MakerNotes tag 0x4018) (ref PH)
8584             %Image::ExifTool::Canon::LightingOpt = (
8585             %binaryDataAttrs,
8586             FORMAT => 'int32s',
8587             FIRST_ENTRY => 1,
8588             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8589             NOTES => 'This information is new in images from the EOS 7D.',
8590             1 => {
8591             Name => 'PeripheralIlluminationCorr',
8592             PrintConv => \%offOn,
8593             },
8594             2 => {
8595             Name => 'AutoLightingOptimizer',
8596             PrintConv => {
8597             0 => 'Standard',
8598             1 => 'Low',
8599             2 => 'Strong',
8600             3 => 'Off',
8601             },
8602             },
8603             3 => {
8604             Name => 'HighlightTonePriority',
8605             PrintConv => \%offOn,
8606             },
8607             4 => {
8608             Name => 'LongExposureNoiseReduction',
8609             PrintConv => {
8610             0 => 'Off',
8611             1 => 'Auto',
8612             2 => 'On',
8613             },
8614             },
8615             5 => {
8616             Name => 'HighISONoiseReduction',
8617             PrintConv => {
8618             0 => 'Standard',
8619             1 => 'Low',
8620             2 => 'Strong',
8621             3 => 'Off',
8622             },
8623             },
8624             # 6 - related to ChromaticAberrationCorr
8625             # 7 - related to DistortionCorrection (0=off, 1=On in a 5DmkIV sample)
8626             # 8 - related to PeripheralIlluminationCorr and ChromaticAberrationCorr
8627             );
8628              
8629             # Lens information (MakerNotes tag 0x4019) (ref 20)
8630             %Image::ExifTool::Canon::LensInfo = (
8631             %binaryDataAttrs,
8632             FIRST_ENTRY => 0,
8633             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8634             0 => { # this doesn't seem to be valid for some models (eg. 550D, 7D?, 1DmkIV?)
8635             Name => 'LensSerialNumber',
8636             Notes => q{
8637             apparently this is an internal serial number because it doesn't correspond
8638             to the one printed on the lens
8639             },
8640             Format => 'undef[5]',
8641             Priority => 0,
8642             RawConv => '$val=~/^\0\0\0\0/ ? undef : $val', # (rules out 550D and older lenses)
8643             ValueConv => 'unpack("H*", $val)',
8644             ValueConvInv => 'length($val) < 10 and $val = 0 x (10-length($val)) . $val; pack("H*",$val)',
8645             },
8646             );
8647              
8648             # Subject mode ambience information (MakerNotes tag 0x4020) (ref PH)
8649             %Image::ExifTool::Canon::Ambience = (
8650             %binaryDataAttrs,
8651             FORMAT => 'int32s',
8652             FIRST_ENTRY => 1,
8653             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8654             1 => {
8655             Name => 'AmbienceSelection',
8656             PrintConv => {
8657             0 => 'Standard',
8658             1 => 'Vivid',
8659             2 => 'Warm',
8660             3 => 'Soft',
8661             4 => 'Cool',
8662             5 => 'Intense',
8663             6 => 'Brighter',
8664             7 => 'Darker',
8665             8 => 'Monochrome',
8666             },
8667             },
8668             );
8669              
8670             # Multi-exposure information (MakerNotes tag 0x4021) (ref PH)
8671             %Image::ExifTool::Canon::MultiExp = (
8672             %binaryDataAttrs,
8673             FORMAT => 'int32s',
8674             FIRST_ENTRY => 1,
8675             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8676             1 => {
8677             Name => 'MultiExposure',
8678             PrintConv => {
8679             0 => 'Off',
8680             1 => 'On',
8681             2 => 'On (RAW)', #IB
8682             },
8683             },
8684             2 => {
8685             Name => 'MultiExposureControl',
8686             PrintConv => {
8687             0 => 'Additive',
8688             1 => 'Average',
8689             2 => 'Bright (comparative)',
8690             3 => 'Dark (comparative)',
8691             },
8692             },
8693             3 => 'MultiExposureShots',
8694             );
8695              
8696             my %filterConv = (
8697             PrintConv => {
8698             -1 => 'Off',
8699             OTHER => sub { my $val=shift; return "On ($val)" },
8700             },
8701             );
8702             # Creative filter information (MakerNotes tag 0x4024) (ref PH)
8703             %Image::ExifTool::Canon::FilterInfo = (
8704             PROCESS_PROC => \&ProcessFilters,
8705             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8706             NOTES => 'Information about creative filter settings.',
8707             0x101 => {
8708             Name => 'GrainyBWFilter',
8709             Description => 'Grainy B/W Filter',
8710             %filterConv,
8711             },
8712             0x201 => { Name => 'SoftFocusFilter', %filterConv },
8713             0x301 => { Name => 'ToyCameraFilter', %filterConv },
8714             0x401 => { Name => 'MiniatureFilter', %filterConv },
8715             0x402 => {
8716             Name => 'MiniatureFilterOrientation',
8717             PrintConv => {
8718             0 => 'Horizontal',
8719             1 => 'Vertical',
8720             },
8721             },
8722             0x403 => 'MiniatureFilterPosition',
8723             0x404 => 'MiniatureFilterParameter', # but what is the meaning?
8724             0x501 => { Name => 'FisheyeFilter', %filterConv }, # (M2)
8725             0x601 => { Name => 'PaintingFilter', %filterConv }, # (M2)
8726             0x701 => { Name => 'WatercolorFilter', %filterConv }, # (M2)
8727             );
8728              
8729             # HDR information (MakerNotes tag 0x4025) (ref PH)
8730             %Image::ExifTool::Canon::HDRInfo = (
8731             %binaryDataAttrs,
8732             FORMAT => 'int32s',
8733             FIRST_ENTRY => 1,
8734             GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
8735             1 => {
8736             Name => 'HDR',
8737             PrintConv => {
8738             0 => 'Off',
8739             1 => 'Auto',
8740             2 => 'On',
8741             },
8742             },
8743             2 => {
8744             Name => 'HDREffect',
8745             PrintConv => {
8746             0 => 'Natural',
8747             1 => 'Art (standard)',
8748             2 => 'Art (vivid)',
8749             3 => 'Art (bold)',
8750             4 => 'Art (embossed)',
8751             },
8752             },
8753             # 3 - maybe related to AutoImageAlign?
8754             );
8755              
8756             # More color information (MakerNotes tag 0x4026) (ref github issue #119)
8757             %Image::ExifTool::Canon::LogInfo = (
8758             %binaryDataAttrs,
8759             FORMAT => 'int32s',
8760             FIRST_ENTRY => 1,
8761             PRIORITY => 0,
8762             4 => {
8763             Name => 'CompressionFormat',
8764             PrintConv => {
8765             0 => 'Editing (ALL-I)',
8766             1 => 'Standard (IPB)',
8767             2 => 'Light (IPB)',
8768             3 => 'Motion JPEG',
8769             4 => 'RAW', # either Standard or Light, depending on Quality
8770             },
8771             },
8772             6 => { # 0 to 7
8773             Name => 'Sharpness',
8774             RawConv => '$val == 0x7fffffff ? undef : $val',
8775             },
8776             7 => { # -4 to 4
8777             Name => 'Saturation',
8778             RawConv => '$val == 0x7fffffff ? undef : $val',
8779             %Image::ExifTool::Exif::printParameter,
8780             },
8781             8 => { # -4 to 4
8782             Name => 'ColorTone',
8783             RawConv => '$val == 0x7fffffff ? undef : $val',
8784             %Image::ExifTool::Exif::printParameter,
8785             },
8786             9 => {
8787             Name => 'ColorSpace2',
8788             RawConv => '$val == 0x7fffffff ? undef : $val',
8789             PrintConv => {
8790             0 => 'BT.709',
8791             1 => 'BT.2020',
8792             2 => 'CinemaGamut',
8793             },
8794             },
8795             10 => {
8796             Name => 'ColorMatrix',
8797             RawConv => '$val == 0x7fffffff ? undef : $val',
8798             PrintConv => {
8799             0 => 'EOS Original',
8800             1 => 'Neutral',
8801             },
8802             },
8803             11 => {
8804             Name => 'CanonLogVersion', # (increases dynamic range of sensor data)
8805             RawConv => '$val == 0x7fffffff ? undef : $val',
8806             PrintConv => {
8807             0 => 'OFF',
8808             1 => 'CLogV1',
8809             2 => 'CLogV2', # (NC)
8810             3 => 'CLogV3',
8811             },
8812             },
8813             );
8814              
8815             # AF configuration info (MakerNotes tag 0x4028) (ref PH)
8816             %Image::ExifTool::Canon::AFConfig = (
8817             %binaryDataAttrs,
8818             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8819             FORMAT => 'int32s',
8820             FIRST_ENTRY => 1,
8821             1 => {
8822             Name => 'AFConfigTool',
8823             ValueConv => '$val + 1',
8824             ValueConvInv => '$val - 1',
8825             PrintConv => '"Case $val"',
8826             PrintConvInv => '$val=~/(\d+)/ ? $1 : undef',
8827             },
8828             2 => 'AFTrackingSensitivity',
8829             3 => {
8830             Name => 'AFAccelDecelTracking',
8831             Description => 'AF Accel/Decel Tracking',
8832             },
8833             4 => 'AFPointSwitching',
8834             5 => { #52
8835             Name => 'AIServoFirstImage',
8836             PrintConv => {
8837             0 => 'Equal Priority',
8838             1 => 'Release Priority',
8839             2 => 'Focus Priority',
8840             },
8841             },
8842             6 => { #52
8843             Name => 'AIServoSecondImage',
8844             PrintConv => {
8845             0 => 'Equal Priority',
8846             1 => 'Release Priority',
8847             2 => 'Focus Priority',
8848             3 => 'Release High Priority',
8849             4 => 'Focus High Priority',
8850             },
8851             },
8852             7 => { #52
8853             Name => 'USMLensElectronicMF',
8854             PrintConv => {
8855             0 => 'Enable After AF',
8856             1 => 'Disable After AF',
8857             2 => 'Disable in AF Mode',
8858             },
8859             },
8860             8 => { #52
8861             Name => 'AFAssistBeam',
8862             PrintConv => {
8863             0 => 'Enable',
8864             1 => 'Disable',
8865             2 => 'IR AF Assist Beam Only',
8866             },
8867             },
8868             9 => { #52
8869             Name => 'OneShotAFRelease',
8870             PrintConv => {
8871             0 => 'Focus Priority',
8872             1 => 'Release Priority',
8873             },
8874             },
8875             10 => { #52
8876             Name => 'AutoAFPointSelEOSiTRAF',
8877             Description => 'Auto AF Point Sel EOS iTR AF',
8878             # valid for: 1DX, 1DXmkII, 7DmkII, 5DS, 5DSR
8879             # not valid for: 5DmkIII
8880             Notes => 'only valid for some models',
8881             Condition => '$$self{Model} !~ /5D /',
8882             PrintConv => {
8883             0 => 'Enable',
8884             1 => 'Disable',
8885             },
8886             },
8887             11 => { #52
8888             Name => 'LensDriveWhenAFImpossible',
8889             PrintConv => {
8890             0 => 'Continue Focus Search',
8891             1 => 'Stop Focus Search',
8892             },
8893             },
8894             12 => { #52
8895             Name => 'SelectAFAreaSelectionMode',
8896             PrintConv => { BITMASK => {
8897             0 => 'Single-point AF',
8898             1 => 'Auto', # (61 point)
8899             2 => 'Zone AF',
8900             3 => 'AF Point Expansion (4 point)',
8901             4 => 'Spot AF',
8902             5 => 'AF Point Expansion (8 point)',
8903             }},
8904             },
8905             13 => { #52
8906             Name => 'AFAreaSelectionMethod',
8907             PrintConv => {
8908             0 => 'M-Fn Button',
8909             1 => 'Main Dial',
8910             },
8911             },
8912             14 => { #52
8913             Name => 'OrientationLinkedAF',
8914             PrintConv => { # Covers both 1Dx (0-2) and 5D3 (0-1)
8915             0 => 'Same for Vert/Horiz Points',
8916             1 => 'Separate Vert/Horiz Points',
8917             2 => 'Separate Area+Points',
8918             },
8919             },
8920             15 => { #52
8921             Name => 'ManualAFPointSelPattern',
8922             PrintConv => {
8923             0 => 'Stops at AF Area Edges',
8924             1 => 'Continuous',
8925             },
8926             },
8927             16 => { #52
8928             Name => 'AFPointDisplayDuringFocus',
8929             PrintConv => {
8930             0 => 'Selected (constant)',
8931             1 => 'All (constant)',
8932             2 => 'Selected (pre-AF, focused)',
8933             3 => 'Selected (focused)',
8934             4 => 'Disabled',
8935             },
8936             },
8937             17 => { #52
8938             Name => 'VFDisplayIllumination',
8939             PrintConv => {
8940             0 => 'Auto',
8941             1 => 'Enable',
8942             2 => 'Disable',
8943             },
8944             },
8945             18 => { #52
8946             Name => 'AFStatusViewfinder',
8947             Condition => '$$self{Model} =~ /1D X/',
8948             Notes => '1D X only',
8949             PrintConv => {
8950             0 => 'Show in Field of View',
8951             1 => 'Show Outside View',
8952             },
8953             },
8954             19 => { #52
8955             Name => 'InitialAFPointInServo',
8956             Condition => '$$self{Model} =~ /1D X/',
8957             Notes => '1D X only',
8958             PrintConv => {
8959             0 => 'Initial AF Point Selected',
8960             1 => 'Manual AF Point',
8961             2 => 'Auto', #PH (1DXmkII)
8962             },
8963             },
8964             );
8965              
8966             # RAW burst mode info (MakerNotes tag 0x403f) (ref 25)
8967             %Image::ExifTool::Canon::RawBurstInfo = (
8968             %binaryDataAttrs,
8969             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
8970             FORMAT => 'int32u',
8971             FIRST_ENTRY => 1,
8972             1 => 'RawBurstImageNum',
8973             2 => 'RawBurstImageCount',
8974             );
8975              
8976             # Canon UUID atoms (ref PH, SX280)
8977             %Image::ExifTool::Canon::uuid = (
8978             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
8979             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
8980             NOTES => q{
8981             Tags extracted from the uuid atom of MP4 videos from cameras such as the
8982             SX280, and CR3 images from cameras such as the EOS M50.
8983             },
8984             CNCV => {
8985             Name => 'CompressorVersion',
8986             # use this to recognize the specific type of Canon RAW (CR3 or CRM)
8987             RawConv => '$self->OverrideFileType($1) if $val =~ /^Canon(\w{3})/i; $val',
8988             },
8989             # CNDM - 4 bytes - 0xff,0xd8,0xff,0xd9
8990             CNTH => {
8991             Name => 'CanonCNTH',
8992             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNTH' },
8993             },
8994             CCTP => { # (CR3 files)
8995             Name => 'CanonCCTP',
8996             SubDirectory => {
8997             TagTable => 'Image::ExifTool::Canon::CCTP',
8998             Start => '12',
8999             },
9000             },
9001             # CTBO - (CR3 files) int32u entry count N, N x (int32u index, int64u offset, int64u size)
9002             # index: 1=XMP, 2=PRVW, 3=mdat, 4=?, 5=?
9003             # --> ignored when reading, but offsets are updated when writing
9004             CMT1 => { # (CR3 files)
9005             Name => 'IFD0',
9006             PreservePadding => 1,
9007             SubDirectory => {
9008             TagTable => 'Image::ExifTool::Exif::Main',
9009             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9010             WriteProc => \&Image::ExifTool::WriteTIFF,
9011             },
9012             },
9013             CMT2 => { # (CR3 files)
9014             Name => 'ExifIFD',
9015             PreservePadding => 1,
9016             SubDirectory => {
9017             TagTable => 'Image::ExifTool::Exif::Main',
9018             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9019             WriteProc => \&Image::ExifTool::WriteTIFF,
9020             },
9021             },
9022             CMT3 => { # (CR3 files)
9023             Name => 'MakerNoteCanon',
9024             PreservePadding => 1,
9025             SubDirectory => {
9026             TagTable => 'Image::ExifTool::Canon::Main',
9027             ProcessProc => \&ProcessCMT3,
9028             WriteProc => \&Image::ExifTool::WriteTIFF,
9029             },
9030             },
9031             CMT4 => { # (CR3 files)
9032             Name => 'GPSInfo',
9033             PreservePadding => 1,
9034             SubDirectory => {
9035             TagTable => 'Image::ExifTool::GPS::Main',
9036             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9037             WriteProc => \&Image::ExifTool::WriteTIFF,
9038             DirName => 'GPS',
9039             },
9040             },
9041             THMB => {
9042             Name => 'ThumbnailImage',
9043             Groups => { 2 => 'Preview' },
9044             PreservePadding => 1,
9045             RawConv => 'substr($val, 16)',
9046             Binary => 1,
9047             },
9048             CNOP => { #PH (M50)
9049             Name => 'CanonCNOP',
9050             SubDirectory => { TagTable => 'Image::ExifTool::Canon::CNOP' },
9051             },
9052             );
9053              
9054             # Canon top-level uuid atoms (ref PH, written by DPP4)
9055             %Image::ExifTool::Canon::uuid2 = (
9056             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9057             CNOP => {
9058             Name => 'CanonVRD',
9059             PreservePadding => 1,
9060             SubDirectory => {
9061             TagTable => 'Image::ExifTool::CanonVRD::Main',
9062             WriteProc => 'Image::ExifTool::CanonVRD::WriteCanonDR4',
9063             },
9064             },
9065             );
9066              
9067             %Image::ExifTool::Canon::UnknownIFD = (
9068             GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
9069             );
9070              
9071             # Canon CCTP atoms (ref PH, CR3 files)
9072             %Image::ExifTool::Canon::CCTP = (
9073             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9074             # CCDT - int32u[3]: 0. 0, 1. decoder type?, 2. 0, 3. index
9075             );
9076              
9077             # 'CMP1' atom information (ref 54, CR3 files)
9078             %Image::ExifTool::Canon::CMP1 = (
9079             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9080             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9081             FORMAT => 'int16u',
9082             FIRST_ENTRY => 0,
9083             PRIORITY => 0,
9084             8 => { Name => 'ImageWidth', Format => 'int32u' },
9085             10 => { Name => 'ImageHeight', Format => 'int32u' },
9086             # (the rest of the documented tags don't seem to produced good values with my samples - PH)
9087             );
9088              
9089             # 'CDI1' atom information (ref PH, CR3 files)
9090             %Image::ExifTool::Canon::CDI1 = (
9091             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9092             IAD1 => { Name => 'IAD1', SubDirectory => { TagTable => 'Image::ExifTool::Canon::IAD1' } },
9093             );
9094              
9095             # 'IAD1' atom information (ref 54, CR3 files)
9096             %Image::ExifTool::Canon::IAD1 = (
9097             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9098             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9099             FORMAT => 'int16u',
9100             FIRST_ENTRY => 0,
9101             );
9102              
9103             # Canon Timed MetaData (ref PH, CR3 files)
9104             %Image::ExifTool::Canon::CTMD = (
9105             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9106             PROCESS_PROC => \&ProcessCTMD,
9107             NOTES => q{
9108             Canon Timed MetaData tags found in CR3 images. The L option
9109             is automatically applied when reading CR3 files to be able to extract this
9110             information.
9111             },
9112             1 => {
9113             Name => 'TimeStamp',
9114             Groups => { 2 => 'Time' },
9115             RawConv => q{
9116             my $fmt = GetByteOrder() eq 'MM' ? 'x2nCCCCCC' : 'x2vCCCCCC';
9117             sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d.%.2d', unpack($fmt, $val));
9118             },
9119             PrintConv => '$self->ConvertDateTime($val)',
9120             },
9121             # 3 - 4 bytes, seen: ff ff ff ff
9122             4 => {
9123             Name => 'FocalInfo',
9124             SubDirectory => { TagTable => 'Image::ExifTool::Canon::FocalInfo' },
9125             },
9126             5 => {
9127             Name => 'ExposureInfo',
9128             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExposureInfo' },
9129             },
9130             7 => {
9131             Name => 'ExifInfo7',
9132             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9133             },
9134             8 => {
9135             Name => 'ExifInfo8',
9136             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9137             },
9138             9 => {
9139             Name => 'ExifInfo9',
9140             SubDirectory => { TagTable => 'Image::ExifTool::Canon::ExifInfo' },
9141             },
9142             # 10 - 60 bytes: all zeros with a pair of 0xff's at offset 0x02 (C200 CRM)
9143             # 11 - 612 bytes: all zero with pairs of 0xff's at offset 0x6e and 0x116 (C200 CRM)
9144             );
9145              
9146             # Canon Timed MetaData (ref PH, CR3 files)
9147             %Image::ExifTool::Canon::ExifInfo = (
9148             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9149             PROCESS_PROC => \&ProcessExifInfo,
9150             0x8769 => {
9151             Name => 'ExifIFD',
9152             SubDirectory => {
9153             TagTable => 'Image::ExifTool::Exif::Main',
9154             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9155             },
9156             },
9157             0x927c => {
9158             Name => 'MakerNoteCanon',
9159             SubDirectory => {
9160             TagTable => 'Image::ExifTool::Canon::Main',
9161             ProcessProc => \&Image::ExifTool::ProcessTIFF,
9162             },
9163             },
9164             );
9165              
9166             # timed focal length information (ref PH, CR3 files)
9167             %Image::ExifTool::Canon::FocalInfo = (
9168             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9169             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9170             FORMAT => 'int32u',
9171             FIRST_ENTRY => 0,
9172             0 => {
9173             Name => 'FocalLength',
9174             Format => 'rational32u',
9175             PrintConv => 'sprintf("%.1f mm",$val)',
9176             },
9177             );
9178              
9179             # timed exposure information (ref PH, CR3 files)
9180             %Image::ExifTool::Canon::ExposureInfo = (
9181             PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
9182             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Image' },
9183             FORMAT => 'int32u',
9184             FIRST_ENTRY => 0,
9185             0 => {
9186             Name => 'FNumber',
9187             Format => 'rational32u',
9188             PrintConv => 'Image::ExifTool::Exif::PrintFNumber($val)',
9189             },
9190             1 => {
9191             Name => 'ExposureTime',
9192             Format => 'rational32u',
9193             PrintConv => 'Image::ExifTool::Exif::PrintExposureTime($val)',
9194             },
9195             2 => {
9196             Name => 'ISO',
9197             Format => 'int32u',
9198             ValueConv => '$val & 0x7fffffff', # (not sure what high bit indicates)
9199             },
9200             );
9201              
9202             %Image::ExifTool::Canon::CNTH = (
9203             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9204             VARS => { ATOM_COUNT => 1 }, # only one contained atom
9205             WRITABLE => 1,
9206             WRITE_PROC => 'Image::ExifTool::QuickTime::WriteQuickTime',
9207             NOTES => q{
9208             Canon-specific QuickTime tags found in the CNTH atom of MOV/MP4 videos from
9209             some cameras.
9210             },
9211             CNDA => {
9212             Name => 'ThumbnailImage',
9213             Groups => { 2 => 'Preview' },
9214             Format => 'undef',
9215             Notes => 'the full THM image, embedded metadata is extracted as the first sub-document',
9216             SetBase => 1,
9217             RawConv => q{
9218             $$self{DOC_NUM} = ++$$self{DOC_COUNT};
9219             $self->ExtractInfo(\$val, { ReEntry => 1 });
9220             $$self{DOC_NUM} = 0;
9221             return \$val;
9222             },
9223             RawConvInv => '$val',
9224             },
9225             );
9226              
9227             # Canon CNOP atoms (ref PH)
9228             %Image::ExifTool::Canon::CNOP = (
9229             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9230             # CNFB - 52 bytes (7DmkII,M50,C200)
9231             # CNMI - 4 bytes: "0x20000001" (C200)
9232             # CNCM - 48 bytes: original file name in bytes 24-31 (C200)
9233             );
9234              
9235             # 'skip' atom of Canon MOV videos (ref PH)
9236             %Image::ExifTool::Canon::Skip = (
9237             GROUPS => { 0 => 'MakerNotes', 1 => 'Canon', 2 => 'Video' },
9238             NOTES => 'Information found in the "skip" atom of Canon MOV videos.',
9239             CNDB => { Name => 'Unknown_CNDB', Unknown => 1, Binary => 1 },
9240             );
9241              
9242             # Canon composite tags
9243             %Image::ExifTool::Canon::Composite = (
9244             GROUPS => { 2 => 'Camera' },
9245             DriveMode => {
9246             Require => {
9247             0 => 'ContinuousDrive',
9248             1 => 'SelfTimer',
9249             },
9250             ValueConv => '$val[0] ? 0 : ($val[1] ? 1 : 2)',
9251             PrintConv => {
9252             0 => 'Continuous Shooting',
9253             1 => 'Self-timer Operation',
9254             2 => 'Single-frame Shooting',
9255             },
9256             },
9257             Lens => {
9258             Require => {
9259             0 => 'Canon:MinFocalLength',
9260             1 => 'Canon:MaxFocalLength',
9261             },
9262             ValueConv => '$val[0]',
9263             PrintConv => 'Image::ExifTool::Canon::PrintFocalRange(@val)',
9264             },
9265             Lens35efl => {
9266             Description => 'Lens',
9267             Require => {
9268             0 => 'Canon:MinFocalLength',
9269             1 => 'Canon:MaxFocalLength',
9270             3 => 'Lens',
9271             },
9272             Desire => {
9273             2 => 'ScaleFactor35efl',
9274             },
9275             ValueConv => '$val[3] * ($val[2] ? $val[2] : 1)',
9276             PrintConv => '$prt[3] . ($val[2] ? sprintf(" (35 mm equivalent: %s)",Image::ExifTool::Canon::PrintFocalRange(@val)) : "")',
9277             },
9278             ShootingMode => {
9279             Require => {
9280             0 => 'CanonExposureMode',
9281             1 => 'EasyMode',
9282             },
9283             Desire => {
9284             2 => 'BulbDuration',
9285             },
9286             # most Canon models set CanonExposureMode to Manual (4) for Bulb shots,
9287             # but the 1DmkIII uses a value of 7 for Bulb, so use this for other
9288             # models too (Note that Canon DPP reports "Manual Exposure" here)
9289             ValueConv => '$val[0] ? (($val[0] eq "4" and $val[2]) ? 7 : $val[0]) : $val[1] + 10',
9290             PrintConv => '$val eq "7" ? "Bulb" : ($val[0] ? $prt[0] : $prt[1])',
9291             },
9292             FlashType => {
9293             Notes => q{
9294             may report "Built-in Flash" for some Canon cameras with external flash in
9295             manual mode
9296             },
9297             Require => {
9298             0 => 'FlashBits',
9299             },
9300             RawConv => '$val[0] ? $val : undef',
9301             ValueConv => '$val[0]&(1<<14)? 1 : 0',
9302             PrintConv => {
9303             0 => 'Built-In Flash',
9304             1 => 'External',
9305             },
9306             },
9307             RedEyeReduction => {
9308             Require => {
9309             0 => 'CanonFlashMode',
9310             1 => 'FlashBits',
9311             },
9312             RawConv => '$val[1] ? $val : undef',
9313             ValueConv => '($val[0]==3 or $val[0]==4 or $val[0]==6) ? 1 : 0',
9314             PrintConv => {
9315             0 => 'Off',
9316             1 => 'On',
9317             },
9318             },
9319             # same as FlashExposureComp, but undefined if no flash
9320             ConditionalFEC => {
9321             Description => 'Flash Exposure Compensation',
9322             Require => {
9323             0 => 'FlashExposureComp',
9324             1 => 'FlashBits',
9325             },
9326             RawConv => '$val[1] ? $val : undef',
9327             ValueConv => '$val[0]',
9328             PrintConv => '$prt[0]',
9329             },
9330             # hack to assume 1st curtain unless we see otherwise
9331             ShutterCurtainHack => {
9332             Description => 'Shutter Curtain Sync',
9333             Desire => {
9334             0 => 'ShutterCurtainSync',
9335             },
9336             Require => {
9337             1 => 'FlashBits',
9338             },
9339             RawConv => '$val[1] ? $val : undef',
9340             ValueConv => 'defined($val[0]) ? $val[0] : 0',
9341             PrintConv => {
9342             0 => '1st-curtain sync',
9343             1 => '2nd-curtain sync',
9344             },
9345             },
9346             WB_RGGBLevels => {
9347             Require => {
9348             0 => 'Canon:WhiteBalance',
9349             },
9350             Desire => {
9351             1 => 'WB_RGGBLevelsAsShot',
9352             # indices of the following entries correspond to Canon:WhiteBalance + 2
9353             2 => 'WB_RGGBLevelsAuto',
9354             3 => 'WB_RGGBLevelsDaylight',
9355             4 => 'WB_RGGBLevelsCloudy',
9356             5 => 'WB_RGGBLevelsTungsten',
9357             6 => 'WB_RGGBLevelsFluorescent',
9358             7 => 'WB_RGGBLevelsFlash',
9359             8 => 'WB_RGGBLevelsCustom',
9360             10 => 'WB_RGGBLevelsShade',
9361             11 => 'WB_RGGBLevelsKelvin',
9362             },
9363             ValueConv => '$val[1] ? $val[1] : $val[($val[0] || 0) + 2]',
9364             },
9365             ISO => {
9366             Priority => 0, # let EXIF:ISO take priority
9367             Desire => {
9368             0 => 'Canon:CameraISO',
9369             1 => 'Canon:BaseISO',
9370             2 => 'Canon:AutoISO',
9371             },
9372             Notes => 'use CameraISO if numerical, otherwise calculate as BaseISO * AutoISO / 100',
9373             ValueConv => q{
9374             return $val[0] if $val[0] and $val[0] =~ /^\d+$/;
9375             return undef unless $val[1] and $val[2];
9376             return $val[1] * $val[2] / 100;
9377             },
9378             PrintConv => 'sprintf("%.0f",$val)',
9379             },
9380             DigitalZoom => {
9381             Require => {
9382             0 => 'Canon:ZoomSourceWidth',
9383             1 => 'Canon:ZoomTargetWidth',
9384             2 => 'Canon:DigitalZoom',
9385             },
9386             RawConv => q{
9387             ToFloat(@val);
9388             return undef unless $val[2] and $val[2] == 3 and $val[0] and $val[1];
9389             return $val[1] / $val[0];
9390             },
9391             PrintConv => 'sprintf("%.2fx",$val)',
9392             },
9393             OriginalDecisionData => {
9394             Flags => ['Writable','Protected'],
9395             WriteGroup => 'MakerNotes',
9396             Require => 'OriginalDecisionDataOffset',
9397             RawConv => 'Image::ExifTool::Canon::ReadODD($self,$val[0])',
9398             },
9399             FileNumber => {
9400             Groups => { 2 => 'Image' },
9401             Writable => 1,
9402             WriteCheck => '$val=~/\d+-\d+/ ? undef : "Invalid format"',
9403             DelCheck => '"Can\'t delete"',
9404             Require => {
9405             0 => 'DirectoryIndex',
9406             1 => 'FileIndex',
9407             },
9408             WriteAlso => {
9409             DirectoryIndex => '$val=~/(\d+)-(\d+)/; $1',
9410             FileIndex => '$val=~/(\d+)-(\d+)/; $2',
9411             },
9412             ValueConv => q{
9413             # fix the funny things that these numbers do when they wrap over 9999
9414             # (it seems that FileIndex and DirectoryIndex actually store the
9415             # numbers from the previous image, so we need special logic
9416             # to handle the FileIndex wrap properly)
9417             $val[1] == 10000 and $val[1] = 1, ++$val[0];
9418             return sprintf("%.3d%.4d",@val);
9419             },
9420             PrintConv => '$_=$val;s/(\d+)(\d{4})/$1-$2/;$_',
9421             },
9422             );
9423              
9424             # add our composite tags
9425             Image::ExifTool::AddCompositeTags('Image::ExifTool::Canon');
9426              
9427             #------------------------------------------------------------------------------
9428             # Return lens name with teleconverter if applicable
9429             # Inputs: 0) lens name string, 1) short focal length
9430             # Returns: lens string with tc if appropriate
9431             sub LensWithTC($$)
9432             {
9433 5     5 0 17 my ($lens, $shortFocal) = @_;
9434              
9435             # add teleconverter multiplication factor if applicable
9436             # (and if the LensType doesn't already include one)
9437 5 50 33     58 if (not $lens =~ /x$/ and $lens =~ /(\d+)/) {
9438 5         19 my $sf = $1; # short focal length
9439 5         12 my $tc;
9440 5         15 foreach $tc (1, 1.4, 2, 2.8) {
9441 5 50       34 next if abs($shortFocal - $sf * $tc) > 0.9;
9442 5 50       32 $lens .= " + ${tc}x" if $tc > 1;
9443 5         17 last;
9444             }
9445             }
9446 5         146 return $lens;
9447             }
9448              
9449             #------------------------------------------------------------------------------
9450             # Attempt to calculate sensor size for Canon cameras
9451             # Inputs: 0/1) rational values for FocalPlaneX/YResolution
9452             # Returns: Sensor diagonal size in mm, or undef
9453             # Notes: This algorithm is fairly reliable, but has been found to give incorrect
9454             # values for some firmware versions of the EOS 20D, A310, SD40 and IXUS 65
9455             # (ref http://wyw.dcweb.cn/download.asp?path=&file=jhead-2.96-ccdwidth_hack.zip)
9456             sub CalcSensorDiag($$)
9457             {
9458 55     55 0 226 my ($xres, $yres) = @_;
9459             # most Canon cameras store the sensor size in the denominator
9460 55 100 66     304 if ($xres and $yres) {
9461             # assumptions: 1) numerators are image width/height * 1000
9462             # 2) denominators are sensor width/height in inches * 1000
9463 43         271 my @xres = split /[ \/]/, $xres;
9464 43         197 my @yres = split /[ \/]/, $yres;
9465             # verify assumptions as best we can:
9466             # numerators are always divisible by 1000
9467 43 50 66     978 if ($xres[0] % 1000 == 0 and $yres[0] % 1000 == 0 and
      66        
      66        
      66        
      66        
      33        
      33        
      33        
      33        
      33        
9468             # at least 640x480 pixels (DC models - PH)
9469             $xres[0] >= 640000 and $yres[0] >= 480000 and
9470             # ... but not too big!
9471             $xres[0] < 10000000 and $yres[0] < 10000000 and
9472             # minimum sensor size is 0.061 inches (DC models - PH)
9473             $xres[1] >= 61 and $xres[1] < 1500 and
9474             $yres[1] >= 61 and $yres[1] < 1000 and
9475             # sensor isn't square (may happen if rationals have been reduced)
9476             $xres[1] != $yres[1])
9477             {
9478 27         187 return sqrt($xres[1]*$xres[1] + $yres[1]*$yres[1]) * 0.0254;
9479             }
9480             }
9481 28         91 return undef;
9482             }
9483              
9484             #------------------------------------------------------------------------------
9485             # Attempt to identify the specific lens if multiple lenses have the same LensType
9486             # Inputs: 0) PrintConv hash ref, 1) LensType, 2) MinFocalLength, 3) MaxFocalLength
9487             # 4) MaxAperture, 5) LensModel
9488             # Notes: PrintConv, LensType, MinFocalLength and MaxFocalLength must be defined.
9489             # Other inputs are optional.
9490             sub PrintLensID(@)
9491             {
9492 28     28 0 115 my ($printConv, $lensType, $shortFocal, $longFocal, $maxAperture, $lensModel) = @_;
9493 28         63 my $lens;
9494 28 100 66     243 $lens = $$printConv{$lensType} unless $lensType eq '-1' or $lensType eq '65535';
9495 28 100 33     173 if ($lens) {
    50          
9496             # return this lens unless other lenses have the same LensType
9497 6 100       45 return LensWithTC($lens, $shortFocal) unless $$printConv{"$lensType.1"};
9498 1         4 $lens =~ s/ or .*//s; # remove everything after "or"
9499             # make list of all possible matching lenses
9500 1         3 my @lenses = ( $lens );
9501 1         3 my $i;
9502 1         19 for ($i=1; $$printConv{"$lensType.$i"}; ++$i) {
9503 3         14 push @lenses, $$printConv{"$lensType.$i"};
9504             }
9505 1         4 my ($tc, @user, @maybe, @likely, @matches);
9506             # look for lens in user-defined lenses
9507 1         3 foreach $lens (@lenses) {
9508 4 50       11 push @user, $lens if $Image::ExifTool::userLens{$lens};
9509             }
9510             # attempt to determine actual lens
9511 1         4 foreach $tc (1, 1.4, 2, 2.8) { # loop through teleconverter scaling factors
9512 1         3 foreach $lens (@lenses) {
9513 4 100       27 next unless $lens =~ /(\d+)(?:-(\d+))?mm.*?(?:[fF]\/?)(\d+(?:\.\d+)?)(?:-(\d+(?:\.\d+)?))?/;
9514             # ($1=short focal, $2=long focal, $3=max aperture wide, $4=max aperture tele)
9515 3         46 my ($sf, $lf, $sa, $la) = ($1, $2, $3, $4);
9516             # see if we can rule out this lens by focal length or aperture
9517 3 50 33     16 $lf = $sf if $sf and not $lf;
9518 3 100 66     13 $la = $sa if $sa and not $la;
9519             # account for converter-specific LensType's (ie. end with " + #.#x")
9520 3 50       11 if ($lens =~ / \+ (\d+(\.\d+)?)x$/) {
9521 0         0 $sf *= $1; $lf *= $1;
  0         0  
9522 0         0 $sa *= $1; $la *= $1;
  0         0  
9523             }
9524 3 100       21 next if abs($shortFocal - $sf * $tc) > 0.9;
9525 1         4 my $tclens = $lens;
9526 1 50       4 $tclens .= " + ${tc}x" if $tc > 1;
9527 1         4 push @maybe, $tclens;
9528 1 50       4 next if abs($longFocal - $lf * $tc) > 0.9;
9529 1         3 push @likely, $tclens;
9530 1 50       10 if ($maxAperture) {
9531             # (not 100% sure that TC affects MaxAperture, but it should!)
9532             # (RF 24-105mm F4L IS USM shows a MaxAperture of 4.177)
9533 0 0       0 next if $maxAperture < $sa * $tc - 0.18;
9534 0 0       0 next if $maxAperture > $la * $tc + 0.18;
9535             }
9536 1         4 push @matches, $tclens;
9537             }
9538 1 50       5 last if @maybe;
9539             }
9540 1 50       4 if (@user) {
9541             # choose the best match if we have more than one
9542 0 0       0 if (@user > 1) {
9543 0         0 my ($try, @good);
9544 0         0 foreach $try (\@matches, \@likely, \@maybe) {
9545 0         0 foreach (@$try) {
9546 0 0       0 $Image::ExifTool::userLens{$_} and push(@good, $_), next;
9547             # check for match with TC string removed
9548 0 0       0 next unless /^(.*) \+ \d+(\.\d+)?x$/;
9549 0 0       0 $Image::ExifTool::userLens{$1} and push(@good, $_);
9550             }
9551 0 0       0 return join(' or ', @good) if @good;
9552             }
9553             }
9554             # default to returning the first user-defined lens
9555 0         0 return LensWithTC($user[0], $shortFocal);
9556             }
9557             # differentiate Sigma Art/Contemporary/Sports models
9558 1 0 33     6 if (@matches > 1 and $lensModel and $lensModel =~ /(\| [ACS])/) {
      33        
9559 0         0 my $type = $1;
9560 0         0 my @best;
9561 0         0 foreach $lens (@matches) {
9562 0 0       0 push @best, $lens if $lens =~ /\Q$type/;
9563             }
9564 0 0       0 @matches = @best if @best;
9565             }
9566 1 50       4 @matches = @likely unless @matches;
9567 1 50       14 @matches = @maybe unless @matches;
9568 1         9 Image::ExifTool::Exif::MatchLensModel(\@matches, $lensModel);
9569 1 50       33 return join(' or ', @matches) if @matches;
9570             } elsif ($lensModel and $lensModel =~ /\d/) {
9571             # use lens model as written by the camera
9572 0 0       0 if ($printConv eq \%canonLensTypes) {
9573             # add "Canon" to the start since the Canon cameras only understand Canon lenses
9574 0         0 return "Canon $lensModel";
9575             } else {
9576 0         0 return $lensModel;
9577             }
9578             }
9579 22         67 my $str = '';
9580 22 50       90 if ($shortFocal) {
9581 22         120 $str .= sprintf(' %d', $shortFocal);
9582 22 50 33     173 $str .= sprintf('-%d', $longFocal) if $longFocal and $longFocal != $shortFocal;
9583 22         64 $str .= 'mm';
9584             }
9585             # (careful because Sigma LensType's may not be integer, so use string comparison)
9586 22 50 33     666 return "Unknown$str" if $lensType eq '-1' or $lensType eq '65535';
9587 0         0 return "Unknown ($lensType)$str";
9588             }
9589              
9590             #------------------------------------------------------------------------------
9591             # Swap 16-bit words in 32-bit integers
9592             # Inputs: 0) string of integers
9593             # Returns: string of word-swapped integers
9594             sub SwapWords($)
9595             {
9596 7     7 0 23 my @a = split(' ', shift);
9597 7         28 $_ = (($_ >> 16) | ($_ << 16)) & 0xffffffff foreach @a;
9598 7         31 return "@a";
9599             }
9600              
9601             #------------------------------------------------------------------------------
9602             # Validate first word of Canon binary data
9603             # Inputs: 0) data pointer, 1) offset, 2-N) list of valid values
9604             # Returns: true if data value is the same
9605             sub Validate($$@)
9606             {
9607 349     349 0 1149 my ($dataPt, $offset, @vals) = @_;
9608             # the first 16-bit value is the length of the data in bytes
9609 349         1085 my $dataVal = Image::ExifTool::Get16u($dataPt, $offset);
9610 349         728 my $val;
9611 349         844 foreach $val (@vals) {
9612 349 50       3969 return 1 if $val == $dataVal;
9613             }
9614 0         0 return undef;
9615             }
9616              
9617             #------------------------------------------------------------------------------
9618             # Validate CanonAFInfo
9619             # Inputs: 0) data pointer, 1) offset, 2) size
9620             # Returns: true if data appears valid
9621             sub ValidateAFInfo($$$)
9622             {
9623 41     41 0 182 my ($dataPt, $offset, $size) = @_;
9624 41 50       198 return 0 if $size < 24; # must be at least 24 bytes long (PowerShot Pro1)
9625 41         197 my $af = Get16u($dataPt, $offset);
9626 41 50       401 return 0 if $af !~ /^(1|5|7|9|15|45|53)$/; # check NumAFPoints
9627 41         159 my $w1 = Get16u($dataPt, $offset + 4);
9628 41         210 my $h1 = Get16u($dataPt, $offset + 6);
9629 41 50 33     302 return 0 unless $h1 and $w1;
9630 41         133 my $f1 = $w1 / $h1;
9631             # check for normal aspect ratio
9632 41 50 33     308 return 1 if abs($f1 - 1.33) < 0.01 or abs($f1 - 1.67) < 0.01;
9633             # ZoomBrowser can modify this for rotated images (ref Joshua Bixby)
9634 41 50 33     302 return 1 if abs($f1 - 0.75) < 0.01 or abs($f1 - 0.60) < 0.01;
9635 41         143 my $w2 = Get16u($dataPt, $offset + 8);
9636 41         163 my $h2 = Get16u($dataPt, $offset + 10);
9637 41 50 33     284 return 0 unless $h2 and $w2;
9638             # compare aspect ratio with AF image size
9639             # (but the Powershot AFImageHeight is odd, hence the test above)
9640 41 50       167 return 0 if $w1 eq $h1;
9641 41         117 my $f2 = $w2 / $h2;
9642 41 50       592 return 1 if abs(1-$f1/$f2) < 0.01;
9643 0 0       0 return 1 if abs(1-$f1*$f2) < 0.01;
9644 0         0 return 0;
9645             }
9646              
9647             #------------------------------------------------------------------------------
9648             # Read original decision data from file (variable length)
9649             # Inputs: 0) ExifTool object ref, 1) offset in file
9650             # Returns: reference to original decision data (or undef if no data)
9651             sub ReadODD($$)
9652             {
9653 12     12 0 55 my ($et, $offset) = @_;
9654 12 100       118 return undef unless $offset;
9655 4         12 my ($raf, $buff, $buf2, $i, $warn);
9656 4 50       21 return undef unless defined($raf = $$et{RAF});
9657             # the data block is a variable length and starts with 0xffffffff
9658             # followed a 4-byte (int32u) version number
9659 4         19 my $pos = $raf->Tell();
9660 4 50 33     19 if ($raf->Seek($offset, 0) and $raf->Read($buff, 8)==8 and $buff=~/^\xff{4}.\0\0/s) {
      33        
9661 4         14 my $err = 1;
9662             # must set byte order in case it is different than current byte order
9663             # (we could be reading this after byte order was changed)
9664 4         19 my $oldOrder = GetByteOrder();
9665 4         17 my $version = Get32u(\$buff, 4);
9666 4 100       26 if ($version > 20) {
9667 1         5 ToggleByteOrder();
9668 1         7 $version = unpack('N',pack('V',$version));
9669             }
9670 4 50 33     124 if ($version == 1 or # 1Ds (big endian)
    50          
9671             $version == 2) # 5D/20D (little endian)
9672             {
9673             # this data is structured as follows:
9674             # 4 bytes: all 0xff
9675             # 4 bytes: version number (=1 or 2)
9676             # 20 bytes: sha1
9677             # 4 bytes: record count
9678             # for each record:
9679             # | 4 bytes: record number (beginning at 0)
9680             # | 4 bytes: block offset
9681             # | 4 bytes: block length
9682             # | 20 bytes: block sha1
9683 0 0       0 if ($raf->Read($buf2, 24) == 24) {
9684 0         0 $buff .= $buf2;
9685 0         0 my $count = Get32u(\$buf2, 20);
9686             # read all records if the count is reasonable
9687 0 0 0     0 if ($count and $count < 20 and
      0        
9688             $raf->Read($buf2, $count * 32) == $count * 32)
9689             {
9690 0         0 $buff .= $buf2;
9691 0         0 undef $err;
9692             }
9693             }
9694             } elsif ($version == 3) { # newer models (little endian)
9695             # this data is structured as follows:
9696             # 4 bytes: all 0xff
9697             # 4 bytes: version number (=3)
9698             # 24 bytes: sha1 A length (=20) + sha1 A
9699             # 24 bytes: sha1 B length (=20) + sha1 B
9700             # 4 bytes: length of remaining data (including this length word!)
9701             # 8 bytes: salt length (=4) + salt ?
9702             # 4 bytes: unknown (=3)
9703             # 4 bytes: size of file
9704             # 4 bytes: unknown (=1 for most models, 2 for 5DmkII)
9705             # 4 bytes: unknown (=1)
9706             # 4 bytes: unknown (always the same for a given firmware version)
9707             # 4 bytes: unknown (random)
9708             # 4 bytes: record count
9709             # for each record:
9710             # | 4 bytes: record number (beginning at 1)
9711             # | 8 bytes: salt length (=4) + salt ?
9712             # | 24 bytes: sha1 length (=20) + sha1
9713             # | 4 bytes: block count
9714             # | for each block:
9715             # | | 4 bytes: block offset
9716             # | | 4 bytes: block length
9717             # followed by zero padding to end of ODD data (~72 bytes)
9718 4         14 for ($i=0; ; ++$i) {
9719 16 100       41 $i == 3 and undef $err, last; # success!
9720 12 50       35 $raf->Read($buf2, 4) == 4 or last;
9721 12         29 $buff .= $buf2;
9722 12         31 my $len = Get32u(\$buf2, 0);
9723             # (the data length includes the length word itself - doh!)
9724 12 100 66     54 $len -= 4 if $i == 2 and $len >= 4;
9725             # make sure records are a reasonable size (<= 64kB)
9726 12 50 33     47 $len <= 0x10000 and $raf->Read($buf2, $len) == $len or last;
9727 12         31 $buff .= $buf2;
9728             }
9729             } else {
9730 0         0 $warn = "Unsupported original decision data version $version";
9731             }
9732 4         34 SetByteOrder($oldOrder);
9733 4 50       16 unless ($err) {
9734 4 50       20 if ($et->Options('HtmlDump')) {
9735 0         0 $et->HDump($offset, length $buff, '[OriginalDecisionData]', undef);
9736             }
9737 4         44 $raf->Seek($pos, 0); # restore original file position
9738 4         44 return \$buff;
9739             }
9740             }
9741 0   0     0 $et->Warn($warn || 'Invalid original decision data');
9742 0         0 $raf->Seek($pos, 0); # restore original file position
9743 0         0 return undef;
9744             }
9745              
9746             #------------------------------------------------------------------------------
9747             # Convert the CameraISO value
9748             # Inputs: 0) value, 1) set for inverse conversion
9749             sub CameraISO($;$)
9750             {
9751 44     44 0 200 my ($val, $inv) = @_;
9752 44         94 my $rtnVal;
9753 44         461 my %isoLookup = (
9754             0 => 'n/a',
9755             14 => 'Auto High', #PH (S3IS)
9756             15 => 'Auto',
9757             16 => 50,
9758             17 => 100,
9759             18 => 200,
9760             19 => 400,
9761             20 => 800, #PH
9762             );
9763 44 100       216 if ($inv) {
    50          
9764 5         27 $rtnVal = Image::ExifTool::ReverseLookup($val, \%isoLookup);
9765 5 50 66     44 if (not defined $rtnVal and Image::ExifTool::IsInt($val)) {
9766 0         0 $rtnVal = ($val & 0x3fff) | 0x4000;
9767             }
9768             } elsif ($val != 0x7fff) {
9769 39 50       121 if ($val & 0x4000) {
9770 0         0 $rtnVal = $val & 0x3fff;
9771             } else {
9772 39   33     174 $rtnVal = $isoLookup{$val} || "Unknown ($val)";
9773             }
9774             }
9775 44         413 return $rtnVal;
9776             }
9777              
9778             #------------------------------------------------------------------------------
9779             # Print range of focal lengths
9780             # Inputs: 0) short focal, 1) long focal, 2) optional scaling factor
9781             sub PrintFocalRange(@)
9782             {
9783 64     64 0 248 my ($short, $long, $scale) = @_;
9784              
9785 64 100       210 $scale or $scale = 1;
9786 64 50       230 if ($short == $long) {
9787 0         0 return sprintf("%.1f mm", $short * $scale);
9788             } else {
9789 64         1095 return sprintf("%.1f - %.1f mm", $short * $scale, $long * $scale);
9790             }
9791             }
9792              
9793             #------------------------------------------------------------------------------
9794             # Process a serial stream of binary data
9795             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
9796             # Returns: 1 on success
9797             # Notes: The tagID's for serial stream tags are consecutive indices beginning
9798             # at 0, and the corresponding values must be contiguous in memory.
9799             # "Unknown" tags must be used to skip padding or unknown values.
9800             # (does not yet extract Rational values)
9801             sub ProcessSerialData($$$)
9802             {
9803 63     63 0 241 my ($et, $dirInfo, $tagTablePtr) = @_;
9804 63         203 my $dataPt = $$dirInfo{DataPt};
9805 63         144 my $offset = $$dirInfo{DirStart};
9806 63         152 my $size = $$dirInfo{DirLen};
9807 63   100     662 my $base = $$dirInfo{Base} || 0;
9808 63         244 my $verbose = $et->Options('Verbose');
9809 63   100     426 my $dataPos = $$dirInfo{DataPos} || 0;
9810              
9811             # temporarily set Unknown option so GetTagInfo() will return existing unknown tags
9812             # (require to maintain serial data synchronization)
9813 63         261 my $unknown = $et->Options(Unknown => 1);
9814             # but disable unknown tag generation (because processing ends when we run out of tags)
9815 63         204 $$et{NO_UNKNOWN} = 1;
9816              
9817 63 100       214 $verbose and $et->VerboseDir('SerialData', undef, $size);
9818              
9819             # get default format ('int8u' unless specified)
9820 63   50     285 my $defaultFormat = $$tagTablePtr{FORMAT} || 'int8u';
9821              
9822 63         150 my ($index, %val);
9823 63         148 my $pos = 0;
9824 63   66     536 for ($index=0; $$tagTablePtr{$index} and $pos <= $size; ++$index) {
9825 812 100       2247 my $tagInfo = $et->GetTagInfo($tagTablePtr, $index) or last;
9826 753         1737 my $format = $$tagInfo{Format};
9827 753         1173 my $count = 1;
9828 753 100       1420 if ($format) {
9829 248 100       1451 if ($format =~ /(.*)\[(.*)\]/) {
    50          
9830 223         664 $format = $1;
9831 223         474 $count = $2;
9832             # evaluate count to allow count to be based on previous values
9833             #### eval Format (%val, $size)
9834 223         13732 $count = eval $count;
9835 223 50       1482 $@ and warn("Format $$tagInfo{Name}: $@"), last;
9836             } elsif ($format eq 'string') {
9837             # allow string with no specified count to run to end of block
9838 0 0       0 $count = ($size > $pos) ? $size - $pos : 0;
9839             }
9840             } else {
9841 505         897 $format = $defaultFormat;
9842             }
9843 753   50     1983 my $len = (Image::ExifTool::FormatSize($format) || 1) * $count;
9844 753 50       1743 last if $pos + $len > $size;
9845 753         1943 my $val = ReadValue($dataPt, $pos+$offset, $format, $count, $size-$pos);
9846 753 50       1795 last unless defined $val;
9847 753 100       1902 if ($verbose) {
9848 22         109 $et->VerboseInfo($index, $tagInfo,
9849             Index => $index,
9850             Table => $tagTablePtr,
9851             Value => $val,
9852             DataPt => $dataPt,
9853             Size => $len,
9854             Start => $pos+$offset,
9855             Addr => $pos+$offset+$base+$dataPos,
9856             Format => $format,
9857             Count => $count,
9858             );
9859             }
9860 753         1769 $val{$index} = $val;
9861 753 100 100     2732 if ($$tagInfo{SubDirectory}) {
    100          
9862 1         9 my $subTablePtr = GetTagTable($$tagInfo{SubDirectory}{TagTable});
9863 1         14 my %dirInfo = (
9864             DataPt => \$val,
9865             DataPos => $dataPos + $pos,
9866             DirStart => 0,
9867             DirLen => length($val),
9868             );
9869 1         7 $et->ProcessDirectory(\%dirInfo, $subTablePtr);
9870             } elsif (not $$tagInfo{Unknown} or $unknown) {
9871             # don't extract zero-length information
9872 707 100       2359 $et->FoundTag($tagInfo, $val) if $count;
9873             }
9874 753         4880 $pos += $len;
9875             }
9876 63         403 $et->Options(Unknown => $unknown); # restore Unknown option
9877 63         198 delete $$et{NO_UNKNOWN};
9878 63         376 return 1;
9879             }
9880              
9881             #------------------------------------------------------------------------------
9882             # Print 1D AF points
9883             # Inputs: 0) value to convert
9884             # Focus point pattern:
9885             # A1 A2 A3 A4 A5 A6 A7
9886             # B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
9887             # C1 C2 C3 C4 C5 C6 C7 C9 C9 C10 C11
9888             # D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
9889             # E1 E2 E3 E4 E5 E6 E7
9890             sub PrintAFPoints1D($)
9891             {
9892 0     0 0 0 my $val = shift;
9893 0 0       0 return 'Unknown' unless length $val == 8;
9894             # list of focus point values for decoding the first byte of the 8-byte record.
9895             # they are the x/y positions of each bit in the AF point mask
9896             # (y is upper 3 bits / x is lower 5 bits)
9897 0         0 my @focusPts = (0,0,
9898             0x04,0x06,0x08,0x0a,0x0c,0x0e,0x10, 0,0,
9899             0x21,0x23,0x25,0x27,0x29,0x2b,0x2d,0x2f,0x31,0x33,
9900             0x40,0x42,0x44,0x46,0x48,0x4a,0x4c,0x4d,0x50,0x52,0x54,
9901             0x61,0x63,0x65,0x67,0x69,0x6b,0x6d,0x6f,0x71,0x73, 0,0,
9902             0x84,0x86,0x88,0x8a,0x8c,0x8e,0x90, 0,0,0,0,0
9903             );
9904 0         0 my $focus = unpack('C',$val);
9905 0         0 my @bits = split //, unpack('b*',substr($val,1));
9906 0         0 my @rows = split //, ' AAAAAAA BBBBBBBBBBCCCCCCCCCCCDDDDDDDDDD EEEEEEE ';
9907 0         0 my ($focusing, $focusPt, @points);
9908 0         0 my $lastRow = '';
9909 0         0 my $col = 0;
9910 0         0 foreach $focusPt (@focusPts) {
9911 0         0 my $row = shift @rows;
9912 0 0       0 $col = ($row eq $lastRow) ? $col + 1 : 1;
9913 0         0 $lastRow = $row;
9914 0 0       0 $focusing = "$row$col" if $focus eq $focusPt;
9915 0 0       0 push @points, "$row$col" if shift @bits;
9916             }
9917 0 0       0 $focusing or $focusing = ($focus == 0xff) ? 'Auto' : sprintf('Unknown (0x%.2x)',$focus);
    0          
9918 0         0 return "$focusing (" . join(',',@points) . ')';
9919             }
9920              
9921             #------------------------------------------------------------------------------
9922             # Convert Canon hex-based EV (modulo 0x20) to real number
9923             # Inputs: 0) value to convert
9924             # eg) 0x00 -> 0
9925             # 0x0c -> 0.33333
9926             # 0x10 -> 0.5
9927             # 0x14 -> 0.66666
9928             # 0x20 -> 1 ... etc
9929             sub CanonEv($)
9930             {
9931 324     324 0 828 my $val = shift;
9932 324         542 my $sign;
9933             # temporarily make the number positive
9934 324 100       795 if ($val < 0) {
9935 25         81 $val = -$val;
9936 25         57 $sign = -1;
9937             } else {
9938 299         565 $sign = 1;
9939             }
9940 324         591 my $frac = $val & 0x1f;
9941 324         555 $val -= $frac; # remove fraction
9942             # Convert 1/3 and 2/3 codes
9943 324 100       1051 if ($frac == 0x0c) {
    100          
9944 5         10 $frac = 0x20 / 3;
9945             } elsif ($frac == 0x14) {
9946 76         157 $frac = 0x40 / 3;
9947             }
9948 324         3048 return $sign * ($val + $frac) / 0x20;
9949             }
9950              
9951             #------------------------------------------------------------------------------
9952             # Convert number to Canon hex-based EV (modulo 0x20)
9953             # Inputs: 0) number
9954             # Returns: Canon EV code
9955             sub CanonEvInv($)
9956             {
9957 433     433 0 1098 my $num = shift;
9958 433         720 my $sign;
9959             # temporarily make the number positive
9960 433 100       1165 if ($num < 0) {
9961 81         163 $num = -$num;
9962 81         169 $sign = -1;
9963             } else {
9964 352         697 $sign = 1;
9965             }
9966 433         875 my $val = int($num);
9967 433         888 my $frac = $num - $val;
9968 433 100       1417 if (abs($frac - 0.33) < 0.05) {
    100          
9969 2         6 $frac = 0x0c
9970             } elsif (abs($frac - 0.67) < 0.05) {
9971 57         111 $frac = 0x14;
9972             } else {
9973 374         827 $frac = int($frac * 0x20 + 0.5);
9974             }
9975 433         3598 return $sign * ($val * 0x20 + $frac);
9976             }
9977              
9978             #------------------------------------------------------------------------------
9979             # Read CMT3 maker notes from CR3 file
9980             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
9981             # Returns: data block (may be empty if no Exif data) or undef on error
9982             sub ProcessCMT3($$$)
9983             {
9984 4     4 0 16 my ($et, $dirInfo, $tagTablePtr) = @_;
9985              
9986             # extract the static maker notes to copying to other file types if requested
9987             # Note: this won't copy makernotes in the timed metadata since these are stored
9988             # separately, but the only records they have that aren't in the static maker notes
9989             # (for the M50) are: ColorData9, Flavor, CanonCameraInfoUnknown,
9990             # VignettingCorrUnknown1, Canon_0x4033 and Canon_0x402e
9991 4 50 33     24 if (($et->Options('MakerNotes') or $$et{REQ_TAG_LOOKUP}{makernotecanon}) and
      33        
9992             $$dirInfo{DirLen} > 8)
9993             {
9994 0         0 my $dataPt = $$dirInfo{DataPt};
9995             # remove old (unused) trailer
9996 0         0 $$dataPt =~ s/(II\x2a\0|MM\0\x2a)\0{4,10}$//;
9997             # remove TIFF header and append as the Canon makernote trailer
9998             # (so offsets will be interpreted correctly)
9999 0         0 my $val = substr($$dataPt,8) . substr($$dataPt,0,8);
10000 0         0 $et->FoundTag($Image::ExifTool::Canon::uuid{CMT3}, \$val);
10001             }
10002 4         22 return $et->ProcessTIFF($dirInfo, $tagTablePtr);
10003             }
10004              
10005             #------------------------------------------------------------------------------
10006             # Process CTMD EXIF information
10007             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10008             # Returns: 1 on success
10009             sub ProcessExifInfo($$$)
10010             {
10011 12     12 0 49 my ($et, $dirInfo, $tagTablePtr) = @_;
10012 12         31 my $dataPt = $$dirInfo{DataPt};
10013 12   50     45 my $start = $$dirInfo{DirStart} || 0;
10014 12   33     46 my $dirLen = $$dirInfo{DirLen} || (length($$dataPt) - $start);
10015 12         23 my $dirEnd = $start + $dirLen;
10016             # loop through TIFF-format EXIF/MakerNote records
10017 12         26 my ($pos, $len, $tag);
10018 12         54 for ($pos = $start; $pos + 8 < $dirEnd; $pos += $len) {
10019 16         52 $len = Get32u($dataPt, $pos);
10020 16         72 $tag = Get32u($dataPt, $pos + 4);
10021             # test size/tag for valid ExifInfo (not EXIF in CRM files)
10022 16 50 33     150 last if $len < 8 or $pos + $len > $dirEnd or not $$tagTablePtr{$tag};
      33        
10023 16 100       86 $et->VerboseDir('ExifInfo', undef, $dirLen) if $pos == $start;
10024             $et->HandleTag($tagTablePtr, $tag, undef,
10025             DataPt => $dataPt,
10026 16         128 Base => $$dirInfo{Base} + $pos + 8, # base for TIFF pointers
10027             DataPos => -($pos + 8), # (relative to Base)
10028             Start => $pos + 8,
10029             Size => $len - 8,
10030             );
10031             }
10032 12         42 return 1;
10033             }
10034              
10035             #------------------------------------------------------------------------------
10036             # Process Canon Timed MetaData (ref PH)
10037             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10038             # Returns: 1 on success
10039             sub ProcessCTMD($$$)
10040             {
10041 4     4 0 14 my ($et, $dirInfo, $tagTablePtr) = @_;
10042 4         14 my $dataPt = $$dirInfo{DataPt};
10043 4         18 my $verbose = $et->Options('Verbose');
10044 4         11 my $dirLen = length $$dataPt;
10045 4         12 my $pos = 0;
10046 4         17 SetByteOrder('II');
10047 4         27 while ($pos + 6 < $dirLen) {
10048 28         82 my $size = Get32u($dataPt, $pos);
10049 28         85 my $type = Get16u($dataPt, $pos + 4);
10050             # what is the meaning of the 6-byte header of these records?:
10051             # type 1 - 00 00 00 01 zz zz - TimeStamp(CR3/CRM); zz=00(CR3),ff(CRM)
10052             # type 3 - 00 00 00 01 zz zz - ? "ff ff ff ff"; zz=00(CR3),ff(CRM)
10053             # type 4 - 00 00 00 01 ff ff - FocalInfo(CR3/CRM)
10054             # type 5 - 00 00 00 01 ff ff - ExposureInfo(CR3/CRM)
10055             # type 6 - 00 04 00 01 ff ff - ? "03 04 00 80 e0 15 ff ff"(CRM) [0x15e0 = ColorTemperature?]
10056             # type 7 - xx yy 00 01 ff ff - ExifIFD + MakerNotes(CR3), ?(CRM); xxyy=0101(CR3),0004(CRM)
10057             # type 8 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),04(CRM)
10058             # type 9 - 01 yy 00 01 ff ff - MakerNotes(CR3), ?(CRM); yy=01(CR3),00(CRM)
10059             # type 10- 01 00 00 01 ff ff - ? (CRM)
10060             # type 11- 01 00 00 01 ff ff - ? (CRM)
10061             # --> maybe yy == 01 for ExifInfo?
10062 28 50       83 $size < 12 and $et->Warn('Short CTMD record'), last;
10063 28 50       87 $pos + $size > $dirLen and $et->Warn('Truncated CTMD record'), last;
10064 28         166 $et->VerboseDir("CTMD type $type", undef, $size - 6);
10065             HexDump($dataPt, 6, # dump 6-byte header
10066             Start => $pos + 6,
10067             Addr => $$dirInfo{Base} + $pos + 6,
10068             Prefix => $$et{INDENT},
10069 28 50       79 ) if $verbose > 2;
10070 28 100       104 if ($$tagTablePtr{$type}) {
    50          
10071             $et->HandleTag($tagTablePtr, $type, undef,
10072             DataPt => $dataPt,
10073             Base => $$dirInfo{Base},
10074 24         120 Start => $pos + 12,
10075             Size => $size - 12,
10076             );
10077             } elsif ($verbose) {
10078 0         0 $et->VerboseDump($dataPt, Len=>$size-12, Start=>$pos+12, DataPos=>$$dirInfo{Base});
10079             }
10080 28         118 $pos += $size;
10081             }
10082 4 50       26 $et->Warn('Error parsing Canon CTMD data', 1) if $pos != $dirLen;
10083 4         20 return 1;
10084             }
10085              
10086             #------------------------------------------------------------------------------
10087             # Process a creative filter data
10088             # Inputs: 0) ExifTool object ref, 1) dirInfo ref, 2) tag table ref
10089             # Returns: 1 on success
10090             sub ProcessFilters($$$)
10091             {
10092 4     4 0 18 my ($et, $dirInfo, $tagTablePtr) = @_;
10093 4         13 my $dataPt = $$dirInfo{DataPt};
10094 4         13 my $pos = $$dirInfo{DirStart};
10095 4         17 my $dirLen = $$dirInfo{DirLen};
10096 4   50     29 my $dataPos = $$dirInfo{DataPos} || 0;
10097 4         12 my $end = $pos + $dirLen;
10098 4         18 my $verbose = $et->Options('Verbose');
10099              
10100 4 50       32 return 0 if $dirLen < 8;
10101 4         18 my $numFilters = Get32u($dataPt, $pos + 4);
10102 4 50       24 $verbose and $et->VerboseDir('Creative Filter', $numFilters);
10103 4         18 $pos += 8;
10104 4         14 my ($i, $j, $err);
10105 4         21 for ($i=0; $i<$numFilters; ++$i) {
10106             # read filter structure:
10107             # 4 bytes - filter number
10108             # 4 bytes - filter data length
10109             # 4 bytes - number of parameters:
10110             # | 4 bytes - parameter ID
10111             # | 4 bytes - parameter value count
10112             # | 4 bytes * count - parameter values (NC)
10113 28 50       71 $pos + 12 > $end and $err = "Truncated data for filter $i", last;
10114 28         71 my $fnum = Get32u($dataPt, $pos); # (is this an index or an ID?)
10115 28         72 my $size = Get32u($dataPt, $pos + 4);
10116 28         76 my $nparm = Get32u($dataPt, $pos + 8);
10117 28         66 my $nxt = $pos + 4 + $size;
10118 28 50       67 $nxt > $end and $err = "Invalid size ($size) for filter $i", last;
10119 28 50       68 $verbose and $et->VerboseDir("Filter $fnum", $nparm, $size);
10120 28         46 $pos += 12;
10121 28         82 for ($j=0; $j<$nparm; ++$j) {
10122 40 50       89 $pos + 12 > $end and $err = "Truncated data for filter $i param $j", last;
10123 40         92 my $tag = Get32u($dataPt, $pos);
10124 40         96 my $count = Get32u($dataPt, $pos + 4);
10125 40         75 $pos += 8;
10126 40 50       93 $pos + 4 * $count > $end and $err = "Truncated value for filter $i param $j", last;
10127 40         108 my $val = ReadValue($dataPt, $pos, 'int32s', $count, 4 * $count);
10128 40         150 $et->HandleTag($tagTablePtr, $tag, $val,
10129             DataPt => $dataPt,
10130             DataPos => $dataPos,
10131             Start => $pos,
10132             Size => 4 * $count,
10133             );
10134 40         139 $pos += 4 * $count;
10135             }
10136 28         72 $pos = $nxt; # step to next filter
10137             }
10138 4 50       19 $err and $et->Warn($err, 1);
10139 4         19 return 1;
10140             }
10141              
10142             #------------------------------------------------------------------------------
10143             # Write Canon maker notes
10144             # Inputs: 0) ExifTool object reference, 1) dirInfo ref, 2) tag table ref
10145             # Returns: data block (may be empty if no Exif data) or undef on error
10146             sub WriteCanon($$$)
10147             {
10148 151     151 0 460 my ($et, $dirInfo, $tagTablePtr) = @_;
10149 151 100       750 $et or return 1; # allow dummy access to autoload this package
10150 23         439 my $dirData = Image::ExifTool::Exif::WriteExif($et, $dirInfo, $tagTablePtr);
10151             # add footer which is written by some Canon models (format of a TIFF header)
10152 23 100 33     287 if (defined $dirData and length $dirData and $$dirInfo{Fixup}) {
      66        
10153 20         86 $dirData .= GetByteOrder() . Set16u(42) . Set32u(0);
10154 20         150 $$dirInfo{Fixup}->AddFixup(length($dirData) - 4);
10155             }
10156 23         258 return $dirData;
10157             }
10158              
10159             #------------------------------------------------------------------------------
10160             1; # end
10161              
10162             __END__